PK M"܆3 3 error_reporting.ininu W+A error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICTPK My libs/Autoloader.phpnu W+A 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',);
/**
* Registers Smarty_Autoloader backward compatible to older installations.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function registerBC($prepend = false)
{
/**
* register the class autoloader
*/
if (!defined('SMARTY_SPL_AUTOLOAD')) {
define('SMARTY_SPL_AUTOLOAD', 0);
}
if (SMARTY_SPL_AUTOLOAD
&& set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
) {
$registeredAutoLoadFunctions = spl_autoload_functions();
if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
spl_autoload_register();
}
} else {
self::register($prepend);
}
}
/**
* Registers Smarty_Autoloader as an SPL autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function register($prepend = false)
{
self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR;
self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR :
self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR;
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
} else {
spl_autoload_register(array(__CLASS__, 'autoload'));
}
}
/**
* Handles auto loading of classes.
*
* @param string $class A class name.
*/
public static function autoload($class)
{
if ($class[ 0 ] !== 'S' && strpos($class, 'Smarty') !== 0) {
return;
}
$_class = strtolower($class);
if (isset(self::$rootClasses[ $_class ])) {
$file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
if (is_file($file)) {
include $file;
}
} else {
$file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
if (is_file($file)) {
include $file;
}
}
return;
}
}
PK Mǥq > libs/sysplugins/smarty_internal_method_getdefaultmodifiers.phpnu W+A _getSmartyObj();
return $smarty->default_modifiers;
}
}
PK M|3$% % 6 libs/sysplugins/smarty_internal_parsetree_template.phpnu W+A subtrees)) {
$this->subtrees = array_merge($this->subtrees, $subtree->subtrees);
} else {
if ($subtree->data !== '') {
$this->subtrees[] = $subtree;
}
}
}
/**
* Append array to subtree
*
* @param \Smarty_Internal_Templateparser $parser
* @param \Smarty_Internal_ParseTree[] $array
*/
public function append_array(Smarty_Internal_Templateparser $parser, $array = array())
{
if (!empty($array)) {
$this->subtrees = array_merge($this->subtrees, (array) $array);
}
}
/**
* Prepend array to subtree
*
* @param \Smarty_Internal_Templateparser $parser
* @param \Smarty_Internal_ParseTree[] $array
*/
public function prepend_array(Smarty_Internal_Templateparser $parser, $array = array())
{
if (!empty($array)) {
$this->subtrees = array_merge((array) $array, $this->subtrees);
}
}
/**
* Sanitize and merge subtree buffers together
*
* @param \Smarty_Internal_Templateparser $parser
*
* @return string template code content
*/
public function to_smarty_php(Smarty_Internal_Templateparser $parser)
{
$code = '';
for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key ++) {
if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
$subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Text ||
$this->subtrees[ $key + 1 ]->data === '')) {
$key ++;
if ($this->subtrees[ $key ]->data === '') {
continue;
}
$subtree .= $this->subtrees[ $key ]->to_smarty_php($parser);
}
if ($subtree === '') {
continue;
}
$code .= preg_replace(
'/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "\n",
$subtree
);
continue;
}
if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
$subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Tag ||
$this->subtrees[ $key + 1 ]->data === '')) {
$key ++;
if ($this->subtrees[ $key ]->data === '') {
continue;
}
$subtree = $parser->compiler->appendCode($subtree, $this->subtrees[ $key ]->to_smarty_php($parser));
}
if ($subtree === '') {
continue;
}
$code .= $subtree;
continue;
}
$code .= $this->subtrees[ $key ]->to_smarty_php($parser);
}
return $code;
}
}
PK M? = libs/sysplugins/smarty_internal_method_addautoloadfilters.phpnu W+A _getSmartyObj();
if ($type !== null) {
$this->_checkFilterType($type);
if (!empty($smarty->autoload_filters[ $type ])) {
$smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array) $filters);
} else {
$smarty->autoload_filters[ $type ] = (array) $filters;
}
} else {
foreach ((array) $filters as $type => $value) {
$this->_checkFilterType($type);
if (!empty($smarty->autoload_filters[ $type ])) {
$smarty->autoload_filters[ $type ] =
array_merge($smarty->autoload_filters[ $type ], (array) $value);
} else {
$smarty->autoload_filters[ $type ] = (array) $value;
}
}
}
return $obj;
}
}
PK M^ 1 libs/sysplugins/smarty_internal_compile_while.phpnu W+A loopNesting ++;
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$this->openTag($compiler, 'while', $compiler->nocache);
if (!array_key_exists('if condition', $parameter)) {
$compiler->trigger_template_error('missing while condition', null, true);
}
// maybe nocache because of nocache variables
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
if (is_array($parameter[ 'if condition' ])) {
if ($compiler->nocache) {
// create nocache var to make it know for further compiling
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
$var = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
} else {
$var = $parameter[ 'if condition' ][ 'var' ];
}
$compiler->setNocacheInVariable($var);
}
$prefixVar = $compiler->getNewPrefixVariable();
$assignCompiler = new Smarty_Internal_Compile_Assign();
$assignAttr = array();
$assignAttr[][ 'value' ] = $prefixVar;
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
$_output = "";
$_output .= $assignCompiler->compile(
$assignAttr, $compiler,
array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])
);
} else {
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
$_output = "";
$_output .= $assignCompiler->compile($assignAttr, $compiler, array());
}
return $_output;
} else {
return "";
}
}
}
/**
* Smarty Internal Plugin Compile Whileclose Class
*
* @package Smarty
* @subpackage Compiler
*/
class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase
{
/**
* Compiles code for the {/while} tag
*
* @param array $args array with attributes from parser
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
*
* @return string compiled code
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
$compiler->loopNesting --;
// must endblock be nocache?
if ($compiler->nocache) {
$compiler->tag_nocache = true;
}
$compiler->nocache = $this->closeTag($compiler, array('while'));
return "\n";
}
}
PK M6N * libs/sysplugins/smarty_resource_custom.phpnu W+A filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25);
$source->uid = sha1($source->type . ':' . $source->name);
$mtime = $this->fetchTimestamp($source->name);
if ($mtime !== null) {
$source->timestamp = $mtime;
} else {
$this->fetch($source->name, $content, $timestamp);
$source->timestamp = isset($timestamp) ? $timestamp : false;
if (isset($content)) {
$source->content = $content;
}
}
$source->exists = !!$source->timestamp;
}
/**
* Load template's source into current template object
*
* @param Smarty_Template_Source $source source object
*
* @return string template source
* @throws SmartyException if source cannot be loaded
*/
public function getContent(Smarty_Template_Source $source)
{
$this->fetch($source->name, $content, $timestamp);
if (isset($content)) {
return $content;
}
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
/**
* Determine basename for compiled filename
*
* @param Smarty_Template_Source $source source object
*
* @return string resource's basename
*/
public function getBasename(Smarty_Template_Source $source)
{
return basename(substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25));
}
}
PK M{ { 5 libs/sysplugins/smarty_internal_method_loadfilter.phpnu W+A true, 'post' => true, 'output' => true, 'variable' => true);
/**
* load a filter of specified type and name
*
* @api Smarty::loadFilter()
*
* @link http://www.smarty.net/docs/en/api.load.filter.tpl
*
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type filter type
* @param string $name filter name
*
* @return bool
* @throws SmartyException if filter could not be loaded
*/
public function loadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
{
$smarty = $obj->_getSmartyObj();
$this->_checkFilterType($type);
$_plugin = "smarty_{$type}filter_{$name}";
$_filter_name = $_plugin;
if (is_callable($_plugin)) {
$smarty->registered_filters[ $type ][ $_filter_name ] = $_plugin;
return true;
}
if ($smarty->loadPlugin($_plugin)) {
if (class_exists($_plugin, false)) {
$_plugin = array($_plugin, 'execute');
}
if (is_callable($_plugin)) {
$smarty->registered_filters[ $type ][ $_filter_name ] = $_plugin;
return true;
}
}
throw new SmartyException("{$type}filter '{$name}' not found or callable");
}
/**
* Check if filter type is valid
*
* @param string $type
*
* @throws \SmartyException
*/
public function _checkFilterType($type)
{
if (!isset($this->filterTypes[ $type ])) {
throw new SmartyException("Illegal filter type '{$type}'");
}
}
}
PK Mm ; libs/sysplugins/smarty_internal_method_unregisterfilter.phpnu W+A _getSmartyObj();
$this->_checkFilterType($type);
if (isset($smarty->registered_filters[ $type ])) {
$name = is_string($callback) ? $callback : $this->_getFilterName($callback);
if (isset($smarty->registered_filters[ $type ][ $name ])) {
unset($smarty->registered_filters[ $type ][ $name ]);
if (empty($smarty->registered_filters[ $type ])) {
unset($smarty->registered_filters[ $type ]);
}
}
}
return $obj;
}
}
PK M;:ę libs/sysplugins/smarty_data.phpnu W+A dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count);
$this->smarty = $smarty;
if (is_object($_parent)) {
// when object set up back pointer
$this->parent = $_parent;
} elseif (is_array($_parent)) {
// set up variable values
foreach ($_parent as $_key => $_val) {
$this->tpl_vars[ $_key ] = new Smarty_Variable($_val);
}
} elseif ($_parent !== null) {
throw new SmartyException('Wrong type for template variables');
}
}
}
PK M 5 libs/sysplugins/smarty_internal_method_clearcache.phpnu W+A _clearTemplateCache();
// load cache resource and call clear
$_cache_resource = Smarty_CacheResource::load($smarty, $type);
return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time);
}
}
PK M& D libs/sysplugins/smarty_internal_compile_private_registered_block.phpnu W+A smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ])) {
$tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
$callback = $tag_info[ 0 ];
if (is_array($callback)) {
if (is_object($callback[ 0 ])) {
$callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
$callback =
array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
} else {
$callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
$callback =
array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}");
}
} else {
$callable = "\$_block_plugin{$this->nesting}";
$callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0]", '');
}
} else {
$tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
$callback = $tag_info[ 0 ];
if (is_array($callback)) {
$callable = "array('{$callback[0]}', '{$callback[1]}')";
$callback = "{$callback[1]}::{$callback[1]}";
} else {
$callable = null;
}
}
$compiler->tag_nocache = !$tag_info[ 1 ] | $compiler->tag_nocache;
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) {
$_value = str_replace('\'', "^#^", $_value);
$_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
} else {
$_paramsArray[] = "'$_key'=>$_value";
}
}
return array($callback, $_paramsArray, $callable);
}
}
PK MtCc 2 libs/sysplugins/smarty_internal_nocache_insert.phpnu W+A assign('{$_assign}' , {$_function} (" . var_export($_attr, true) .
',\$_smarty_tpl), true);?>';
} else {
$_output .= "echo {$_function}(" . var_export($_attr, true) . ',$_smarty_tpl);?>';
}
$_tpl = $_template;
while ($_tpl->_isSubTpl()) {
$_tpl = $_tpl->parent;
}
return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";
}
}
PK M^^n > libs/sysplugins/smarty_internal_method_compilealltemplates.phpnu W+A compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
}
/**
* Compile all template or config files
*
* @param \Smarty $smarty
* @param string $extension template file name extension
* @param bool $force_compile force all to recompile
* @param int $time_limit set maximum execution time
* @param int $max_errors set maximum allowed errors
* @param bool $isConfig flag true if called for config files
*
* @return int number of template files compiled
*/
protected function compileAll(Smarty $smarty,
$extension,
$force_compile,
$time_limit,
$max_errors,
$isConfig = false
) {
// switch off time limit
if (function_exists('set_time_limit')) {
@set_time_limit($time_limit);
}
$_count = 0;
$_error_count = 0;
$sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
// loop over array of source directories
foreach ($sourceDir as $_dir) {
$_dir_1 = new RecursiveDirectoryIterator(
$_dir, defined('FilesystemIterator::FOLLOW_SYMLINKS') ?
FilesystemIterator::FOLLOW_SYMLINKS : 0
);
$_dir_2 = new RecursiveIteratorIterator($_dir_1);
foreach ($_dir_2 as $_fileinfo) {
$_file = $_fileinfo->getFilename();
if (substr(basename($_fileinfo->getPathname()), 0, 1) === '.' || strpos($_file, '.svn') !== false) {
continue;
}
if (substr_compare($_file, $extension, -strlen($extension)) !== 0) {
continue;
}
if ($_fileinfo->getPath() !== substr($_dir, 0, -1)) {
$_file = substr($_fileinfo->getPath(), strlen($_dir)) . DIRECTORY_SEPARATOR . $_file;
}
echo "\n
", $_dir, '---', $_file;
flush();
$_start_time = microtime(true);
$_smarty = clone $smarty;
//
$_smarty->_cache = array();
$_smarty->ext = new Smarty_Internal_Extension_Handler();
$_smarty->ext->objType = $_smarty->_objType;
$_smarty->force_compile = $force_compile;
try {
/* @var Smarty_Internal_Template $_tpl */
$_tpl = new $smarty->template_class($_file, $_smarty);
$_tpl->caching = Smarty::CACHING_OFF;
$_tpl->source =
$isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
if ($_tpl->mustCompile()) {
$_tpl->compileTemplateSource();
$_count++;
echo ' compiled in ', microtime(true) - $_start_time, ' seconds';
flush();
} else {
echo ' is up to date';
flush();
}
}
catch (Exception $e) {
echo "\n
------>Error: ", $e->getMessage(), "
\n";
$_error_count++;
}
// free memory
unset($_tpl);
$_smarty->_clearTemplateCache();
if ($max_errors !== null && $_error_count === $max_errors) {
echo "\n
too many errors\n";
exit(1);
}
}
}
echo "\n
";
return $_count;
}
}
PK M| | 1 libs/sysplugins/smarty_internal_templatelexer.phpnu W+A
*/
class Smarty_Internal_Templatelexer
{
const TEXT = 1;
const TAG = 2;
const TAGBODY = 3;
const LITERAL = 4;
const DOUBLEQUOTEDSTRING = 5;
/**
* Source
*
* @var string
*/
public $data;
/**
* Source length
*
* @var int
*/
public $dataLength = null;
/**
* byte counter
*
* @var int
*/
public $counter;
/**
* token number
*
* @var int
*/
public $token;
/**
* token value
*
* @var string
*/
public $value;
/**
* current line
*
* @var int
*/
public $line;
/**
* tag start line
*
* @var
*/
public $taglineno;
/**
* php code type
*
* @var string
*/
public $phpType = '';
/**
* state number
*
* @var int
*/
public $state = 1;
/**
* Smarty object
*
* @var Smarty
*/
public $smarty = null;
/**
* compiler object
*
* @var Smarty_Internal_TemplateCompilerBase
*/
public $compiler = null;
/**
* trace file
*
* @var resource
*/
public $yyTraceFILE;
/**
* trace prompt
*
* @var string
*/
public $yyTracePrompt;
/**
* XML flag true while processing xml
*
* @var bool
*/
public $is_xml = false;
/**
* state names
*
* @var array
*/
public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
/**
* token names
*
* @var array
*/
public $smarty_token_names = array( // Text for parser error messages
'NOT' => '(!,not)',
'OPENP' => '(',
'CLOSEP' => ')',
'OPENB' => '[',
'CLOSEB' => ']',
'PTR' => '->',
'APTR' => '=>',
'EQUAL' => '=',
'NUMBER' => 'number',
'UNIMATH' => '+" , "-',
'MATH' => '*" , "/" , "%',
'INCDEC' => '++" , "--',
'SPACE' => ' ',
'DOLLAR' => '$',
'SEMICOLON' => ';',
'COLON' => ':',
'DOUBLECOLON' => '::',
'AT' => '@',
'HATCH' => '#',
'QUOTE' => '"',
'BACKTICK' => '`',
'VERT' => '"|" modifier',
'DOT' => '.',
'COMMA' => '","',
'QMARK' => '"?"',
'ID' => 'id, name',
'TEXT' => 'text',
'LDELSLASH' => '{/..} closing tag',
'LDEL' => '{...} Smarty tag',
'COMMENT' => 'comment',
'AS' => 'as',
'TO' => 'to',
'PHP' => '" '"<", "==" ... logical operator',
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
'SCOND' => '"is even" ... if condition',
);
/**
* literal tag nesting level
*
* @var int
*/
private $literal_cnt = 0;
/**
* preg token pattern for state TEXT
*
* @var string
*/
private $yy_global_pattern1 = null;
/**
* preg token pattern for state TAG
*
* @var string
*/
private $yy_global_pattern2 = null;
/**
* preg token pattern for state TAGBODY
*
* @var string
*/
private $yy_global_pattern3 = null;
/**
* preg token pattern for state LITERAL
*
* @var string
*/
private $yy_global_pattern4 = null;
/**
* preg token pattern for state DOUBLEQUOTEDSTRING
*
* @var null
*/
private $yy_global_pattern5 = null;
private $_yy_state = 1;
private $_yy_stack = array();
/**
* constructor
*
* @param string $source template source
* @param Smarty_Internal_TemplateCompilerBase $compiler
*/
function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
{
$this->data = $source;
$this->dataLength = strlen($this->data);
$this->counter = 0;
if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
$this->counter += strlen($match[ 0 ]);
}
$this->line = 1;
$this->smarty = $compiler->template->smarty;
$this->compiler = $compiler;
$this->compiler->initDelimiterPreg();
$this->smarty_token_names[ 'LDEL' ] = $this->smarty->getLeftDelimiter();
$this->smarty_token_names[ 'RDEL' ] = $this->smarty->getRightDelimiter();
}
/**
* open lexer/parser trace file
*/
public function PrintTrace()
{
$this->yyTraceFILE = fopen('php://output', 'w');
$this->yyTracePrompt = '
';
}
/**
* replace placeholders with runtime preg code
*
* @param string $preg
*
* @return string
*/
public function replace($preg)
{
return $this->compiler->replaceDelimiter($preg);
}
/**
* check if current value is an autoliteral left delimiter
*
* @return bool
*/
public function isAutoLiteral()
{
return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
} // end function
public function yylex()
{
return $this->{'yylex' . $this->_yy_state}();
}
public function yypushstate($state)
{
if ($this->yyTraceFILE) {
fprintf(
$this->yyTraceFILE,
"%sState push %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state
);
}
array_push($this->_yy_stack, $this->_yy_state);
$this->_yy_state = $state;
if ($this->yyTraceFILE) {
fprintf(
$this->yyTraceFILE,
"%snew State %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state
);
}
}
public function yypopstate()
{
if ($this->yyTraceFILE) {
fprintf(
$this->yyTraceFILE,
"%sState pop %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state
);
}
$this->_yy_state = array_pop($this->_yy_stack);
if ($this->yyTraceFILE) {
fprintf(
$this->yyTraceFILE,
"%snew State %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state
);
}
}
public function yybegin($state)
{
$this->_yy_state = $state;
if ($this->yyTraceFILE) {
fprintf(
$this->yyTraceFILE,
"%sState set %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state
);
}
}
public function yylex1()
{
if (!isset($this->yy_global_pattern1)) {
$this->yy_global_pattern1 =
$this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G((.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+)/isS");
}
if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data);
}
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
do {
if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) {
$yymatches = preg_grep("/(.|\s)+/", $yymatches);
} else {
$yymatches = array_filter($yymatches);
}
if (empty($yymatches)) {
throw new Exception(
'Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state TEXT'
);
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
$this->value = current($yymatches); // token value
$r = $this->{'yy_r1_' . $this->token}();
if ($r === null) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
} else if ($r === true) {
// we have changed state
// process this token in the new state
return $this->yylex();
} else if ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
}
} else {
throw new Exception(
'Unexpected input at line' . $this->line .
': ' . $this->data[ $this->counter ]
);
}
break;
} while (true);
}
function yy_r1_1()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
function yy_r1_2()
{
preg_match(
"/[*]{$this->compiler->getRdelPreg()}[\n]?/",
$this->data,
$match,
PREG_OFFSET_CAPTURE,
$this->counter
);
if (isset($match[ 0 ][ 1 ])) {
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
} else {
$this->compiler->trigger_template_error("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
}
$this->value = substr($this->data, $this->counter, $to - $this->counter);
return false;
}
function yy_r1_4()
{
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
}
function yy_r1_8()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
function yy_r1_10()
{
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
$this->yypushstate(self::LITERAL);
}
function yy_r1_12()
{
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
$this->yypushstate(self::LITERAL);
} // end function
function yy_r1_14()
{
$this->yypushstate(self::TAG);
return true;
}
function yy_r1_16()
{
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
}
function yy_r1_19()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
public function yylex2()
{
if (!isset($this->yy_global_pattern2)) {
$this->yy_global_pattern2 =
$this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$]smarty\\.block\\.(child|parent)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/][0-9]*[a-zA-Z_]\\w*\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS");
}
if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data);
}
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
do {
if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) {
$yymatches = preg_grep("/(.|\s)+/", $yymatches);
} else {
$yymatches = array_filter($yymatches);
}
if (empty($yymatches)) {
throw new Exception(
'Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state TAG'
);
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
$this->value = current($yymatches); // token value
$r = $this->{'yy_r2_' . $this->token}();
if ($r === null) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
} else if ($r === true) {
// we have changed state
// process this token in the new state
return $this->yylex();
} else if ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
}
} else {
throw new Exception(
'Unexpected input at line' . $this->line .
': ' . $this->data[ $this->counter ]
);
}
break;
} while (true);
}
function yy_r2_1()
{
$this->token = Smarty_Internal_Templateparser::TP_LDELIF;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
function yy_r2_4()
{
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
function yy_r2_6()
{
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
function yy_r2_8()
{
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
function yy_r2_10()
{
$this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
function yy_r2_12()
{
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
$this->taglineno = $this->line;
}
function yy_r2_15()
{
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
$this->taglineno = $this->line;
}
function yy_r2_18()
{
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
$this->taglineno = $this->line;
}
function yy_r2_20()
{
if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) {
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
$this->taglineno = $this->line;
} else {
$this->value = $this->smarty->getLeftDelimiter();
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
} // end function
function yy_r2_23()
{
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
function yy_r2_25()
{
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
}
public function yylex3()
{
if (!isset($this->yy_global_pattern3)) {
$this->yy_global_pattern3 =
$this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS");
}
if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data);
}
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
do {
if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) {
$yymatches = preg_grep("/(.|\s)+/", $yymatches);
} else {
$yymatches = array_filter($yymatches);
}
if (empty($yymatches)) {
throw new Exception(
'Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state TAGBODY'
);
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
$this->value = current($yymatches); // token value
$r = $this->{'yy_r3_' . $this->token}();
if ($r === null) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
} else if ($r === true) {
// we have changed state
// process this token in the new state
return $this->yylex();
} else if ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
}
} else {
throw new Exception(
'Unexpected input at line' . $this->line .
': ' . $this->data[ $this->counter ]
);
}
break;
} while (true);
}
function yy_r3_1()
{
$this->token = Smarty_Internal_Templateparser::TP_RDEL;
$this->yypopstate();
}
function yy_r3_2()
{
$this->yypushstate(self::TAG);
return true;
}
function yy_r3_4()
{
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
$this->compiler->enterDoubleQuote();
}
function yy_r3_5()
{
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
}
function yy_r3_6()
{
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
}
function yy_r3_7()
{
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
}
function yy_r3_8()
{
$this->token = Smarty_Internal_Templateparser::TP_ISIN;
}
function yy_r3_9()
{
$this->token = Smarty_Internal_Templateparser::TP_AS;
}
function yy_r3_10()
{
$this->token = Smarty_Internal_Templateparser::TP_TO;
}
function yy_r3_11()
{
$this->token = Smarty_Internal_Templateparser::TP_STEP;
}
function yy_r3_12()
{
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
}
function yy_r3_13()
{
$this->token = Smarty_Internal_Templateparser::TP_LOGOP;
}
function yy_r3_15()
{
$this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
}
function yy_r3_17()
{
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
}
function yy_r3_20()
{
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
}
function yy_r3_23()
{
$this->token = Smarty_Internal_Templateparser::TP_NOT;
}
function yy_r3_24()
{
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
}
function yy_r3_28()
{
$this->token = Smarty_Internal_Templateparser::TP_OPENP;
}
function yy_r3_29()
{
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
}
function yy_r3_30()
{
$this->token = Smarty_Internal_Templateparser::TP_OPENB;
}
function yy_r3_31()
{
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
}
function yy_r3_32()
{
$this->token = Smarty_Internal_Templateparser::TP_PTR;
}
function yy_r3_33()
{
$this->token = Smarty_Internal_Templateparser::TP_APTR;
}
function yy_r3_34()
{
$this->token = Smarty_Internal_Templateparser::TP_EQUAL;
}
function yy_r3_35()
{
$this->token = Smarty_Internal_Templateparser::TP_INCDEC;
}
function yy_r3_37()
{
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
}
function yy_r3_39()
{
$this->token = Smarty_Internal_Templateparser::TP_MATH;
}
function yy_r3_41()
{
$this->token = Smarty_Internal_Templateparser::TP_AT;
}
function yy_r3_42()
{
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
}
function yy_r3_43()
{
// resolve conflicts with shorttag and right_delimiter starting with '='
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()
) {
preg_match('/\s+/', $this->value, $match);
$this->value = $match[ 0 ];
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
} else {
$this->token = Smarty_Internal_Templateparser::TP_ATTR;
}
}
function yy_r3_44()
{
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
}
function yy_r3_47()
{
$this->token = Smarty_Internal_Templateparser::TP_ID;
}
function yy_r3_48()
{
$this->token = Smarty_Internal_Templateparser::TP_INTEGER;
}
function yy_r3_49()
{
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->yypopstate();
}
function yy_r3_50()
{
$this->token = Smarty_Internal_Templateparser::TP_VERT;
}
function yy_r3_51()
{
$this->token = Smarty_Internal_Templateparser::TP_DOT;
}
function yy_r3_52()
{
$this->token = Smarty_Internal_Templateparser::TP_COMMA;
}
function yy_r3_53()
{
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
}
function yy_r3_54()
{
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
}
function yy_r3_55()
{
$this->token = Smarty_Internal_Templateparser::TP_COLON;
}
function yy_r3_56()
{
$this->token = Smarty_Internal_Templateparser::TP_QMARK;
}
function yy_r3_57()
{
$this->token = Smarty_Internal_Templateparser::TP_HEX;
}
function yy_r3_58()
{
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
} // end function
function yy_r3_59()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
public function yylex4()
{
if (!isset($this->yy_global_pattern4)) {
$this->yy_global_pattern4 =
$this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel))/isS");
}
if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data);
}
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
do {
if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) {
$yymatches = preg_grep("/(.|\s)+/", $yymatches);
} else {
$yymatches = array_filter($yymatches);
}
if (empty($yymatches)) {
throw new Exception(
'Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state LITERAL'
);
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
$this->value = current($yymatches); // token value
$r = $this->{'yy_r4_' . $this->token}();
if ($r === null) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
} else if ($r === true) {
// we have changed state
// process this token in the new state
return $this->yylex();
} else if ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
}
} else {
throw new Exception(
'Unexpected input at line' . $this->line .
': ' . $this->data[ $this->counter ]
);
}
break;
} while (true);
}
function yy_r4_1()
{
$this->literal_cnt++;
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
}
function yy_r4_3()
{
if ($this->literal_cnt) {
$this->literal_cnt--;
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} else {
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
$this->yypopstate();
}
}
function yy_r4_5()
{
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} // end function
public function yylex5()
{
if (!isset($this->yy_global_pattern5)) {
$this->yy_global_pattern5 =
$this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))/isS");
}
if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data);
}
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
do {
if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) {
$yymatches = preg_grep("/(.|\s)+/", $yymatches);
} else {
$yymatches = array_filter($yymatches);
}
if (empty($yymatches)) {
throw new Exception(
'Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state DOUBLEQUOTEDSTRING'
);
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
$this->value = current($yymatches); // token value
$r = $this->{'yy_r5_' . $this->token}();
if ($r === null) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
} else if ($r === true) {
// we have changed state
// process this token in the new state
return $this->yylex();
} else if ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
}
} else {
throw new Exception(
'Unexpected input at line' . $this->line .
': ' . $this->data[ $this->counter ]
);
}
break;
} while (true);
}
function yy_r5_1()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
function yy_r5_3()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
function yy_r5_5()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
function yy_r5_7()
{
$this->yypushstate(self::TAG);
return true;
}
function yy_r5_9()
{
$this->yypushstate(self::TAG);
return true;
}
function yy_r5_11()
{
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->taglineno = $this->line;
$this->yypushstate(self::TAGBODY);
}
function yy_r5_13()
{
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypopstate();
}
function yy_r5_14()
{
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->value = substr($this->value, 0, -1);
$this->yypushstate(self::TAGBODY);
$this->taglineno = $this->line;
}
function yy_r5_15()
{
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
}
function yy_r5_16()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
function yy_r5_17()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
}
PK M06$ $ , libs/sysplugins/smarty_template_compiled.phpnu W+A source->handler->hasCompiledHandler) {
$_template->source->handler->populateCompiledFilepath($compiled, $_template);
} else {
$compiled->populateCompiledFilepath($_template);
}
return $compiled;
}
/**
* populate Compiled Object with compiled filepath
*
* @param Smarty_Internal_Template $_template template object
**/
public function populateCompiledFilepath(Smarty_Internal_Template $_template)
{
$source = &$_template->source;
$smarty = &$_template->smarty;
$this->filepath = $smarty->getCompileDir();
if (isset($_template->compile_id)) {
$this->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) .
($smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^');
}
// if use_sub_dirs, break file into directories
if ($smarty->use_sub_dirs) {
$this->filepath .= $source->uid[ 0 ] . $source->uid[ 1 ] . DIRECTORY_SEPARATOR . $source->uid[ 2 ] .
$source->uid[ 3 ] . DIRECTORY_SEPARATOR . $source->uid[ 4 ] . $source->uid[ 5 ] .
DIRECTORY_SEPARATOR;
}
$this->filepath .= $source->uid . '_';
if ($source->isConfig) {
$this->filepath .= (int)$smarty->config_read_hidden + (int)$smarty->config_booleanize * 2 +
(int)$smarty->config_overwrite * 4;
} else {
$this->filepath .= (int)$smarty->merge_compiled_includes + (int)$smarty->escape_html * 2 +
(($smarty->merge_compiled_includes && $source->type === 'extends') ?
(int)$smarty->extends_recursion * 4 : 0);
}
$this->filepath .= '.' . $source->type;
$basename = $source->handler->getBasename($source);
if (!empty($basename)) {
$this->filepath .= '.' . $basename;
}
if ($_template->caching) {
$this->filepath .= '.cache';
}
$this->filepath .= '.php';
$this->timestamp = $this->exists = is_file($this->filepath);
if ($this->exists) {
$this->timestamp = filemtime($this->filepath);
}
}
/**
* render compiled template code
*
* @param Smarty_Internal_Template $_template
*
* @return string
* @throws Exception
*/
public function render(Smarty_Internal_Template $_template)
{
// checks if template exists
if (!$_template->source->exists) {
$type = $_template->source->isConfig ? 'config' : 'template';
throw new SmartyException("Unable to load {$type} '{$_template->source->type}:{$_template->source->name}'");
}
if ($_template->smarty->debugging) {
if (!isset($_template->smarty->_debug)) {
$_template->smarty->_debug = new Smarty_Internal_Debug();
}
$_template->smarty->_debug->start_render($_template);
}
if (!$this->processed) {
$this->process($_template);
}
if (isset($_template->cached)) {
$_template->cached->file_dependency =
array_merge($_template->cached->file_dependency, $this->file_dependency);
}
if ($_template->source->handler->uncompiled) {
$_template->source->handler->renderUncompiled($_template->source, $_template);
} else {
$this->getRenderedTemplateCode($_template);
}
if ($_template->caching && $this->has_nocache_code) {
$_template->cached->hashes[ $this->nocache_hash ] = true;
}
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_render($_template);
}
}
/**
* load compiled template or compile from source
*
* @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
*
* @throws Exception
*/
public function process(Smarty_Internal_Template $_smarty_tpl)
{
$source = &$_smarty_tpl->source;
$smarty = &$_smarty_tpl->smarty;
if ($source->handler->recompiled) {
$source->handler->process($_smarty_tpl);
} else if (!$source->handler->uncompiled) {
if (!$this->exists || $smarty->force_compile
|| ($_smarty_tpl->compile_check && $source->getTimeStamp() > $this->getTimeStamp())
) {
$this->compileTemplateSource($_smarty_tpl);
$compileCheck = $_smarty_tpl->compile_check;
$_smarty_tpl->compile_check = Smarty::COMPILECHECK_OFF;
$this->loadCompiledTemplate($_smarty_tpl);
$_smarty_tpl->compile_check = $compileCheck;
} else {
$_smarty_tpl->mustCompile = true;
@include $this->filepath;
if ($_smarty_tpl->mustCompile) {
$this->compileTemplateSource($_smarty_tpl);
$compileCheck = $_smarty_tpl->compile_check;
$_smarty_tpl->compile_check = Smarty::COMPILECHECK_OFF;
$this->loadCompiledTemplate($_smarty_tpl);
$_smarty_tpl->compile_check = $compileCheck;
}
}
$_smarty_tpl->_subTemplateRegister();
$this->processed = true;
}
}
/**
* compile template from source
*
* @param Smarty_Internal_Template $_template
*
* @throws Exception
*/
public function compileTemplateSource(Smarty_Internal_Template $_template)
{
$this->file_dependency = array();
$this->includes = array();
$this->nocache_hash = null;
$this->unifunc = null;
// compile locking
if ($saved_timestamp = (!$_template->source->handler->recompiled && is_file($this->filepath))) {
$saved_timestamp = $this->getTimeStamp();
touch($this->filepath);
}
// compile locking
try {
// call compiler
$_template->loadCompiler();
$this->write($_template, $_template->compiler->compileTemplate($_template));
}
catch (Exception $e) {
// restore old timestamp in case of error
if ($saved_timestamp && is_file($this->filepath)) {
touch($this->filepath, $saved_timestamp);
}
unset($_template->compiler);
throw $e;
}
// release compiler object to free memory
unset($_template->compiler);
}
/**
* Write compiled code by handler
*
* @param Smarty_Internal_Template $_template template object
* @param string $code compiled code
*
* @return bool success
* @throws \SmartyException
*/
public function write(Smarty_Internal_Template $_template, $code)
{
if (!$_template->source->handler->recompiled) {
if ($_template->smarty->ext->_writeFile->writeFile($this->filepath, $code, $_template->smarty) === true) {
$this->timestamp = $this->exists = is_file($this->filepath);
if ($this->exists) {
$this->timestamp = filemtime($this->filepath);
return true;
}
}
return false;
}
return true;
}
/**
* Read compiled content from handler
*
* @param Smarty_Internal_Template $_template template object
*
* @return string content
*/
public function read(Smarty_Internal_Template $_template)
{
if (!$_template->source->handler->recompiled) {
return file_get_contents($this->filepath);
}
return isset($this->content) ? $this->content : false;
}
/**
* Load fresh compiled template by including the PHP file
* HHVM requires a work around because of a PHP incompatibility
*
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
*/
private function loadCompiledTemplate(Smarty_Internal_Template $_smarty_tpl)
{
if (function_exists('opcache_invalidate')
&& (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1)
) {
opcache_invalidate($this->filepath, true);
} else if (function_exists('apc_compile_file')) {
apc_compile_file($this->filepath);
}
if (defined('HHVM_VERSION')) {
eval('?>' . file_get_contents($this->filepath));
} else {
include $this->filepath;
}
}
}
PK M/u2 2 1 libs/sysplugins/smarty_internal_method_append.phpnu W+A $_val) {
if ($_key !== '') {
$this->append($data, $_key, $_val, $merge, $nocache);
}
}
} else {
if ($tpl_var !== '' && isset($value)) {
if (!isset($data->tpl_vars[ $tpl_var ])) {
$tpl_var_inst = $data->ext->getTemplateVars->_getVariable($data, $tpl_var, null, true, false);
if ($tpl_var_inst instanceof Smarty_Undefined_Variable) {
$data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache);
} else {
$data->tpl_vars[ $tpl_var ] = clone $tpl_var_inst;
}
}
if (!(is_array($data->tpl_vars[ $tpl_var ]->value)
|| $data->tpl_vars[ $tpl_var ]->value instanceof ArrayAccess)
) {
settype($data->tpl_vars[ $tpl_var ]->value, 'array');
}
if ($merge && is_array($value)) {
foreach ($value as $_mkey => $_mval) {
$data->tpl_vars[ $tpl_var ]->value[ $_mkey ] = $_mval;
}
} else {
$data->tpl_vars[ $tpl_var ]->value[] = $value;
}
}
if ($data->_isTplObj() && $data->scope) {
$data->ext->_updateScope->_updateScope($data, $tpl_var);
}
}
return $data;
}
}
PK McU U * libs/sysplugins/smarty_template_cached.phpnu W+A compile_id = $_template->compile_id;
$this->cache_id = $_template->cache_id;
$this->source = $_template->source;
if (!class_exists('Smarty_CacheResource', false)) {
include SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';
}
$this->handler = Smarty_CacheResource::load($_template->smarty);
}
/**
* @param Smarty_Internal_Template $_template
*
* @return Smarty_Template_Cached
*/
static function load(Smarty_Internal_Template $_template)
{
$_template->cached = new Smarty_Template_Cached($_template);
$_template->cached->handler->populate($_template->cached, $_template);
// caching enabled ?
if (!$_template->caching || $_template->source->handler->recompiled
) {
$_template->cached->valid = false;
}
return $_template->cached;
}
/**
* Render cache template
*
* @param \Smarty_Internal_Template $_template
* @param bool $no_output_filter
*
* @throws \Exception
*/
public function render(Smarty_Internal_Template $_template, $no_output_filter = true)
{
if ($this->isCached($_template)) {
if ($_template->smarty->debugging) {
if (!isset($_template->smarty->_debug)) {
$_template->smarty->_debug = new Smarty_Internal_Debug();
}
$_template->smarty->_debug->start_cache($_template);
}
if (!$this->processed) {
$this->process($_template);
}
$this->getRenderedTemplateCode($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_cache($_template);
}
return;
} else {
$_template->smarty->ext->_updateCache->updateCache($this, $_template, $no_output_filter);
}
}
/**
* Check if cache is valid, lock cache if required
*
* @param \Smarty_Internal_Template $_template
*
* @return bool flag true if cache is valid
*/
public function isCached(Smarty_Internal_Template $_template)
{
if ($this->valid !== null) {
return $this->valid;
}
while (true) {
while (true) {
if ($this->exists === false || $_template->smarty->force_compile || $_template->smarty->force_cache) {
$this->valid = false;
} else {
$this->valid = true;
}
if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_CURRENT
&& $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime)
) {
// lifetime expired
$this->valid = false;
}
if ($this->valid && $_template->compile_check === Smarty::COMPILECHECK_ON
&& $_template->source->getTimeStamp() > $this->timestamp
) {
$this->valid = false;
}
if ($this->valid || !$_template->smarty->cache_locking) {
break;
}
if (!$this->handler->locked($_template->smarty, $this)) {
$this->handler->acquireLock($_template->smarty, $this);
break 2;
}
$this->handler->populate($this, $_template);
}
if ($this->valid) {
if (!$_template->smarty->cache_locking || $this->handler->locked($_template->smarty, $this) === null) {
// load cache file for the following checks
if ($_template->smarty->debugging) {
$_template->smarty->_debug->start_cache($_template);
}
if ($this->handler->process($_template, $this) === false) {
$this->valid = false;
} else {
$this->processed = true;
}
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_cache($_template);
}
} else {
$this->is_locked = true;
continue;
}
} else {
return $this->valid;
}
if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED
&& $_template->cached->cache_lifetime >= 0
&& (time() > ($_template->cached->timestamp + $_template->cached->cache_lifetime))
) {
$this->valid = false;
}
if ($_template->smarty->cache_locking) {
if (!$this->valid) {
$this->handler->acquireLock($_template->smarty, $this);
} elseif ($this->is_locked) {
$this->handler->releaseLock($_template->smarty, $this);
}
}
return $this->valid;
}
return $this->valid;
}
/**
* Process cached template
*
* @param Smarty_Internal_Template $_template template object
* @param bool $update flag if called because cache update
*/
public function process(Smarty_Internal_Template $_template, $update = false)
{
if ($this->handler->process($_template, $this, $update) === false) {
$this->valid = false;
}
if ($this->valid) {
$this->processed = true;
} else {
$this->processed = false;
}
}
/**
* Read cache content from handler
*
* @param Smarty_Internal_Template $_template template object
*
* @return string|false content
*/
public function read(Smarty_Internal_Template $_template)
{
if (!$_template->source->handler->recompiled) {
return $this->handler->readCachedContent($_template);
}
return false;
}
}
PK M4(eX X 4 libs/sysplugins/smarty_internal_method_getglobal.phpnu W+A value;
} else {
return '';
}
} else {
$_result = array();
foreach (Smarty::$global_tpl_vars AS $key => $var) {
$_result[ $key ] = $var->value;
}
return $_result;
}
}
}
PK MX > libs/sysplugins/smarty_internal_method_adddefaultmodifiers.phpnu W+A _getSmartyObj();
if (is_array($modifiers)) {
$smarty->default_modifiers = array_merge($smarty->default_modifiers, $modifiers);
} else {
$smarty->default_modifiers[] = $modifiers;
}
return $obj;
}
}
PK MieA A / libs/sysplugins/smarty_internal_compilebase.phpnu W+A true, 0 => false, 'true' => true, 'false' => false);
/**
* Mapping array with attributes as key
*
* @var array
*/
public $mapCache = array();
/**
* This function checks if the attributes passed are valid
* The attributes passed for the tag to compile are checked against the list of required and
* optional attributes. Required attributes must be present. Optional attributes are check against
* the corresponding list. The keyword '_any' specifies that any attribute will be accepted
* as valid
*
* @param object $compiler compiler object
* @param array $attributes attributes applied to the tag
*
* @return array of mapped attributes for further processing
*/
public function getAttributes($compiler, $attributes)
{
$_indexed_attr = array();
if (!isset($this->mapCache[ 'option' ])) {
$this->mapCache[ 'option' ] = array_fill_keys($this->option_flags, true);
}
foreach ($attributes as $key => $mixed) {
// shorthand ?
if (!is_array($mixed)) {
// option flag ?
if (isset($this->mapCache[ 'option' ][ trim($mixed, '\'"') ])) {
$_indexed_attr[ trim($mixed, '\'"') ] = true;
// shorthand attribute ?
} elseif (isset($this->shorttag_order[ $key ])) {
$_indexed_attr[ $this->shorttag_order[ $key ] ] = $mixed;
} else {
// too many shorthands
$compiler->trigger_template_error('too many shorthand attributes', null, true);
}
// named attribute
} else {
foreach ($mixed as $k => $v) {
// option flag?
if (isset($this->mapCache[ 'option' ][ $k ])) {
if (is_bool($v)) {
$_indexed_attr[ $k ] = $v;
} else {
if (is_string($v)) {
$v = trim($v, '\'" ');
}
if (isset($this->optionMap[ $v ])) {
$_indexed_attr[ $k ] = $this->optionMap[ $v ];
} else {
$compiler->trigger_template_error(
"illegal value '" . var_export($v, true) .
"' for option flag '{$k}'", null, true
);
}
}
// must be named attribute
} else {
$_indexed_attr[ $k ] = $v;
}
}
}
}
// check if all required attributes present
foreach ($this->required_attributes as $attr) {
if (!isset($_indexed_attr[ $attr ])) {
$compiler->trigger_template_error("missing '{$attr}' attribute", null, true);
}
}
// check for not allowed attributes
if ($this->optional_attributes !== array('_any')) {
if (!isset($this->mapCache[ 'all' ])) {
$this->mapCache[ 'all' ] =
array_fill_keys(
array_merge(
$this->required_attributes, $this->optional_attributes,
$this->option_flags
), true
);
}
foreach ($_indexed_attr as $key => $dummy) {
if (!isset($this->mapCache[ 'all' ][ $key ]) && $key !== 0) {
$compiler->trigger_template_error("unexpected '{$key}' attribute", null, true);
}
}
}
// default 'false' for all option flags not set
foreach ($this->option_flags as $flag) {
if (!isset($_indexed_attr[ $flag ])) {
$_indexed_attr[ $flag ] = false;
}
}
if (isset($_indexed_attr[ 'nocache' ]) && $_indexed_attr[ 'nocache' ]) {
$compiler->tag_nocache = true;
}
return $_indexed_attr;
}
/**
* Push opening tag name on stack
* Optionally additional data can be saved on stack
*
* @param object $compiler compiler object
* @param string $openTag the opening tag's name
* @param mixed $data optional data saved
*/
public function openTag($compiler, $openTag, $data = null)
{
array_push($compiler->_tag_stack, array($openTag, $data));
}
/**
* Pop closing tag
* Raise an error if this stack-top doesn't match with expected opening tags
*
* @param object $compiler compiler object
* @param array|string $expectedTag the expected opening tag names
*
* @return mixed any type the opening tag's name or saved data
*/
public function closeTag($compiler, $expectedTag)
{
if (count($compiler->_tag_stack) > 0) {
// get stacked info
list($_openTag, $_data) = array_pop($compiler->_tag_stack);
// open tag must match with the expected ones
if (in_array($_openTag, (array) $expectedTag)) {
if (is_null($_data)) {
// return opening tag
return $_openTag;
} else {
// return restored data
return $_data;
}
}
// wrong nesting of tags
$compiler->trigger_template_error("unclosed '{$compiler->smarty->left_delimiter}{$_openTag}{$compiler->smarty->right_delimiter}' tag");
return;
}
// wrong nesting of tags
$compiler->trigger_template_error('unexpected closing tag', null, true);
return;
}
}
PK MXB 8 libs/sysplugins/smarty_internal_method_clearallcache.phpnu W+A _clearTemplateCache();
// load cache resource and call clearAll
$_cache_resource = Smarty_CacheResource::load($smarty, $type);
return $_cache_resource->clearAll($smarty, $exp_time);
}
}
PK M,O ; libs/sysplugins/smarty_internal_method_getdebugtemplate.phpnu W+A _getSmartyObj();
return $smarty->debug_tpl;
}
}
PK MӞ
0 libs/sysplugins/smarty_internal_resource_php.phpnu W+A short_open_tag = function_exists('ini_get') ? ini_get('short_open_tag') : 1;
}
/**
* Load template's source from file into current template object
*
* @param Smarty_Template_Source $source source object
*
* @return string template source
* @throws SmartyException if source cannot be loaded
*/
public function getContent(Smarty_Template_Source $source)
{
if ($source->exists) {
return '';
}
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
/**
* populate compiled object with compiled filepath
*
* @param Smarty_Template_Compiled $compiled compiled object
* @param Smarty_Internal_Template $_template template object (is ignored)
*/
public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
{
$compiled->filepath = $_template->source->filepath;
$compiled->timestamp = $_template->source->timestamp;
$compiled->exists = $_template->source->exists;
$compiled->file_dependency[ $_template->source->uid ] =
array($compiled->filepath,
$compiled->timestamp,
$_template->source->type,);
}
/**
* Render and output the template (without using the compiler)
*
* @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object
*
* @return void
* @throws SmartyException if template cannot be loaded or allow_php_templates is disabled
*/
public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
{
if (!$source->smarty->allow_php_templates) {
throw new SmartyException('PHP templates are disabled');
}
if (!$source->exists) {
throw new SmartyException(
"Unable to load template '{$source->type}:{$source->name}'" .
($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : '')
);
}
// prepare variables
extract($_template->getTemplateVars());
// include PHP template with short open tags enabled
if (function_exists('ini_set')) {
ini_set('short_open_tag', '1');
}
/**
*
*
* @var Smarty_Internal_Template $_smarty_template
* used in included file
*/
$_smarty_template = $_template;
include $source->filepath;
if (function_exists('ini_set')) {
ini_set('short_open_tag', $this->short_open_tag);
}
}
}
PK Mr;6 ;6 0 libs/sysplugins/smarty_internal_templatebase.phpnu W+A _execute($template, $cache_id, $compile_id, $parent, 0);
return $result === null ? ob_get_clean() : $result;
}
/**
* displays a Smarty template
*
* @param string $template the resource handle of the template file or template object
* @param mixed $cache_id cache id to be used with this template
* @param mixed $compile_id compile id to be used with this template
* @param object $parent next higher level of Smarty variables
*
* @throws \Exception
* @throws \SmartyException
*/
public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
{
// display template
$this->_execute($template, $cache_id, $compile_id, $parent, 1);
}
/**
* test if cache is valid
*
* @api Smarty::isCached()
* @link http://www.smarty.net/docs/en/api.is.cached.tpl
*
* @param null|string|\Smarty_Internal_Template $template the resource handle of the template file or template object
* @param mixed $cache_id cache id to be used with this template
* @param mixed $compile_id compile id to be used with this template
* @param object $parent next higher level of Smarty variables
*
* @return bool cache status
* @throws \Exception
* @throws \SmartyException
*/
public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
{
return $this->_execute($template, $cache_id, $compile_id, $parent, 2);
}
/**
* fetches a rendered Smarty template
*
* @param string $template the resource handle of the template file or template object
* @param mixed $cache_id cache id to be used with this template
* @param mixed $compile_id compile id to be used with this template
* @param object $parent next higher level of Smarty variables
* @param string $function function type 0 = fetch, 1 = display, 2 = isCache
*
* @return mixed
* @throws \Exception
* @throws \SmartyException
*/
private function _execute($template, $cache_id, $compile_id, $parent, $function)
{
$smarty = $this->_getSmartyObj();
$saveVars = true;
if ($template === null) {
if (!$this->_isTplObj()) {
throw new SmartyException($function . '():Missing \'$template\' parameter');
} else {
$template = $this;
}
} elseif (is_object($template)) {
/* @var Smarty_Internal_Template $template */
if (!isset($template->_objType) || !$template->_isTplObj()) {
throw new SmartyException($function . '():Template object expected');
}
} else {
// get template object
$saveVars = false;
$template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent ? $parent : $this, false);
if ($this->_objType === 1) {
// set caching in template object
$template->caching = $this->caching;
}
}
// make sure we have integer values
$template->caching = (int)$template->caching;
// fetch template content
$level = ob_get_level();
try {
$_smarty_old_error_level =
isset($smarty->error_reporting) ? error_reporting($smarty->error_reporting) : null;
if ($this->_objType === 2) {
/* @var Smarty_Internal_Template $this */
$template->tplFunctions = $this->tplFunctions;
$template->inheritance = $this->inheritance;
}
/* @var Smarty_Internal_Template $parent */
if (isset($parent->_objType) && ($parent->_objType === 2) && !empty($parent->tplFunctions)) {
$template->tplFunctions = array_merge($parent->tplFunctions, $template->tplFunctions);
}
if ($function === 2) {
if ($template->caching) {
// return cache status of template
if (!isset($template->cached)) {
$template->loadCached();
}
$result = $template->cached->isCached($template);
Smarty_Internal_Template::$isCacheTplObj[ $template->_getTemplateId() ] = $template;
} else {
return false;
}
} else {
if ($saveVars) {
$savedTplVars = $template->tpl_vars;
$savedConfigVars = $template->config_vars;
}
ob_start();
$template->_mergeVars();
if (!empty(Smarty::$global_tpl_vars)) {
$template->tpl_vars = array_merge(Smarty::$global_tpl_vars, $template->tpl_vars);
}
$result = $template->render(false, $function);
$template->_cleanUp();
if ($saveVars) {
$template->tpl_vars = $savedTplVars;
$template->config_vars = $savedConfigVars;
} else {
if (!$function && !isset(Smarty_Internal_Template::$tplObjCache[ $template->templateId ])) {
$template->parent = null;
$template->tpl_vars = $template->config_vars = array();
Smarty_Internal_Template::$tplObjCache[ $template->templateId ] = $template;
}
}
}
if (isset($_smarty_old_error_level)) {
error_reporting($_smarty_old_error_level);
}
return $result;
}
catch (Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
if (isset($_smarty_old_error_level)) {
error_reporting($_smarty_old_error_level);
}
throw $e;
}
}
/**
* Registers plugin to be used in templates
*
* @api Smarty::registerPlugin()
* @link http://www.smarty.net/docs/en/api.register.plugin.tpl
*
* @param string $type plugin type
* @param string $name name of template tag
* @param callback $callback PHP callback to register
* @param bool $cacheable if true (default) this function is cache able
* @param mixed $cache_attr caching attributes if any
*
* @return \Smarty|\Smarty_Internal_Template
* @throws SmartyException when the plugin tag is invalid
*/
public function registerPlugin($type, $name, $callback, $cacheable = true, $cache_attr = null)
{
return $this->ext->registerPlugin->registerPlugin($this, $type, $name, $callback, $cacheable, $cache_attr);
}
/**
* load a filter of specified type and name
*
* @api Smarty::loadFilter()
* @link http://www.smarty.net/docs/en/api.load.filter.tpl
*
* @param string $type filter type
* @param string $name filter name
*
* @return bool
* @throws SmartyException if filter could not be loaded
*/
public function loadFilter($type, $name)
{
return $this->ext->loadFilter->loadFilter($this, $type, $name);
}
/**
* Registers a filter function
*
* @api Smarty::registerFilter()
* @link http://www.smarty.net/docs/en/api.register.filter.tpl
*
* @param string $type filter type
* @param callback $callback
* @param string|null $name optional filter name
*
* @return \Smarty|\Smarty_Internal_Template
* @throws \SmartyException
*/
public function registerFilter($type, $callback, $name = null)
{
return $this->ext->registerFilter->registerFilter($this, $type, $callback, $name);
}
/**
* Registers object to be used in templates
*
* @api Smarty::registerObject()
* @link http://www.smarty.net/docs/en/api.register.object.tpl
*
* @param string $object_name
* @param object $object the referenced PHP object to register
* @param array $allowed_methods_properties list of allowed methods (empty = all)
* @param bool $format smarty argument format, else traditional
* @param array $block_methods list of block-methods
*
* @return \Smarty|\Smarty_Internal_Template
* @throws \SmartyException
*/
public function registerObject($object_name, $object, $allowed_methods_properties = array(), $format = true,
$block_methods = array()
) {
return $this->ext->registerObject->registerObject(
$this, $object_name, $object, $allowed_methods_properties,
$format, $block_methods
);
}
/**
* @param int $compile_check
*/
public function setCompileCheck($compile_check)
{
$this->compile_check = (int)$compile_check;
}
/**
* @param int $caching
*/
public function setCaching($caching)
{
$this->caching = (int)$caching;
}
/**
* @param int $cache_lifetime
*/
public function setCacheLifetime($cache_lifetime)
{
$this->cache_lifetime = $cache_lifetime;
}
/**
* @param string $compile_id
*/
public function setCompileId($compile_id)
{
$this->compile_id = $compile_id;
}
/**
* @param string $cache_id
*/
public function setCacheId($cache_id)
{
$this->cache_id = $cache_id;
}
}
PK M"J]^ * libs/sysplugins/smarty_template_source.phpnu W+A handler =
isset($smarty->_cache[ 'resource_handlers' ][ $type ]) ? $smarty->_cache[ 'resource_handlers' ][ $type ] :
Smarty_Resource::load($smarty, $type);
$this->smarty = $smarty;
$this->resource = $resource;
$this->type = $type;
$this->name = $name;
}
/**
* initialize Source Object for given resource
* Either [$_template] or [$smarty, $template_resource] must be specified
*
* @param Smarty_Internal_Template $_template template object
* @param Smarty $smarty smarty object
* @param string $template_resource resource identifier
*
* @return Smarty_Template_Source Source Object
* @throws SmartyException
*/
public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null,
$template_resource = null
) {
if ($_template) {
$smarty = $_template->smarty;
$template_resource = $_template->template_resource;
}
if (empty($template_resource)) {
throw new SmartyException('Source: Missing name');
}
// parse resource_name, load resource handler, identify unique resource name
if (preg_match('/^([A-Za-z0-9_\-]{2,})[:]([\s\S]*)$/', $template_resource, $match)) {
$type = $match[ 1 ];
$name = $match[ 2 ];
} else {
// no resource given, use default
// or single character before the colon is not a resource type, but part of the filepath
$type = $smarty->default_resource_type;
$name = $template_resource;
}
// create new source object
$source = new Smarty_Template_Source($smarty, $template_resource, $type, $name);
$source->handler->populate($source, $_template);
if (!$source->exists && isset($_template->smarty->default_template_handler_func)) {
Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
$source->handler->populate($source, $_template);
}
return $source;
}
/**
* Get source time stamp
*
* @return int
*/
public function getTimeStamp()
{
if (!isset($this->timestamp)) {
$this->handler->populateTimestamp($this);
}
return $this->timestamp;
}
/**
* Get source content
*
* @return string
* @throws \SmartyException
*/
public function getContent()
{
return isset($this->content) ? $this->content : $this->handler->getContent($this);
}
}
PK Mhk 7 libs/sysplugins/smarty_internal_runtime_updatecache.phpnu W+A compiled)) {
$_template->loadCompiled();
}
$_template->compiled->render($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->start_cache($_template);
}
$this->removeNoCacheHash($cached, $_template, $no_output_filter);
$compile_check = (int)$_template->compile_check;
$_template->compile_check = Smarty::COMPILECHECK_OFF;
if ($_template->_isSubTpl()) {
$_template->compiled->unifunc = $_template->parent->compiled->unifunc;
}
if (!$_template->cached->processed) {
$_template->cached->process($_template, true);
}
$_template->compile_check = $compile_check;
$cached->getRenderedTemplateCode($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_cache($_template);
}
}
/**
* Sanitize content and write it to cache resource
*
* @param \Smarty_Template_Cached $cached
* @param Smarty_Internal_Template $_template
* @param bool $no_output_filter
*
* @throws \SmartyException
*/
public function removeNoCacheHash(Smarty_Template_Cached $cached,
Smarty_Internal_Template $_template,
$no_output_filter
) {
$php_pattern = '/(<%|%>|<\?php|<\?|\?>|]*>)|(]*>)|(
]*>.*?]*>)#is', $text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER ) ) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@'; $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length); $_offset += $_length - strlen($replace); $_store ++; } } $expressions = array(// replace multiple spaces between tags by a single space '#(:SMARTY@!@|>)[\040\011]+(?=@!@SMARTY:|<)#s' => '\1 \2', // remove newline between tags '#(:SMARTY@!@|>)[\040\011]*[\n]\s*(?=@!@SMARTY:|<)#s' => '\1\2', // remove multiple spaces between attributes (but not in attribute values!) '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5', '#>[\040\011]+$#Ss' => '> ', '#>[\040\011]*[\n]\s*$#Ss' => '>', $this->stripRegEx => '',); $text = preg_replace(array_keys($expressions), array_values($expressions), $text); $_offset = 0; if (preg_match_all( '#@!@SMARTY:([0-9]+):SMARTY@!@#is', $text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER ) ) { foreach ($matches as $match) { $_length = strlen($match[ 0 ][ 0 ]); $replace = $store[ $match[ 1 ][ 0 ] ]; $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length); $_offset += strlen($replace) - $_length; $_store ++; } } } else { $text = preg_replace($this->stripRegEx, '', $text); } } return new Smarty_Internal_ParseTree_Text($text); } return null; } /** * lazy loads internal compile plugin for tag and calls the compile method * compile objects cached for reuse. * class name format: Smarty_Internal_Compile_TagName * plugin filename format: Smarty_Internal_TagName.php * * @param string $tag tag name * @param array $args list of tag attributes * @param mixed $param1 optional parameter * @param mixed $param2 optional parameter * @param mixed $param3 optional parameter * * @return bool|string compiled code or false * @throws \SmartyCompilerException */ public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null) { /* @var Smarty_Internal_CompileBase $tagCompiler */ $tagCompiler = $this->getTagCompiler($tag); // compile this tag return $tagCompiler === false ? false : $tagCompiler->compile($args, $this, $param1, $param2, $param3); } /** * lazy loads internal compile plugin for tag compile objects cached for reuse. * * class name format: Smarty_Internal_Compile_TagName * plugin filename format: Smarty_Internal_TagName.php * * @param string $tag tag name * * @return bool|\Smarty_Internal_CompileBase tag compiler object or false if not found * @throws \SmartyCompilerException */ public function getTagCompiler($tag) { // re-use object if already exists if (!isset(self::$_tag_objects[ $tag ])) { // lazy load internal compiler plugin $_tag = explode('_', $tag); $_tag = array_map('ucfirst', $_tag); $class_name = 'Smarty_Internal_Compile_' . implode('_', $_tag); if (class_exists($class_name) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) ) { self::$_tag_objects[ $tag ] = new $class_name; } else { self::$_tag_objects[ $tag ] = false; } } return self::$_tag_objects[ $tag ]; } /** * Check for plugins and return function name * * @param $plugin_name * @param string $plugin_type type of plugin * * @return string call name of function * @throws \SmartyException */ public function getPlugin($plugin_name, $plugin_type) { $function = null; if ($this->caching && ($this->nocache || $this->tag_nocache)) { if (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { $function = $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } else if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ] = $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ]; $function = $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } } else { if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { $function = $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } else if (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ] = $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ]; $function = $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } } if (isset($function)) { if ($plugin_type === 'modifier') { $this->modifier_plugins[ $plugin_name ] = true; } return $function; } // loop through plugin dirs and find the plugin $function = 'smarty_' . $plugin_type . '_' . $plugin_name; $file = $this->smarty->loadPlugin($function, false); if (is_string($file)) { if ($this->caching && ($this->nocache || $this->tag_nocache)) { $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'file' ] = $file; $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ] = $function; } else { $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'file' ] = $file; $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ] = $function; } if ($plugin_type === 'modifier') { $this->modifier_plugins[ $plugin_name ] = true; } return $function; } if (is_callable($function)) { // plugin function is defined in the script return $function; } return false; } /** * Check for plugins by default plugin handler * * @param string $tag name of tag * @param string $plugin_type type of plugin * * @return bool true if found * @throws \SmartyCompilerException */ public function getPluginFromDefaultHandler($tag, $plugin_type) { $callback = null; $script = null; $cacheable = true; $result = call_user_func_array( $this->smarty->default_plugin_handler_func, array($tag, $plugin_type, $this->template, &$callback, &$script, &$cacheable,) ); if ($result) { $this->tag_nocache = $this->tag_nocache || !$cacheable; if ($script !== null) { if (is_file($script)) { if ($this->caching && ($this->nocache || $this->tag_nocache)) { $this->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'file' ] = $script; $this->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'function' ] = $callback; } else { $this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'file' ] = $script; $this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] = $callback; } include_once $script; } else { $this->trigger_template_error("Default plugin handler: Returned script file '{$script}' for '{$tag}' not found"); } } if (is_callable($callback)) { $this->default_handler_plugins[ $plugin_type ][ $tag ] = array($callback, true, array()); return true; } else { $this->trigger_template_error("Default plugin handler: Returned callback for '{$tag}' not callable"); } } return false; } /** * Append code segments and remove unneeded ?> \s?$/D', $left) && preg_match('/^<\?php\s+/', $right)) { $left = preg_replace('/\s*\?>\s?$/D', "\n", $left); $left .= preg_replace('/^<\?php\s+/', '', $right); } else { $left .= $right; } return $left; } /** * Inject inline code for nocache template sections * This method gets the content of each template element from the parser. * If the content is compiled code and it should be not cached the code is injected * into the rendered output. * * @param string $content content of template element * @param boolean $is_code true if content is compiled code * * @return string content */ public function processNocacheCode($content, $is_code) { // If the template is not evaluated and we have a nocache section and or a nocache tag if ($is_code && !empty($content)) { // generate replacement code if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->caching && !$this->suppressNocacheProcessing && ($this->nocache || $this->tag_nocache) ) { $this->template->compiled->has_nocache_code = true; $_output = addcslashes($content, '\'\\'); $_output = str_replace('^#^', '\'', $_output); $_output = "nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n"; // make sure we include modifier plugins for nocache code foreach ($this->modifier_plugins as $plugin_name => $dummy) { if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ])) { $this->required_plugins[ 'nocache' ][ $plugin_name ][ 'modifier' ] = $this->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ]; } } } else { $_output = $content; } } else { $_output = $content; } $this->modifier_plugins = array(); $this->suppressNocacheProcessing = false; $this->tag_nocache = false; return $_output; } /** * Get Id * * @param string $input * * @return bool|string */ public function getId($input) { if (preg_match('~^([\'"]*)([0-9]*[a-zA-Z_]\w*)\1$~', $input, $match)) { return $match[ 2 ]; } return false; } /** * Get variable name from string * * @param string $input * * @return bool|string */ public function getVariableName($input) { if (preg_match('~^[$]_smarty_tpl->tpl_vars\[[\'"]*([0-9]*[a-zA-Z_]\w*)[\'"]*\]->value$~', $input, $match)) { return $match[ 1 ]; } return false; } /** * Set nocache flag in variable or create new variable * * @param string $varName */ public function setNocacheInVariable($varName) { // create nocache var to make it know for further compiling if ($_var = $this->getId($varName)) { if (isset($this->template->tpl_vars[ $_var ])) { $this->template->tpl_vars[ $_var ] = clone $this->template->tpl_vars[ $_var ]; $this->template->tpl_vars[ $_var ]->nocache = true; } else { $this->template->tpl_vars[ $_var ] = new Smarty_Variable(null, true); } } } /** * @param array $_attr tag attributes * @param array $validScopes * * @return int|string * @throws \SmartyCompilerException */ public function convertScope($_attr, $validScopes) { $_scope = 0; if (isset($_attr[ 'scope' ])) { $_scopeName = trim($_attr[ 'scope' ], '\'"'); if (is_numeric($_scopeName) && in_array($_scopeName, $validScopes)) { $_scope = $_scopeName; } else if (is_string($_scopeName)) { $_scopeName = trim($_scopeName, '\'"'); $_scope = isset($validScopes[ $_scopeName ]) ? $validScopes[ $_scopeName ] : false; } else { $_scope = false; } if ($_scope === false) { $err = var_export($_scopeName, true); $this->trigger_template_error("illegal value '{$err}' for \"scope\" attribute", null, true); } } return $_scope; } /** * Generate nocache code string * * @param string $code PHP code * * @return string */ public function makeNocacheCode($code) { return "echo '/*%%SmartyNocache:{$this->nocache_hash}%%*//*/%%SmartyNocache:{$this->nocache_hash}%%*/';\n"; } /** * display compiler error messages without dying * If parameter $args is empty it is a parser detected syntax error. * In this case the parser is called to obtain information about expected tokens. * If parameter $args contains a string this is used as error message * * @param string $args individual error message or null * @param string $line line-number * @param null|bool $tagline if true the line number of last tag * * @throws \SmartyCompilerException when an unexpected token is found */ public function trigger_template_error($args = null, $line = null, $tagline = null) { $lex = $this->parser->lex; if ($tagline === true) { // get line number of Tag $line = $lex->taglineno; } else if (!isset($line)) { // get template source line which has error $line = $lex->line; } else { $line = (int)$line; } if (in_array( $this->template->source->type, array('eval', 'string') ) ) { $templateName = $this->template->source->type . ':' . trim( preg_replace( '![\t\r\n]+!', ' ', strlen($lex->data) > 40 ? substr($lex->data, 0, 40) . '...' : $lex->data ) ); } else { $templateName = $this->template->source->type . ':' . $this->template->source->filepath; } // $line += $this->trace_line_offset; $match = preg_split("/\n/", $lex->data); $error_text = 'Syntax error in template "' . (empty($this->trace_filepath) ? $templateName : $this->trace_filepath) . '" on line ' . ($line + $this->trace_line_offset) . ' "' . trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ])) . '" '; if (isset($args)) { // individual error message $error_text .= $args; } else { $expect = array(); // expected token from parser $error_text .= ' - Unexpected "' . $lex->value . '"'; if (count($this->parser->yy_get_expected_tokens($this->parser->yymajor)) <= 4) { foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) { $exp_token = $this->parser->yyTokenName[ $token ]; if (isset($lex->smarty_token_names[ $exp_token ])) { // token type from lexer $expect[] = '"' . $lex->smarty_token_names[ $exp_token ] . '"'; } else { // otherwise internal token name $expect[] = $this->parser->yyTokenName[ $token ]; } } $error_text .= ', expected one of: ' . implode(' , ', $expect); } } if ($this->smarty->_parserdebug) { $this->parser->errorRunDown(); echo ob_get_clean(); flush(); } $e = new SmartyCompilerException($error_text); $e->line = $line; $e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ])); $e->desc = $args; $e->template = $this->template->source->filepath; throw $e; } /** * Return var_export() value with all white spaces removed * * @param mixed $value * * @return string */ public function getVarExport($value) { return preg_replace('/\s/', '', var_export($value, true)); } /** * enter double quoted string * - save tag stack count */ public function enterDoubleQuote() { array_push($this->_tag_stack_count, $this->getTagStackCount()); } /** * Return tag stack count * * @return int */ public function getTagStackCount() { return count($this->_tag_stack); } /** * @param $lexerPreg * * @return mixed */ public function replaceDelimiter($lexerPreg) { return str_replace( array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'), array($this->ldelPreg, $this->literalPreg, $this->rdelPreg, $this->smarty->getAutoLiteral() ? '{1,}' : '{9}', $this->smarty->getAutoLiteral() ? '' : '\\s*'), $lexerPreg ); } /** * Build lexer regular expressions for left and right delimiter and user defined literals */ public function initDelimiterPreg() { $ldel = $this->smarty->getLeftDelimiter(); $this->ldelLength = strlen($ldel); $this->ldelPreg = ''; foreach (str_split($ldel, 1) as $chr) { $this->ldelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; } $rdel = $this->smarty->getRightDelimiter(); $this->rdelLength = strlen($rdel); $this->rdelPreg = ''; foreach (str_split($rdel, 1) as $chr) { $this->rdelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; } $literals = $this->smarty->getLiterals(); if (!empty($literals)) { foreach ($literals as $key => $literal) { $literalPreg = ''; foreach (str_split($literal, 1) as $chr) { $literalPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; } $literals[ $key ] = $literalPreg; } $this->literalPreg = '|' . implode('|', $literals); } else { $this->literalPreg = ''; } } /** * leave double quoted string * - throw exception if block in string was not closed * * @throws \SmartyCompilerException */ public function leaveDoubleQuote() { if (array_pop($this->_tag_stack_count) !== $this->getTagStackCount()) { $tag = $this->getOpenBlockTag(); $this->trigger_template_error( "unclosed '{{$tag}}' in doubled quoted string", null, true ); } } /** * Get left delimiter preg * * @return string */ public function getLdelPreg() { return $this->ldelPreg; } /** * Get right delimiter preg * * @return string */ public function getRdelPreg() { return $this->rdelPreg; } /** * Get length of left delimiter * * @return int */ public function getLdelLength() { return $this->ldelLength; } /** * Get length of right delimiter * * @return int */ public function getRdelLength() { return $this->rdelLength; } /** * Get name of current open block tag * * @return string|boolean */ public function getOpenBlockTag() { $tagCount = $this->getTagStackCount(); if ($tagCount) { return $this->_tag_stack[ $tagCount - 1 ][ 0 ]; } else { return false; } } /** * Check if $value contains variable elements * * @param mixed $value * * @return bool|int */ public function isVariable($value) { if (is_string($value)) { return preg_match('/[$(]/', $value); } if (is_bool($value) || is_numeric($value)) { return false; } if (is_array($value)) { foreach ($value as $k => $v) { if ($this->isVariable($k) || $this->isVariable($v)) { return true; } } return false; } return false; } /** * Get new prefix variable name * * @return string */ public function getNewPrefixVariable() { ++self::$prefixVariableNumber; return $this->getPrefixVariable(); } /** * Get current prefix variable name * * @return string */ public function getPrefixVariable() { return '$_prefixVariable' . self::$prefixVariableNumber; } /** * append code to prefix buffer * * @param string $code */ public function appendPrefixCode($code) { $this->prefix_code[] = $code; } /** * get prefix code string * * @return string */ public function getPrefixCode() { $code = ''; $prefixArray = array_merge($this->prefix_code, array_pop($this->prefixCodeStack)); $this->prefixCodeStack[] = array(); foreach ($prefixArray as $c) { $code = $this->appendCode($code, $c); } $this->prefix_code = array(); return $code; } /** * Save current required plugins * * @param bool $init if true init required plugins */ public function saveRequiredPlugins($init=false) { $this->required_plugins_stack[] = $this->required_plugins; if ($init) { $this->required_plugins = array('compiled' => array(), 'nocache' => array()); } } /** * Restore required plugins */ public function restoreRequiredPlugins() { $this->required_plugins = array_pop($this->required_plugins_stack); } /** * Compile code to call Smarty_Internal_Template::_checkPlugins() * for required plugins * * @return string */ public function compileRequiredPlugins() { $code = $this->compileCheckPlugins($this->required_plugins[ 'compiled' ]); if ($this->caching && !empty($this->required_plugins[ 'nocache' ])) { $code .= $this->makeNocacheCode($this->compileCheckPlugins($this->required_plugins[ 'nocache' ])); } return $code; } /** * Compile code to call Smarty_Internal_Template::_checkPlugins * - checks if plugin is callable require otherwise * * @param $requiredPlugins * * @return string */ public function compileCheckPlugins($requiredPlugins) { if (!empty($requiredPlugins)) { $plugins = array(); foreach ($requiredPlugins as $plugin) { foreach ($plugin as $data) { $plugins[] = $data; } } return '$_smarty_tpl->_checkPlugins(' . $this->getVarExport($plugins) . ');' . "\n"; } else { return ''; } } /** * method to compile a Smarty template * * @param mixed $_content template source * @param bool $isTemplateSource * * @return bool true if compiling succeeded, false if it failed */ abstract protected function doCompile($_content, $isTemplateSource = false); /** * Compile Tag * * @param string $tag tag name * @param array $args array with tag attributes * @param array $parameter array with compilation parameter * * @throws SmartyCompilerException * @throws SmartyException * @return string compiled code */ private function compileTag2($tag, $args, $parameter) { $plugin_type = ''; // $args contains the attributes parsed and compiled by the lexer/parser // assume that tag does compile into code, but creates no HTML output $this->has_code = true; // log tag/attributes if (isset($this->smarty->_cache[ 'get_used_tags' ])) { $this->template->_cache[ 'used_tags' ][] = array($tag, $args); } // check nocache option flag foreach ($args as $arg) { if (!is_array($arg)) { if ($arg === "'nocache'" || $arg === 'nocache') { $this->tag_nocache = true; } } else { foreach ($arg as $k => $v) { if (($k === "'nocache'" || $k === 'nocache') && (trim($v, "'\" ") === 'true')) { $this->tag_nocache = true; } } } } // compile the smarty tag (required compile classes to compile the tag are auto loaded) if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) { if (isset($this->parent_compiler->tpl_function[ $tag ]) || (isset($this->template->smarty->ext->_tplFunction) && $this->template->smarty->ext->_tplFunction->getTplFunction($this->template, $tag) !== false) ) { // template defined by {template} tag $args[ '_attr' ][ 'name' ] = "'{$tag}'"; $_output = $this->callTagCompiler('call', $args, $parameter); } } if ($_output !== false) { if ($_output !== true) { // did we get compiled code if ($this->has_code) { // return compiled code return $_output; } } // tag did not produce compiled code return null; } else { // map_named attributes if (isset($args[ '_attr' ])) { foreach ($args[ '_attr' ] as $key => $attribute) { if (is_array($attribute)) { $args = array_merge($args, $attribute); } } } // not an internal compiler tag if (strlen($tag) < 6 || substr($tag, -5) !== 'close') { // check if tag is a registered object if (isset($this->smarty->registered_objects[ $tag ]) && isset($parameter[ 'object_method' ])) { $method = $parameter[ 'object_method' ]; if (!in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ]) && (empty($this->smarty->registered_objects[ $tag ][ 1 ]) || in_array($method, $this->smarty->registered_objects[ $tag ][ 1 ])) ) { return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $method); } else if (in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])) { return $this->callTagCompiler( 'private_object_block_function', $args, $parameter, $tag, $method ); } else { // throw exception $this->trigger_template_error( 'not allowed method "' . $method . '" in registered object "' . $tag . '"', null, true ); } } // check if tag is registered foreach (array(Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK,) as $plugin_type) { if (isset($this->smarty->registered_plugins[ $plugin_type ][ $tag ])) { // if compiler function plugin call it now if ($plugin_type === Smarty::PLUGIN_COMPILER) { $new_args = array(); foreach ($args as $key => $mixed) { if (is_array($mixed)) { $new_args = array_merge($new_args, $mixed); } else { $new_args[ $key ] = $mixed; } } if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) { $this->tag_nocache = true; } return call_user_func_array( $this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ], array($new_args, $this) ); } // compile registered function or block function if ($plugin_type === Smarty::PLUGIN_FUNCTION || $plugin_type === Smarty::PLUGIN_BLOCK) { return $this->callTagCompiler( 'private_registered_' . $plugin_type, $args, $parameter, $tag ); } } } // check plugins from plugins folder foreach ($this->plugin_search_order as $plugin_type) { if ($plugin_type === Smarty::PLUGIN_COMPILER && $this->smarty->loadPlugin('smarty_compiler_' . $tag) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) ) { $plugin = 'smarty_compiler_' . $tag; if (is_callable($plugin)) { // convert arguments format for old compiler plugins $new_args = array(); foreach ($args as $key => $mixed) { if (is_array($mixed)) { $new_args = array_merge($new_args, $mixed); } else { $new_args[ $key ] = $mixed; } } return $plugin($new_args, $this->smarty); } if (class_exists($plugin, false)) { $plugin_object = new $plugin; if (method_exists($plugin_object, 'compile')) { return $plugin_object->compile($args, $this); } } throw new SmartyException("Plugin '{$tag}' not callable"); } else { if ($function = $this->getPlugin($tag, $plugin_type)) { if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this) ) { return $this->callTagCompiler( 'private_' . $plugin_type . '_plugin', $args, $parameter, $tag, $function ); } } } } if (is_callable($this->smarty->default_plugin_handler_func)) { $found = false; // look for already resolved tags foreach ($this->plugin_search_order as $plugin_type) { if (isset($this->default_handler_plugins[ $plugin_type ][ $tag ])) { $found = true; break; } } if (!$found) { // call default handler foreach ($this->plugin_search_order as $plugin_type) { if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) { $found = true; break; } } } if ($found) { // if compiler function plugin call it now if ($plugin_type === Smarty::PLUGIN_COMPILER) { $new_args = array(); foreach ($args as $key => $mixed) { if (is_array($mixed)) { $new_args = array_merge($new_args, $mixed); } else { $new_args[ $key ] = $mixed; } } return call_user_func_array( $this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ], array($new_args, $this) ); } else { return $this->callTagCompiler( 'private_registered_' . $plugin_type, $args, $parameter, $tag ); } } } } else { // compile closing tag of block function $base_tag = substr($tag, 0, -5); // check if closing tag is a registered object if (isset($this->smarty->registered_objects[ $base_tag ]) && isset($parameter[ 'object_method' ])) { $method = $parameter[ 'object_method' ]; if (in_array($method, $this->smarty->registered_objects[ $base_tag ][ 3 ])) { return $this->callTagCompiler( 'private_object_block_function', $args, $parameter, $tag, $method ); } else { // throw exception $this->trigger_template_error( 'not allowed closing tag method "' . $method . '" in registered object "' . $base_tag . '"', null, true ); } } // registered block tag ? if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) || isset($this->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) ) { return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag); } // registered function tag ? if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) { return $this->callTagCompiler('private_registered_function', $args, $parameter, $tag); } // block plugin? if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) { return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function); } // function plugin? if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) { if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this) ) { return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function); } } // registered compiler plugin ? if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ])) { // if compiler function plugin call it now $args = array(); if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) { $this->tag_nocache = true; } return call_user_func_array( $this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ], array($args, $this) ); } if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) { $plugin = 'smarty_compiler_' . $tag; if (is_callable($plugin)) { return $plugin($args, $this->smarty); } if (class_exists($plugin, false)) { $plugin_object = new $plugin; if (method_exists($plugin_object, 'compile')) { return $plugin_object->compile($args, $this); } } throw new SmartyException("Plugin '{$tag}' not callable"); } } $this->trigger_template_error("unknown tag '{$tag}'", null, true); } } } PK M]7 3 libs/sysplugins/smarty_internal_method_literals.phpnu W+A _getSmartyObj(); return (array)$smarty->literals; } /** * Add literals * * @api Smarty::addLiterals() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param array|string $literals literal or list of literals * to addto add * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException */ public function addLiterals(Smarty_Internal_TemplateBase $obj, $literals = null) { if (isset($literals)) { $this->set($obj->_getSmartyObj(), (array)$literals); } return $obj; } /** * Set literals * * @api Smarty::setLiterals() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param array|string $literals literal or list of literals * to setto set * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException */ public function setLiterals(Smarty_Internal_TemplateBase $obj, $literals = null) { $smarty = $obj->_getSmartyObj(); $smarty->literals = array(); if (!empty($literals)) { $this->set($smarty, (array)$literals); } return $obj; } /** * common setter for literals for easier handling of duplicates the * Smarty::$literals array gets filled with identical key values * * @param \Smarty $smarty * @param array $literals * * @throws \SmartyException */ private function set(Smarty $smarty, $literals) { $literals = array_combine($literals, $literals); $error = isset($literals[ $smarty->left_delimiter ]) ? array($smarty->left_delimiter) : array(); $error = isset($literals[ $smarty->right_delimiter ]) ? $error[] = $smarty->right_delimiter : $error; if (!empty($error)) { throw new SmartyException( 'User defined literal(s) "' . $error . '" may not be identical with left or right delimiter' ); } $smarty->literals = array_merge((array)$smarty->literals, (array)$literals); } } PK M#" " ( libs/sysplugins/smarty_internal_data.phpnu W+A ext = new Smarty_Internal_Extension_Handler(); $this->ext->objType = $this->_objType; } /** * assigns a Smarty variable * * @param array|string $tpl_var the template variable name(s) * @param mixed $value the value to assign * @param boolean $nocache if true any output of this variable will be not cached * * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for * chaining */ public function assign($tpl_var, $value = null, $nocache = false) { if (is_array($tpl_var)) { foreach ($tpl_var as $_key => $_val) { $this->assign($_key, $_val, $nocache); } } else { if ($tpl_var !== '') { if ($this->_objType === 2) { /** * * * @var Smarty_Internal_Template $this */ $this->_assignInScope($tpl_var, $value, $nocache); } else { $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache); } } } return $this; } /** * appends values to template variables * * @api Smarty::append() * @link http://www.smarty.net/docs/en/api.append.tpl * * @param array|string $tpl_var the template variable name(s) * @param mixed $value the value to append * @param bool $merge flag if array elements shall be merged * @param bool $nocache if true any output of this variable will * be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function append($tpl_var, $value = null, $merge = false, $nocache = false) { return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache); } /** * assigns a global Smarty variable * * @param string $varName the global variable name * @param mixed $value the value to assign * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function assignGlobal($varName, $value = null, $nocache = false) { return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache); } /** * appends values to template variables by reference * * @param string $tpl_var the template variable name * @param mixed &$value the referenced value to append * @param boolean $merge flag if array elements shall be merged * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function appendByRef($tpl_var, &$value, $merge = false) { return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge); } /** * assigns values to template variables by reference * * @param string $tpl_var the template variable name * @param $value * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function assignByRef($tpl_var, &$value, $nocache = false) { return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache); } /** * Returns a single or all template variables * * @api Smarty::getTemplateVars() * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * * @param string $varName variable name or null * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object * @param bool $searchParents include parent templates? * * @return mixed variable value or or array of variables */ public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) { return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents); } /** * gets the object of a Smarty variable * * @param string $variable the name of the Smarty variable * @param Smarty_Internal_Data $_ptr optional pointer to data object * @param boolean $searchParents search also in parent data * @param bool $error_enable * * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead. */ public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true, $error_enable = true ) { return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable); } /** * Follow the parent chain an merge template and config variables * * @param \Smarty_Internal_Data|null $data */ public function _mergeVars(Smarty_Internal_Data $data = null) { if (isset($data)) { if (!empty($this->tpl_vars)) { $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars); } if (!empty($this->config_vars)) { $data->config_vars = array_merge($this->config_vars, $data->config_vars); } } else { $data = $this; } if (isset($this->parent)) { $this->parent->_mergeVars($data); } } /** * Return true if this instance is a Data obj * * @return bool */ public function _isDataObj() { return $this->_objType === 4; } /** * Return true if this instance is a template obj * * @return bool */ public function _isTplObj() { return $this->_objType === 2; } /** * Return true if this instance is a Smarty obj * * @return bool */ public function _isSmartyObj() { return $this->_objType === 1; } /** * Get Smarty object * * @return Smarty */ public function _getSmartyObj() { return $this->smarty; } /** * Handle unknown class methods * * @param string $name unknown method-name * @param array $args argument array * * @return mixed * @throws SmartyException */ public function __call($name, $args) { return $this->ext->_callExternalMethod($this, $name, $args); } } PK MU 1 libs/sysplugins/smarty_internal_compile_block.phpnu W+A */ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inheritance { /** * Attribute definition: Overwrites base class. * * @var array * @see Smarty_Internal_CompileBase */ public $required_attributes = array('name'); /** * Attribute definition: Overwrites base class. * * @var array * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('name'); /** * Attribute definition: Overwrites base class. * * @var array * @see Smarty_Internal_CompileBase */ public $option_flags = array('hide', 'nocache'); /** * Attribute definition: Overwrites base class. * * @var array * @see Smarty_Internal_CompileBase */ public $optional_attributes = array('assign'); /** * Compiles code for the {block} tag * * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param array $parameter array with compilation parameter */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { if (!isset($compiler->_cache[ 'blockNesting' ])) { $compiler->_cache[ 'blockNesting' ] = 0; } if ($compiler->_cache[ 'blockNesting' ] === 0) { // make sure that inheritance gets initialized in template code $this->registerInit($compiler); $this->option_flags = array('hide', 'nocache', 'append', 'prepend'); } else { $this->option_flags = array('hide', 'nocache'); } // check and get attributes $_attr = $this->getAttributes($compiler, $args); ++$compiler->_cache[ 'blockNesting' ]; $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true)); $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ]; $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className; $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array(); $compiler->_cache[ 'blockParams' ][ 1 ][ 'subBlocks' ][ trim($_attr[ 'name' ], '"\'') ][] = $_className; $this->openTag( $compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, $compiler->template->caching) ); $compiler->saveRequiredPlugins(true); $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); $compiler->template->compiled->has_nocache_code = false; $compiler->suppressNocacheProcessing = true; } } /** * Smarty Internal Plugin Compile BlockClose Class */ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance { /** * Compiles code for the {/block} tag * * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param array $parameter array with compilation parameter * * @return bool true */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block')); // init block parameter $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]; unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]); $_name = $_attr[ 'name' ]; $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null; unset($_attr[ 'assign' ], $_attr[ 'name' ]); foreach ($_attr as $name => $stat) { if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat !== 'false')) { $_block[ $name ] = 'true'; } } $_className = $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ]; // get compiled block code $_functionCode = $compiler->parser->current_buffer; // setup buffer for template function code $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); $output = " $value) { $output .= "public \${$property} = " . var_export($value, true) .";\n"; } $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; $output .= $compiler->compileRequiredPlugins(); $compiler->restoreRequiredPlugins(); if ($compiler->template->compiled->has_nocache_code) { $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n"; } if (isset($_assign)) { $output .= "ob_start();\n"; } $output .= "?>\n"; $compiler->parser->current_buffer->append_subtree( $compiler->parser, new Smarty_Internal_ParseTree_Tag( $compiler->parser, $output ) ); $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = "assign({$_assign}, ob_get_clean());\n"; } $output .= "}\n"; $output .= "}\n"; $output .= "/* {/block {$_name}} */\n\n"; $output .= "?>\n"; $compiler->parser->current_buffer->append_subtree( $compiler->parser, new Smarty_Internal_ParseTree_Tag( $compiler->parser, $output ) ); $compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); // restore old status $compiler->template->compiled->has_nocache_code = $_has_nocache_code; $compiler->tag_nocache = $compiler->nocache; $compiler->nocache = $_nocache; $compiler->parser->current_buffer = $_buffer; $output = "_cache[ 'blockNesting' ] === 1) { $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n"; } else { $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n"; } $output .= "?>\n"; --$compiler->_cache[ 'blockNesting' ]; if ($compiler->_cache[ 'blockNesting' ] === 0) { unset($compiler->_cache[ 'blockNesting' ]); } $compiler->has_code = true; $compiler->suppressNocacheProcessing = true; return $output; } } PK Mn; 6 libs/sysplugins/smarty_internal_method_mustcompile.phpnu W+A source->exists) { if ($_template->_isSubTpl()) { $parent_resource = " in '$_template->parent->template_resource}'"; } else { $parent_resource = ''; } throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}"); } if ($_template->mustCompile === null) { $_template->mustCompile = (!$_template->source->handler->uncompiled && ($_template->smarty->force_compile || $_template->source->handler->recompiled || !$_template->compiled->exists || ($_template->compile_check && $_template->compiled->getTimeStamp() < $_template->source->getTimeStamp()))); } return $_template->mustCompile; } } PK M 2 libs/sysplugins/smarty_internal_compile_ldelim.phpnu W+A getAttributes($compiler, $args); if ($_attr[ 'nocache' ] === true) { $compiler->trigger_template_error('nocache option not allowed', null, true); } return $compiler->smarty->left_delimiter; } } PK M B libs/sysplugins/smarty_internal_compile_private_foreachsection.phpnu W+A propertyPreg = '~('; $this->startOffset = 0; $this->resultOffsets = array(); $this->matchResults = array('named' => array(), 'item' => array()); if ($this->isNamed) { $this->buildPropertyPreg(true, $attributes); } if (isset($this->itemProperties)) { if ($this->isNamed) { $this->propertyPreg .= '|'; } $this->buildPropertyPreg(false, $attributes); } $this->propertyPreg .= ')\W~i'; // Template source $this->matchTemplateSource($compiler); // Parent template source $this->matchParentTemplateSource($compiler); // {block} source $this->matchBlockSource($compiler); } /** * Build property preg string * * @param bool $named * @param array $attributes */ public function buildPropertyPreg($named, $attributes) { if ($named) { $this->resultOffsets[ 'named' ] = $this->startOffset + 4; $this->propertyPreg .= "(([\$]smarty[.]{$this->tagName}[.]" . ($this->tagName === 'section' ? "|[\[]\s*" : '') . "){$attributes['name']}[.]("; $properties = $this->nameProperties; } else { $this->resultOffsets[ 'item' ] = $this->startOffset + 3; $this->propertyPreg .= "([\$]{$attributes['item']}[@]("; $properties = $this->itemProperties; } $this->startOffset += count($properties) + 2; $propName = reset($properties); while ($propName) { $this->propertyPreg .= "({$propName})"; $propName = next($properties); if ($propName) { $this->propertyPreg .= '|'; } } $this->propertyPreg .= '))'; } /** * Find matches in source string * * @param string $source */ public function matchProperty($source) { preg_match_all($this->propertyPreg, $source, $match, PREG_SET_ORDER); foreach ($this->resultOffsets as $key => $offset) { foreach ($match as $m) { if (isset($m[ $offset ]) && !empty($m[ $offset ])) { $this->matchResults[ $key ][ strtolower($m[ $offset ]) ] = true; } } } } /** * Find matches in template source * * @param \Smarty_Internal_TemplateCompilerBase $compiler */ public function matchTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler) { $this->matchProperty($compiler->parser->lex->data); } /** * Find matches in all parent template source * * @param \Smarty_Internal_TemplateCompilerBase $compiler * * @throws \SmartyException */ public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler) { // search parent compiler template source $nextCompiler = $compiler; while ($nextCompiler !== $nextCompiler->parent_compiler) { $nextCompiler = $nextCompiler->parent_compiler; if ($compiler !== $nextCompiler) { // get template source $_content = $nextCompiler->template->source->getContent(); if ($_content !== '') { // run pre filter if required if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) || isset($nextCompiler->smarty->registered_filters[ 'pre' ])) ) { $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter( 'pre', $_content, $nextCompiler->template ); } $this->matchProperty($_content); } } } } /** * Find matches in {block} tag source * * @param \Smarty_Internal_TemplateCompilerBase $compiler */ public function matchBlockSource(Smarty_Internal_TemplateCompilerBase $compiler) { } /** * Compiles code for the {$smarty.foreach.xxx} or {$smarty.section.xxx}tag * * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException */ public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { $tag = strtolower(trim($parameter[ 0 ], '"\'')); $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false; if (!$name) { $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); } $property = isset($parameter[ 2 ]) ? strtolower($compiler->getId($parameter[ 2 ])) : false; if (!$property || !in_array($property, $this->nameProperties)) { $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true); } $tagVar = "'__smarty_{$tag}_{$name}'"; return "(isset(\$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}']) ? \$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}'] : null)"; } } PK M 6 libs/sysplugins/smarty_internal_method_clearconfig.phpnu W+A config_vars[ $name ]); } else { $data->config_vars = array(); } return $data; } } PK MxaS # libs/sysplugins/smarty_variable.phpnu W+A value = $value; $this->nocache = $nocache; } /** * <