Exemplo n.º 1
0
 /**
  * Initializes the application component.
  */
 public function init()
 {
     $helpers = ['app' => \Yii::$app, 'format' => new helpers\Format(), 'html' => new helpers\HTML(), 'i18n' => new helpers\I18N(), 'url' => new helpers\URL(), 'yii' => ['debug' => YII_DEBUG, 'devEnv' => YII_ENV_DEV, 'prodEnv' => YII_ENV_PROD, 'testEnv' => YII_ENV_TEST]];
     $options = ['cache' => new Cache(['viewRenderer' => $this]), 'charset' => \Yii::$app->charset, 'entity_flags' => ENT_QUOTES | ENT_SUBSTITUTE, 'escape' => [Html::class, 'encode'], 'helpers' => ArrayHelper::merge($helpers, $this->helpers), 'partials_loader' => new Loader(['viewRenderer' => $this]), 'strict_callables' => true];
     if ($this->enableLogging()) {
         $options['logger'] = new Logger();
     }
     $this->engine = new \Mustache_Engine($options);
     parent::init();
     $this->helpers = [];
 }
Exemplo n.º 2
0
 /**
  * Init a haml parser instance
  */
 public function init()
 {
     parent::init();
     $this->parser = new Jade\Renderer(['cachePath' => Yii::getAlias($this->cachePath), 'lifeTime' => $this->options['lifeTime'], 'pretty' => $this->options['pretty']]);
 }
Exemplo n.º 3
0
 /**
  * Initializes the object.
  * This method is invoked at the end of the constructor after the object is initialized with the
  * given configuration.
  * @throws InvalidConfigException if cacheComponent is incorrect.
  */
 public function init()
 {
     parent::init();
     $this->initCacheComponent();
 }