mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Use Composer autoload to handle dependency class loading
This commit is contained in:
@ -1,9 +1,14 @@
|
||||
<?php
|
||||
|
||||
// Set to false to disable debug mode
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
|
||||
require(__DIR__ . '/../../framework/yii.php');
|
||||
$frameworkPath = __DIR__ . '/../../framework/';
|
||||
require($frameworkPath . 'yii.php');
|
||||
|
||||
$config = require(__DIR__ . '/protected/config/main.php');
|
||||
$application = new yii\web\Application($config);
|
||||
|
||||
// Register Composer autoloader
|
||||
@include $frameworkPath . '/vendor/autoload.php';
|
||||
|
||||
$application->run();
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
namespace yii\helpers\base;
|
||||
|
||||
\Yii::setAlias('@Michelf', \Yii::getAlias('@yii/vendor/michelf/php-markdown/Michelf'));
|
||||
use Michelf\MarkdownExtra;
|
||||
|
||||
/**
|
||||
|
@ -6,10 +6,6 @@
|
||||
*/
|
||||
namespace yii\helpers\base;
|
||||
|
||||
if (!class_exists('HTMLPurifier_Bootstrap', false)) {
|
||||
require_once(\Yii::getAlias('@yii/vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Purifier provides an ability to clean up HTML from any harmful code.
|
||||
*
|
||||
|
@ -23,11 +23,6 @@ use yii\helpers\Html;
|
||||
*/
|
||||
class SmartyViewRenderer extends ViewRenderer
|
||||
{
|
||||
/**
|
||||
* @var string the directory or path alias pointing to where Smarty code is located.
|
||||
*/
|
||||
public $smartyPath = '@yii/vendor/smarty/smarty/distribution/libs';
|
||||
|
||||
/**
|
||||
* @var string the directory or path alias pointing to where Smarty cache will be stored.
|
||||
*/
|
||||
@ -45,7 +40,6 @@ class SmartyViewRenderer extends ViewRenderer
|
||||
|
||||
public function init()
|
||||
{
|
||||
require_once(Yii::getAlias($this->smartyPath) . '/Smarty.class.php');
|
||||
$this->smarty = new Smarty();
|
||||
$this->smarty->setCompileDir(Yii::getAlias($this->compilePath));
|
||||
$this->smarty->setCacheDir(Yii::getAlias($this->cachePath));
|
||||
|
@ -22,11 +22,6 @@ use yii\helpers\Html;
|
||||
*/
|
||||
class TwigViewRenderer extends ViewRenderer
|
||||
{
|
||||
/**
|
||||
* @var string the directory or path alias pointing to where Twig code is located.
|
||||
*/
|
||||
public $twigPath = '@yii/vendor/twig/twig/lib/Twig';
|
||||
|
||||
/**
|
||||
* @var string the directory or path alias pointing to where Twig cache will be stored.
|
||||
*/
|
||||
@ -45,10 +40,6 @@ class TwigViewRenderer extends ViewRenderer
|
||||
|
||||
public function init()
|
||||
{
|
||||
if (!isset(Yii::$aliases['@Twig'])) {
|
||||
Yii::setAlias('@Twig', $this->twigPath);
|
||||
}
|
||||
|
||||
$loader = new \Twig_Loader_String();
|
||||
|
||||
$this->twig = new \Twig_Environment($loader, array_merge(array(
|
||||
|
Reference in New Issue
Block a user