Exemplo n.º 1
0
 /**
  * Create handle
  * @param array params
  */
 public static function factory($parms = 'smarty')
 {
     $smarty = false;
     // $test = loader::$root_path . loader::DIR_MODULES . 'core/tplparser/smarty/Smarty.class.php';
     $test = loader::get_root() . loader::DIR_EXT . 'smarty/Smarty.class.php';
     if (fs::file_exists($test)) {
         require $test;
         $smarty = new Smarty();
         $smarty->compile_check = true;
         $smarty->force_compile = false;
         // true;
         $template = core::get_instance()->get_cfg_var('template');
         $smarty->caching = false;
         //TRUE;
         //$smarty->cache_lifetime = 3600;
         $smarty->debugging = core::get_instance()->get_cfg_var('debug_templates');
     } else {
         $smarty = new tplparser_mock();
         core::dprint('[tplparser] using mock');
     }
     self::$parser = $smarty;
     self::set_template($template);
     return $smarty;
 }
Exemplo n.º 2
0
 /**
  * Create handle
  * @param array params
  *   engine: null, smarty, smarty3
  */
 public static function factory($parms, $standalone = false)
 {
     if (empty($parms)) {
         $params = array();
     }
     if (!isset($parms['engine'])) {
         $parms['engine'] = 'smarty';
     }
     $init_action = '_init_' . $parms['engine'];
     if (!is_callable(array('tpl_loader', $init_action))) {
         throw new lib_exception('tpl_loader no initializer for : ' . $init_action);
     }
     $parser = call_user_func(array('tpl_loader', $init_action), $parms);
     if (!$standalone) {
         self::$parser = $parser;
     }
     return $parser;
 }