Ejemplo n.º 1
0
 /**
  * @return Smarty
  */
 private function _getSmarty()
 {
     if (!isset(self::$_smarty)) {
         self::$_smarty = new Smarty();
         self::$_smarty->setTemplateDir(DIR_ROOT);
         self::$_smarty->setCompileDir(CM_Bootloader::getInstance()->getDirTmp() . 'smarty/');
         self::$_smarty->_file_perms = 0666;
         self::$_smarty->_dir_perms = 0777;
         self::$_smarty->compile_check = CM_Bootloader::getInstance()->isDebug();
         self::$_smarty->caching = false;
         self::$_smarty->error_reporting = error_reporting();
     }
     $pluginDirs = array(SMARTY_PLUGINS_DIR);
     foreach ($this->getSite()->getModules() as $moduleName) {
         $pluginDirs[] = CM_Util::getModulePath($moduleName) . 'library/' . $moduleName . '/SmartyPlugins';
     }
     self::$_smarty->setPluginsDir($pluginDirs);
     self::$_smarty->loadFilter('pre', 'translate');
     return self::$_smarty;
 }