Ejemplo n.º 1
0
 /**
  * Constructor.
  */
 function __construct($params = null)
 {
     $this->path = $params['path'];
     $this->name = $params['name'];
     // Init smarty.
     if (!self::$smarty) {
         // Extend smarty package.
         if (!defined('SMARTY_DIR')) {
             define('SMARTY_DIR', APP_ROOT . 'core/library/smarty/libs/');
             require APP_ROOT . 'core/library/smarty/libs/Smarty.class.php';
         }
         self::$smarty = new Smarty();
         self::$smarty->setCacheDir(APP_ROOT . 'core/cache/');
         self::$smarty->setCompileDir(APP_ROOT . 'core/cache/');
         self::$smarty->setConfigDir(APP_ROOT . 'core/library/smarty/config/');
         self::$smarty->force_compile = Request::$config->smarty['force_compile'] ? true : false;
         self::$smarty->caching = Request::$config->smarty['caching'] ? true : false;
     }
     // Init helpers.
     foreach ((array) Request::$available_helpers as $helper) {
         if (class_exists($helper)) {
             $class = new $helper();
             self::$smarty->registerObject($helper, $class);
         }
         // If we loaded a function helper...
         if (function_exists($helper)) {
             self::$smarty->registerPlugin('function', $helper, $helper);
             self::$smarty->registerPlugin('modifier', $helper, $helper);
         }
         // Register compiler functions.
         self::register_compilers();
     }
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     if (self::$smarty) {
         return;
     }
     $smarty = new Smarty();
     $runtimePath = './Application/Runtime';
     $compilePath = $runtimePath . '/Compile/' . MODULE . '/' . CONTROLLER . '/';
     is_dir($compilePath) || mkdir($compilePath, 0777, true);
     $cachePath = $runtimePath . '/Cache/' . MODULE . '/' . CONTROLLER . '/';
     is_dir($cachePath) || mkdir($cachePath, 0777, true);
     $smarty->template_dir = './Application/' . MODULE . '/View/' . CONTROLLER;
     $smarty->compile_dir = $compilePath;
     $smarty->cache_dir = $cachePath;
     $smarty->left_delimiter = C('LEFT_DELIMITER');
     $smarty->right_delimiter = C('RIGHT_DELIMITER');
     $smarty->caching = C('CACHING');
     $smarty->cache_lifetime = C('CACHE_LIFETIME');
     self::$smarty = $smarty;
 }
Ejemplo n.º 3
0
 public static function init($s)
 {
     if (is_object($s)) {
         self::$smarty = $s;
     }
 }