KONTOLODON
/
var
/
www
/
ojs-3.3.0-13
/
lib
/
pkp
/
lib
/
vendor
/
smarty
/
smarty
/
libs
/
sysplugins
/
Nama File / Folder
Size
Action
smarty_cacheresource_custom.php
9.68KB
Hapus
Edit
Rename
smarty_cacheresource_keyvaluestore.php
17.237KB
Hapus
Edit
Rename
smarty_data.php
1.656KB
Hapus
Edit
Rename
smarty_internal_cacheresource_file.php
8.01KB
Hapus
Edit
Rename
smarty_internal_compile_append.php
1.749KB
Hapus
Edit
Rename
smarty_internal_compile_assign.php
3.336KB
Hapus
Edit
Rename
smarty_internal_compile_block.php
7.516KB
Hapus
Edit
Rename
smarty_internal_compile_block_child.php
0.474KB
Hapus
Edit
Rename
smarty_internal_compile_block_parent.php
0.569KB
Hapus
Edit
Rename
smarty_internal_compile_break.php
3.764KB
Hapus
Edit
Rename
smarty_internal_compile_call.php
2.803KB
Hapus
Edit
Rename
smarty_internal_compile_capture.php
3.548KB
Hapus
Edit
Rename
smarty_internal_compile_child.php
2.41KB
Hapus
Edit
Rename
smarty_internal_compile_config_load.php
2.665KB
Hapus
Edit
Rename
smarty_internal_compile_continue.php
0.427KB
Hapus
Edit
Rename
smarty_internal_compile_debug.php
1.058KB
Hapus
Edit
Rename
smarty_internal_compile_eval.php
1.847KB
Hapus
Edit
Rename
smarty_internal_compile_extends.php
5.276KB
Hapus
Edit
Rename
smarty_internal_compile_for.php
6.549KB
Hapus
Edit
Rename
smarty_internal_compile_foreach.php
11.453KB
Hapus
Edit
Rename
smarty_internal_compile_function.php
9.7KB
Hapus
Edit
Rename
smarty_internal_compile_if.php
8.107KB
Hapus
Edit
Rename
smarty_internal_compile_include.php
14.666KB
Hapus
Edit
Rename
smarty_internal_compile_include_php.php
3.481KB
Hapus
Edit
Rename
smarty_internal_compile_insert.php
5.883KB
Hapus
Edit
Rename
smarty_internal_compile_ldelim.php
1.028KB
Hapus
Edit
Rename
smarty_internal_compile_make_nocache.php
1.627KB
Hapus
Edit
Rename
smarty_internal_compile_nocache.php
2.088KB
Hapus
Edit
Rename
smarty_internal_compile_parent.php
0.552KB
Hapus
Edit
Rename
smarty_internal_compile_private_block_plugin.php
4.965KB
Hapus
Edit
Rename
smarty_internal_compile_private_foreachsection.php
6.911KB
Hapus
Edit
Rename
smarty_internal_compile_private_function_plugin.php
2.468KB
Hapus
Edit
Rename
smarty_internal_compile_private_modifier.php
7.855KB
Hapus
Edit
Rename
smarty_internal_compile_private_object_block_function.php
1.324KB
Hapus
Edit
Rename
smarty_internal_compile_private_object_function.php
3.125KB
Hapus
Edit
Rename
smarty_internal_compile_private_php.php
9.604KB
Hapus
Edit
Rename
smarty_internal_compile_private_print_expression.php
6.526KB
Hapus
Edit
Rename
smarty_internal_compile_private_registered_block.php
2.911KB
Hapus
Edit
Rename
smarty_internal_compile_private_registered_function.php
3.357KB
Hapus
Edit
Rename
smarty_internal_compile_private_special_variable.php
5.689KB
Hapus
Edit
Rename
smarty_internal_compile_rdelim.php
0.881KB
Hapus
Edit
Rename
smarty_internal_compile_section.php
17.966KB
Hapus
Edit
Rename
smarty_internal_compile_setfilter.php
2.131KB
Hapus
Edit
Rename
smarty_internal_compile_shared_inheritance.php
1.755KB
Hapus
Edit
Rename
smarty_internal_compile_while.php
3.732KB
Hapus
Edit
Rename
smarty_internal_compilebase.php
6.932KB
Hapus
Edit
Rename
smarty_internal_config_file_compiler.php
6.395KB
Hapus
Edit
Rename
smarty_internal_configfilelexer.php
24.264KB
Hapus
Edit
Rename
smarty_internal_configfileparser.php
33.828KB
Hapus
Edit
Rename
smarty_internal_errorhandler.php
4.233KB
Hapus
Edit
Rename
smarty_internal_extension_handler.php
8.018KB
Hapus
Edit
Rename
smarty_internal_method_addautoloadfilters.php
2.17KB
Hapus
Edit
Rename
smarty_internal_method_adddefaultmodifiers.php
1.137KB
Hapus
Edit
Rename
smarty_internal_method_append.php
2.8KB
Hapus
Edit
Rename
smarty_internal_method_appendbyref.php
1.759KB
Hapus
Edit
Rename
smarty_internal_method_assignbyref.php
1.246KB
Hapus
Edit
Rename
smarty_internal_method_assignglobal.php
1.375KB
Hapus
Edit
Rename
smarty_internal_method_clearallassign.php
0.76KB
Hapus
Edit
Rename
smarty_internal_method_clearallcache.php
0.971KB
Hapus
Edit
Rename
smarty_internal_method_clearassign.php
1.048KB
Hapus
Edit
Rename
smarty_internal_method_clearcache.php
1.255KB
Hapus
Edit
Rename
smarty_internal_method_clearcompiledtemplate.php
5.523KB
Hapus
Edit
Rename
smarty_internal_method_clearconfig.php
0.954KB
Hapus
Edit
Rename
smarty_internal_method_compileallconfig.php
0.941KB
Hapus
Edit
Rename
smarty_internal_method_compilealltemplates.php
4.537KB
Hapus
Edit
Rename
smarty_internal_method_configload.php
7.126KB
Hapus
Edit
Rename
smarty_internal_method_createdata.php
1.299KB
Hapus
Edit
Rename
smarty_internal_method_getautoloadfilters.php
1.321KB
Hapus
Edit
Rename
smarty_internal_method_getconfigvariable.php
0.897KB
Hapus
Edit
Rename
smarty_internal_method_getconfigvars.php
1.595KB
Hapus
Edit
Rename
smarty_internal_method_getdebugtemplate.php
0.692KB
Hapus
Edit
Rename
smarty_internal_method_getdefaultmodifiers.php
0.728KB
Hapus
Edit
Rename
smarty_internal_method_getglobal.php
1.086KB
Hapus
Edit
Rename
smarty_internal_method_getregisteredobject.php
1.313KB
Hapus
Edit
Rename
smarty_internal_method_getstreamvariable.php
1.239KB
Hapus
Edit
Rename
smarty_internal_method_gettags.php
2.023KB
Hapus
Edit
Rename
smarty_internal_method_gettemplatevars.php
3.927KB
Hapus
Edit
Rename
smarty_internal_method_literals.php
2.978KB
Hapus
Edit
Rename
smarty_internal_method_loadfilter.php
2.121KB
Hapus
Edit
Rename
smarty_internal_method_loadplugin.php
4.146KB
Hapus
Edit
Rename
smarty_internal_method_mustcompile.php
1.728KB
Hapus
Edit
Rename
smarty_internal_method_registercacheresource.php
1.15KB
Hapus
Edit
Rename
smarty_internal_method_registerclass.php
1.394KB
Hapus
Edit
Rename
smarty_internal_method_registerdefaultconfighandler.php
1.147KB
Hapus
Edit
Rename
smarty_internal_method_registerdefaultpluginhandler.php
1.244KB
Hapus
Edit
Rename
smarty_internal_method_registerdefaulttemplatehandler.php
2.944KB
Hapus
Edit
Rename
smarty_internal_method_registerfilter.php
2.438KB
Hapus
Edit
Rename
smarty_internal_method_registerobject.php
3.98KB
Hapus
Edit
Rename
smarty_internal_method_registerplugin.php
2.166KB
Hapus
Edit
Rename
smarty_internal_method_registerresource.php
1.818KB
Hapus
Edit
Rename
smarty_internal_method_setautoloadfilters.php
2.225KB
Hapus
Edit
Rename
smarty_internal_method_setdebugtemplate.php
0.999KB
Hapus
Edit
Rename
smarty_internal_method_setdefaultmodifiers.php
0.984KB
Hapus
Edit
Rename
smarty_internal_method_unloadfilter.php
1.406KB
Hapus
Edit
Rename
smarty_internal_method_unregistercacheresource.php
1.049KB
Hapus
Edit
Rename
smarty_internal_method_unregisterfilter.php
1.437KB
Hapus
Edit
Rename
smarty_internal_method_unregisterobject.php
1.034KB
Hapus
Edit
Rename
smarty_internal_method_unregisterplugin.php
1.131KB
Hapus
Edit
Rename
smarty_internal_method_unregisterresource.php
1.029KB
Hapus
Edit
Rename
smarty_internal_nocache_insert.php
1.69KB
Hapus
Edit
Rename
smarty_internal_parsetree.php
0.886KB
Hapus
Edit
Rename
smarty_internal_parsetree_code.php
0.868KB
Hapus
Edit
Rename
smarty_internal_parsetree_dq.php
3.237KB
Hapus
Edit
Rename
smarty_internal_parsetree_dqcontent.php
0.908KB
Hapus
Edit
Rename
smarty_internal_parsetree_tag.php
1.734KB
Hapus
Edit
Rename
smarty_internal_parsetree_template.php
4.612KB
Hapus
Edit
Rename
smarty_internal_parsetree_text.php
1.249KB
Hapus
Edit
Rename
smarty_internal_resource_eval.php
2.722KB
Hapus
Edit
Rename
smarty_internal_resource_extends.php
3.641KB
Hapus
Edit
Rename
smarty_internal_resource_file.php
6.619KB
Hapus
Edit
Rename
smarty_internal_resource_php.php
3.518KB
Hapus
Edit
Rename
smarty_internal_resource_registered.php
3.124KB
Hapus
Edit
Rename
smarty_internal_resource_stream.php
2.339KB
Hapus
Edit
Rename
smarty_internal_resource_string.php
3.001KB
Hapus
Edit
Rename
smarty_internal_runtime_cachemodify.php
2.532KB
Hapus
Edit
Rename
smarty_internal_runtime_cacheresourcefile.php
5.729KB
Hapus
Edit
Rename
smarty_internal_runtime_capture.php
4.089KB
Hapus
Edit
Rename
smarty_internal_runtime_codeframe.php
3.993KB
Hapus
Edit
Rename
smarty_internal_runtime_filterhandler.php
2.907KB
Hapus
Edit
Rename
smarty_internal_runtime_foreach.php
5.349KB
Hapus
Edit
Rename
smarty_internal_runtime_getincludepath.php
4.894KB
Hapus
Edit
Rename
smarty_internal_runtime_inheritance.php
8.173KB
Hapus
Edit
Rename
smarty_internal_runtime_make_nocache.php
2.021KB
Hapus
Edit
Rename
smarty_internal_runtime_tplfunction.php
7.404KB
Hapus
Edit
Rename
smarty_internal_runtime_updatecache.php
6.472KB
Hapus
Edit
Rename
smarty_internal_runtime_updatescope.php
3.86KB
Hapus
Edit
Rename
smarty_internal_runtime_writefile.php
3.387KB
Hapus
Edit
Rename
smarty_internal_smartytemplatecompiler.php
5.493KB
Hapus
Edit
Rename
smarty_internal_template.php
25.317KB
Hapus
Edit
Rename
smarty_internal_templatebase.php
13.61KB
Hapus
Edit
Rename
smarty_internal_templatecompilerbase.php
58.309KB
Hapus
Edit
Rename
smarty_internal_templatelexer.php
35.54KB
Hapus
Edit
Rename
smarty_internal_templateparser.php
134.648KB
Hapus
Edit
Rename
smarty_internal_testinstall.php
31.293KB
Hapus
Edit
Rename
smarty_internal_undefined.php
1.659KB
Hapus
Edit
Rename
smarty_resource_recompiled.php
2.338KB
Hapus
Edit
Rename
smarty_resource_uncompiled.php
1.387KB
Hapus
Edit
Rename
smarty_template_compiled.php
9.239KB
Hapus
Edit
Rename
smarty_template_resource_base.php
3.409KB
Hapus
Edit
Rename
smarty_undefined_variable.php
0.554KB
Hapus
Edit
Rename
<=Back
<?php /** * Smarty Internal Plugin Template * This file contains the Smarty template engine * * @package Smarty * @subpackage Template * @author Uwe Tews */ /** * Main class with template data structures and methods * * @package Smarty * @subpackage Template * * @property Smarty_Template_Compiled $compiled * @property Smarty_Template_Cached $cached * @property Smarty_Internal_TemplateCompilerBase $compiler * @property mixed|\Smarty_Template_Cached registered_plugins * * The following methods will be dynamically loaded by the extension handler when they are called. * They are located in a corresponding Smarty_Internal_Method_xxxx class * * @method bool mustCompile() */ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { /** * Template object cache * * @var Smarty_Internal_Template[] */ public static $tplObjCache = array(); /** * Template object cache for Smarty::isCached() === true * * @var Smarty_Internal_Template[] */ public static $isCacheTplObj = array(); /** * Sub template Info Cache * - index name * - value use count * * @var int[] */ public static $subTplInfo = array(); /** * This object type (Smarty = 1, template = 2, data = 4) * * @var int */ public $_objType = 2; /** * Global smarty instance * * @var Smarty */ public $smarty = null; /** * Source instance * * @var Smarty_Template_Source|Smarty_Template_Config */ public $source = null; /** * Inheritance runtime extension * * @var Smarty_Internal_Runtime_Inheritance */ public $inheritance = null; /** * Template resource * * @var string */ public $template_resource = null; /** * flag if compiled template is invalid and must be (re)compiled * * @var bool */ public $mustCompile = null; /** * Template Id * * @var null|string */ public $templateId = null; /** * Scope in which variables shall be assigned * * @var int */ public $scope = 0; /** * Flag which is set while rending a cache file * * @var bool */ public $isRenderingCache = false; /** * Callbacks called before rendering template * * @var callback[] */ public $startRenderCallbacks = array(); /** * Callbacks called after rendering template * * @var callback[] */ public $endRenderCallbacks = array(); /** * Create template data object * Some of the global Smarty settings copied to template scope * It load the required template resources and caching plugins * * @param string $template_resource template resource string * @param Smarty $smarty Smarty instance * @param null|\Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $_parent back pointer to parent * object with variables or * null * @param mixed $_cache_id cache id or null * @param mixed $_compile_id compile id or null * @param bool|int|null $_caching use caching? * @param int|null $_cache_lifetime cache life-time in * seconds * @param bool $_isConfig * * @throws \SmartyException */ public function __construct( $template_resource, Smarty $smarty, Smarty_Internal_Data $_parent = null, $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null, $_isConfig = false ) { $this->smarty = $smarty; // Smarty parameter $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id; $this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id; $this->caching = (int)($_caching === null ? $this->smarty->caching : $_caching); $this->cache_lifetime = $_cache_lifetime === null ? $this->smarty->cache_lifetime : $_cache_lifetime; $this->compile_check = (int)$smarty->compile_check; $this->parent = $_parent; // Template resource $this->template_resource = $template_resource; $this->source = $_isConfig ? Smarty_Template_Config::load($this) : Smarty_Template_Source::load($this); parent::__construct(); if ($smarty->security_policy && method_exists($smarty->security_policy, 'registerCallBacks')) { $smarty->security_policy->registerCallBacks($this); } } /** * render template * * @param bool $no_output_filter if true do not run output filter * @param null|bool $display true: display, false: fetch null: sub-template * * @return string * @throws \Exception * @throws \SmartyException */ public function render($no_output_filter = true, $display = null) { if ($this->smarty->debugging) { if (!isset($this->smarty->_debug)) { $this->smarty->_debug = new Smarty_Internal_Debug(); } $this->smarty->_debug->start_template($this, $display); } // checks if template exists if (!$this->source->exists) { throw new SmartyException( "Unable to load template '{$this->source->type}:{$this->source->name}'" . ($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : '') ); } // disable caching for evaluated code if ($this->source->handler->recompiled) { $this->caching = Smarty::CACHING_OFF; } // read from cache or render if ($this->caching === Smarty::CACHING_LIFETIME_CURRENT || $this->caching === Smarty::CACHING_LIFETIME_SAVED) { if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id || $this->cached->compile_id !== $this->compile_id ) { $this->loadCached(true); } $this->cached->render($this, $no_output_filter); } else { if (!isset($this->compiled) || $this->compiled->compile_id !== $this->compile_id) { $this->loadCompiled(true); } $this->compiled->render($this); } // display or fetch if ($display) { if ($this->caching && $this->smarty->cache_modified_check) { $this->smarty->ext->_cacheModify->cacheModifiedCheck( $this->cached, $this, isset($content) ? $content : ob_get_clean() ); } else { if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ]) || isset($this->smarty->registered_filters[ 'output' ])) ) { echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this); } else { echo ob_get_clean(); } } if ($this->smarty->debugging) { $this->smarty->_debug->end_template($this); // debug output $this->smarty->_debug->display_debug($this, true); } return ''; } else { if ($this->smarty->debugging) { $this->smarty->_debug->end_template($this); if ($this->smarty->debugging === 2 && $display === false) { $this->smarty->_debug->display_debug($this, true); } } if (!$no_output_filter && (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && (isset($this->smarty->autoload_filters[ 'output' ]) || isset($this->smarty->registered_filters[ 'output' ])) ) { return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this); } // return cache content return null; } } /** * Runtime function to render sub-template * * @param string $template template name * @param mixed $cache_id cache id * @param mixed $compile_id compile id * @param integer $caching cache mode * @param integer $cache_lifetime life time of cache data * @param array $data passed parameter template variables * @param int $scope scope in which {include} should execute * @param bool $forceTplCache cache template object * @param string $uid file dependency uid * @param string $content_func function name * * @throws \Exception * @throws \SmartyException */ public function _subTemplateRender( $template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $scope, $forceTplCache, $uid = null, $content_func = null ) { $tpl = clone $this; $tpl->parent = $this; $smarty = &$this->smarty; $_templateId = $smarty->_getTemplateId($template, $cache_id, $compile_id, $caching, $tpl); // recursive call ? if (isset($tpl->templateId) ? $tpl->templateId : $tpl->_getTemplateId() !== $_templateId) { // already in template cache? if (isset(self::$tplObjCache[ $_templateId ])) { // copy data from cached object $cachedTpl = &self::$tplObjCache[ $_templateId ]; $tpl->templateId = $cachedTpl->templateId; $tpl->template_resource = $cachedTpl->template_resource; $tpl->cache_id = $cachedTpl->cache_id; $tpl->compile_id = $cachedTpl->compile_id; $tpl->source = $cachedTpl->source; if (isset($cachedTpl->compiled)) { $tpl->compiled = $cachedTpl->compiled; } else { unset($tpl->compiled); } if ($caching !== 9999 && isset($cachedTpl->cached)) { $tpl->cached = $cachedTpl->cached; } else { unset($tpl->cached); } } else { $tpl->templateId = $_templateId; $tpl->template_resource = $template; $tpl->cache_id = $cache_id; $tpl->compile_id = $compile_id; if (isset($uid)) { // for inline templates we can get all resource information from file dependency list($filepath, $timestamp, $type) = $tpl->compiled->file_dependency[ $uid ]; $tpl->source = new Smarty_Template_Source($smarty, $filepath, $type, $filepath); $tpl->source->filepath = $filepath; $tpl->source->timestamp = $timestamp; $tpl->source->exists = true; $tpl->source->uid = $uid; } else { $tpl->source = Smarty_Template_Source::load($tpl); unset($tpl->compiled); } if ($caching !== 9999) { unset($tpl->cached); } } } else { // on recursive calls force caching $forceTplCache = true; } $tpl->caching = $caching; $tpl->cache_lifetime = $cache_lifetime; // set template scope $tpl->scope = $scope; if (!isset(self::$tplObjCache[ $tpl->templateId ]) && !$tpl->source->handler->recompiled) { // check if template object should be cached if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ]) && self::$subTplInfo[ $tpl->template_resource ] > 1) || ($tpl->_isSubTpl() && isset(self::$tplObjCache[ $tpl->parent->templateId ])) ) { self::$tplObjCache[ $tpl->templateId ] = $tpl; } } if (!empty($data)) { // set up variable values foreach ($data as $_key => $_val) { $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val, $this->isRenderingCache); } } if ($tpl->caching === 9999) { if (!isset($tpl->compiled)) { $this->loadCompiled(true); } if ($tpl->compiled->has_nocache_code) { $this->cached->hashes[ $tpl->compiled->nocache_hash ] = true; } } $tpl->_cache = array(); if (isset($uid)) { if ($smarty->debugging) { if (!isset($smarty->_debug)) { $smarty->_debug = new Smarty_Internal_Debug(); } $smarty->_debug->start_template($tpl); $smarty->_debug->start_render($tpl); } $tpl->compiled->getRenderedTemplateCode($tpl, $content_func); if ($smarty->debugging) { $smarty->_debug->end_template($tpl); $smarty->_debug->end_render($tpl); } } else { if (isset($tpl->compiled)) { $tpl->compiled->render($tpl); } else { $tpl->render(); } } } /** * Get called sub-templates and save call count */ public function _subTemplateRegister() { foreach ($this->compiled->includes as $name => $count) { if (isset(self::$subTplInfo[ $name ])) { self::$subTplInfo[ $name ] += $count; } else { self::$subTplInfo[ $name ] = $count; } } } /** * Check if this is a sub template * * @return bool true is sub template */ public function _isSubTpl() { return isset($this->parent) && $this->parent->_isTplObj(); } /** * Assign variable in scope * * @param string $varName variable name * @param mixed $value value * @param bool $nocache nocache flag * @param int $scope scope into which variable shall be assigned */ public function _assignInScope($varName, $value, $nocache = false, $scope = 0) { if (isset($this->tpl_vars[ $varName ])) { $this->tpl_vars[ $varName ] = clone $this->tpl_vars[ $varName ]; $this->tpl_vars[ $varName ]->value = $value; if ($nocache || $this->isRenderingCache) { $this->tpl_vars[ $varName ]->nocache = true; } } else { $this->tpl_vars[ $varName ] = new Smarty_Variable($value, $nocache || $this->isRenderingCache); } if ($scope >= 0) { if ($scope > 0 || $this->scope > 0) { $this->smarty->ext->_updateScope->_updateScope($this, $varName, $scope); } } } /** * Check if plugins are callable require file otherwise * * @param array $plugins required plugins * * @throws \SmartyException */ public function _checkPlugins($plugins) { static $checked = array(); foreach ($plugins as $plugin) { $name = join('::', (array)$plugin[ 'function' ]); if (!isset($checked[ $name ])) { if (!is_callable($plugin[ 'function' ])) { if (is_file($plugin[ 'file' ])) { include_once $plugin[ 'file' ]; if (is_callable($plugin[ 'function' ])) { $checked[ $name ] = true; } } } else { $checked[ $name ] = true; } } if (!isset($checked[ $name ])) { if (false !== $this->smarty->loadPlugin($name)) { $checked[ $name ] = true; } else { throw new SmartyException("Plugin '{$name}' not callable"); } } } } /** * This function is executed automatically when a compiled or cached template file is included * - Decode saved properties from compiled template and cache files * - Check if compiled or cache file is valid * * @param \Smarty_Internal_Template $tpl * @param array $properties special template properties * @param bool $cache flag if called from cache file * * @return bool flag if compiled or cache file is valid * @throws \SmartyException */ public function _decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false) { // on cache resources other than file check version stored in cache code if (!isset($properties[ 'version' ]) || Smarty::SMARTY_VERSION !== $properties[ 'version' ]) { if ($cache) { $tpl->smarty->clearAllCache(); } else { $tpl->smarty->clearCompiledTemplate(); } return false; } $is_valid = true; if (!empty($properties[ 'file_dependency' ]) && ((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON) ) { // check file dependencies at compiled code foreach ($properties[ 'file_dependency' ] as $_file_to_check) { if ($_file_to_check[ 2 ] === 'file' || $_file_to_check[ 2 ] === 'php') { if ($tpl->source->filepath === $_file_to_check[ 0 ]) { // do not recheck current template continue; //$mtime = $tpl->source->getTimeStamp(); } else { // file and php types can be checked without loading the respective resource handlers $mtime = is_file($_file_to_check[ 0 ]) ? filemtime($_file_to_check[ 0 ]) : false; } } else { $handler = Smarty_Resource::load($tpl->smarty, $_file_to_check[ 2 ]); if ($handler->checkTimestamps()) { $source = Smarty_Template_Source::load($tpl, $tpl->smarty, $_file_to_check[ 0 ]); $mtime = $source->getTimeStamp(); } else { continue; } } if ($mtime === false || $mtime > $_file_to_check[ 1 ]) { $is_valid = false; break; } } } if ($cache) { // CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0 && (time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ])) ) { $is_valid = false; } $tpl->cached->cache_lifetime = $properties[ 'cache_lifetime' ]; $tpl->cached->valid = $is_valid; $resource = $tpl->cached; } else { $tpl->mustCompile = !$is_valid; $resource = $tpl->compiled; $resource->includes = isset($properties[ 'includes' ]) ? $properties[ 'includes' ] : array(); } if ($is_valid) { $resource->unifunc = $properties[ 'unifunc' ]; $resource->has_nocache_code = $properties[ 'has_nocache_code' ]; // $tpl->compiled->nocache_hash = $properties['nocache_hash']; $resource->file_dependency = $properties[ 'file_dependency' ]; } return $is_valid && !function_exists($properties[ 'unifunc' ]); } /** * Compiles the template * If the template is not evaluated the compiled template is saved on disk * * @throws \Exception */ public function compileTemplateSource() { return $this->compiled->compileTemplateSource($this); } /** * Writes the content to cache resource * * @param string $content * * @return bool */ public function writeCachedContent($content) { return $this->smarty->ext->_updateCache->writeCachedContent($this, $content); } /** * Get unique template id * * @return string * @throws \SmartyException */ public function _getTemplateId() { return isset($this->templateId) ? $this->templateId : $this->templateId = $this->smarty->_getTemplateId($this->template_resource, $this->cache_id, $this->compile_id); } /** * runtime error not matching capture tags * * @throws \SmartyException */ public function capture_error() { throw new SmartyException("Not matching {capture} open/close in '{$this->template_resource}'"); } /** * 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); } } /** * Load cached object * * @param bool $force force new cached object */ public function loadCached($force = false) { if ($force || !isset($this->cached)) { $this->cached = Smarty_Template_Cached::load($this); } } /** * Load inheritance object */ public function _loadInheritance() { if (!isset($this->inheritance)) { $this->inheritance = new Smarty_Internal_Runtime_Inheritance(); } } /** * Unload inheritance object */ public function _cleanUp() { $this->startRenderCallbacks = array(); $this->endRenderCallbacks = array(); $this->inheritance = null; } /** * Load compiler object * * @throws \SmartyException */ public function loadCompiler() { if (!class_exists($this->source->compiler_class)) { $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 ); } /** * Handle unknown class methods * * @param string $name unknown method-name * @param array $args argument array * * @return mixed */ public function __call($name, $args) { // method of Smarty object? if (method_exists($this->smarty, $name)) { return call_user_func_array(array($this->smarty, $name), $args); } // parent return parent::__call($name, $args); } /** * get Smarty property in template context * * @param string $property_name property name * * @return mixed|Smarty_Template_Cached * @throws SmartyException */ public function __get($property_name) { switch ($property_name) { case 'compiled': $this->loadCompiled(); return $this->compiled; case 'cached': $this->loadCached(); return $this->cached; case 'compiler': $this->loadCompiler(); return $this->compiler; default: // Smarty property ? if (property_exists($this->smarty, $property_name)) { return $this->smarty->$property_name; } } throw new SmartyException("template property '$property_name' does not exist."); } /** * set Smarty property in template context * * @param string $property_name property name * @param mixed $value value * * @throws SmartyException */ public function __set($property_name, $value) { switch ($property_name) { case 'compiled': case 'cached': case 'compiler': $this->$property_name = $value; return; default: // Smarty property ? if (property_exists($this->smarty, $property_name)) { $this->smarty->$property_name = $value; return; } } throw new SmartyException("invalid template property '$property_name'."); } /** * Template data object destructor */ public function __destruct() { if ($this->smarty->cache_locking && isset($this->cached) && $this->cached->is_locked) { $this->cached->handler->releaseLock($this->smarty, $this->cached); } } }
Liking