/**
  * load a config file, optionally load just selected sections
  *
  * @api  Smarty::configLoad()
  * @link http://www.smarty.net/docs/en/api.config.load.tpl
  *
  * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
  * @param  string                                                 $config_file filename
  * @param  mixed                                                  $sections    array of section names, single
  *                                                                             section or null
  * @param int                                                     $scope       scope into which config variables
  *                                                                             shall be loaded
  *
  * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
  * @throws \SmartyException
  */
 public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
 {
     /* @var \Smarty $smarty */
     $smarty = $data->_getSmartyObj();
     /* @var \Smarty_Internal_Template $confObj */
     $confObj = new Smarty_Internal_Template($config_file, $smarty, $data, null, null, null, null, true);
     $confObj->caching = Smarty::CACHING_OFF;
     $confObj->source->config_sections = $sections;
     $confObj->source->scope = $scope;
     $confObj->compiled = Smarty_Template_Compiled::load($confObj);
     $confObj->compiled->render($confObj);
     if ($data->_isTplObj()) {
         $data->compiled->file_dependency[$confObj->source->uid] = array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
     }
 }
 /**
  * load a config file, optionally load just selected sections
  *
  * @api  Smarty::configLoad()
  * @link http://www.smarty.net/docs/en/api.config.load.tpl
  *
  * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
  * @param  string                                                 $config_file filename
  * @param  mixed                                                  $sections    array of section names, single
  *                                                                             section or null
  * @param string                                                  $scope       scope into which config variables
  *                                                                             shall be loaded
  *
  * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
  * @throws \SmartyException
  */
 public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 'local')
 {
     /* @var \Smarty $smarty */
     $smarty = isset($data->smarty) ? $data->smarty : $data;
     /* @var \Smarty_Internal_Template $confObj */
     $confObj = new $smarty->template_class($config_file, $smarty, $data);
     $confObj->caching = Smarty::CACHING_OFF;
     $confObj->source = Smarty_Template_Config::load($confObj);
     $confObj->source->config_sections = $sections;
     $confObj->source->scope = $scope;
     $confObj->compiled = Smarty_Template_Compiled::load($confObj);
     $confObj->compiled->render($confObj);
     if ($data->_objType == 2) {
         $data->compiled->file_dependency[$confObj->source->uid] = array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
     }
     return $data;
 }
 /**
  * @param        $obj
  * @param        $config_file
  * @param null   $sections
  * @param string $scope
  */
 static function configLoad($obj, $config_file, $sections = null, $scope = 'local')
 {
     $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
     $confObj = new $smarty->template_class($config_file, $smarty, $obj);
     $confObj->caching = Smarty::CACHING_OFF;
     $confObj->source = Smarty_Template_Config::load($confObj);
     $confObj->source->config_sections = $sections;
     $confObj->source->scope = $scope;
     $confObj->compiled = Smarty_Template_Compiled::load($confObj);
     if ($confObj->smarty->debugging) {
         Smarty_Internal_Debug::start_render($confObj);
     }
     $confObj->compiled->render($confObj);
     if ($confObj->smarty->debugging) {
         Smarty_Internal_Debug::end_render($confObj);
     }
     if ($obj instanceof Smarty_Internal_Template) {
         $obj->properties['file_dependency'][$confObj->source->uid] = array($confObj->source->filepath, $confObj->source->timestamp, $confObj->source->type);
     }
 }
 /**
  * @param                         $obj
  * @param                         $config_file
  * @param null                    $sections
  * @param string                  $scope
  *
  * @throws \SmartyException
  */
 static function configLoad($obj, $config_file, $sections = null, $scope = 'local')
 {
     $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
     $confObj = new $smarty->template_class($config_file, $smarty, $obj);
     $confObj->context = new Smarty_Internal_Context();
     $confObj->caching = Smarty::CACHING_OFF;
     $confObj->source = Smarty_Template_Config::load($confObj);
     $confObj->source->config_sections = $sections;
     $confObj->source->scope = $scope;
     $confObj->compiled = Smarty_Template_Compiled::load($confObj);
     if ($confObj->smarty->debugging) {
         Smarty_Internal_Debug::start_render($confObj);
     }
     $confObj->compiled->render($confObj);
     $confObj->context = null;
     if ($confObj->smarty->debugging) {
         Smarty_Internal_Debug::end_render($confObj);
     }
     if ($obj instanceof Smarty_Internal_Template && isset($obj->context)) {
         $obj->context->resourceInfo[$confObj->source->uid] = array($confObj->source->filepath, $confObj->source->timestamp, $confObj->source->type);
     } else {
         // TODO   config file dependency if loaded in Smarty, Data or Template object
     }
 }
예제 #5
0
 /**
  * Load compiled object
  *
  */
 public function loadCompiled()
 {
     if (!isset($this->compiled)) {
         if (!class_exists('Smarty_Template_Compiled', false)) {
             require SMARTY_SYSPLUGINS_DIR . 'smarty_template_compiled.php';
         }
         $this->compiled = Smarty_Template_Compiled::load($this);
     }
 }
 /**
  * Load compiled object
  *
  */
 public function loadCompiled()
 {
     if (!isset($this->compiled)) {
         $this->compiled = Smarty_Template_Compiled::load($this);
     }
 }
 /**
  * get Smarty property in template context
  *
  * @param string $property_name property name
  *
  * @return mixed
  * @throws SmartyException
  */
 public function __get($property_name)
 {
     switch ($property_name) {
         case 'source':
             $this->loadSource();
             return $this->source;
         case 'compiled':
             $this->compiled = Smarty_Template_Compiled::load($this);
             return $this->compiled;
         case 'cached':
             $this->cached = Smarty_Template_Cached::load($this);
             return $this->cached;
         case 'compiler':
             $this->smarty->loadPlugin($this->source->compiler_class);
             $this->compiler = new $this->source->compiler_class($this->source->template_lexer_class, $this->source->template_parser_class, $this->smarty);
             return $this->compiler;
             // FIXME: routing of template -> smarty attributes
         // FIXME: routing of template -> smarty attributes
         default:
             if (property_exists($this->smarty, $property_name)) {
                 return $this->smarty->{$property_name};
             }
             throw new SmartyException("template property '{$property_name}' does not exist.");
     }
 }
예제 #8
0
 /**
  * Load compiled object
  *
  * @param bool $force force new compiled object
  */
 public function loadCompiled($force = false)
 {
     if ($force || !isset($this->compiled)) {
         $this->compiled = Smarty_Template_Compiled::load($this);
     }
 }