diff options
| author | uwetews <uwe.tews@googlemail.com> | 2018-08-12 03:20:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-12 03:20:33 +0200 |
| commit | b5e5085391100f26656276e091a0b8034e9f13c9 (patch) | |
| tree | 70c5d4d621d0b2ef394c7d13f445ad471b224da7 /libs | |
| parent | cc4d8fa1a07e18f00951a921041e37c87015dcb2 (diff) | |
| parent | 240409578349843bd8467ea6a2083b564baa135d (diff) | |
| download | smarty-b5e5085391100f26656276e091a0b8034e9f13c9.tar.gz smarty-b5e5085391100f26656276e091a0b8034e9f13c9.tar.bz2 smarty-b5e5085391100f26656276e091a0b8034e9f13c9.zip | |
Merge pull request #452 from dusta/Update-PSR-2
Update PSR-2
Diffstat (limited to 'libs')
180 files changed, 3746 insertions, 3043 deletions
diff --git a/libs/Autoloader.php b/libs/Autoloader.php index 3a0da8fa..c3186750 100644 --- a/libs/Autoloader.php +++ b/libs/Autoloader.php @@ -2,14 +2,14 @@ /** * Smarty Autoloader * - * @package Smarty + * @package Smarty */ /** * Smarty Autoloader * - * @package Smarty - * @author Uwe Tews + * @package Smarty + * @author Uwe Tews * Usage: * require_once '...path/Autoloader.php'; * Smarty_Autoloader::register(); @@ -20,7 +20,7 @@ */ class Smarty_Autoloader { - /** + /** * Filepath to Smarty root * * @var string @@ -54,8 +54,8 @@ class Smarty_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 + 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' ])) { diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 4d307547..1352d815 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -276,10 +276,10 @@ class Smarty extends Smarty_Internal_TemplateBase */ public $force_compile = false; /** - * use sub dirs for compiled/cached files? - * - * @var boolean - */ + * use sub dirs for compiled/cached files? + * + * @var boolean + */ public $use_sub_dirs = false; /** * allow ambiguous resources (that are made unique by the resource handler) @@ -618,7 +618,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Enable error handler to mute expected messages * - * @return boolean + * @return boolean * @deprecated */ public static function muteExpectedErrors() @@ -639,7 +639,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Check if a template resource exists * - * @param string $resource_name template name + * @param string $resource_name template name * * @return bool status * @throws \SmartyException @@ -654,7 +654,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Loads security class and enables security * - * @param string|Smarty_Security $security_class if a string is used, it must be class-name + * @param string|Smarty_Security $security_class if a string is used, it must be class-name * * @return Smarty current Smarty instance for chaining * @throws SmartyException when an invalid class name is provided @@ -679,9 +679,9 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Add template directory(s) * - * @param string|array $template_dir directory(s) of template sources - * @param string $key of the array element to assign the template dir to - * @param bool $isConfig true for config_dir + * @param string|array $template_dir directory(s) of template sources + * @param string $key of the array element to assign the template dir to + * @param bool $isConfig true for config_dir * * @return Smarty current Smarty instance for chaining */ @@ -747,8 +747,8 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Set template directory * - * @param string|array $template_dir directory(s) of template sources - * @param bool $isConfig true for config_dir + * @param string|array $template_dir directory(s) of template sources + * @param bool $isConfig true for config_dir * * @return \Smarty current Smarty instance for chaining */ @@ -846,7 +846,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Set plugins directory * - * @param string|array $plugins_dir directory(s) of plugins + * @param string|array $plugins_dir directory(s) of plugins * * @return Smarty current Smarty instance for chaining */ @@ -901,7 +901,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Set cache directory * - * @param string $cache_dir directory to store cached templates in + * @param string $cache_dir directory to store cached templates in * * @return Smarty current Smarty instance for chaining */ @@ -915,11 +915,11 @@ class Smarty extends Smarty_Internal_TemplateBase /** * creates a template object * - * @param string $template the resource handle of the template file - * @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 boolean $do_clone flag is Smarty object shall be cloned + * @param string $template the resource handle of the template file + * @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 boolean $do_clone flag is Smarty object shall be cloned * * @return \Smarty_Internal_Template template object * @throws \SmartyException @@ -981,8 +981,8 @@ class Smarty extends Smarty_Internal_TemplateBase * class name format: Smarty_PluginType_PluginName * plugin filename format: plugintype.pluginname.php * - * @param string $plugin_name class plugin name to load - * @param bool $check check if already loaded + * @param string $plugin_name class plugin name to load + * @param bool $check check if already loaded * * @throws SmartyException * @return string |boolean filepath of loaded file or false @@ -1005,11 +1005,11 @@ class Smarty extends Smarty_Internal_TemplateBase * @throws \SmartyException */ public function _getTemplateId($template_name, - $cache_id = null, - $compile_id = null, - $caching = null, - Smarty_Internal_Template $template = null) - { + $cache_id = null, + $compile_id = null, + $caching = null, + Smarty_Internal_Template $template = null + ) { $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" : $template_name; $cache_id = $cache_id === null ? $this->cache_id : $cache_id; @@ -1033,10 +1033,11 @@ class Smarty extends Smarty_Internal_TemplateBase * - remove /./ and /../ * - make it absolute if required * - * @param string $path file path - * @param bool $realpath if true - convert to absolute - * false - convert to relative - * null - keep as it is but remove /./ /../ + * @param string $path file path + * @param bool $realpath if true - convert to absolute + * false - convert to relative + * null - keep as it is but + * remove /./ /../ * * @return string */ @@ -1045,9 +1046,11 @@ class Smarty extends Smarty_Internal_TemplateBase $nds = array('/' => '\\', '\\' => '/'); // normalize DIRECTORY_SEPARATOR //$path = str_replace(array($nds[DIRECTORY_SEPARATOR], DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR, $path); - preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u', - $path, - $parts); + preg_match( + '%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u', + $path, + $parts + ); $path = $parts[ 'path' ]; if ($parts[ 'root' ] === '\\') { $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ]; @@ -1058,8 +1061,9 @@ class Smarty extends Smarty_Internal_TemplateBase } do { $path = preg_replace( - array('#[\\\\/]{2}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'), - DIRECTORY_SEPARATOR, $path, -1, $count); + array('#[\\\\/]{2}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'), + DIRECTORY_SEPARATOR, $path, -1, $count + ); } while($count > 0); return $realpath !== false ? $parts[ 'root' ] . $path : str_ireplace(getcwd(), '.', $parts[ 'root' ] . $path); } @@ -1254,7 +1258,7 @@ class Smarty extends Smarty_Internal_TemplateBase * Calls the appropriate getter function. * Issues an E_USER_NOTICE if no valid getter is found. * - * @param string $name property name + * @param string $name property name * * @return mixed * @throws \SmartyException @@ -1265,12 +1269,14 @@ class Smarty extends Smarty_Internal_TemplateBase $method = 'get' . $this->accessMap[ $name ]; return $this->{$method}(); } else {if (isset($this->_cache[ $name ])) { - return $this->_cache[ $name ]; + return $this->_cache[ $name ]; } else {if (in_array($name, $this->obsoleteProperties)) { - return null; + return null; } else { trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); - }}} + } + } + } return null; } @@ -1290,14 +1296,15 @@ class Smarty extends Smarty_Internal_TemplateBase $method = 'set' . $this->accessMap[ $name ]; $this->{$method}($value); } else {if (in_array($name, $this->obsoleteProperties)) { - return; + return; } else { if (is_object($value) && method_exists($value, $name)) { $this->$name = $value; } else { trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); } - }} + } + } } /** @@ -1320,7 +1327,6 @@ class Smarty extends Smarty_Internal_TemplateBase * Normalize template_dir or config_dir * * @param bool $isConfig true for config_dir - * */ private function _normalizeTemplateConfig($isConfig) { diff --git a/libs/SmartyBC.class.php b/libs/SmartyBC.class.php index f2230fc9..1141e488 100644 --- a/libs/SmartyBC.class.php +++ b/libs/SmartyBC.class.php @@ -28,7 +28,7 @@ /** * @ignore */ -require_once(dirname(__FILE__) . '/Smarty.class.php'); +require_once dirname(__FILE__) . '/Smarty.class.php'; /** * Smarty Backward Compatibility Wrapper Class @@ -53,7 +53,6 @@ class SmartyBC extends Smarty /** * Initialize new SmartyBC object - * */ public function __construct() { @@ -127,12 +126,12 @@ class SmartyBC extends Smarty * @param boolean $smarty_args smarty argument format, else traditional * @param array $block_methods list of methods that are block format * - * @throws SmartyException + * @throws SmartyException * @internal param array $block_functs list of methods that are block format */ public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, - $block_methods = array()) - { + $block_methods = array() + ) { settype($allowed, 'array'); settype($smarty_args, 'boolean'); $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods); @@ -151,8 +150,8 @@ class SmartyBC extends Smarty /** * Registers block function to be used in templates * - * @param string $block name of template block - * @param string $block_impl PHP function to register + * @param string $block name of template block + * @param string $block_impl PHP function to register * @param bool $cacheable * @param mixed $cache_attrs * @@ -326,10 +325,10 @@ class SmartyBC extends Smarty /** * clear cached content for the given template and cache id * - * @param string $tpl_file name of template file - * @param string $cache_id name of cache_id - * @param string $compile_id name of compile_id - * @param string $exp_time expiration time + * @param string $tpl_file name of template file + * @param string $cache_id name of cache_id + * @param string $compile_id name of compile_id + * @param string $exp_time expiration time * * @return boolean */ @@ -341,7 +340,7 @@ class SmartyBC extends Smarty /** * clear the entire contents of cache (all templates) * - * @param string $exp_time expire time + * @param string $exp_time expire time * * @return boolean */ @@ -353,9 +352,9 @@ class SmartyBC extends Smarty /** * test to see if valid cache exists for this template * - * @param string $tpl_file name of template file - * @param string $cache_id - * @param string $compile_id + * @param string $tpl_file name of template file + * @param string $cache_id + * @param string $compile_id * * @return bool * @throws \Exception @@ -379,9 +378,9 @@ class SmartyBC extends Smarty * or all compiled template files if one is not specified. * This function is for advanced use only, not normally needed. * - * @param string $tpl_file - * @param string $compile_id - * @param string $exp_time + * @param string $tpl_file + * @param string $compile_id + * @param string $exp_time * * @return boolean results of {@link smarty_core_rm_auto()} */ @@ -393,7 +392,7 @@ class SmartyBC extends Smarty /** * Checks whether requested template exists. * - * @param string $tpl_file + * @param string $tpl_file * * @return bool * @throws \SmartyException @@ -406,7 +405,7 @@ class SmartyBC extends Smarty /** * Returns an array containing template variables * - * @param string $name + * @param string $name * * @return array */ @@ -418,7 +417,7 @@ class SmartyBC extends Smarty /** * Returns an array containing config variables * - * @param string $name + * @param string $name * * @return array */ @@ -442,7 +441,7 @@ class SmartyBC extends Smarty /** * return a reference to a registered object * - * @param string $name + * @param string $name * * @return object */ diff --git a/libs/bootstrap.php b/libs/bootstrap.php index dad72fcb..0b183bf9 100644 --- a/libs/bootstrap.php +++ b/libs/bootstrap.php @@ -12,6 +12,6 @@ * Load and register Smarty Autoloader */ if (!class_exists('Smarty_Autoloader')) { - require dirname(__FILE__) . '/Autoloader.php'; + include dirname(__FILE__) . '/Autoloader.php'; } Smarty_Autoloader::register(true); diff --git a/libs/plugins/block.textformat.php b/libs/plugins/block.textformat.php index 310a420e..416d21ee 100644 --- a/libs/plugins/block.textformat.php +++ b/libs/plugins/block.textformat.php @@ -20,8 +20,7 @@ * - indent_char - string (" ") * - wrap_boundary - boolean (true) * - * - * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} + * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} * (Smarty online manual) * * @param array $params parameters @@ -39,8 +38,10 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te return; } if (Smarty::$_MBSTRING) { - $template->_checkPlugins(array(array('function' => 'smarty_modifier_mb_wordwrap', - 'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php'))); + $template->_checkPlugins( + array(array('function' => 'smarty_modifier_mb_wordwrap', + 'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php')) + ); } $style = null; @@ -54,25 +55,25 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te foreach ($params as $_key => $_val) { switch ($_key) { - case 'style': - case 'indent_char': - case 'wrap_char': - case 'assign': - $$_key = (string) $_val; - break; + case 'style': + case 'indent_char': + case 'wrap_char': + case 'assign': + $$_key = (string) $_val; + break; - case 'indent': - case 'indent_first': - case 'wrap': - $$_key = (int) $_val; - break; + case 'indent': + case 'indent_first': + case 'wrap': + $$_key = (int) $_val; + break; - case 'wrap_cut': - $$_key = (bool) $_val; - break; + case 'wrap_cut': + $$_key = (bool) $_val; + break; - default: - trigger_error("textformat: unknown attribute '{$_key}'"); + default: + trigger_error("textformat: unknown attribute '{$_key}'"); } } @@ -88,10 +89,12 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te } // convert mult. spaces & special chars to single space $_paragraph = - preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, + preg_replace( + array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER), - array(' ', - ''), $_paragraph); + array(' ', + ''), $_paragraph + ); // indent first line if ($indent_first > 0) { $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph; diff --git a/libs/plugins/function.cycle.php b/libs/plugins/function.cycle.php index b871524f..692f7033 100644 --- a/libs/plugins/function.cycle.php +++ b/libs/plugins/function.cycle.php @@ -29,14 +29,13 @@ * {cycle name=row values="one,two,three" reset=true} * {cycle name=row} * - * - * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} + * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} * (Smarty online manual) - * @author Monte Ohrt <monte at ohrt dot com> - * @author credit to Mark Priatel <mpriatel@rogers.com> - * @author credit to Gerard <gerard@interfold.com> - * @author credit to Jason Sweat <jsweat_php@yahoo.com> - * @version 1.3 + * @author Monte Ohrt <monte at ohrt dot com> + * @author credit to Mark Priatel <mpriatel@rogers.com> + * @author credit to Gerard <gerard@interfold.com> + * @author credit to Jason Sweat <jsweat_php@yahoo.com> + * @version 1.3 * * @param array $params parameters * @param Smarty_Internal_Template $template template object diff --git a/libs/plugins/function.fetch.php b/libs/plugins/function.fetch.php index 9539e1fc..dcec4146 100644 --- a/libs/plugins/function.fetch.php +++ b/libs/plugins/function.fetch.php @@ -81,73 +81,73 @@ function smarty_function_fetch($params, $template) // loop through parameters, setup headers foreach ($params as $param_key => $param_value) { switch ($param_key) { - case 'file': - case 'assign': - case 'assign_headers': - break; - case 'user': - if (!empty($param_value)) { - $user = $param_value; - } - break; - case 'pass': - if (!empty($param_value)) { - $pass = $param_value; - } - break; - case 'accept': - if (!empty($param_value)) { - $accept = $param_value; - } - break; - case 'header': - if (!empty($param_value)) { - if (!preg_match('![\w\d-]+: .+!', $param_value)) { - trigger_error("[plugin] invalid header format '{$param_value}'", E_USER_NOTICE); - - return; - } else { - $extra_headers[] = $param_value; - } - } - break; - case 'proxy_host': - if (!empty($param_value)) { - $proxy_host = $param_value; - } - break; - case 'proxy_port': - if (!preg_match('!\D!', $param_value)) { - $proxy_port = (int) $param_value; - } else { - trigger_error("[plugin] invalid value for attribute '{$param_key }'", E_USER_NOTICE); + case 'file': + case 'assign': + case 'assign_headers': + break; + case 'user': + if (!empty($param_value)) { + $user = $param_value; + } + break; + case 'pass': + if (!empty($param_value)) { + $pass = $param_value; + } + break; + case 'accept': + if (!empty($param_value)) { + $accept = $param_value; + } + break; + case 'header': + if (!empty($param_value)) { + if (!preg_match('![\w\d-]+: .+!', $param_value)) { + trigger_error("[plugin] invalid header format '{$param_value}'", E_USER_NOTICE); return; - } - break; - case 'agent': - if (!empty($param_value)) { - $agent = $param_value; - } - break; - case 'referer': - if (!empty($param_value)) { - $referer = $param_value; - } - break; - case 'timeout': - if (!preg_match('!\D!', $param_value)) { - $timeout = (int) $param_value; } else { - trigger_error("[plugin] invalid value for attribute '{$param_key}'", E_USER_NOTICE); - - return; + $extra_headers[] = $param_value; } - break; - default: - trigger_error("[plugin] unrecognized attribute '{$param_key}'", E_USER_NOTICE); + } + break; + case 'proxy_host': + if (!empty($param_value)) { + $proxy_host = $param_value; + } + break; + case 'proxy_port': + if (!preg_match('!\D!', $param_value)) { + $proxy_port = (int) $param_value; + } else { + trigger_error("[plugin] invalid value for attribute '{$param_key }'", E_USER_NOTICE); + + return; + } + break; + case 'agent': + if (!empty($param_value)) { + $agent = $param_value; + } + break; + case 'referer': + if (!empty($param_value)) { + $referer = $param_value; + } + break; + case 'timeout': + if (!preg_match('!\D!', $param_value)) { + $timeout = (int) $param_value; + } else { + trigger_error("[plugin] invalid value for attribute '{$param_key}'", E_USER_NOTICE); return; + } + break; + default: + trigger_error("[plugin] unrecognized attribute '{$param_key}'", E_USER_NOTICE); + + return; } } if (!empty($proxy_host) && !empty($proxy_port)) { diff --git a/libs/plugins/function.html_checkboxes.php b/libs/plugins/function.html_checkboxes.php index d654caba..54978ea2 100644 --- a/libs/plugins/function.html_checkboxes.php +++ b/libs/plugins/function.html_checkboxes.php @@ -29,24 +29,25 @@ * - assign (optional) - assign the output as an array to this variable * - escape (optional) - escape the content (not value), defaults to true * - * - * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} + * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} * (Smarty online manual) - * @author Christopher Kvarme <christopher.kvarme@flashjab.com> - * @author credits to Monte Ohrt <monte at ohrt dot com> - * @version 1.0 + * @author Christopher Kvarme <christopher.kvarme@flashjab.com> + * @author credits to Monte Ohrt <monte at ohrt dot com> + * @version 1.0 * * @param array $params parameters * @param Smarty_Internal_Template $template template object * * @return string - * @uses smarty_function_escape_special_chars() + * @uses smarty_function_escape_special_chars() * @throws \SmartyException */ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $template->_checkPlugins( + array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')) + ); $name = 'checkbox'; $values = null; @@ -62,91 +63,99 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp foreach ($params as $_key => $_val) { switch ($_key) { - case 'name': - case 'separator': - $$_key = (string) $_val; - break; + case 'name': + case 'separator': + $$_key = (string) $_val; + break; - case 'escape': - case 'labels': - case 'label_ids': - $$_key = (bool) $_val; - break; + case 'escape': + case 'labels': + case 'label_ids': + $$_key = (bool) $_val; + break; - case 'options': - $$_key = (array) $_val; - break; + case 'options': + $$_key = (array) $_val; + break; - case 'values': - case 'output': - $$_key = array_values((array) $_val); - break; + case 'values': + case 'output': + $$_key = array_values((array) $_val); + break; - case 'checked': - case 'selected': - if (is_array($_val)) { - $selected = array(); - foreach ($_val as $_sel) { - if (is_object($_sel)) { - if (method_exists($_sel, '__toString')) { - $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); - } else { - trigger_error('html_checkboxes: selected attribute contains an object of class \'' . - get_class($_sel) . '\' without __toString() method', E_USER_NOTICE); - continue; - } + case 'checked': + case 'selected': + if (is_array($_val)) { + $selected = array(); + foreach ($_val as $_sel) { + if (is_object($_sel)) { + if (method_exists($_sel, '__toString')) { + $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); } else { - $_sel = smarty_function_escape_special_chars((string) $_sel); + trigger_error( + 'html_checkboxes: selected attribute contains an object of class \'' . + get_class($_sel) . '\' without __toString() method', E_USER_NOTICE + ); + continue; } - $selected[ $_sel ] = true; - } - } elseif (is_object($_val)) { - if (method_exists($_val, '__toString')) { - $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - trigger_error('html_checkboxes: selected attribute is an object of class \'' . get_class($_val) . - '\' without __toString() method', E_USER_NOTICE); + $_sel = smarty_function_escape_special_chars((string) $_sel); } + $selected[ $_sel ] = true; + } + } elseif (is_object($_val)) { + if (method_exists($_val, '__toString')) { + $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - $selected = smarty_function_escape_special_chars((string) $_val); + trigger_error( + 'html_checkboxes: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', E_USER_NOTICE + ); } - break; + } else { + $selected = smarty_function_escape_special_chars((string) $_val); + } + break; - case 'checkboxes': - trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', - E_USER_WARNING); - $options = (array) $_val; - break; + case 'checkboxes': + trigger_error( + 'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', + E_USER_WARNING + ); + $options = (array) $_val; + break; - case 'assign': - break; + case 'assign': + break; - case 'strict': - break; + case 'strict': + break; - case 'disabled': - case 'readonly': - if (!empty($params[ 'strict' ])) { - if (!is_scalar($_val)) { - trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", - E_USER_NOTICE); - } - - if ($_val === true || $_val === $_key) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; - } - - break; + case 'disabled': + case 'readonly': + if (!empty($params[ 'strict' ])) { + if (!is_scalar($_val)) { + trigger_error( + "html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", + E_USER_NOTICE + ); } - // omit break; to fall through! - default: - if (!is_array($_val)) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; - } else { - trigger_error("html_checkboxes: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; } + break; + } + // omit break; to fall through! + + default: + if (!is_array($_val)) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; + } else { + trigger_error("html_checkboxes: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + } + break; } } @@ -159,15 +168,19 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp if (isset($options)) { foreach ($options as $_key => $_val) { $_html_result[] = - smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, - $label_ids, $escape); + smarty_function_html_checkboxes_output( + $name, $_key, $_val, $selected, $extra, $separator, $labels, + $label_ids, $escape + ); } } else { foreach ($values as $_i => $_key) { $_val = isset($output[ $_i ]) ? $output[ $_i ] : ''; $_html_result[] = - smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, - $label_ids, $escape); + smarty_function_html_checkboxes_output( + $name, $_key, $_val, $selected, $extra, $separator, $labels, + $label_ids, $escape + ); } } @@ -186,21 +199,23 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp * @param $separator * @param $labels * @param $label_ids - * @param bool $escape + * @param bool $escape * * @return string */ function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, - $label_ids, $escape = true) -{ + $label_ids, $escape = true +) { $_output = ''; if (is_object($value)) { if (method_exists($value, '__toString')) { $value = (string) $value->__toString(); } else { - trigger_error('html_options: value is an object of class \'' . get_class($value) . - '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', E_USER_NOTICE + ); return ''; } @@ -212,8 +227,10 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte if (method_exists($output, '__toString')) { $output = (string) $output->__toString(); } else { - trigger_error('html_options: output is an object of class \'' . get_class($output) . - '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_options: output is an object of class \'' . get_class($output) . + '\' without __toString() method', E_USER_NOTICE + ); return ''; } @@ -223,8 +240,12 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte if ($labels) { if ($label_ids) { - $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', - $name . '_' . $value)); + $_id = smarty_function_escape_special_chars( + preg_replace( + '![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', + $name . '_' . $value + ) + ); $_output .= '<label for="' . $_id . '">'; } else { $_output .= '<label>'; diff --git a/libs/plugins/function.html_image.php b/libs/plugins/function.html_image.php index 4fda72ee..9455bfc1 100644 --- a/libs/plugins/function.html_image.php +++ b/libs/plugins/function.html_image.php @@ -22,7 +22,6 @@ * - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT * - path_prefix - prefix for path output (optional, default empty) * - * * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image} * (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> @@ -34,12 +33,14 @@ * * @throws SmartyException * @return string - * @uses smarty_function_escape_special_chars() + * @uses smarty_function_escape_special_chars() */ function smarty_function_html_image($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $template->_checkPlugins( + array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')) + ); $alt = ''; $file = ''; @@ -52,36 +53,36 @@ function smarty_function_html_image($params, Smarty_Internal_Template $template) $basedir = isset($_SERVER[ 'DOCUMENT_ROOT' ]) ? $_SERVER[ 'DOCUMENT_ROOT' ] : ''; foreach ($params as $_key => $_val) { switch ($_key) { - case 'file': - case 'height': - case 'width': - case 'dpi': - case 'path_prefix': - case 'basedir': - $$_key = $_val; - break; + case 'file': + case 'height': + case 'width': + case 'dpi': + case 'path_prefix': + case 'basedir': + $$_key = $_val; + break; - case 'alt': - if (!is_array($_val)) { - $$_key = smarty_function_escape_special_chars($_val); - } else { - throw new SmartyException ("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); - } - break; + case 'alt': + if (!is_array($_val)) { + $$_key = smarty_function_escape_special_chars($_val); + } else { + throw new SmartyException("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + } + break; - case 'link': - case 'href': - $prefix = '<a href="' . $_val . '">'; - $suffix = '</a>'; - break; + case 'link': + case 'href': + $prefix = '<a href="' . $_val . '">'; + $suffix = '</a>'; + break; - default: - if (!is_array($_val)) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; - } else { - throw new SmartyException ("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); - } - break; + default: + if (!is_array($_val)) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; + } else { + throw new SmartyException("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + } + break; } } diff --git a/libs/plugins/function.html_options.php b/libs/plugins/function.html_options.php index b8b98649..aa4a4203 100644 --- a/libs/plugins/function.html_options.php +++ b/libs/plugins/function.html_options.php @@ -21,24 +21,25 @@ * - id (optional) - string default not set * - class (optional) - string default not set * - * - * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image} + * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image} * (Smarty online manual) - * @author Monte Ohrt <monte at ohrt dot com> - * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de> + * @author Monte Ohrt <monte at ohrt dot com> + * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de> * - * @param array $params parameters + * @param array $params parameters * * @param \Smarty_Internal_Template $template * * @return string - * @uses smarty_function_escape_special_chars() + * @uses smarty_function_escape_special_chars() * @throws \SmartyException */ function smarty_function_html_options($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $template->_checkPlugins( + array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')) + ); $name = null; $values = null; @@ -52,76 +53,82 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat foreach ($params as $_key => $_val) { switch ($_key) { - case 'name': - case 'class': - case 'id': - $$_key = (string) $_val; - break; + case 'name': + case 'class': + case 'id': + $$_key = (string) $_val; + break; - case 'options': - $options = (array) $_val; - break; + case 'options': + $options = (array) $_val; + break; - case 'values': - case 'output': - $$_key = array_values((array) $_val); - break; + case 'values': + case 'output': + $$_key = array_values((array) $_val); + break; - case 'selected': - if (is_array($_val)) { - $selected = array(); - foreach ($_val as $_sel) { - if (is_object($_sel)) { - if (method_exists($_sel, '__toString')) { - $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); - } else { - trigger_error('html_options: selected attribute contains an object of class \'' . - get_class($_sel) . '\' without __toString() method', E_USER_NOTICE); - continue; - } + case 'selected': + if (is_array($_val)) { + $selected = array(); + foreach ($_val as $_sel) { + if (is_object($_sel)) { + if (method_exists($_sel, '__toString')) { + $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); } else { - $_sel = smarty_function_escape_special_chars((string) $_sel); + trigger_error( + 'html_options: selected attribute contains an object of class \'' . + get_class($_sel) . '\' without __toString() method', E_USER_NOTICE + ); + continue; } - $selected[ $_sel ] = true; - } - } elseif (is_object($_val)) { - if (method_exists($_val, '__toString')) { - $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - trigger_error('html_options: selected attribute is an object of class \'' . get_class($_val) . - '\' without __toString() method', E_USER_NOTICE); + $_sel = smarty_function_escape_special_chars((string) $_sel); } + $selected[ $_sel ] = true; + } + } elseif (is_object($_val)) { + if (method_exists($_val, '__toString')) { + $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - $selected = smarty_function_escape_special_chars((string) $_val); + trigger_error( + 'html_options: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', E_USER_NOTICE + ); } - break; - - case 'strict': - break; - - case 'disabled': - case 'readonly': - if (!empty($params[ 'strict' ])) { - if (!is_scalar($_val)) { - trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", - E_USER_NOTICE); - } + } else { + $selected = smarty_function_escape_special_chars((string) $_val); + } + break; - if ($_val === true || $_val === $_key) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; - } + case 'strict': + break; - break; + case 'disabled': + case 'readonly': + if (!empty($params[ 'strict' ])) { + if (!is_scalar($_val)) { + trigger_error( + "html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", + E_USER_NOTICE + ); } - // omit break; to fall through! - default: - if (!is_array($_val)) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; - } else { - trigger_error("html_options: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; } + break; + } + // omit break; to fall through! + + default: + if (!is_array($_val)) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; + } else { + trigger_error("html_options: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + } + break; } } @@ -183,8 +190,10 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c if (method_exists($value, '__toString')) { $value = smarty_function_escape_special_chars((string) $value->__toString()); } else { - trigger_error('html_options: value is an object of class \'' . get_class($value) . - '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', E_USER_NOTICE + ); return ''; } @@ -196,8 +205,10 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c } else { $_idx = 0; $_html_result = - smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, - $class, $_idx); + smarty_function_html_options_optgroup( + $key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, + $class, $_idx + ); $idx ++; } diff --git a/libs/plugins/function.html_radios.php b/libs/plugins/function.html_radios.php index 37feec63..1b17d7e3 100644 --- a/libs/plugins/function.html_radios.php +++ b/libs/plugins/function.html_radios.php @@ -29,7 +29,6 @@ * {html_radios values=$ids name='box' separator='<br>' output=$names} * {html_radios values=$ids checked=$checked separator='<br>' output=$names} * - * * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios} * (Smarty online manual) * @author Christopher Kvarme <christopher.kvarme@flashjab.com> @@ -40,13 +39,15 @@ * @param Smarty_Internal_Template $template template object * * @return string - * @uses smarty_function_escape_special_chars() + * @uses smarty_function_escape_special_chars() * @throws \SmartyException */ function smarty_function_html_radios($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $template->_checkPlugins( + array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')) + ); $name = 'radio'; $values = null; @@ -61,77 +62,83 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template foreach ($params as $_key => $_val) { switch ($_key) { - case 'name': - case 'separator': - $$_key = (string) $_val; - break; + case 'name': + case 'separator': + $$_key = (string) $_val; + break; - case 'checked': - case 'selected': - if (is_array($_val)) { - trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING); - } elseif (is_object($_val)) { - if (method_exists($_val, '__toString')) { - $selected = smarty_function_escape_special_chars((string) $_val->__toString()); - } else { - trigger_error('html_radios: selected attribute is an object of class \'' . get_class($_val) . - '\' without __toString() method', E_USER_NOTICE); - } + case 'checked': + case 'selected': + if (is_array($_val)) { + trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING); + } elseif (is_object($_val)) { + if (method_exists($_val, '__toString')) { + $selected = smarty_function_escape_special_chars((string) $_val->__toString()); } else { - $selected = (string) $_val; + trigger_error( + 'html_radios: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', E_USER_NOTICE + ); } - break; + } else { + $selected = (string) $_val; + } + break; - case 'escape': - case 'labels': - case 'label_ids': - $$_key = (bool) $_val; - break; + case 'escape': + case 'labels': + case 'label_ids': + $$_key = (bool) $_val; + break; - case 'options': - $$_key = (array) $_val; - break; + case 'options': + $$_key = (array) $_val; + break; - case 'values': - case 'output': - $$_key = array_values((array) $_val); - break; + case 'values': + case 'output': + $$_key = array_values((array) $_val); + break; - case 'radios': - trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', - E_USER_WARNING); - $options = (array) $_val; - break; + case 'radios': + trigger_error( + 'html_radios: the use of the "radios" attribute is deprecated, use "options" instead', + E_USER_WARNING + ); + $options = (array) $_val; + break; - case 'assign': - break; + case 'assign': + break; - case 'strict': - break; + case 'strict': + break; - case 'disabled': - case 'readonly': - if (!empty($params[ 'strict' ])) { - if (!is_scalar($_val)) { - trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", - E_USER_NOTICE); - } - - if ($_val === true || $_val === $_key) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; - } - - break; + case 'disabled': + case 'readonly': + if (!empty($params[ 'strict' ])) { + if (!is_scalar($_val)) { + trigger_error( + "html_options: {$_key} attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", + E_USER_NOTICE + ); } - // omit break; to fall through! - default: - if (!is_array($_val)) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; - } else { - trigger_error("html_radios: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; } + break; + } + // omit break; to fall through! + + default: + if (!is_array($_val)) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; + } else { + trigger_error("html_radios: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + } + break; } } @@ -146,15 +153,19 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template if (isset($options)) { foreach ($options as $_key => $_val) { $_html_result[] = - smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, - $label_ids, $escape); + smarty_function_html_radios_output( + $name, $_key, $_val, $selected, $extra, $separator, $labels, + $label_ids, $escape + ); } } else { foreach ($values as $_i => $_key) { $_val = isset($output[ $_i ]) ? $output[ $_i ] : ''; $_html_result[] = - smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, - $label_ids, $escape); + smarty_function_html_radios_output( + $name, $_key, $_val, $selected, $extra, $separator, $labels, + $label_ids, $escape + ); } } @@ -178,16 +189,18 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template * @return string */ function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, - $escape) -{ + $escape +) { $_output = ''; if (is_object($value)) { if (method_exists($value, '__toString')) { $value = (string) $value->__toString(); } else { - trigger_error('html_options: value is an object of class \'' . get_class($value) . - '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', E_USER_NOTICE + ); return ''; } @@ -199,8 +212,10 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $ if (method_exists($output, '__toString')) { $output = (string) $output->__toString(); } else { - trigger_error('html_options: output is an object of class \'' . get_class($output) . - '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_options: output is an object of class \'' . get_class($output) . + '\' without __toString() method', E_USER_NOTICE + ); return ''; } @@ -210,8 +225,12 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $ if ($labels) { if ($label_ids) { - $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', - $name . '_' . $value)); + $_id = smarty_function_escape_special_chars( + preg_replace( + '![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', + $name . '_' . $value + ) + ); $_output .= '<label for="' . $_id . '">'; } else { $_output .= '<label>'; diff --git a/libs/plugins/function.html_select_date.php b/libs/plugins/function.html_select_date.php index 1d63800e..52a394c6 100644 --- a/libs/plugins/function.html_select_date.php +++ b/libs/plugins/function.html_select_date.php @@ -28,15 +28,14 @@ * - 2.0 complete rewrite for performance, * added attributes month_names, *_id * - * - * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date} + * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date} * (Smarty online manual) - * @version 2.0 - * @author Andrei Zmievski - * @author Monte Ohrt <monte at ohrt dot com> - * @author Rodney Rehm + * @version 2.0 + * @author Andrei Zmievski + * @author Monte Ohrt <monte at ohrt dot com> + * @author Rodney Rehm * - * @param array $params parameters + * @param array $params parameters * * @param \Smarty_Internal_Template $template * @@ -45,8 +44,10 @@ */ function smarty_function_html_select_date($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $template->_checkPlugins( + array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')) + ); // generate timestamps used for month names only static $_month_timestamps = null; static $_current_year = null; @@ -109,66 +110,68 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem foreach ($params as $_key => $_value) { switch ($_key) { - case 'time': - if (!is_array($_value) && $_value !== null) { - $template->_checkPlugins(array(array('function' => 'smarty_make_timestamp', - 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'))); - $time = smarty_make_timestamp($_value); - } - break; + case 'time': + if (!is_array($_value) && $_value !== null) { + $template->_checkPlugins( + array(array('function' => 'smarty_make_timestamp', + 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php')) + ); + $time = smarty_make_timestamp($_value); + } + break; - case 'month_names': - if (is_array($_value) && count($_value) === 12) { - $$_key = $_value; - } else { - trigger_error('html_select_date: month_names must be an array of 12 strings', E_USER_NOTICE); - } - break; + case 'month_names': + if (is_array($_value) && count($_value) === 12) { + $$_key = $_value; + } else { + trigger_error('html_select_date: month_names must be an array of 12 strings', E_USER_NOTICE); + } + break; - case 'prefix': - case 'field_array': - case 'start_year': - case 'end_year': - case 'day_format': - case 'day_value_format': - case 'month_format': - case 'month_value_format': - case 'day_size': - case 'month_size': - case 'year_size': - case 'all_extra': - case 'day_extra': - case 'month_extra': - case 'year_extra': - case 'field_order': - case 'field_separator': - case 'option_separator': - case 'all_empty': - case 'month_empty': - case 'day_empty': - case 'year_empty': - case 'all_id': - case 'month_id': - case 'day_id': - case 'year_id': - $$_key = (string) $_value; - break; + case 'prefix': + case 'field_array': + case 'start_year': + case 'end_year': + case 'day_format': + case 'day_value_format': + case 'month_format': + case 'month_value_format': + case 'day_size': + case 'month_size': + case 'year_size': + case 'all_extra': + case 'day_extra': + case 'month_extra': + case 'year_extra': + case 'field_order': + case 'field_separator': + case 'option_separator': + case 'all_empty': + case 'month_empty': + case 'day_empty': + case 'year_empty': + case 'all_id': + case 'month_id': + case 'day_id': + case 'year_id': + $$_key = (string) $_value; + break; - case 'display_days': - case 'display_months': - case 'display_years': - case 'year_as_text': - case 'reverse_years': - $$_key = (bool) $_value; - break; + case 'display_days': + case 'display_months': + case 'display_years': + case 'year_as_text': + case 'reverse_years': + $$_key = (bool) $_value; + break; - default: - if (!is_array($_value)) { - $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; - } else { - trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); - } - break; + default: + if (!is_array($_value)) { + $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; + } else { + trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + } + break; } } @@ -250,10 +253,12 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem } else { $_html_years = '<select name="' . $_name . '"'; if ($year_id !== null || $all_id !== null) { - $_html_years .= ' id="' . smarty_function_escape_special_chars($year_id !== null ? + $_html_years .= ' id="' . smarty_function_escape_special_chars( + $year_id !== null ? ($year_id ? $year_id : $_name) : ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_name) + ) . '"'; } if ($year_size) { $_html_years .= ' size="' . $year_size . '"'; @@ -288,10 +293,12 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem $_html_months = '<select name="' . $_name . '"'; if ($month_id !== null || $all_id !== null) { - $_html_months .= ' id="' . smarty_function_escape_special_chars($month_id !== null ? + $_html_months .= ' id="' . smarty_function_escape_special_chars( + $month_id !== null ? ($month_id ? $month_id : $_name) : ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_name) + ) . '"'; } if ($month_size) { $_html_months .= ' size="' . $month_size . '"'; @@ -329,8 +336,10 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem $_html_days = '<select name="' . $_name . '"'; if ($day_id !== null || $all_id !== null) { $_html_days .= ' id="' . - smarty_function_escape_special_chars($day_id !== null ? ($day_id ? $day_id : $_name) : - ($all_id ? ($all_id . $_name) : $_name)) . '"'; + smarty_function_escape_special_chars( + $day_id !== null ? ($day_id ? $day_id : $_name) : + ($all_id ? ($all_id . $_name) : $_name) + ) . '"'; } if ($day_size) { $_html_days .= ' size="' . $day_size . '"'; @@ -357,35 +366,35 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem $_html = ''; for ($i = 0; $i <= 2; $i ++) { switch ($field_order[ $i ]) { - case 'Y': - case 'y': - if (isset($_html_years)) { - if ($_html) { - $_html .= $field_separator; - } - $_html .= $_html_years; + case 'Y': + case 'y': + if (isset($_html_years)) { + if ($_html) { + $_html .= $field_separator; } - break; + $_html .= $_html_years; + } + break; - case 'm': - case 'M': - if (isset($_html_months)) { - if ($_html) { - $_html .= $field_separator; - } - $_html .= $_html_months; + case 'm': + case 'M': + if (isset($_html_months)) { + if ($_html) { + $_html .= $field_separator; } - break; + $_html .= $_html_months; + } + break; - case 'd': - case 'D': - if (isset($_html_days)) { - if ($_html) { - $_html .= $field_separator; - } - $_html .= $_html_days; + case 'd': + case 'D': + if (isset($_html_days)) { + if ($_html) { + $_html .= $field_separator; } - break; + $_html .= $_html_days; + } + break; } } diff --git a/libs/plugins/function.html_select_time.php b/libs/plugins/function.html_select_time.php index f7c3816e..8ce7b88b 100644 --- a/libs/plugins/function.html_select_time.php +++ b/libs/plugins/function.html_select_time.php @@ -11,23 +11,25 @@ * Name: html_select_time * Purpose: Prints the dropdowns for time selection * - * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time} + * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time} * (Smarty online manual) - * @author Roberto Berto <roberto@berto.net> - * @author Monte Ohrt <monte AT ohrt DOT com> + * @author Roberto Berto <roberto@berto.net> + * @author Monte Ohrt <monte AT ohrt DOT com> * - * @param array $params parameters + * @param array $params parameters * * @param \Smarty_Internal_Template $template * * @return string - * @uses smarty_make_timestamp() + * @uses smarty_make_timestamp() * @throws \SmartyException */ function smarty_function_html_select_time($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $template->_checkPlugins( + array(array('function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')) + ); $prefix = 'Time_'; $field_array = null; $field_separator = "\n"; @@ -76,72 +78,74 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem foreach ($params as $_key => $_value) { switch ($_key) { - case 'time': - if (!is_array($_value) && $_value !== null) { - $template->_checkPlugins(array(array('function' => 'smarty_make_timestamp', - 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'))); - $time = smarty_make_timestamp($_value); - } - break; + case 'time': + if (!is_array($_value) && $_value !== null) { + $template->_checkPlugins( + array(array('function' => 'smarty_make_timestamp', + 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php')) + ); + $time = smarty_make_timestamp($_value); + } + break; - case 'prefix': - case 'field_array': + case 'prefix': + case 'field_array': - case 'field_separator': - case 'option_separator': + case 'field_separator': + case 'option_separator': - case 'all_extra': - case 'hour_extra': - case 'minute_extra': - case 'second_extra': - case 'meridian_extra': + case 'all_extra': + case 'hour_extra': + case 'minute_extra': + case 'second_extra': + case 'meridian_extra': - case 'all_empty': - case 'hour_empty': - case 'minute_empty': - case 'second_empty': - case 'meridian_empty': + case 'all_empty': + case 'hour_empty': + case 'minute_empty': + case 'second_empty': + case 'meridian_empty': - case 'all_id': - case 'hour_id': - case 'minute_id': - case 'second_id': - case 'meridian_id': + case 'all_id': + case 'hour_id': + case 'minute_id': + case 'second_id': + case 'meridian_id': - case 'hour_format': - case 'hour_value_format': - case 'minute_format': - case 'minute_value_format': - case 'second_format': - case 'second_value_format': - $$_key = (string) $_value; - break; + case 'hour_format': + case 'hour_value_format': + case 'minute_format': + case 'minute_value_format': + case 'second_format': + case 'second_value_format': + $$_key = (string) $_value; + break; - case 'display_hours': - case 'display_minutes': - case 'display_seconds': - case 'display_meridian': - case 'use_24_hours': - $$_key = (bool) $_value; - break; + case 'display_hours': + case 'display_minutes': + case 'display_seconds': + case 'display_meridian': + case 'use_24_hours': + $$_key = (bool) $_value; + break; - case 'minute_interval': - case 'second_interval': + case 'minute_interval': + case 'second_interval': - case 'hour_size': - case 'minute_size': - case 'second_size': - case 'meridian_size': - $$_key = (int) $_value; - break; + case 'hour_size': + case 'minute_size': + case 'second_size': + case 'meridian_size': + $$_key = (int) $_value; + break; - default: - if (!is_array($_value)) { - $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; - } else { - trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); - } - break; + default: + if (!is_array($_value)) { + $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; + } else { + trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + } + break; } } @@ -203,8 +207,10 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem $_html_hours = '<select name="' . $_name . '"'; if ($hour_id !== null || $all_id !== null) { $_html_hours .= ' id="' . - smarty_function_escape_special_chars($hour_id !== null ? ($hour_id ? $hour_id : $_name) : - ($all_id ? ($all_id . $_name) : $_name)) . '"'; + smarty_function_escape_special_chars( + $hour_id !== null ? ($hour_id ? $hour_id : $_name) : + ($all_id ? ($all_id . $_name) : $_name) + ) . '"'; } if ($hour_size) { $_html_hours .= ' size="' . $hour_size . '"'; @@ -249,10 +255,12 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem $_html_minutes = '<select name="' . $_name . '"'; if ($minute_id !== null || $all_id !== null) { - $_html_minutes .= ' id="' . smarty_function_escape_special_chars($minute_id !== null ? + $_html_minutes .= ' id="' . smarty_function_escape_special_chars( + $minute_id !== null ? ($minute_id ? $minute_id : $_name) : ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_name) + ) . '"'; } if ($minute_size) { $_html_minutes .= ' size="' . $minute_size . '"'; @@ -290,10 +298,12 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem $_html_seconds = '<select name="' . $_name . '"'; if ($second_id !== null || $all_id !== null) { - $_html_seconds .= ' id="' . smarty_function_escape_special_chars($second_id !== null ? + $_html_seconds .= ' id="' . smarty_function_escape_special_chars( + $second_id !== null ? ($second_id ? $second_id : $_name) : ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_name) + ) . '"'; } if ($second_size) { $_html_seconds .= ' size="' . $second_size . '"'; @@ -331,11 +341,13 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem $_html_meridian = '<select name="' . $_name . '"'; if ($meridian_id !== null || $all_id !== null) { - $_html_meridian .= ' id="' . smarty_function_escape_special_chars($meridian_id !== null ? + $_html_meridian .= ' id="' . smarty_function_escape_special_chars( + $meridian_id !== null ? ($meridian_id ? $meridian_id : $_name) : ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_name) + ) . '"'; } if ($meridian_size) { $_html_meridian .= ' size="' . $meridian_size . '"'; diff --git a/libs/plugins/function.html_table.php b/libs/plugins/function.html_table.php index d9a9fd69..acd53d17 100644 --- a/libs/plugins/function.html_table.php +++ b/libs/plugins/function.html_table.php @@ -35,12 +35,11 @@ * {table loop=$data cols=4 tr_attr='"bgcolor=red"'} * {table loop=$data cols="first,second,third" tr_attr=$colors} * - * - * @author Monte Ohrt <monte at ohrt dot com> - * @author credit to Messju Mohr <messju at lammfellpuschen dot de> - * @author credit to boots <boots dot smarty at yahoo dot com> - * @version 1.1 - * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table} + * @author Monte Ohrt <monte at ohrt dot com> + * @author credit to Messju Mohr <messju at lammfellpuschen dot de> + * @author credit to boots <boots dot smarty at yahoo dot com> + * @version 1.1 + * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table} * (Smarty online manual) * * @param array $params parameters @@ -70,42 +69,42 @@ function smarty_function_html_table($params) foreach ($params as $_key => $_value) { switch ($_key) { - case 'loop': - $$_key = (array) $_value; - break; + case 'loop': + $$_key = (array) $_value; + break; - case 'cols': - if (is_array($_value) && !empty($_value)) { - $cols = $_value; - $cols_count = count($_value); - } elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) { - $cols = explode(',', $_value); - $cols_count = count($cols); - } elseif (!empty($_value)) { - $cols_count = (int) $_value; - } else { - $cols_count = $cols; - } - break; + case 'cols': + if (is_array($_value) && !empty($_value)) { + $cols = $_value; + $cols_count = count($_value); + } elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) { + $cols = explode(',', $_value); + $cols_count = count($cols); + } elseif (!empty($_value)) { + $cols_count = (int) $_value; + } else { + $cols_count = $cols; + } + break; - case 'rows': - $$_key = (int) $_value; - break; + case 'rows': + $$_key = (int) $_value; + break; - case 'table_attr': - case 'trailpad': - case 'hdir': - case 'vdir': - case 'inner': - case 'caption': - $$_key = (string) $_value; - break; + case 'table_attr': + case 'trailpad': + case 'hdir': + case 'vdir': + case 'inner': + case 'caption': + $$_key = (string) $_value; + break; - case 'tr_attr': - case 'td_attr': - case 'th_attr': - $$_key = $_value; - break; + case 'tr_attr': + case 'td_attr': + case 'th_attr': + $$_key = $_value; + break; } } diff --git a/libs/plugins/function.mailto.php b/libs/plugins/function.mailto.php index 0d817535..1e5ae1e5 100644 --- a/libs/plugins/function.mailto.php +++ b/libs/plugins/function.mailto.php @@ -37,12 +37,11 @@ * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"} * {mailto address="me@domain.com" extra='class="mailto"'} * - * - * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto} + * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto} * (Smarty online manual) - * @version 1.2 - * @author Monte Ohrt <monte at ohrt dot com> - * @author credits to Jason Sweat (added cc, bcc and subject functionality) + * @version 1.2 + * @author Monte Ohrt <monte at ohrt dot com> + * @author credits to Jason Sweat (added cc, bcc and subject functionality) * * @param array $params parameters * @@ -70,24 +69,24 @@ function smarty_function_mailto($params) $mail_parms = array(); foreach ($params as $var => $value) { switch ($var) { - case 'cc': - case 'bcc': - case 'followupto': - if (!empty($value)) { - $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value)); - } - break; + case 'cc': + case 'bcc': + case 'followupto': + if (!empty($value)) { + $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value)); + } + break; - case 'subject': - case 'newsgroups': - $mail_parms[] = $var . '=' . rawurlencode($value); - break; + case 'subject': + case 'newsgroups': + $mail_parms[] = $var . '=' . rawurlencode($value); + break; - case 'extra': - case 'text': - $$var = $value; + case 'extra': + case 'text': + $$var = $value; - default: + default: } } @@ -97,8 +96,10 @@ function smarty_function_mailto($params) $encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ]; if (!isset($_allowed_encoding[ $encode ])) { - trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", - E_USER_WARNING); + trigger_error( + "mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", + E_USER_WARNING + ); return; } diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php index 396ad085..111d5130 100644 --- a/libs/plugins/function.math.php +++ b/libs/plugins/function.math.php @@ -13,9 +13,9 @@ * Name: math * Purpose: handle math computations in template * - * @link http://www.smarty.net/manual/en/language.function.math.php {math} + * @link http://www.smarty.net/manual/en/language.function.math.php {math} * (Smarty online manual) - * @author Monte Ohrt <monte at ohrt dot com> + * @author Monte Ohrt <monte at ohrt dot com> * * @param array $params parameters * @param Smarty_Internal_Template $template template object diff --git a/libs/plugins/modifier.capitalize.php b/libs/plugins/modifier.capitalize.php index e354977b..a26ff1fa 100644 --- a/libs/plugins/modifier.capitalize.php +++ b/libs/plugins/modifier.capitalize.php @@ -29,23 +29,32 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals $upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET); } else { // uppercase word breaks - $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, - 'smarty_mod_cap_mbconvert_cb', $string); + $upper_string = preg_replace_callback( + "!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, + 'smarty_mod_cap_mbconvert_cb', $string + ); } // check uc_digits case if (!$uc_digits) { - if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, - PREG_OFFSET_CAPTURE)) { + if (preg_match_all( + "!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, + PREG_OFFSET_CAPTURE + ) + ) { foreach ($matches[ 1 ] as $match) { $upper_string = - substr_replace($upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ], - strlen($match[ 0 ])); + substr_replace( + $upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ], + strlen($match[ 0 ]) + ); } } } $upper_string = - preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb', - $upper_string); + preg_replace_callback( + "!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb', + $upper_string + ); return $upper_string; } @@ -55,20 +64,27 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals } // uppercase (including hyphenated words) $upper_string = - preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', - $string); + preg_replace_callback( + "!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', + $string + ); // check uc_digits case if (!$uc_digits) { - if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, - PREG_OFFSET_CAPTURE)) { + if (preg_match_all( + "!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, + PREG_OFFSET_CAPTURE + ) + ) { foreach ($matches[ 1 ] as $match) { $upper_string = substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ])); } } } - $upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb', - $upper_string); + $upper_string = preg_replace_callback( + "!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb', + $upper_string + ); return $upper_string; } diff --git a/libs/plugins/modifier.date_format.php b/libs/plugins/modifier.date_format.php index b45b2d4b..d38d8b08 100644 --- a/libs/plugins/modifier.date_format.php +++ b/libs/plugins/modifier.date_format.php @@ -38,7 +38,7 @@ function smarty_modifier_date_format($string, $format = null, $default_date = '' static $is_loaded = false; if (!$is_loaded) { if (!is_callable('smarty_make_timestamp')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); + include_once SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'; } $is_loaded = true; } diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php index 2bd11215..70d52f2a 100644 --- a/libs/plugins/modifier.debug_print_var.php +++ b/libs/plugins/modifier.debug_print_var.php @@ -26,86 +26,86 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = { $_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t'); switch (gettype($var)) { - case 'array' : - $results = '<b>Array (' . count($var) . ')</b>'; - if ($depth === $max) { - break; - } - foreach ($var as $curr_key => $curr_val) { - $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . - '</b> => ' . - smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects); - $depth --; - } + case 'array' : + $results = '<b>Array (' . count($var) . ')</b>'; + if ($depth === $max) { break; + } + foreach ($var as $curr_key => $curr_val) { + $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . + '</b> => ' . + smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects); + $depth --; + } + break; - case 'object' : - $object_vars = get_object_vars($var); - $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; - if (in_array($var, $objects)) { - $results .= ' called recursive'; - break; - } - if ($depth === $max) { - break; - } - $objects[] = $var; - foreach ($object_vars as $curr_key => $curr_val) { - $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . - '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects); - $depth --; - } + case 'object' : + $object_vars = get_object_vars($var); + $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; + if (in_array($var, $objects)) { + $results .= ' called recursive'; break; - - case 'boolean' : - case 'NULL' : - case 'resource' : - if (true === $var) { - $results = 'true'; - } elseif (false === $var) { - $results = 'false'; - } elseif (null === $var) { - $results = 'null'; - } else { - $results = htmlspecialchars((string) $var); - } - $results = '<i>' . $results . '</i>'; + } + if ($depth === $max) { break; + } + $objects[] = $var; + foreach ($object_vars as $curr_key => $curr_val) { + $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . + '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects); + $depth --; + } + break; - case 'integer' : - case 'float' : + case 'boolean' : + case 'NULL' : + case 'resource' : + if (true === $var) { + $results = 'true'; + } elseif (false === $var) { + $results = 'false'; + } elseif (null === $var) { + $results = 'null'; + } else { $results = htmlspecialchars((string) $var); - break; + } + $results = '<i>' . $results . '</i>'; + break; + + case 'integer' : + case 'float' : + $results = htmlspecialchars((string) $var); + break; - case 'string' : - $results = strtr($var, $_replace); - if (Smarty::$_MBSTRING) { - if (mb_strlen($var, Smarty::$_CHARSET) > $length) { - $results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...'; - } - } else { - if (isset($var[ $length ])) { - $results = substr($var, 0, $length - 3) . '...'; - } + case 'string' : + $results = strtr($var, $_replace); + if (Smarty::$_MBSTRING) { + if (mb_strlen($var, Smarty::$_CHARSET) > $length) { + $results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...'; } + } else { + if (isset($var[ $length ])) { + $results = substr($var, 0, $length - 3) . '...'; + } + } - $results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET); - break; + $results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET); + break; - case 'unknown type' : - default : - $results = strtr((string) $var, $_replace); - if (Smarty::$_MBSTRING) { - if (mb_strlen($results, Smarty::$_CHARSET) > $length) { - $results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...'; - } - } else { - if (strlen($results) > $length) { - $results = substr($results, 0, $length - 3) . '...'; - } + case 'unknown type' : + default : + $results = strtr((string) $var, $_replace); + if (Smarty::$_MBSTRING) { + if (mb_strlen($results, Smarty::$_CHARSET) > $length) { + $results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...'; + } + } else { + if (strlen($results) > $length) { + $results = substr($results, 0, $length - 3) . '...'; } + } - $results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET); + $results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET); } return $results; diff --git a/libs/plugins/modifier.escape.php b/libs/plugins/modifier.escape.php index 1ae87a7a..87aec07b 100644 --- a/libs/plugins/modifier.escape.php +++ b/libs/plugins/modifier.escape.php @@ -36,200 +36,212 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ } switch ($esc_type) { - case 'html': + case 'html': + if ($_double_encode) { + // php >=5.3.2 - go native + return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode); + } else { + if ($double_encode) { + // php <5.2.3 - only handle double encoding + return htmlspecialchars($string, ENT_QUOTES, $char_set); + } else { + // php <5.2.3 - prevent double encoding + $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); + $string = htmlspecialchars($string, ENT_QUOTES, $char_set); + $string = str_replace( + array('%%%SMARTY_START%%%', + '%%%SMARTY_END%%%'), array('&', + ';'), $string + ); + + return $string; + } + } + + case 'htmlall': + if (Smarty::$_MBSTRING) { + // mb_convert_encoding ignores htmlspecialchars() if ($_double_encode) { // php >=5.3.2 - go native - return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode); + $string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode); } else { if ($double_encode) { // php <5.2.3 - only handle double encoding - return htmlspecialchars($string, ENT_QUOTES, $char_set); + $string = htmlspecialchars($string, ENT_QUOTES, $char_set); } else { // php <5.2.3 - prevent double encoding $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); $string = htmlspecialchars($string, ENT_QUOTES, $char_set); - $string = str_replace(array('%%%SMARTY_START%%%', - '%%%SMARTY_END%%%'), array('&', - ';'), $string); + $string = + str_replace( + array('%%%SMARTY_START%%%', + '%%%SMARTY_END%%%'), array('&', + ';'), $string + ); return $string; } } - case 'htmlall': - if (Smarty::$_MBSTRING) { - // mb_convert_encoding ignores htmlspecialchars() - if ($_double_encode) { - // php >=5.3.2 - go native - $string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode); - } else { - if ($double_encode) { - // php <5.2.3 - only handle double encoding - $string = htmlspecialchars($string, ENT_QUOTES, $char_set); - } else { - // php <5.2.3 - prevent double encoding - $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); - $string = htmlspecialchars($string, ENT_QUOTES, $char_set); - $string = - str_replace(array('%%%SMARTY_START%%%', - '%%%SMARTY_END%%%'), array('&', - ';'), $string); - - return $string; - } - } - - // htmlentities() won't convert everything, so use mb_convert_encoding - return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set); - } + // htmlentities() won't convert everything, so use mb_convert_encoding + return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set); + } - // no MBString fallback - if ($_double_encode) { - return htmlentities($string, ENT_QUOTES, $char_set, $double_encode); + // no MBString fallback + if ($_double_encode) { + return htmlentities($string, ENT_QUOTES, $char_set, $double_encode); + } else { + if ($double_encode) { + return htmlentities($string, ENT_QUOTES, $char_set); } else { - if ($double_encode) { - return htmlentities($string, ENT_QUOTES, $char_set); - } else { - $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); - $string = htmlentities($string, ENT_QUOTES, $char_set); - $string = str_replace(array('%%%SMARTY_START%%%', - '%%%SMARTY_END%%%'), array('&', - ';'), $string); + $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); + $string = htmlentities($string, ENT_QUOTES, $char_set); + $string = str_replace( + array('%%%SMARTY_START%%%', + '%%%SMARTY_END%%%'), array('&', + ';'), $string + ); - return $string; - } + return $string; } + } - case 'url': - return rawurlencode($string); + case 'url': + return rawurlencode($string); - case 'urlpathinfo': - return str_replace('%2F', '/', rawurlencode($string)); + case 'urlpathinfo': + return str_replace('%2F', '/', rawurlencode($string)); - case 'quotes': - // escape unescaped single quotes - return preg_replace("%(?<!\\\\)'%", "\\'", $string); + case 'quotes': + // escape unescaped single quotes + return preg_replace("%(?<!\\\\)'%", "\\'", $string); - case 'hex': - // escape every byte into hex - // Note that the UTF-8 encoded character ä will be represented as %c3%a4 - $return = ''; - $_length = strlen($string); - for ($x = 0; $x < $_length; $x ++) { - $return .= '%' . bin2hex($string[ $x ]); - } + case 'hex': + // escape every byte into hex + // Note that the UTF-8 encoded character ä will be represented as %c3%a4 + $return = ''; + $_length = strlen($string); + for ($x = 0; $x < $_length; $x ++) { + $return .= '%' . bin2hex($string[ $x ]); + } - return $return; + return $return; - case 'hexentity': - $return = ''; - if (Smarty::$_MBSTRING) { - if (!$is_loaded_1) { - if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); - } - $is_loaded_1 = true; + case 'hexentity': + $return = ''; + if (Smarty::$_MBSTRING) { + if (!$is_loaded_1) { + if (!is_callable('smarty_mb_to_unicode')) { + include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'; } - $return = ''; - foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { - $return .= '&#x' . strtoupper(dechex($unicode)) . ';'; - } - - return $return; + $is_loaded_1 = true; } - // no MBString fallback - $_length = strlen($string); - for ($x = 0; $x < $_length; $x ++) { - $return .= '&#x' . bin2hex($string[ $x ]) . ';'; + $return = ''; + foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { + $return .= '&#x' . strtoupper(dechex($unicode)) . ';'; } return $return; + } + // no MBString fallback + $_length = strlen($string); + for ($x = 0; $x < $_length; $x ++) { + $return .= '&#x' . bin2hex($string[ $x ]) . ';'; + } - case 'decentity': - $return = ''; - if (Smarty::$_MBSTRING) { - if (!$is_loaded_1) { - if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); - } - $is_loaded_1 = true; - } - $return = ''; - foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { - $return .= '&#' . $unicode . ';'; - } + return $return; - return $return; + case 'decentity': + $return = ''; + if (Smarty::$_MBSTRING) { + if (!$is_loaded_1) { + if (!is_callable('smarty_mb_to_unicode')) { + include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'; + } + $is_loaded_1 = true; } - // no MBString fallback - $_length = strlen($string); - for ($x = 0; $x < $_length; $x ++) { - $return .= '&#' . ord($string[ $x ]) . ';'; + $return = ''; + foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { + $return .= '&#' . $unicode . ';'; } return $return; + } + // no MBString fallback + $_length = strlen($string); + for ($x = 0; $x < $_length; $x ++) { + $return .= '&#' . ord($string[ $x ]) . ';'; + } + + return $return; - case 'javascript': - // escape quotes and backslashes, newlines, etc. - return strtr($string, array('\\' => '\\\\', + case 'javascript': + // escape quotes and backslashes, newlines, etc. + return strtr( + $string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', - '</' => '<\/')); + '</' => '<\/') + ); - case 'mail': - if (Smarty::$_MBSTRING) { - if (!$is_loaded_2) { - if (!is_callable('smarty_mb_str_replace')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); - } - $is_loaded_2 = true; + case 'mail': + if (Smarty::$_MBSTRING) { + if (!$is_loaded_2) { + if (!is_callable('smarty_mb_str_replace')) { + include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'; } - return smarty_mb_str_replace(array('@', - '.'), array(' [AT] ', - ' [DOT] '), $string); + $is_loaded_2 = true; } - // no MBString fallback - return str_replace(array('@', + return smarty_mb_str_replace( + array('@', + '.'), array(' [AT] ', + ' [DOT] '), $string + ); + } + // no MBString fallback + return str_replace( + array('@', '.'), array(' [AT] ', - ' [DOT] '), $string); + ' [DOT] '), $string + ); - case 'nonstd': - // escape non-standard chars, such as ms document quotes - $return = ''; - if (Smarty::$_MBSTRING) { - if (!$is_loaded_1) { - if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); - } - $is_loaded_1 = true; - } - foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { - if ($unicode >= 126) { - $return .= '&#' . $unicode . ';'; - } else { - $return .= chr($unicode); - } + case 'nonstd': + // escape non-standard chars, such as ms document quotes + $return = ''; + if (Smarty::$_MBSTRING) { + if (!$is_loaded_1) { + if (!is_callable('smarty_mb_to_unicode')) { + include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'; } - - return $return; + $is_loaded_1 = true; } - - $_length = strlen($string); - for ($_i = 0; $_i < $_length; $_i ++) { - $_ord = ord(substr($string, $_i, 1)); - // non-standard char, escape it - if ($_ord >= 126) { - $return .= '&#' . $_ord . ';'; + foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { + if ($unicode >= 126) { + $return .= '&#' . $unicode . ';'; } else { - $return .= substr($string, $_i, 1); + $return .= chr($unicode); } } return $return; + } + + $_length = strlen($string); + for ($_i = 0; $_i < $_length; $_i ++) { + $_ord = ord(substr($string, $_i, 1)); + // non-standard char, escape it + if ($_ord >= 126) { + $return .= '&#' . $_ord . ';'; + } else { + $return .= substr($string, $_i, 1); + } + } + + return $return; - default: - return $string; + default: + return $string; } } diff --git a/libs/plugins/modifier.mb_wordwrap.php b/libs/plugins/modifier.mb_wordwrap.php index 93c6241e..39a3409a 100644 --- a/libs/plugins/modifier.mb_wordwrap.php +++ b/libs/plugins/modifier.mb_wordwrap.php @@ -11,13 +11,12 @@ * Name: mb_wordwrap * Purpose: Wrap a string to a given number of characters * - - * @link http://php.net/manual/en/function.wordwrap.php for similarity + * @link http://php.net/manual/en/function.wordwrap.php for similarity * - * @param string $str the string to wrap - * @param int $width the width of the output - * @param string $break the character used to break the line - * @param boolean $cut ignored parameter, just for the sake of + * @param string $str the string to wrap + * @param int $width the width of the output + * @param string $break the character used to break the line + * @param boolean $cut ignored parameter, just for the sake of * * @return string wrapped string * @author Rodney Rehm @@ -36,10 +35,12 @@ function smarty_modifier_mb_wordwrap($str, $width = 75, $break = "\n", $cut = fa $_tokens = array($_token); if ($token_length > $width) { if ($cut) { - $_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, - $_token, - -1, - PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); + $_tokens = preg_split( + '!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, + $_token, + -1, + PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE + ); } } diff --git a/libs/plugins/modifier.regex_replace.php b/libs/plugins/modifier.regex_replace.php index 479aba87..34d5b799 100644 --- a/libs/plugins/modifier.regex_replace.php +++ b/libs/plugins/modifier.regex_replace.php @@ -12,9 +12,9 @@ * Name: regex_replace * Purpose: regular expression search/replace * - * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php + * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php * regex_replace (Smarty online manual) - * @author Monte Ohrt <monte at ohrt dot com> + * @author Monte Ohrt <monte at ohrt dot com> * * @param string $string input string * @param string|array $search regular expression(s) to search for diff --git a/libs/plugins/modifier.replace.php b/libs/plugins/modifier.replace.php index a1b043b6..a8f8f9b8 100644 --- a/libs/plugins/modifier.replace.php +++ b/libs/plugins/modifier.replace.php @@ -28,7 +28,7 @@ function smarty_modifier_replace($string, $search, $replace) if (Smarty::$_MBSTRING) { if (!$is_loaded) { if (!is_callable('smarty_mb_str_replace')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); + include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'; } $is_loaded = true; } diff --git a/libs/plugins/modifier.truncate.php b/libs/plugins/modifier.truncate.php index bb9df92d..a020c716 100644 --- a/libs/plugins/modifier.truncate.php +++ b/libs/plugins/modifier.truncate.php @@ -35,8 +35,10 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo if (mb_strlen($string, Smarty::$_CHARSET) > $length) { $length -= min($length, mb_strlen($etc, Smarty::$_CHARSET)); if (!$break_words && !$middle) { - $string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '', - mb_substr($string, 0, $length + 1, Smarty::$_CHARSET)); + $string = preg_replace( + '/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '', + mb_substr($string, 0, $length + 1, Smarty::$_CHARSET) + ); } if (!$middle) { return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc; diff --git a/libs/plugins/modifiercompiler.cat.php b/libs/plugins/modifiercompiler.cat.php index 919b03c3..bb4c782f 100644 --- a/libs/plugins/modifiercompiler.cat.php +++ b/libs/plugins/modifiercompiler.cat.php @@ -15,9 +15,9 @@ * Input: string to catenate * Example: {$var|cat:"foo"} * - * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat + * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat * (Smarty online manual) - * @author Uwe Tews + * @author Uwe Tews * * @param array $params parameters * diff --git a/libs/plugins/modifiercompiler.count_paragraphs.php b/libs/plugins/modifiercompiler.count_paragraphs.php index 1917d290..884d0d37 100644 --- a/libs/plugins/modifiercompiler.count_paragraphs.php +++ b/libs/plugins/modifiercompiler.count_paragraphs.php @@ -12,9 +12,9 @@ * Name: count_paragraphs * Purpose: count the number of paragraphs in a text * - * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php + * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php * count_paragraphs (Smarty online manual) - * @author Uwe Tews + * @author Uwe Tews * * @param array $params parameters * diff --git a/libs/plugins/modifiercompiler.count_sentences.php b/libs/plugins/modifiercompiler.count_sentences.php index a782d8e0..015620e6 100644 --- a/libs/plugins/modifiercompiler.count_sentences.php +++ b/libs/plugins/modifiercompiler.count_sentences.php @@ -12,9 +12,9 @@ * Name: count_sentences * Purpose: count the number of sentences in a text * - * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php + * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php * count_sentences (Smarty online manual) - * @author Uwe Tews + * @author Uwe Tews * * @param array $params parameters * diff --git a/libs/plugins/modifiercompiler.escape.php b/libs/plugins/modifiercompiler.escape.php index 6a6e0163..40fbb0c0 100644 --- a/libs/plugins/modifiercompiler.escape.php +++ b/libs/plugins/modifiercompiler.escape.php @@ -14,8 +14,8 @@ * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual) * @author Rodney Rehm * - * @param array $params parameters - * @param Smarty_Internal_TemplateCompilerBase $compiler + * @param array $params parameters + * @param Smarty_Internal_TemplateCompilerBase $compiler * * @return string with compiled code * @throws \SmartyException @@ -24,8 +24,10 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile { static $_double_encode = null; static $is_loaded = false; - $compiler->template->_checkPlugins(array(array('function' => 'smarty_literal_compiler_param', - 'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php'))); + $compiler->template->_checkPlugins( + array(array('function' => 'smarty_literal_compiler_param', + 'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php')) + ); if ($_double_encode === null) { $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>='); } @@ -40,57 +42,57 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile } switch ($esc_type) { - case 'html': - if ($_double_encode) { - return 'htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' . - var_export($double_encode, true) . ')'; - } elseif ($double_encode) { - return 'htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ')'; - } else { - // fall back to modifier.escape.php - } - - case 'htmlall': - if (Smarty::$_MBSTRING) { - if ($_double_encode) { - // php >=5.2.3 - go native - return 'mb_convert_encoding(htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . - var_export($char_set, true) . ', ' . var_export($double_encode, true) . - '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')'; - } elseif ($double_encode) { - // php <5.2.3 - only handle double encoding - return 'mb_convert_encoding(htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . - var_export($char_set, true) . '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')'; - } else { - // fall back to modifier.escape.php - } - } + case 'html': + if ($_double_encode) { + return 'htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' . + var_export($double_encode, true) . ')'; + } elseif ($double_encode) { + return 'htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ')'; + } else { + // fall back to modifier.escape.php + } - // no MBString fallback + case 'htmlall': + if (Smarty::$_MBSTRING) { if ($_double_encode) { // php >=5.2.3 - go native - return 'htmlentities(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' . - var_export($double_encode, true) . ')'; + return 'mb_convert_encoding(htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . + var_export($char_set, true) . ', ' . var_export($double_encode, true) . + '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')'; } elseif ($double_encode) { // php <5.2.3 - only handle double encoding - return 'htmlentities(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ')'; + return 'mb_convert_encoding(htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . + var_export($char_set, true) . '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')'; } else { // fall back to modifier.escape.php } + } + + // no MBString fallback + if ($_double_encode) { + // php >=5.2.3 - go native + return 'htmlentities(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' . + var_export($double_encode, true) . ')'; + } elseif ($double_encode) { + // php <5.2.3 - only handle double encoding + return 'htmlentities(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ')'; + } else { + // fall back to modifier.escape.php + } - case 'url': - return 'rawurlencode(' . $params[ 0 ] . ')'; + case 'url': + return 'rawurlencode(' . $params[ 0 ] . ')'; - case 'urlpathinfo': - return 'str_replace("%2F", "/", rawurlencode(' . $params[ 0 ] . '))'; + case 'urlpathinfo': + return 'str_replace("%2F", "/", rawurlencode(' . $params[ 0 ] . '))'; - case 'quotes': - // escape unescaped single quotes - return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[ 0 ] . ')'; + case 'quotes': + // escape unescaped single quotes + return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[ 0 ] . ')'; - case 'javascript': - // escape quotes and backslashes, newlines, etc. - return 'strtr(' . $params[ 0 ] . + case 'javascript': + // escape quotes and backslashes, newlines, etc. + return 'strtr(' . $params[ 0 ] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))'; } } diff --git a/libs/plugins/modifiercompiler.noprint.php b/libs/plugins/modifiercompiler.noprint.php index 455cfe14..d4b3304e 100644 --- a/libs/plugins/modifiercompiler.noprint.php +++ b/libs/plugins/modifiercompiler.noprint.php @@ -12,7 +12,7 @@ * Name: noprint * Purpose: return an empty string * - * @author Uwe Tews + * @author Uwe Tews * @return string with compiled code */ function smarty_modifiercompiler_noprint() diff --git a/libs/plugins/modifiercompiler.unescape.php b/libs/plugins/modifiercompiler.unescape.php index 5a94e072..44e01a48 100644 --- a/libs/plugins/modifiercompiler.unescape.php +++ b/libs/plugins/modifiercompiler.unescape.php @@ -30,21 +30,21 @@ function smarty_modifiercompiler_unescape($params) } switch (trim($params[ 1 ], '"\'')) { - case 'entity': - case 'htmlall': - if (Smarty::$_MBSTRING) { - return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')'; - } + case 'entity': + case 'htmlall': + if (Smarty::$_MBSTRING) { + return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')'; + } - return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')'; + return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')'; - case 'html': - return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)'; + case 'html': + return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)'; - case 'url': - return 'rawurldecode(' . $params[ 0 ] . ')'; + case 'url': + return 'rawurldecode(' . $params[ 0 ] . ')'; - default: - return $params[ 0 ]; + default: + return $params[ 0 ]; } } diff --git a/libs/plugins/modifiercompiler.wordwrap.php b/libs/plugins/modifiercompiler.wordwrap.php index 94a0cf60..b08d2e05 100644 --- a/libs/plugins/modifiercompiler.wordwrap.php +++ b/libs/plugins/modifiercompiler.wordwrap.php @@ -14,7 +14,7 @@ * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual) * @author Uwe Tews * - * @param array $params parameters + * @param array $params parameters * @param \Smarty_Internal_TemplateCompilerBase $compiler * * @return string with compiled code @@ -33,7 +33,7 @@ function smarty_modifiercompiler_wordwrap($params, Smarty_Internal_TemplateCompi } $function = 'wordwrap'; if (Smarty::$_MBSTRING) { - $function = $compiler->getPlugin('mb_wordwrap','modifier'); + $function = $compiler->getPlugin('mb_wordwrap', 'modifier'); } return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')'; } diff --git a/libs/plugins/outputfilter.trimwhitespace.php b/libs/plugins/outputfilter.trimwhitespace.php index 70a66d3d..9c8e7304 100644 --- a/libs/plugins/outputfilter.trimwhitespace.php +++ b/libs/plugins/outputfilter.trimwhitespace.php @@ -10,12 +10,12 @@ * Smarty trimwhitespace outputfilter plugin * Trim unnecessary whitespace from HTML markup. * - * @author Rodney Rehm + * @author Rodney Rehm * * @param string $source input string * * @return string filtered output - * @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail! + * @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail! */ function smarty_outputfilter_trimwhitespace($source) { @@ -27,8 +27,11 @@ function smarty_outputfilter_trimwhitespace($source) $source = preg_replace('/\015\012|\015|\012/', "\n", $source); // capture Internet Explorer and KnockoutJS Conditional Comments - if (preg_match_all('#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is', $source, $matches, - PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { + if (preg_match_all( + '#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is', $source, $matches, + PREG_OFFSET_CAPTURE | PREG_SET_ORDER + ) + ) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); @@ -46,8 +49,11 @@ function smarty_outputfilter_trimwhitespace($source) // capture html elements not to be messed with $_offset = 0; - if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', - $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { + if (preg_match_all( + '#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', + $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER + ) + ) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); diff --git a/libs/plugins/shared.escape_special_chars.php b/libs/plugins/shared.escape_special_chars.php index 1d4c7284..9ce66778 100644 --- a/libs/plugins/shared.escape_special_chars.php +++ b/libs/plugins/shared.escape_special_chars.php @@ -12,9 +12,9 @@ * Purpose: used by other smarty functions to escape * special chars except for already escaped ones * - * @author Monte Ohrt <monte at ohrt dot com> + * @author Monte Ohrt <monte at ohrt dot com> * - * @param string $string text that should by escaped + * @param string $string text that should by escaped * * @return string */ diff --git a/libs/plugins/shared.literal_compiler_param.php b/libs/plugins/shared.literal_compiler_param.php index 8a3711d3..abac78b7 100644 --- a/libs/plugins/shared.literal_compiler_param.php +++ b/libs/plugins/shared.literal_compiler_param.php @@ -25,8 +25,10 @@ function smarty_literal_compiler_param($params, $index, $default = null) } // test if param is a literal if (!preg_match('/^([\'"]?)[a-zA-Z0-9-]+(\\1)$/', $params[ $index ])) { - throw new SmartyException('$param[' . $index . - '] is not a literal and is thus not evaluatable at compile time'); + throw new SmartyException( + '$param[' . $index . + '] is not a literal and is thus not evaluatable at compile time' + ); } $t = null; diff --git a/libs/plugins/shared.make_timestamp.php b/libs/plugins/shared.make_timestamp.php index eb064607..77577c4c 100644 --- a/libs/plugins/shared.make_timestamp.php +++ b/libs/plugins/shared.make_timestamp.php @@ -10,7 +10,7 @@ * Function: smarty_make_timestamp * Purpose: used by other smarty functions to make a timestamp from a string. * - * @author Monte Ohrt <monte at ohrt dot com> + * @author Monte Ohrt <monte at ohrt dot com> * * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime() * @@ -21,14 +21,16 @@ function smarty_make_timestamp($string) if (empty($string)) { // use "now": return time(); - } elseif ($string instanceof DateTime || - (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface) + } elseif ($string instanceof DateTime + || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface) ) { return (int) $string->format('U'); // PHP 5.2 BC } elseif (strlen($string) === 14 && ctype_digit($string)) { // it is mysql timestamp format of YYYYMMDDHHMMSS? - return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2), - substr($string, 6, 2), substr($string, 0, 4)); + return mktime( + substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2), + substr($string, 6, 2), substr($string, 0, 4) + ); } elseif (is_numeric($string)) { // it is a numeric string, we handle it as timestamp return (int) $string; diff --git a/libs/plugins/shared.mb_str_replace.php b/libs/plugins/shared.mb_str_replace.php index 30070293..b03ed070 100644 --- a/libs/plugins/shared.mb_str_replace.php +++ b/libs/plugins/shared.mb_str_replace.php @@ -9,10 +9,10 @@ if (!function_exists('smarty_mb_str_replace')) { /** * Multibyte string replace * - * @param string|string[] $search the string to be searched - * @param string|string[] $replace the replacement string - * @param string $subject the source string - * @param int &$count number of matches found + * @param string|string[] $search the string to be searched + * @param string|string[] $replace the replacement string + * @param string $subject the source string + * @param int &$count number of matches found * * @return string replaced string * @author Rodney Rehm diff --git a/libs/plugins/shared.mb_unicode.php b/libs/plugins/shared.mb_unicode.php index 7450148a..d8253b0a 100644 --- a/libs/plugins/shared.mb_unicode.php +++ b/libs/plugins/shared.mb_unicode.php @@ -9,7 +9,7 @@ /** * convert characters to their decimal unicode equivalents * - * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration + * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration * * @param string $string characters to calculate unicode of * @param string $encoding encoding of $string, if null mb_internal_encoding() is used @@ -31,7 +31,7 @@ function smarty_mb_to_unicode($string, $encoding = null) /** * convert unicodes to the character of given encoding * - * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration + * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration * * @param integer|array $unicode single unicode or list of unicodes to convert * @param string $encoding encoding of returned string, if null mb_internal_encoding() is used diff --git a/libs/plugins/variablefilter.htmlspecialchars.php b/libs/plugins/variablefilter.htmlspecialchars.php index 3c85295d..97e40075 100644 --- a/libs/plugins/variablefilter.htmlspecialchars.php +++ b/libs/plugins/variablefilter.htmlspecialchars.php @@ -8,7 +8,7 @@ /** * Smarty htmlspecialchars variablefilter plugin * - * @param string $source input string + * @param string $source input string * @param \Smarty_Internal_Template $template * * @return string filtered output diff --git a/libs/sysplugins/smarty_cacheresource.php b/libs/sysplugins/smarty_cacheresource.php index 2a4552cb..9b942749 100644 --- a/libs/sysplugins/smarty_cacheresource.php +++ b/libs/sysplugins/smarty_cacheresource.php @@ -51,7 +51,8 @@ abstract class Smarty_CacheResource * @return boolean true or false if the cached content does not exist */ abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null, - $update = false); + $update = false + ); /** * Write the rendered template output to cache @@ -66,7 +67,7 @@ abstract class Smarty_CacheResource /** * Read cached template from cache * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return string content */ diff --git a/libs/sysplugins/smarty_cacheresource_custom.php b/libs/sysplugins/smarty_cacheresource_custom.php index 7a5920f4..15c636bc 100644 --- a/libs/sysplugins/smarty_cacheresource_custom.php +++ b/libs/sysplugins/smarty_cacheresource_custom.php @@ -18,12 +18,12 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * fetch cached content and its modification time from data source * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $content cached content - * @param integer $mtime cache modification timestamp (epoch) + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $content cached content + * @param integer $mtime cache modification timestamp (epoch) * * @return void */ @@ -34,10 +34,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource * {@internal implementing this method is optional. * Only implement it if modification times can be accessed faster than loading the complete cached content.}} * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id * * @return integer|boolean timestamp (epoch) the template was modified, or false if not found */ @@ -49,12 +49,12 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Save content to cache * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer|null $exp_time seconds till expiration or null - * @param string $content content to cache + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer|null $exp_time seconds till expiration or null + * @param string $content content to cache * * @return boolean success */ @@ -63,10 +63,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Delete content from cache * - * @param string|null $name template name - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * @param integer|null $exp_time seconds till expiration time in seconds or null + * @param string|null $name template name + * @param string|null $cache_id cache id + * @param string|null $compile_id compile id + * @param integer|null $exp_time seconds till expiration time in seconds or null * * @return integer number of deleted caches */ @@ -75,8 +75,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * populate Cached Object with meta data from Resource * - * @param Smarty_Template_Cached $cached cached object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -110,8 +110,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource return; } $timestamp = null; - $this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content, - $timestamp); + $this->fetch( + $cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content, + $timestamp + ); $cached->timestamp = isset($timestamp) ? $timestamp : false; $cached->exists = !!$cached->timestamp; } @@ -120,22 +122,24 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource * Read the cached template and process the header * * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template - * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Template_Cached $cached cached object * @param boolean $update flag if called because cache update * * @return boolean true or false if the cached content does not exist */ public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null, - $update = false) - { + $update = false + ) { if (!$cached) { $cached = $_smarty_tpl->cached; } $content = $cached->content ? $cached->content : null; $timestamp = $cached->timestamp ? $cached->timestamp : null; if ($content === null || !$timestamp) { - $this->fetch($_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id, - $_smarty_tpl->compile_id, $content, $timestamp); + $this->fetch( + $_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id, + $_smarty_tpl->compile_id, $content, $timestamp + ); } if (isset($content)) { eval('?>' . $content); @@ -149,21 +153,23 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Write the rendered template output to cache * - * @param Smarty_Internal_Template $_template template object - * @param string $content content to cache + * @param Smarty_Internal_Template $_template template object + * @param string $content content to cache * * @return boolean success */ public function writeCachedContent(Smarty_Internal_Template $_template, $content) { - return $this->save($_template->cached->filepath, $_template->source->name, $_template->cache_id, - $_template->compile_id, $_template->cache_lifetime, $content); + return $this->save( + $_template->cached->filepath, $_template->source->name, $_template->cache_id, + $_template->compile_id, $_template->cache_lifetime, $content + ); } /** * Read cached template from cache * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return string|boolean content */ @@ -173,8 +179,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource $timestamp = null; if ($content === null) { $timestamp = null; - $this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, - $_template->compile_id, $content, $timestamp); + $this->fetch( + $_template->cached->filepath, $_template->source->name, $_template->cache_id, + $_template->compile_id, $content, $timestamp + ); } if (isset($content)) { return $content; @@ -185,8 +193,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Empty cache * - * @param Smarty $smarty Smarty object - * @param integer $exp_time expiration time (number of seconds, not timestamp) + * @param Smarty $smarty Smarty object + * @param integer $exp_time expiration time (number of seconds, not timestamp) * * @return integer number of cache files deleted */ @@ -198,11 +206,11 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Empty cache for a specific template * - * @param Smarty $smarty Smarty object - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time (number of seconds, not timestamp) + * @param Smarty $smarty Smarty object + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer $exp_time expiration time (number of seconds, not timestamp) * * @return int number of cache files deleted * @throws \SmartyException @@ -226,8 +234,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Check is cache is locked for this template * - * @param Smarty $smarty Smarty object - * @param Smarty_Template_Cached $cached cached object + * @param Smarty $smarty Smarty object + * @param Smarty_Template_Cached $cached cached object * * @return boolean true or false if cache is locked */ diff --git a/libs/sysplugins/smarty_cacheresource_keyvaluestore.php b/libs/sysplugins/smarty_cacheresource_keyvaluestore.php index ff065a27..2be39076 100644 --- a/libs/sysplugins/smarty_cacheresource_keyvaluestore.php +++ b/libs/sysplugins/smarty_cacheresource_keyvaluestore.php @@ -47,8 +47,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * populate Cached Object with meta data from Resource * - * @param Smarty_Template_Cached $cached cached object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -63,14 +63,16 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * populate Cached Object with timestamp and exists from Resource * - * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Template_Cached $cached cached object * * @return void */ public function populateTimestamp(Smarty_Template_Cached $cached) { - if (!$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $content, - $timestamp, $cached->source->uid) + if (!$this->fetch( + $cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $content, + $timestamp, $cached->source->uid + ) ) { return; } @@ -83,22 +85,24 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource * Read the cached template and process the header * * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template - * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Template_Cached $cached cached object * @param boolean $update flag if called because cache update * * @return boolean true or false if the cached content does not exist */ public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null, - $update = false) - { + $update = false + ) { if (!$cached) { $cached = $_smarty_tpl->cached; } $content = $cached->content ? $cached->content : null; $timestamp = $cached->timestamp ? $cached->timestamp : null; if ($content === null || !$timestamp) { - if (!$this->fetch($_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id, - $_smarty_tpl->compile_id, $content, $timestamp, $_smarty_tpl->source->uid) + if (!$this->fetch( + $_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id, + $_smarty_tpl->compile_id, $content, $timestamp, $_smarty_tpl->source->uid + ) ) { return false; } @@ -115,8 +119,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Write the rendered template output to cache * - * @param Smarty_Internal_Template $_template template object - * @param string $content content to cache + * @param Smarty_Internal_Template $_template template object + * @param string $content content to cache * * @return boolean success */ @@ -130,7 +134,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Read cached template from cache * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return string|false content */ @@ -139,8 +143,10 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource $content = $_template->cached->content ? $_template->cached->content : null; $timestamp = null; if ($content === null) { - if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, - $_template->compile_id, $content, $timestamp, $_template->source->uid) + if (!$this->fetch( + $_template->cached->filepath, $_template->source->name, $_template->cache_id, + $_template->compile_id, $content, $timestamp, $_template->source->uid + ) ) { return false; } @@ -155,12 +161,12 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource * Empty cache * {@internal the $exp_time argument is ignored altogether }} * - * @param Smarty $smarty Smarty object - * @param integer $exp_time expiration time [being ignored] + * @param Smarty $smarty Smarty object + * @param integer $exp_time expiration time [being ignored] * * @return integer number of cache files deleted [always -1] - * @uses purge() to clear the whole store - * @uses invalidate() to mark everything outdated if purge() is inapplicable + * @uses purge() to clear the whole store + * @uses invalidate() to mark everything outdated if purge() is inapplicable */ public function clearAll(Smarty $smarty, $exp_time = null) { @@ -174,17 +180,17 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource * Empty cache for a specific template * {@internal the $exp_time argument is ignored altogether}} * - * @param Smarty $smarty Smarty object - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time [being ignored] + * @param Smarty $smarty Smarty object + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer $exp_time expiration time [being ignored] * * @return int number of cache files deleted [always -1] * @throws \SmartyException - * @uses buildCachedFilepath() to generate the CacheID - * @uses invalidate() to mark CacheIDs parent chain as outdated - * @uses delete() to remove CacheID from cache + * @uses buildCachedFilepath() to generate the CacheID + * @uses invalidate() to mark CacheIDs parent chain as outdated + * @uses delete() to remove CacheID from cache */ public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time) { @@ -199,12 +205,11 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Get template's unique ID * - * @param Smarty $smarty Smarty object - * @param string $resource_name template name + * @param Smarty $smarty Smarty object + * @param string $resource_name template name * * @return string filepath of cache file * @throws \SmartyException - * */ protected function getTemplateUid(Smarty $smarty, $resource_name) { @@ -220,7 +225,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Sanitize CacheID components * - * @param string $string CacheID component to sanitize + * @param string $string CacheID component to sanitize * * @return string sanitized CacheID component */ @@ -236,19 +241,19 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Fetch and prepare a cache object. * - * @param string $cid CacheID to fetch - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $content cached content - * @param integer &$timestamp cached timestamp (epoch) - * @param string $resource_uid resource's uid + * @param string $cid CacheID to fetch + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $content cached content + * @param integer &$timestamp cached timestamp (epoch) + * @param string $resource_uid resource's uid * * @return boolean success */ protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null, - &$timestamp = null, $resource_uid = null) - { + &$timestamp = null, $resource_uid = null + ) { $t = $this->read(array($cid)); $content = !empty($t[ $cid ]) ? $t[ $cid ] : null; $timestamp = null; @@ -281,7 +286,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Extract the timestamp the $content was cached * - * @param string &$content the cached content + * @param string &$content the cached content * * @return float the microtime the content was cached */ @@ -298,17 +303,17 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Invalidate CacheID * - * @param string $cid CacheID - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $resource_uid source's uid + * @param string $cid CacheID + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $resource_uid source's uid * * @return void */ protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null, - $resource_uid = null) - { + $resource_uid = null + ) { $now = microtime(true); $key = null; // invalidate everything @@ -339,17 +344,17 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Determine the latest timestamp known to the invalidation chain * - * @param string $cid CacheID to determine latest invalidation timestamp of - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $resource_uid source's filepath + * @param string $cid CacheID to determine latest invalidation timestamp of + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $resource_uid source's filepath * * @return float the microtime the CacheID was invalidated */ protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null, - $resource_uid = null) - { + $resource_uid = null + ) { // abort if there is no CacheID if (false && !$cid) { return 0; @@ -373,18 +378,18 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource * Translate a CacheID into the list of applicable InvalidationKeys. * Splits 'some|chain|into|an|array' into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... ) * - * @param string $cid CacheID to translate - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $resource_uid source's filepath + * @param string $cid CacheID to translate + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $resource_uid source's filepath * * @return array list of InvalidationKeys - * @uses $invalidationKeyPrefix to prepend to each InvalidationKey + * @uses $invalidationKeyPrefix to prepend to each InvalidationKey */ protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, - $resource_uid = null) - { + $resource_uid = null + ) { $t = array('IVK#ALL'); $_name = $_compile = '#'; if ($resource_name) { @@ -425,8 +430,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Check is cache is locked for this template * - * @param Smarty $smarty Smarty object - * @param Smarty_Template_Cached $cached cached object + * @param Smarty $smarty Smarty object + * @param Smarty_Template_Cached $cached cached object * * @return boolean true or false if cache is locked */ @@ -471,7 +476,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Read values for a set of keys from cache * - * @param array $keys list of keys to fetch + * @param array $keys list of keys to fetch * * @return array list of values with the given keys used as indexes */ @@ -480,8 +485,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Save values for a set of keys to cache * - * @param array $keys list of values to save - * @param int $expire expiration time + * @param array $keys list of values to save + * @param int $expire expiration time * * @return boolean true on success, false on failure */ @@ -490,7 +495,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Remove values from cache * - * @param array $keys list of keys to delete + * @param array $keys list of keys to delete * * @return boolean true on success, false on failure */ diff --git a/libs/sysplugins/smarty_internal_block.php b/libs/sysplugins/smarty_internal_block.php index 780319f1..9956d642 100644 --- a/libs/sysplugins/smarty_internal_block.php +++ b/libs/sysplugins/smarty_internal_block.php @@ -87,4 +87,4 @@ class Smarty_Internal_Block public function callBlock(Smarty_Internal_Template $tpl) { } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php index f6ef0930..bcdb66e8 100644 --- a/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -32,11 +32,13 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource $_filepath = sha1($source->uid . $smarty->_joined_template_dir); $cached->filepath = $smarty->getCacheDir(); if (isset($_template->cache_id)) { - $cached->filepath .= preg_replace(array('![^\w|]+!', + $cached->filepath .= preg_replace( + array('![^\w|]+!', '![|]+!'), - array('_', + array('_', $_compile_dir_sep), - $_template->cache_id) . $_compile_dir_sep; + $_template->cache_id + ) . $_compile_dir_sep; } if (isset($_template->compile_id)) { $cached->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) . $_compile_dir_sep; @@ -88,9 +90,9 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource * @return boolean true or false if the cached content does not exist */ public function process(Smarty_Internal_Template $_smarty_tpl, - Smarty_Template_Cached $cached = null, - $update = false) - { + Smarty_Template_Cached $cached = null, + $update = false + ) { $_smarty_tpl->cached->valid = false; if ($update && defined('HHVM_VERSION')) { eval('?>' . file_get_contents($_smarty_tpl->cached->filepath)); @@ -111,12 +113,14 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource */ public function writeCachedContent(Smarty_Internal_Template $_template, $content) { - if ($_template->smarty->ext->_writeFile->writeFile($_template->cached->filepath, - $content, - $_template->smarty) === true + if ($_template->smarty->ext->_writeFile->writeFile( + $_template->cached->filepath, + $content, + $_template->smarty + ) === true ) { - if (function_exists('opcache_invalidate') && - (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1 + if (function_exists('opcache_invalidate') + && (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1 ) { opcache_invalidate($_template->cached->filepath, true); } else if (function_exists('apc_compile_file')) { @@ -135,7 +139,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource /** * Read cached template from cache * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return string content */ diff --git a/libs/sysplugins/smarty_internal_compile_append.php b/libs/sysplugins/smarty_internal_compile_append.php index b3689e91..1a9befbf 100644 --- a/libs/sysplugins/smarty_internal_compile_append.php +++ b/libs/sysplugins/smarty_internal_compile_append.php @@ -19,9 +19,9 @@ class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign /** * Compiles code for the {append} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException diff --git a/libs/sysplugins/smarty_internal_compile_assign.php b/libs/sysplugins/smarty_internal_compile_assign.php index cb2ea425..d2d24afe 100644 --- a/libs/sysplugins/smarty_internal_compile_assign.php +++ b/libs/sysplugins/smarty_internal_compile_assign.php @@ -24,7 +24,7 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase */ public $option_flags = array('nocache', 'noscope'); - /** + /** * Valid scope names * * @var array @@ -36,9 +36,9 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase /** * Compiles code for the {assign} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index 88d6f37e..710b8129 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -47,10 +47,9 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher /** * 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 - * + * @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) { @@ -72,11 +71,13 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher $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, + $this->openTag( + $compiler, + 'block', + array($_attr, $compiler->nocache, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, - $compiler->template->caching)); + $compiler->template->caching) + ); $compiler->saveRequiredPlugins(true); $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); @@ -86,16 +87,15 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher } /** * 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 array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return bool true */ @@ -124,7 +124,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $output .= "class {$_className} extends Smarty_Internal_Block\n"; $output .= "{\n"; foreach ($_block as $property => $value) { - $output .= "public \${$property} = " . var_export($value,true) .";\n"; + $output .= "public \${$property} = " . var_export($value, true) .";\n"; } $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; $output .= $compiler->compileRequiredPlugins(); @@ -136,9 +136,13 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $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, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = "<?php\n"; if (isset($_assign)) { @@ -148,9 +152,13 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $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->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 diff --git a/libs/sysplugins/smarty_internal_compile_block_child.php b/libs/sysplugins/smarty_internal_compile_block_child.php index 1708f648..5a506157 100644 --- a/libs/sysplugins/smarty_internal_compile_block_child.php +++ b/libs/sysplugins/smarty_internal_compile_block_child.php @@ -21,4 +21,4 @@ class Smarty_Internal_Compile_Block_Child extends Smarty_Internal_Compile_Child * @var string */ public $tag = 'block_child'; -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_compile_block_parent.php b/libs/sysplugins/smarty_internal_compile_block_parent.php index 4f094ad6..89a5f440 100644 --- a/libs/sysplugins/smarty_internal_compile_block_parent.php +++ b/libs/sysplugins/smarty_internal_compile_block_parent.php @@ -28,4 +28,4 @@ class Smarty_Internal_Compile_Block_Parent extends Smarty_Internal_Compile_Child * @var string */ public $blockType = 'Parent'; -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_compile_break.php b/libs/sysplugins/smarty_internal_compile_break.php index 09c25d23..9de82ec7 100644 --- a/libs/sysplugins/smarty_internal_compile_break.php +++ b/libs/sysplugins/smarty_internal_compile_break.php @@ -33,16 +33,16 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase public $shorttag_order = array('levels'); /** - * Tag name may be overloaded by Smarty_Internal_Compile_Continue - * - * @var string - */ + * Tag name may be overloaded by Smarty_Internal_Compile_Continue + * + * @var string + */ public $tag = 'break'; /** * Compiles code for the {break} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -67,7 +67,7 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase /** * check attributes and return array of break and foreach levels * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return array diff --git a/libs/sysplugins/smarty_internal_compile_call.php b/libs/sysplugins/smarty_internal_compile_call.php index eb444d35..445cabc6 100644 --- a/libs/sysplugins/smarty_internal_compile_call.php +++ b/libs/sysplugins/smarty_internal_compile_call.php @@ -43,8 +43,8 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase /** * Compiles the calls of user defined tags defined by {function} * - * @param array $args array with attributes from parser - * @param object $compiler compiler object + * @param array $args array with attributes from parser + * @param object $compiler compiler object * * @return string compiled code */ diff --git a/libs/sysplugins/smarty_internal_compile_capture.php b/libs/sysplugins/smarty_internal_compile_capture.php index 564b1f63..71b31772 100644 --- a/libs/sysplugins/smarty_internal_compile_capture.php +++ b/libs/sysplugins/smarty_internal_compile_capture.php @@ -35,9 +35,9 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase /** * Compiles code for the {$smarty.capture.xxx} * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase$compiler compiler object - * @param array $parameter array with compilation parameter + * @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 @@ -55,9 +55,9 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase /** * Compiles code for the {capture} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param null $parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param null $parameter * * @return string compiled code */ @@ -90,9 +90,9 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase /** * Compiles code for the {/capture} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param null $parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param null $parameter * * @return string compiled code */ diff --git a/libs/sysplugins/smarty_internal_compile_child.php b/libs/sysplugins/smarty_internal_compile_child.php index 8c7bbdf0..460fdeb7 100644 --- a/libs/sysplugins/smarty_internal_compile_child.php +++ b/libs/sysplugins/smarty_internal_compile_child.php @@ -40,9 +40,9 @@ class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase /** * Compiles code for the {child} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @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 @@ -53,8 +53,10 @@ class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase $_attr = $this->getAttributes($compiler, $args); $tag = isset($parameter[0]) ? "'{$parameter[0]}'" : "'{{$this->tag}}'"; if (!isset($compiler->_cache[ 'blockNesting' ])) { - $compiler->trigger_template_error("{$tag} used outside {block} tags ", - $compiler->parser->lex->taglineno); + $compiler->trigger_template_error( + "{$tag} used outside {block} tags ", + $compiler->parser->lex->taglineno + ); } $compiler->has_code = true; $compiler->suppressNocacheProcessing = true; @@ -74,4 +76,4 @@ class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase $output .="?>\n"; return $output; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_compile_config_load.php b/libs/sysplugins/smarty_internal_compile_config_load.php index 7c6e9b59..f94db5a1 100644 --- a/libs/sysplugins/smarty_internal_compile_config_load.php +++ b/libs/sysplugins/smarty_internal_compile_config_load.php @@ -60,7 +60,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase /** * Compiles code for the {config_load} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code diff --git a/libs/sysplugins/smarty_internal_compile_continue.php b/libs/sysplugins/smarty_internal_compile_continue.php index 19e5d4be..e545728e 100644 --- a/libs/sysplugins/smarty_internal_compile_continue.php +++ b/libs/sysplugins/smarty_internal_compile_continue.php @@ -17,9 +17,9 @@ class Smarty_Internal_Compile_Continue extends Smarty_Internal_Compile_Break { /** - * Tag name - * - * @var string - */ + * Tag name + * + * @var string + */ public $tag = 'continue'; } diff --git a/libs/sysplugins/smarty_internal_compile_debug.php b/libs/sysplugins/smarty_internal_compile_debug.php index 1668e72e..a7448f5b 100644 --- a/libs/sysplugins/smarty_internal_compile_debug.php +++ b/libs/sysplugins/smarty_internal_compile_debug.php @@ -20,8 +20,8 @@ class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase /** * Compiles code for the {debug} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object + * @param array $args array with attributes from parser + * @param object $compiler compiler object * * @return string compiled code */ diff --git a/libs/sysplugins/smarty_internal_compile_eval.php b/libs/sysplugins/smarty_internal_compile_eval.php index 550f194e..daad449c 100644 --- a/libs/sysplugins/smarty_internal_compile_eval.php +++ b/libs/sysplugins/smarty_internal_compile_eval.php @@ -43,8 +43,8 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase /** * Compiles code for the {eval} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object + * @param array $args array with attributes from parser + * @param object $compiler compiler object * * @return string compiled code */ diff --git a/libs/sysplugins/smarty_internal_compile_extends.php b/libs/sysplugins/smarty_internal_compile_extends.php index 37bf8dd3..bb751811 100644 --- a/libs/sysplugins/smarty_internal_compile_extends.php +++ b/libs/sysplugins/smarty_internal_compile_extends.php @@ -108,28 +108,34 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh $inlineUids = $match[ 1 ]; } } - $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, - '<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' . + $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + '<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' . (isset($template) ? ", {$template}{$inlineUids}" : - '') . ");\n?>"); + '') . ");\n?>" + ); } /** * Add code for including subtemplate to end of template * * @param \Smarty_Internal_TemplateCompilerBase $compiler - * @param string $template subtemplate name + * @param string $template subtemplate name * * @throws \SmartyCompilerException * @throws \SmartyException */ private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $template) { - $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, - $compiler->compileTag('include', - array($template, - array('scope' => 'parent')))); + $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $compiler->compileTag( + 'include', + array($template, + array('scope' => 'parent')) + ) + ); } /** diff --git a/libs/sysplugins/smarty_internal_compile_for.php b/libs/sysplugins/smarty_internal_compile_for.php index 79848e52..c98f3163 100644 --- a/libs/sysplugins/smarty_internal_compile_for.php +++ b/libs/sysplugins/smarty_internal_compile_for.php @@ -26,9 +26,9 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase * The parser is generating different sets of attribute by which this compiler can * determine which syntax is used. * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * @param array $parameter array with compilation parameter * * @return string compiled code */ @@ -113,9 +113,9 @@ class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase /** * Compiles code for the {forelse} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * @param array $parameter array with compilation parameter * * @return string compiled code */ @@ -142,9 +142,9 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/for} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * @param array $parameter array with compilation parameter * * @return string compiled code */ diff --git a/libs/sysplugins/smarty_internal_compile_foreach.php b/libs/sysplugins/smarty_internal_compile_foreach.php index 471e92c3..939d6ad7 100644 --- a/libs/sysplugins/smarty_internal_compile_foreach.php +++ b/libs/sysplugins/smarty_internal_compile_foreach.php @@ -78,7 +78,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo /** * Compiles code for the {foreach} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -119,8 +119,10 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo if ($fromName) { foreach (array('item', 'key') as $a) { if (isset($attributes[ $a ]) && $attributes[ $a ] === $fromName) { - $compiler->trigger_template_error("'{$a}' and 'from' may not have same variable name '{$fromName}'", - null, true); + $compiler->trigger_template_error( + "'{$a}' and 'from' may not have same variable name '{$fromName}'", + null, true + ); } } } @@ -187,8 +189,10 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo } $needTotal = isset($itemAttr[ 'total' ]); // Register tag - $this->openTag($compiler, 'foreach', - array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 1 : 2)); + $this->openTag( + $compiler, 'foreach', + array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 1 : 2) + ); // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; // generate output code @@ -277,7 +281,7 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase /** * Compiles code for the {foreachelse} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -309,12 +313,12 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/foreach} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code * @throws \SmartyCompilerException - */ + */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { $compiler->loopNesting --; diff --git a/libs/sysplugins/smarty_internal_compile_function.php b/libs/sysplugins/smarty_internal_compile_function.php index 909b767c..1042fd71 100644 --- a/libs/sysplugins/smarty_internal_compile_function.php +++ b/libs/sysplugins/smarty_internal_compile_function.php @@ -44,7 +44,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase /** * Compiles code for the {function} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool true @@ -91,7 +91,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/function} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool true @@ -143,9 +143,13 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; $output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>"; $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";?>"; - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $output)); + $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 = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; $output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n"; @@ -154,13 +158,21 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output .= "}\n}\n"; $output .= "/*/ {$_funcName}_nocache */\n\n"; $output .= "?>\n"; - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $output)); - $_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser, - preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", - array($this, 'removeNocache'), - $_functionCode->to_smarty_php($compiler->parser))); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); + $_functionCode = new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + preg_replace_callback( + "/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", + array($this, 'removeNocache'), + $_functionCode->to_smarty_php($compiler->parser) + ) + ); } $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName; $output = "<?php\n"; @@ -171,18 +183,26 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n"; $output .= $compiler->compileCheckPlugins(array_merge($compiler->required_plugins[ 'compiled' ], $compiler->required_plugins[ 'nocache' ])); $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, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = "<?php\n}}\n"; $output .= "/*/ {$_funcName} */\n\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, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); - // restore old buffer + // restore old buffer $compiler->parser->current_buffer = $saved_data[ 1 ]; // restore old status $compiler->restoreRequiredPlugins(); @@ -201,8 +221,10 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase function removeNocache($match) { $code = - preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", - '', $match[ 0 ]); + preg_replace( + "/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", + '', $match[ 0 ] + ); $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code); return $code; } diff --git a/libs/sysplugins/smarty_internal_compile_if.php b/libs/sysplugins/smarty_internal_compile_if.php index 82436c26..9848e2d1 100644 --- a/libs/sysplugins/smarty_internal_compile_if.php +++ b/libs/sysplugins/smarty_internal_compile_if.php @@ -55,8 +55,10 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase $assignCompiler = new Smarty_Internal_Compile_Assign(); if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; - $_output .= $assignCompiler->compile($assignAttr, $compiler, - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); + $_output .= $assignCompiler->compile( + $assignAttr, $compiler, + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]) + ); } else { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; $_output .= $assignCompiler->compile($assignAttr, $compiler, array()); @@ -84,7 +86,7 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code - */ + */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); @@ -143,8 +145,10 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase $assignAttr[][ 'value' ] = $prefixVar; if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; - $assignCode .= $assignCompiler->compile($assignAttr, $compiler, - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); + $assignCode .= $assignCompiler->compile( + $assignAttr, $compiler, + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]) + ); } else { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; $assignCode .= $assignCompiler->compile($assignAttr, $compiler, array()); diff --git a/libs/sysplugins/smarty_internal_compile_include.php b/libs/sysplugins/smarty_internal_compile_include.php index 70f22546..8bf9cb61 100644 --- a/libs/sysplugins/smarty_internal_compile_include.php +++ b/libs/sysplugins/smarty_internal_compile_include.php @@ -59,8 +59,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase /** * Compiles code for the {include} tag * - * @param array $args array with attributes from parser - * @param Smarty_Internal_SmartyTemplateCompiler $compiler compiler object + * @param array $args array with attributes from parser + * @param Smarty_Internal_SmartyTemplateCompiler $compiler compiler object * * @return string * @throws \Exception @@ -91,8 +91,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $compiled->includes[ $fullResourceName ]++; $cache_tpl = true; } else { - if ("{$compiler->template->source->type}:{$compiler->template->source->name}" == - $fullResourceName + if ("{$compiler->template->source->type}:{$compiler->template->source->name}" == $fullResourceName ) { // recursive call of current template $compiled->includes[ $fullResourceName ] = 2; @@ -193,9 +192,11 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $t_hash = sha1($c_id . ($_caching ? '--caching' : '--nocaching')); $compiler->smarty->allow_ambiguous_resources = true; /* @var Smarty_Internal_Template $tpl */ - $tpl = new $compiler->smarty->template_class (trim($fullResourceName, '"\''), $compiler->smarty, - $compiler->template, $compiler->template->cache_id, $c_id, - $_caching); + $tpl = new $compiler->smarty->template_class( + trim($fullResourceName, '"\''), $compiler->smarty, + $compiler->template, $compiler->template->cache_id, $c_id, + $_caching + ); $uid = $tpl->source->type . $tpl->source->uid; if (!isset($compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ])) { $has_compiled_template = $this->compileInlineTemplate($compiler, $tpl, $t_hash); @@ -269,16 +270,16 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * * @param \Smarty_Internal_SmartyTemplateCompiler $compiler * @param \Smarty_Internal_Template $tpl - * @param string $t_hash + * @param string $t_hash * * @return bool * @throws \Exception * @throws \SmartyException */ public function compileInlineTemplate(Smarty_Internal_SmartyTemplateCompiler $compiler, - Smarty_Internal_Template $tpl, - $t_hash) - { + Smarty_Internal_Template $tpl, + $t_hash + ) { $uid = $tpl->source->type . $tpl->source->uid; if (!($tpl->source->handler->uncompiled) && $tpl->source->exists) { $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'uid' ] = $tpl->source->uid; @@ -317,9 +318,11 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase if ($tpl->compiled->has_nocache_code) { // replace nocache_hash $compiled_code = - str_replace("{$tpl->compiled->nocache_hash}", - $compiler->template->compiled->nocache_hash, - $compiled_code); + str_replace( + "{$tpl->compiled->nocache_hash}", + $compiler->template->compiled->nocache_hash, + $compiled_code + ); $compiler->template->compiled->has_nocache_code = true; } $compiler->parent_compiler->mergedSubTemplatesCode[ $tpl->compiled->unifunc ] = $compiled_code; diff --git a/libs/sysplugins/smarty_internal_compile_include_php.php b/libs/sysplugins/smarty_internal_compile_include_php.php index e0aca93b..7fd53809 100644 --- a/libs/sysplugins/smarty_internal_compile_include_php.php +++ b/libs/sysplugins/smarty_internal_compile_include_php.php @@ -42,7 +42,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase /** * Compiles code for the {include_php} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string @@ -56,7 +56,10 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase } // check and get attributes $_attr = $this->getAttributes($compiler, $args); - /** @var Smarty_Internal_Template $_smarty_tpl + /** +* + * + * @var Smarty_Internal_Template $_smarty_tpl * used in evaluated code */ $_smarty_tpl = $compiler->template; diff --git a/libs/sysplugins/smarty_internal_compile_insert.php b/libs/sysplugins/smarty_internal_compile_insert.php index e71abdce..8ac4b716 100644 --- a/libs/sysplugins/smarty_internal_compile_insert.php +++ b/libs/sysplugins/smarty_internal_compile_insert.php @@ -41,7 +41,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase /** * Compiles code for the {insert} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -104,11 +104,13 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase } // code for script file loading $_output .= "require_once '{$_filepath}' ;"; - require_once $_filepath; + include_once $_filepath; if (!is_callable($_function)) { - $compiler->trigger_template_error(" {insert} function '{$_function}' is not callable in script file '{$_script}'", - null, - true); + $compiler->trigger_template_error( + " {insert} function '{$_function}' is not callable in script file '{$_script}'", + null, + true + ); } } else { $_filepath = 'null'; @@ -117,9 +119,11 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase if (!is_callable($_function)) { // try plugin if (!$_function = $compiler->getPlugin($_name, 'insert')) { - $compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'", - null, - true); + $compiler->trigger_template_error( + "{insert} no function or plugin found for '{$_name}'", + null, + true + ); } } } diff --git a/libs/sysplugins/smarty_internal_compile_ldelim.php b/libs/sysplugins/smarty_internal_compile_ldelim.php index c22e1a63..5493d4ec 100644 --- a/libs/sysplugins/smarty_internal_compile_ldelim.php +++ b/libs/sysplugins/smarty_internal_compile_ldelim.php @@ -16,11 +16,11 @@ */ class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase { - /** + /** * Compiles code for the {ldelim} tag * This tag does output the left delimiter * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code diff --git a/libs/sysplugins/smarty_internal_compile_make_nocache.php b/libs/sysplugins/smarty_internal_compile_make_nocache.php index f793ecbb..8a34ccd0 100644 --- a/libs/sysplugins/smarty_internal_compile_make_nocache.php +++ b/libs/sysplugins/smarty_internal_compile_make_nocache.php @@ -41,11 +41,11 @@ class Smarty_Internal_Compile_Make_Nocache extends Smarty_Internal_CompileBase /** * Compiles code for the {make_nocache} tag * - * @param array $args array with attributes from parser + * @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) { // check and get attributes diff --git a/libs/sysplugins/smarty_internal_compile_nocache.php b/libs/sysplugins/smarty_internal_compile_nocache.php index b29a993a..825b60bf 100644 --- a/libs/sysplugins/smarty_internal_compile_nocache.php +++ b/libs/sysplugins/smarty_internal_compile_nocache.php @@ -27,7 +27,7 @@ class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase * Compiles code for the {nocache} tag * This tag does not generate compiled output. It only sets a compiler flag. * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool @@ -57,7 +57,7 @@ class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase * Compiles code for the {/nocache} tag * This tag does not generate compiled output. It only sets a compiler flag. * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool diff --git a/libs/sysplugins/smarty_internal_compile_parent.php b/libs/sysplugins/smarty_internal_compile_parent.php index 052479ae..c04689f0 100644 --- a/libs/sysplugins/smarty_internal_compile_parent.php +++ b/libs/sysplugins/smarty_internal_compile_parent.php @@ -29,4 +29,4 @@ class Smarty_Internal_Compile_Parent extends Smarty_Internal_Compile_Child * @var string */ public $blockType = 'Parent'; -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_compile_private_block_plugin.php b/libs/sysplugins/smarty_internal_compile_private_block_plugin.php index 6c3f05aa..5527a987 100644 --- a/libs/sysplugins/smarty_internal_compile_private_block_plugin.php +++ b/libs/sysplugins/smarty_internal_compile_private_block_plugin.php @@ -34,11 +34,11 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi /** * Compiles code for the execution of block plugin * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * @param string $tag name of block plugin - * @param string $function PHP function name + * @param array $parameter array with compilation parameter + * @param string $tag name of block plugin + * @param string $function PHP function name * * @return string compiled code * @throws \SmartyCompilerException @@ -84,9 +84,11 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi $mod_content2 = "\$_block_content{$this->nesting}"; $mod_content = "\$_block_content{$this->nesting} = ob_get_clean();\n"; $mod_pre = "ob_start();\n"; - $mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifier_list' ], - 'value' => 'ob_get_clean()')) . ";\n"; + $mod_post = 'echo ' . $compiler->compileTag( + 'private_modifier', array(), + array('modifierlist' => $parameter[ 'modifier_list' ], + 'value' => 'ob_get_clean()') + ) . ";\n"; } $output = "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n"; $output .= 'array_pop($_smarty_tpl->smarty->_cache[\'_tag_stack\']);?>'; @@ -98,9 +100,9 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi * Setup callback and parameter array * * @param \Smarty_Internal_TemplateCompilerBase $compiler - * @param array $_attr attributes - * @param string $tag - * @param string $function + * @param array $_attr attributes + * @param string $tag + * @param string $function * * @return array */ diff --git a/libs/sysplugins/smarty_internal_compile_private_foreachsection.php b/libs/sysplugins/smarty_internal_compile_private_foreachsection.php index 5161da64..e8c9b97b 100644 --- a/libs/sysplugins/smarty_internal_compile_private_foreachsection.php +++ b/libs/sysplugins/smarty_internal_compile_private_foreachsection.php @@ -74,7 +74,7 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com /** * Scan sources for used tag attributes * - * @param array $attributes + * @param array $attributes * @param \Smarty_Internal_TemplateCompilerBase $compiler * * @throws \SmartyException @@ -178,11 +178,13 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com $_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' ])) + if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) + || isset($nextCompiler->smarty->registered_filters[ 'pre' ])) ) { - $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content, - $nextCompiler->template); + $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter( + 'pre', $_content, + $nextCompiler->template + ); } $this->matchProperty($_content); } @@ -202,9 +204,9 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com /** * Compiles code for the {$smarty.foreach.xxx} or {$smarty.section.xxx}tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -223,4 +225,4 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com $tagVar = "'__smarty_{$tag}_{$name}'"; return "(isset(\$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}']) ? \$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}'] : null)"; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_compile_private_function_plugin.php b/libs/sysplugins/smarty_internal_compile_private_function_plugin.php index 9e9c65f5..1d9d9058 100644 --- a/libs/sysplugins/smarty_internal_compile_private_function_plugin.php +++ b/libs/sysplugins/smarty_internal_compile_private_function_plugin.php @@ -35,11 +35,11 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co /** * Compiles code for the execution of function plugin * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * @param string $tag name of function plugin - * @param string $function PHP function name + * @param array $parameter array with compilation parameter + * @param string $tag name of function plugin + * @param string $function PHP function name * * @return string compiled code * @throws \SmartyCompilerException @@ -64,9 +64,11 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co // compile code $output = "{$function}({$_params},\$_smarty_tpl)"; if (!empty($parameter[ 'modifierlist' ])) { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifierlist' ], - 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', array(), + array('modifierlist' => $parameter[ 'modifierlist' ], + 'value' => $output) + ); } $output = "<?php echo {$output};?>\n"; return $output; diff --git a/libs/sysplugins/smarty_internal_compile_private_modifier.php b/libs/sysplugins/smarty_internal_compile_private_modifier.php index e83b7a24..a783581e 100644 --- a/libs/sysplugins/smarty_internal_compile_private_modifier.php +++ b/libs/sysplugins/smarty_internal_compile_private_modifier.php @@ -20,9 +20,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa /** * Compiles code for modifier execution * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -47,99 +47,103 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa } foreach ($modifier_types as $type) { switch ($type) { - case 1: - // registered modifier - if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) { - if (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) { - $output = - sprintf('call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], array( %s ))', - Smarty::PLUGIN_MODIFIER, var_export($modifier, true), $params); - $compiler->known_modifier_type[ $modifier ] = $type; - break 2; - } - } - break; - case 2: - // registered modifier compiler - if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) { + case 1: + // registered modifier + if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) { + if (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) { $output = - call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ], - $single_modifier, $compiler->smarty); + sprintf( + 'call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], array( %s ))', + Smarty::PLUGIN_MODIFIER, var_export($modifier, true), $params + ); $compiler->known_modifier_type[ $modifier ] = $type; break 2; } - break; - case 3: - // modifiercompiler plugin - if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) { - // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) - ) { - $plugin = 'smarty_modifiercompiler_' . $modifier; - $output = $plugin($single_modifier, $compiler); - } - $compiler->known_modifier_type[ $modifier ] = $type; - break 2; + } + break; + case 2: + // registered modifier compiler + if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) { + $output = + call_user_func( + $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ], + $single_modifier, $compiler->smarty + ); + $compiler->known_modifier_type[ $modifier ] = $type; + break 2; + } + break; + case 3: + // modifiercompiler plugin + if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) { + // check if modifier allowed + if (!is_object($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) + ) { + $plugin = 'smarty_modifiercompiler_' . $modifier; + $output = $plugin($single_modifier, $compiler); } - break; - case 4: - // modifier plugin - if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) { - // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) - ) { - $output = "{$function}({$params})"; - } - $compiler->known_modifier_type[ $modifier ] = $type; - break 2; + $compiler->known_modifier_type[ $modifier ] = $type; + break 2; + } + break; + case 4: + // modifier plugin + if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) { + // check if modifier allowed + if (!is_object($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) + ) { + $output = "{$function}({$params})"; } - break; - case 5: - // PHP function - if (is_callable($modifier)) { - // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler) - ) { - $output = "{$modifier}({$params})"; - } - $compiler->known_modifier_type[ $modifier ] = $type; - break 2; + $compiler->known_modifier_type[ $modifier ] = $type; + break 2; + } + break; + case 5: + // PHP function + if (is_callable($modifier)) { + // check if modifier allowed + if (!is_object($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler) + ) { + $output = "{$modifier}({$params})"; } - break; - case 6: - // default plugin handler - if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) || - (is_callable($compiler->smarty->default_plugin_handler_func) && - $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER)) + $compiler->known_modifier_type[ $modifier ] = $type; + break 2; + } + break; + case 6: + // default plugin handler + if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) + || (is_callable($compiler->smarty->default_plugin_handler_func) + && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER)) + ) { + $function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ]; + // check if modifier allowed + if (!is_object($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) ) { - $function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ]; - // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) - ) { - if (!is_array($function)) { - $output = "{$function}({$params})"; + if (!is_array($function)) { + $output = "{$function}({$params})"; + } else { + if (is_object($function[ 0 ])) { + $output = $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')'; } else { - if (is_object($function[ 0 ])) { - $output = $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')'; - } else { - $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')'; - } + $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')'; } } - if (isset($compiler->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) || - isset($compiler->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) - ) { - // was a plugin - $compiler->known_modifier_type[ $modifier ] = 4; - } else { - $compiler->known_modifier_type[ $modifier ] = $type; - } - break 2; } + if (isset($compiler->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) + || isset($compiler->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) + ) { + // was a plugin + $compiler->known_modifier_type[ $modifier ] = 4; + } else { + $compiler->known_modifier_type[ $modifier ] = $type; + } + break 2; + } } } if (!isset($compiler->known_modifier_type[ $modifier ])) { @@ -149,4 +153,4 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa return $output; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_compile_private_object_block_function.php b/libs/sysplugins/smarty_internal_compile_private_object_block_function.php index 5c7fb626..8afdc8d0 100644 --- a/libs/sysplugins/smarty_internal_compile_private_object_block_function.php +++ b/libs/sysplugins/smarty_internal_compile_private_object_block_function.php @@ -20,9 +20,9 @@ class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Inter * Setup callback and parameter array * * @param \Smarty_Internal_TemplateCompilerBase $compiler - * @param array $_attr attributes - * @param string $tag - * @param string $method + * @param array $_attr attributes + * @param string $tag + * @param string $method * * @return array */ diff --git a/libs/sysplugins/smarty_internal_compile_private_object_function.php b/libs/sysplugins/smarty_internal_compile_private_object_function.php index 8d6c7e39..d1d9fe8b 100644 --- a/libs/sysplugins/smarty_internal_compile_private_object_function.php +++ b/libs/sysplugins/smarty_internal_compile_private_object_function.php @@ -27,11 +27,11 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co /** * Compiles code for the execution of function plugin * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * @param string $tag name of function - * @param string $method name of method to call + * @param array $parameter array with compilation parameter + * @param string $tag name of function + * @param string $method name of method to call * * @return string compiled code * @throws \SmartyCompilerException @@ -70,8 +70,10 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}"; } if (!empty($parameter[ 'modifierlist' ])) { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', array(), + array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output) + ); } if (empty($_assign)) { return "<?php echo {$output};?>\n"; diff --git a/libs/sysplugins/smarty_internal_compile_private_php.php b/libs/sysplugins/smarty_internal_compile_private_php.php index 1d100f0d..c01711dc 100644 --- a/libs/sysplugins/smarty_internal_compile_private_php.php +++ b/libs/sysplugins/smarty_internal_compile_private_php.php @@ -43,10 +43,16 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase if ($_attr[ 'type' ] === 'xml') { $compiler->tag_nocache = true; $output = addcslashes($_attr[ 'code' ], "'\\"); - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $compiler->processNocacheCode("<?php echo '{$output}';?>", - true))); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $compiler->processNocacheCode( + "<?php echo '{$output}';?>", + true + ) + ) + ); return ''; } if ($_attr[ 'type' ] !== 'tag') { @@ -54,23 +60,35 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase return ''; } elseif ($compiler->php_handling === Smarty::PHP_QUOTE) { $output = - preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', - array($this, 'quote'), $_attr[ 'code' ]); - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Text($output)); + preg_replace_callback( + '#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', + array($this, 'quote'), $_attr[ 'code' ] + ); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Text($output) + ); return ''; } elseif ($compiler->php_handling === Smarty::PHP_PASSTHRU || $_attr[ 'type' ] === 'unmatched') { $compiler->tag_nocache = true; $output = addcslashes($_attr[ 'code' ], "'\\"); - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $compiler->processNocacheCode("<?php echo '{$output}';?>", - true))); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $compiler->processNocacheCode( + "<?php echo '{$output}';?>", + true + ) + ) + ); return ''; } elseif ($compiler->php_handling === Smarty::PHP_ALLOW) { if (!($compiler->smarty instanceof SmartyBC)) { - $compiler->trigger_template_error('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', - null, true); + $compiler->trigger_template_error( + '$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', + null, true + ); } $compiler->has_code = true; return $_attr[ 'code' ]; @@ -80,8 +98,10 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase } else { $compiler->has_code = true; if (!($compiler->smarty instanceof SmartyBC)) { - $compiler->trigger_template_error('{php}{/php} tags not allowed. Use SmartyBC to enable them', null, - true); + $compiler->trigger_template_error( + '{php}{/php} tags not allowed. Use SmartyBC to enable them', null, + true + ); } $ldel = preg_quote($compiler->smarty->left_delimiter, '#'); $rdel = preg_quote($compiler->smarty->right_delimiter, '#'); @@ -93,8 +113,10 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase $compiler->trigger_template_error("illegal value of option flag '{$match[2]}'", null, true); } } - return preg_replace(array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), - array('<?php ', '?>'), $_attr[ 'code' ]); + return preg_replace( + array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), + array('<?php ', '?>'), $_attr[ 'code' ] + ); } } @@ -148,8 +170,8 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase if ($lex->phpType === 'unmatched') { return; } - if (($lex->phpType === 'php' || $lex->phpType === 'asp') && - ($lex->compiler->php_handling === Smarty::PHP_PASSTHRU || $lex->compiler->php_handling === Smarty::PHP_QUOTE) + if (($lex->phpType === 'php' || $lex->phpType === 'asp') + && ($lex->compiler->php_handling === Smarty::PHP_PASSTHRU || $lex->compiler->php_handling === Smarty::PHP_QUOTE) ) { return; } @@ -161,8 +183,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); } while ($body) { - if (preg_match('~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', - $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { + if (preg_match( + '~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', + $lex->data, $match, PREG_OFFSET_CAPTURE, $start + ) + ) { $value = $match[ 0 ][ 0 ]; $from = $pos = $match[ 0 ][ 1 ]; if ($pos > $close) { @@ -178,8 +203,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase } } while ($close > $pos && $close < $start) { - if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, - $from)) { + if (preg_match( + '~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, + $from + ) + ) { $close = $match[ 0 ][ 1 ]; $from = $close + strlen($match[ 0 ][ 0 ]); } else { diff --git a/libs/sysplugins/smarty_internal_compile_private_print_expression.php b/libs/sysplugins/smarty_internal_compile_private_print_expression.php index 2dde6948..cf3102ea 100644 --- a/libs/sysplugins/smarty_internal_compile_private_print_expression.php +++ b/libs/sysplugins/smarty_internal_compile_private_print_expression.php @@ -49,9 +49,11 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C $output = $parameter[ 'value' ]; // tag modifier if (!empty($parameter[ 'modifierlist' ])) { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifierlist' ], - 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', array(), + array('modifierlist' => $parameter[ 'modifierlist' ], + 'value' => $output) + ); } if (isset($_attr[ 'assign' ])) { // assign output to variable @@ -64,8 +66,10 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C if (empty($compiler->default_modifier_list)) { $modifierlist = array(); foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) { - preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', - $single_default_modifier, $mod_array); + preg_match_all( + '/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', + $single_default_modifier, $mod_array + ); for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) { if ($mod_array[ 0 ][ $i ] !== ':') { $modifierlist[ $key ][] = $mod_array[ 0 ][ $i ]; @@ -74,9 +78,11 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } $compiler->default_modifier_list = $modifierlist; } - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $compiler->default_modifier_list, - 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', array(), + array('modifierlist' => $compiler->default_modifier_list, + 'value' => $output) + ); } // autoescape html if ($compiler->template->smarty->escape_html) { @@ -110,13 +116,15 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } } foreach ($compiler->variable_filters as $filter) { - if (count($filter) === 1 && - ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false + if (count($filter) === 1 + && ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false ) { $output = $result; } else { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => array($filter), 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', array(), + array('modifierlist' => array($filter), 'value' => $output) + ); } } } @@ -136,12 +144,12 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C */ private function compile_variable_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output) { - $function= $compiler->getPlugin($name, 'variablefilter'); - if ($function) { + $function= $compiler->getPlugin($name, 'variablefilter'); + if ($function) { return "{$function}({$output},\$_smarty_tpl)"; - } else { + } else { // not found return false; - } + } } } diff --git a/libs/sysplugins/smarty_internal_compile_private_registered_block.php b/libs/sysplugins/smarty_internal_compile_private_registered_block.php index bd88f1bf..cac9458c 100644 --- a/libs/sysplugins/smarty_internal_compile_private_registered_block.php +++ b/libs/sysplugins/smarty_internal_compile_private_registered_block.php @@ -20,9 +20,9 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C * Setup callback, parameter array and nocache mode * * @param \Smarty_Internal_TemplateCompilerBase $compiler - * @param array $_attr attributes - * @param string $tag - * @param null $function + * @param array $_attr attributes + * @param string $tag + * @param null $function * * @return array */ diff --git a/libs/sysplugins/smarty_internal_compile_private_registered_function.php b/libs/sysplugins/smarty_internal_compile_private_registered_function.php index 467f9a49..babbbb24 100644 --- a/libs/sysplugins/smarty_internal_compile_private_registered_function.php +++ b/libs/sysplugins/smarty_internal_compile_private_registered_function.php @@ -27,10 +27,10 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna /** * Compiles code for the execution of a registered function * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * @param string $tag name of function + * @param array $parameter array with compilation parameter + * @param string $tag name of function * * @return string compiled code * @throws \SmartyCompilerException @@ -76,11 +76,13 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna } } if (!empty($parameter[ 'modifierlist' ])) { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifierlist' ], - 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', array(), + array('modifierlist' => $parameter[ 'modifierlist' ], + 'value' => $output) + ); } $output = "<?php echo {$output};?>\n"; return $output; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_compile_private_special_variable.php b/libs/sysplugins/smarty_internal_compile_private_special_variable.php index 0c6be44f..1bd76f2b 100644 --- a/libs/sysplugins/smarty_internal_compile_private_special_variable.php +++ b/libs/sysplugins/smarty_internal_compile_private_special_variable.php @@ -19,9 +19,9 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C /** * Compiles code for the special $smarty variables * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param $parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param $parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -33,86 +33,86 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C if ($variable === false) { $compiler->trigger_template_error("special \$Smarty variable name index can not be variable", null, true); } - if (!isset($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedSpecialSmartyVar($variable, $compiler) + if (!isset($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedSpecialSmartyVar($variable, $compiler) ) { switch ($variable) { - case 'foreach': - case 'section': - if (!isset(Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ])) { - $class = 'Smarty_Internal_Compile_' . ucfirst($variable); - Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ] = new $class; - } - return Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ]->compileSpecialVariable(array(), $compiler, $_index); - case 'capture': - if (class_exists('Smarty_Internal_Compile_Capture')) { - return Smarty_Internal_Compile_Capture::compileSpecialVariable(array(), $compiler, $_index); - } - return ''; - case 'now': - return 'time()'; - case 'cookies': - if (isset($compiler->smarty->security_policy) && - !$compiler->smarty->security_policy->allow_super_globals - ) { - $compiler->trigger_template_error("(secure mode) super globals not permitted"); - break; - } - $compiled_ref = '$_COOKIE'; + case 'foreach': + case 'section': + if (!isset(Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ])) { + $class = 'Smarty_Internal_Compile_' . ucfirst($variable); + Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ] = new $class; + } + return Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ]->compileSpecialVariable(array(), $compiler, $_index); + case 'capture': + if (class_exists('Smarty_Internal_Compile_Capture')) { + return Smarty_Internal_Compile_Capture::compileSpecialVariable(array(), $compiler, $_index); + } + return ''; + case 'now': + return 'time()'; + case 'cookies': + if (isset($compiler->smarty->security_policy) + && !$compiler->smarty->security_policy->allow_super_globals + ) { + $compiler->trigger_template_error("(secure mode) super globals not permitted"); break; - case 'get': - case 'post': - case 'env': - case 'server': - case 'session': - case 'request': - if (isset($compiler->smarty->security_policy) && - !$compiler->smarty->security_policy->allow_super_globals - ) { - $compiler->trigger_template_error("(secure mode) super globals not permitted"); - break; - } - $compiled_ref = '$_' . strtoupper($variable); + } + $compiled_ref = '$_COOKIE'; + break; + case 'get': + case 'post': + case 'env': + case 'server': + case 'session': + case 'request': + if (isset($compiler->smarty->security_policy) + && !$compiler->smarty->security_policy->allow_super_globals + ) { + $compiler->trigger_template_error("(secure mode) super globals not permitted"); break; + } + $compiled_ref = '$_' . strtoupper($variable); + break; - case 'template': - return 'basename($_smarty_tpl->source->filepath)'; - - case 'template_object': - return '$_smarty_tpl'; + case 'template': + return 'basename($_smarty_tpl->source->filepath)'; - case 'current_dir': - return 'dirname($_smarty_tpl->source->filepath)'; + case 'template_object': + return '$_smarty_tpl'; - case 'version': - return "Smarty::SMARTY_VERSION"; + case 'current_dir': + return 'dirname($_smarty_tpl->source->filepath)'; - case 'const': - if (isset($compiler->smarty->security_policy) && - !$compiler->smarty->security_policy->allow_constants - ) { - $compiler->trigger_template_error("(secure mode) constants not permitted"); - break; - } - if (strpos($_index[ 1 ], '$') === false && strpos($_index[ 1 ], '\'') === false) { - return "@constant('{$_index[1]}')"; - } else { - return "@constant({$_index[1]})"; - } + case 'version': + return "Smarty::SMARTY_VERSION"; - case 'config': - if (isset($_index[ 2 ])) { - return "(is_array(\$tmp = \$_smarty_tpl->smarty->ext->configload->_getConfigVariable(\$_smarty_tpl, $_index[1])) ? \$tmp[$_index[2]] : null)"; - } else { - return "\$_smarty_tpl->smarty->ext->configload->_getConfigVariable(\$_smarty_tpl, $_index[1])"; - } - case 'ldelim': - return "\$_smarty_tpl->smarty->left_delimiter"; - case 'rdelim': - return "\$_smarty_tpl->smarty->right_delimiter"; - default: - $compiler->trigger_template_error('$smarty.' . trim($_index[ 0 ], "'") . ' is not defined'); + case 'const': + if (isset($compiler->smarty->security_policy) + && !$compiler->smarty->security_policy->allow_constants + ) { + $compiler->trigger_template_error("(secure mode) constants not permitted"); break; + } + if (strpos($_index[ 1 ], '$') === false && strpos($_index[ 1 ], '\'') === false) { + return "@constant('{$_index[1]}')"; + } else { + return "@constant({$_index[1]})"; + } + + case 'config': + if (isset($_index[ 2 ])) { + return "(is_array(\$tmp = \$_smarty_tpl->smarty->ext->configload->_getConfigVariable(\$_smarty_tpl, $_index[1])) ? \$tmp[$_index[2]] : null)"; + } else { + return "\$_smarty_tpl->smarty->ext->configload->_getConfigVariable(\$_smarty_tpl, $_index[1])"; + } + case 'ldelim': + return "\$_smarty_tpl->smarty->left_delimiter"; + case 'rdelim': + return "\$_smarty_tpl->smarty->right_delimiter"; + default: + $compiler->trigger_template_error('$smarty.' . trim($_index[ 0 ], "'") . ' is not defined'); + break; } if (isset($_index[ 1 ])) { array_shift($_index); diff --git a/libs/sysplugins/smarty_internal_compile_rdelim.php b/libs/sysplugins/smarty_internal_compile_rdelim.php index e3d034da..1cc340c1 100644 --- a/libs/sysplugins/smarty_internal_compile_rdelim.php +++ b/libs/sysplugins/smarty_internal_compile_rdelim.php @@ -20,7 +20,7 @@ class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_Compile_Ldelim * Compiles code for the {rdelim} tag * This tag does output the right delimiter. * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -28,7 +28,7 @@ class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_Compile_Ldelim */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { - parent::compile($args,$compiler); + parent::compile($args, $compiler); return $compiler->smarty->right_delimiter; } } diff --git a/libs/sysplugins/smarty_internal_compile_section.php b/libs/sysplugins/smarty_internal_compile_section.php index 6e80e0fd..2772d837 100644 --- a/libs/sysplugins/smarty_internal_compile_section.php +++ b/libs/sysplugins/smarty_internal_compile_section.php @@ -79,8 +79,8 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo /** * Compiles code for the {section} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code * @throws \SmartyCompilerException @@ -132,50 +132,50 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $output = "<?php\n"; foreach ($_attr as $attr_name => $attr_value) { switch ($attr_name) { - case 'loop': - if (is_numeric($attr_value)) { - $v = (int) $attr_value; - $t = 0; - } else { - $v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))"; - $t = 1; - } - if ($t === 1) { - $initLocal[ 'loop' ] = $v; - $v = "{$local}loop"; - } - break; - case 'show': - if (is_bool($attr_value)) { - $v = $attr_value ? 'true' : 'false'; - $t = 0; - } else { - $v = "(bool) $attr_value"; - $t = 3; - } - break; - case 'step': - if (is_numeric($attr_value)) { - $v = (int) $attr_value; - $v = ($v === 0) ? 1 : $v; - $t = 0; - break; - } - $initLocal[ 'step' ] = "((int)@$attr_value) === 0 ? 1 : (int)@$attr_value"; - $v = "{$local}step"; - $t = 2; + case 'loop': + if (is_numeric($attr_value)) { + $v = (int) $attr_value; + $t = 0; + } else { + $v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))"; + $t = 1; + } + if ($t === 1) { + $initLocal[ 'loop' ] = $v; + $v = "{$local}loop"; + } + break; + case 'show': + if (is_bool($attr_value)) { + $v = $attr_value ? 'true' : 'false'; + $t = 0; + } else { + $v = "(bool) $attr_value"; + $t = 3; + } + break; + case 'step': + if (is_numeric($attr_value)) { + $v = (int) $attr_value; + $v = ($v === 0) ? 1 : $v; + $t = 0; break; + } + $initLocal[ 'step' ] = "((int)@$attr_value) === 0 ? 1 : (int)@$attr_value"; + $v = "{$local}step"; + $t = 2; + break; - case 'max': - case 'start': - if (is_numeric($attr_value)) { - $v = (int) $attr_value; - $t = 0; - break; - } - $v = "(int)@$attr_value"; - $t = 3; + case 'max': + case 'start': + if (is_numeric($attr_value)) { + $v = (int) $attr_value; + $t = 0; break; + } + $v = "(int)@$attr_value"; + $t = 3; + break; } if ($t === 3 && $compiler->getId($attr_value)) { $t = 1; @@ -264,8 +264,10 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $start_code[ $i ] = ''; } if ($propType[ 'start' ] === 0) { - $start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1, - $propValue[ 'start' ] + $propValue[ 'loop' ])); + $start_code = array(max( + $propValue[ 'step' ] > 0 ? 0 : - 1, + $propValue[ 'start' ] + $propValue[ 'loop' ] + )); } } else { for ($i = 1; $i <= 11; $i ++) { @@ -273,8 +275,10 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo } if ($propType[ 'start' ] === 0) { $start_code = - array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1, - $propValue[ 'start' ])); + array(min( + $propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1, + $propValue[ 'start' ] + )); } } } @@ -295,8 +299,12 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ]; if ($propType[ 'total' ] === 0) { $propValue[ 'total' ] = - min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] : - (int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]); + min( + ceil( + ($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] : + (int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ]) + ), $propValue[ 'max' ] + ); } else { $total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ", 5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ', @@ -404,7 +412,7 @@ class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase /** * Compiles code for the {sectionelse} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -432,7 +440,7 @@ class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/section} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code diff --git a/libs/sysplugins/smarty_internal_compile_setfilter.php b/libs/sysplugins/smarty_internal_compile_setfilter.php index 1f3ba8d4..a66bfed5 100644 --- a/libs/sysplugins/smarty_internal_compile_setfilter.php +++ b/libs/sysplugins/smarty_internal_compile_setfilter.php @@ -19,9 +19,9 @@ class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase /** * Compiles code for setfilter tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code */ @@ -48,7 +48,7 @@ class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase * Compiles code for the {/setfilter} tag * This tag does not generate compiled output. It resets variable filter. * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code diff --git a/libs/sysplugins/smarty_internal_compile_shared_inheritance.php b/libs/sysplugins/smarty_internal_compile_shared_inheritance.php index a32173cd..55685588 100644 --- a/libs/sysplugins/smarty_internal_compile_shared_inheritance.php +++ b/libs/sysplugins/smarty_internal_compile_shared_inheritance.php @@ -37,12 +37,14 @@ class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_Compile public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) { - $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), - array($initChildSequence), - 'inheritanceInit', - $initChildSequence); + $compiler->registerPostCompileCallback( + array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), + array($initChildSequence), + 'inheritanceInit', + $initChildSequence + ); $compiler->_cache['inheritanceInit'] = true; } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_compile_while.php b/libs/sysplugins/smarty_internal_compile_while.php index 328d6551..69b68105 100644 --- a/libs/sysplugins/smarty_internal_compile_while.php +++ b/libs/sysplugins/smarty_internal_compile_while.php @@ -19,9 +19,9 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase /** * Compiles code for the {while} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -56,8 +56,10 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; $_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>"; - $_output .= $assignCompiler->compile($assignAttr, $compiler, - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); + $_output .= $assignCompiler->compile( + $assignAttr, $compiler, + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]) + ); } else { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; $_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>"; @@ -82,7 +84,7 @@ class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/while} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code diff --git a/libs/sysplugins/smarty_internal_compilebase.php b/libs/sysplugins/smarty_internal_compilebase.php index 656672b9..9d1a0540 100644 --- a/libs/sysplugins/smarty_internal_compilebase.php +++ b/libs/sysplugins/smarty_internal_compilebase.php @@ -65,8 +65,8 @@ abstract class Smarty_Internal_CompileBase * 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 + * @param object $compiler compiler object + * @param array $attributes attributes applied to the tag * * @return array of mapped attributes for further processing */ @@ -103,8 +103,10 @@ abstract class Smarty_Internal_CompileBase 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); + $compiler->trigger_template_error( + "illegal value '" . var_export($v, true) . + "' for option flag '{$k}'", null, true + ); } } // must be named attribute @@ -124,8 +126,12 @@ abstract class Smarty_Internal_CompileBase 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); + 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) { @@ -162,8 +168,8 @@ abstract class Smarty_Internal_CompileBase * 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 + * @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 */ diff --git a/libs/sysplugins/smarty_internal_config_file_compiler.php b/libs/sysplugins/smarty_internal_config_file_compiler.php index ada38869..8395633f 100644 --- a/libs/sysplugins/smarty_internal_config_file_compiler.php +++ b/libs/sysplugins/smarty_internal_config_file_compiler.php @@ -114,9 +114,13 @@ class Smarty_Internal_Config_File_Compiler } // init the lexer/parser to compile the config file /* @var Smarty_Internal_ConfigFileLexer $this ->lex */ - $this->lex = new $this->lexer_class(str_replace(array("\r\n", - "\r"), "\n", $template->source->getContent()) . "\n", - $this); + $this->lex = new $this->lexer_class( + str_replace( + array("\r\n", + "\r"), "\n", $template->source->getContent() + ) . "\n", + $this + ); /* @var Smarty_Internal_ConfigFileParser $this ->parser */ $this->parser = new $this->parser_class($this->lex, $this); diff --git a/libs/sysplugins/smarty_internal_configfilelexer.php b/libs/sysplugins/smarty_internal_configfilelexer.php index 454c9f82..1a6169a8 100644 --- a/libs/sysplugins/smarty_internal_configfilelexer.php +++ b/libs/sysplugins/smarty_internal_configfilelexer.php @@ -130,7 +130,7 @@ class Smarty_Internal_Configfilelexer /** * constructor * - * @param string $data template source + * @param string $data template source * @param Smarty_Internal_Config_File_Compiler $compiler */ function __construct($data, Smarty_Internal_Config_File_Compiler $compiler) @@ -166,39 +166,47 @@ class Smarty_Internal_Configfilelexer 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); + 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); + 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); + 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); + 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 + ); } } @@ -206,11 +214,13 @@ class Smarty_Internal_Configfilelexer { $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); + 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 + ); } } @@ -234,10 +244,14 @@ class Smarty_Internal_Configfilelexer $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 START'); + throw new Exception( + 'Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state START' + ); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -262,8 +276,10 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -332,10 +348,14 @@ class Smarty_Internal_Configfilelexer $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 VALUE'); + throw new Exception( + 'Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state VALUE' + ); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -360,8 +380,10 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -404,8 +426,9 @@ class Smarty_Internal_Configfilelexer function yy_r2_7() { - if (!$this->configBooleanize || - !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))) { + if (!$this->configBooleanize + || !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no')) + ) { $this->yypopstate(); $this->yypushstate(self::NAKED_STRING_VALUE); return true; //reprocess in new state @@ -447,10 +470,14 @@ class Smarty_Internal_Configfilelexer $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 NAKED_STRING_VALUE'); + throw new Exception( + 'Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state NAKED_STRING_VALUE' + ); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -475,8 +502,10 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -507,10 +536,14 @@ class Smarty_Internal_Configfilelexer $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 COMMENT'); + throw new Exception( + 'Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state COMMENT' + ); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -535,8 +568,10 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -577,10 +612,14 @@ class Smarty_Internal_Configfilelexer $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 SECTION'); + throw new Exception( + 'Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state SECTION' + ); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -605,8 +644,10 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -642,10 +683,14 @@ class Smarty_Internal_Configfilelexer $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 TRIPPLE'); + throw new Exception( + 'Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state TRIPPLE' + ); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -670,8 +715,10 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); diff --git a/libs/sysplugins/smarty_internal_configfileparser.php b/libs/sysplugins/smarty_internal_configfileparser.php index 1c76f7bc..22299eea 100644 --- a/libs/sysplugins/smarty_internal_configfileparser.php +++ b/libs/sysplugins/smarty_internal_configfileparser.php @@ -9,7 +9,7 @@ class TPC_yyStackEntry ** is the value of the token */ } -#line 12 "../smarty/lexer/smarty_internal_configfileparser.y" +// line 12 "../smarty/lexer/smarty_internal_configfileparser.y" /** * Smarty Internal Plugin Configfileparse @@ -23,7 +23,7 @@ class TPC_yyStackEntry */ class Smarty_Internal_Configfileparser { - #line 25 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 25 "../smarty/lexer/smarty_internal_configfileparser.y" const TPC_OPENB = 1; const TPC_SECTION = 2; const TPC_CLOSEB = 3; @@ -287,8 +287,8 @@ class Smarty_Internal_Configfileparser public static function yy_destructor($yymajor, $yypminor) { switch ($yymajor) { - default: - break; /* If no destructor action specified: do nothing */ + default: + break; /* If no destructor action specified: do nothing */ } } @@ -375,9 +375,11 @@ class Smarty_Internal_Configfileparser } $yytos = array_pop($this->yystack); if ($this->yyTraceFILE && $this->yyidx >= 0) { - fwrite($this->yyTraceFILE, - $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . - "\n"); + fwrite( + $this->yyTraceFILE, + $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . + "\n" + ); } $yymajor = $yytos->major; self::yy_destructor($yymajor, $yytos->minor); @@ -429,7 +431,8 @@ class Smarty_Internal_Configfileparser $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; $nextstate = $this->yy_find_reduce_action( $this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + self::$yyRuleInfo[ $yyruleno ][ 0 ] + ); if (isset(self::$yyExpectedTokens[ $nextstate ])) { $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); if (isset($res4[ $nextstate ][ $token ])) { @@ -439,8 +442,8 @@ class Smarty_Internal_Configfileparser return array_unique($expected); } } else { - if ($res4[ $nextstate ][ $token ] = - in_array($token, self::$yyExpectedTokens[ $nextstate ], true)) { + if ($res4[ $nextstate ][ $token ] = in_array($token, self::$yyExpectedTokens[ $nextstate ], true) + ) { $this->yyidx = $yyidx; $this->yystack = $stack; return array_unique($expected); @@ -515,7 +518,8 @@ class Smarty_Internal_Configfileparser $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; $nextstate = $this->yy_find_reduce_action( $this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + self::$yyRuleInfo[ $yyruleno ][ 0 ] + ); if (isset($res2[ $nextstate ][ $token ])) { if ($res2[ $nextstate ][ $token ]) { $this->yyidx = $yyidx; @@ -523,10 +527,13 @@ class Smarty_Internal_Configfileparser return true; } } else { - if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && - in_array($token, - self::$yyExpectedTokens[ $nextstate ], - true))) { + if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) + && in_array( + $token, + self::$yyExpectedTokens[ $nextstate ], + true + )) + ) { $this->yyidx = $yyidx; $this->yystack = $stack; return true; @@ -584,15 +591,19 @@ class Smarty_Internal_Configfileparser return self::YY_NO_ACTION; } $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || - self::$yy_lookahead[ $i ] != $iLookAhead) { + if ($i < 0 || $i >= self::YY_SZ_ACTTAB + || self::$yy_lookahead[ $i ] != $iLookAhead + ) { if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) - && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) { + && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0 + ) { if ($this->yyTraceFILE) { - fwrite($this->yyTraceFILE, - $this->yyTracePrompt . 'FALLBACK ' . + fwrite( + $this->yyTraceFILE, + $this->yyTracePrompt . 'FALLBACK ' . $this->yyTokenName[ $iLookAhead ] . ' => ' . - $this->yyTokenName[ $iFallback ] . "\n"); + $this->yyTokenName[ $iFallback ] . "\n" + ); } return $this->yy_find_shift_action($iFallback); } @@ -616,8 +627,9 @@ class Smarty_Internal_Configfileparser return self::YY_NO_ACTION; } $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || - self::$yy_lookahead[ $i ] != $iLookAhead) { + if ($i < 0 || $i >= self::YY_SZ_ACTTAB + || self::$yy_lookahead[ $i ] != $iLookAhead + ) { return self::$yy_default[ $stateno ]; } else { return self::$yy_action[ $i ]; @@ -635,7 +647,7 @@ class Smarty_Internal_Configfileparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 239 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 239 "../smarty/lexer/smarty_internal_configfileparser.y" $this->internalError = true; $this->compiler->trigger_config_file_error('Stack overflow in configfile parser'); return; @@ -646,15 +658,19 @@ class Smarty_Internal_Configfileparser $yytos->minor = $yypMinor; $this->yystack[] = $yytos; if ($this->yyTraceFILE && $this->yyidx > 0) { - fprintf($this->yyTraceFILE, - "%sShift %d\n", - $this->yyTracePrompt, - $yyNewState); + fprintf( + $this->yyTraceFILE, + "%sShift %d\n", + $this->yyTracePrompt, + $yyNewState + ); fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); for ($i = 1; $i <= $this->yyidx; $i++) { - fprintf($this->yyTraceFILE, - " %s", - $this->yyTokenName[ $this->yystack[ $i ]->major ]); + fprintf( + $this->yyTraceFILE, + " %s", + $this->yyTokenName[ $this->yystack[ $i ]->major ] + ); } fwrite($this->yyTraceFILE, "\n"); } @@ -677,100 +693,105 @@ class Smarty_Internal_Configfileparser $this->_retvalue = null; } - #line 245 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 245 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r5() { if ($this->configReadHidden) { - $this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor); + $this->add_section_vars( + $this->yystack[ $this->yyidx + -3 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor + ); } $this->_retvalue = null; } - #line 250 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 250 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r6() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 264 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 264 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r7() { $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -1 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 269 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 269 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r8() { $this->_retvalue = array(); } - #line 277 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 277 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r9() { $this->_retvalue = array('key' => $this->yystack[ $this->yyidx + -2 ]->minor, 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 281 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 281 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r10() { $this->_retvalue = (float)$this->yystack[ $this->yyidx + 0 ]->minor; } - #line 285 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 285 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r11() { $this->_retvalue = (int)$this->yystack[ $this->yyidx + 0 ]->minor; } - #line 291 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 291 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r12() { $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 296 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 296 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r13() { $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 300 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 300 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r14() { $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 304 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 304 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r15() { $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + -1 ]->minor); } - #line 308 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 308 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r16() { $this->_retvalue = ''; } - #line 312 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 312 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r17() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 316 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 316 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_reduce($yyruleno) { if ($this->yyTraceFILE && $yyruleno >= 0 - && $yyruleno < count(self::$yyRuleName)) { - fprintf($this->yyTraceFILE, - "%sReduce (%d) [%s].\n", - $this->yyTracePrompt, - $yyruleno, - self::$yyRuleName[ $yyruleno ]); + && $yyruleno < count(self::$yyRuleName) + ) { + fprintf( + $this->yyTraceFILE, + "%sReduce (%d) [%s].\n", + $this->yyTracePrompt, + $yyruleno, + self::$yyRuleName[ $yyruleno ] + ); } $this->_retvalue = $yy_lefthand_side = null; if (isset(self::$yyReduceMap[ $yyruleno ])) { @@ -803,7 +824,7 @@ class Smarty_Internal_Configfileparser } } - #line 320 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 320 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_parse_failed() { if ($this->yyTraceFILE) { @@ -814,10 +835,10 @@ class Smarty_Internal_Configfileparser } } - #line 324 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 324 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_syntax_error($yymajor, $TOKEN) { - #line 232 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 232 "../smarty/lexer/smarty_internal_configfileparser.y" $this->internalError = true; $this->yymajor = $yymajor; $this->compiler->trigger_config_file_error(); @@ -831,7 +852,7 @@ class Smarty_Internal_Configfileparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 225 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 225 "../smarty/lexer/smarty_internal_configfileparser.y" $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; @@ -851,15 +872,18 @@ class Smarty_Internal_Configfileparser } $yyendofinput = ($yymajor == 0); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sInput %s\n", - $this->yyTracePrompt, - $this->yyTokenName[ $yymajor ]); + fprintf( + $this->yyTraceFILE, + "%sInput %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ] + ); } do { $yyact = $this->yy_find_shift_action($yymajor); - if ($yymajor < self::YYERRORSYMBOL && - !$this->yy_is_expected_token($yymajor)) { + if ($yymajor < self::YYERRORSYMBOL + && !$this->yy_is_expected_token($yymajor) + ) { // force a syntax error $yyact = self::YY_ERROR_ACTION; } @@ -875,9 +899,11 @@ class Smarty_Internal_Configfileparser $this->yy_reduce($yyact - self::YYNSTATE); } else if ($yyact === self::YY_ERROR_ACTION) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sSyntax Error!\n", - $this->yyTracePrompt); + fprintf( + $this->yyTraceFILE, + "%sSyntax Error!\n", + $this->yyTracePrompt + ); } if (self::YYERRORSYMBOL) { if ($this->yyerrcnt < 0) { @@ -886,10 +912,12 @@ class Smarty_Internal_Configfileparser $yymx = $this->yystack[ $this->yyidx ]->major; if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sDiscard input token %s\n", - $this->yyTracePrompt, - $this->yyTokenName[ $yymajor ]); + fprintf( + $this->yyTraceFILE, + "%sDiscard input token %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ] + ); } $this->yy_destructor($yymajor, $yytokenvalue); $yymajor = self::YYNOCODE; diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index 37b917b1..27ac7cb4 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -87,9 +87,9 @@ abstract class Smarty_Internal_Data /** * 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 + * @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 @@ -103,7 +103,11 @@ abstract class Smarty_Internal_Data } else { if ($tpl_var !== '') { if ($this->_objType === 2) { - /** @var Smarty_Internal_Template $this */ + /** +* + * + * @var Smarty_Internal_Template $this +*/ $this->_assignInScope($tpl_var, $value, $nocache); } else { $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache); @@ -119,11 +123,11 @@ abstract class Smarty_Internal_Data * @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 + * @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 */ @@ -135,9 +139,9 @@ abstract class Smarty_Internal_Data /** * 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 + * @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 */ @@ -149,9 +153,9 @@ abstract class Smarty_Internal_Data /** * 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 + * @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 */ @@ -163,9 +167,9 @@ abstract class Smarty_Internal_Data /** * 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 + * @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 */ @@ -180,9 +184,9 @@ abstract class Smarty_Internal_Data * @api Smarty::getTemplateVars() * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * - * @param string $varName variable name or null + * @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? + * @param bool $searchParents include parent templates? * * @return mixed variable value or or array of variables */ @@ -194,17 +198,17 @@ abstract class Smarty_Internal_Data /** * 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 + * @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 + * @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) - { + $error_enable = true + ) { return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable); } diff --git a/libs/sysplugins/smarty_internal_debug.php b/libs/sysplugins/smarty_internal_debug.php index c826a178..733f039e 100644 --- a/libs/sysplugins/smarty_internal_debug.php +++ b/libs/sysplugins/smarty_internal_debug.php @@ -191,7 +191,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data /** * Opens a window for the Smarty Debugging Console and display the data * - * @param Smarty_Internal_Template|Smarty $obj object to debug + * @param Smarty_Internal_Template|Smarty $obj object to debug * @param bool $full * * @throws \Exception @@ -264,7 +264,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data /** * Recursively gets variables from all template/data scopes * - * @param Smarty_Internal_Template|Smarty_Data $obj object to debug + * @param Smarty_Internal_Template|Smarty_Data $obj object to debug * * @return StdClass */ diff --git a/libs/sysplugins/smarty_internal_errorhandler.php b/libs/sysplugins/smarty_internal_errorhandler.php index 83142183..14437593 100644 --- a/libs/sysplugins/smarty_internal_errorhandler.php +++ b/libs/sysplugins/smarty_internal_errorhandler.php @@ -3,7 +3,6 @@ /** * Smarty error handler * - * * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews @@ -58,11 +57,11 @@ class Smarty_Internal_ErrorHandler * * @link http://php.net/set_error_handler * - * @param integer $errno Error level - * @param $errstr - * @param $errfile - * @param $errline - * @param $errcontext + * @param integer $errno Error level + * @param $errstr + * @param $errfile + * @param $errline + * @param $errcontext * * @return bool */ @@ -98,15 +97,17 @@ class Smarty_Internal_ErrorHandler // or the error was within smarty but masked to be ignored if (!$_is_muted_directory || ($errno && $errno & error_reporting())) { if (self::$previousErrorHandler) { - return call_user_func(self::$previousErrorHandler, - $errno, - $errstr, - $errfile, - $errline, - $errcontext); + return call_user_func( + self::$previousErrorHandler, + $errno, + $errstr, + $errfile, + $errline, + $errcontext + ); } else { return false; } } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_extension_handler.php b/libs/sysplugins/smarty_internal_extension_handler.php index 90d3b81e..d322dd00 100644 --- a/libs/sysplugins/smarty_internal_extension_handler.php +++ b/libs/sysplugins/smarty_internal_extension_handler.php @@ -5,37 +5,36 @@ * * Load extensions dynamically * - * * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews * * Runtime extensions - * @property Smarty_Internal_Runtime_CacheModify $_cacheModify - * @property Smarty_Internal_Runtime_CacheResourceFile $_cacheResourceFile - * @property Smarty_Internal_Runtime_Capture $_capture - * @property Smarty_Internal_Runtime_CodeFrame $_codeFrame - * @property Smarty_Internal_Runtime_FilterHandler $_filterHandler - * @property Smarty_Internal_Runtime_Foreach $_foreach - * @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath - * @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache - * @property Smarty_Internal_Runtime_UpdateCache $_updateCache - * @property Smarty_Internal_Runtime_UpdateScope $_updateScope - * @property Smarty_Internal_Runtime_TplFunction $_tplFunction - * @property Smarty_Internal_Runtime_WriteFile $_writeFile + * @property Smarty_Internal_Runtime_CacheModify $_cacheModify + * @property Smarty_Internal_Runtime_CacheResourceFile $_cacheResourceFile + * @property Smarty_Internal_Runtime_Capture $_capture + * @property Smarty_Internal_Runtime_CodeFrame $_codeFrame + * @property Smarty_Internal_Runtime_FilterHandler $_filterHandler + * @property Smarty_Internal_Runtime_Foreach $_foreach + * @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath + * @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache + * @property Smarty_Internal_Runtime_UpdateCache $_updateCache + * @property Smarty_Internal_Runtime_UpdateScope $_updateScope + * @property Smarty_Internal_Runtime_TplFunction $_tplFunction + * @property Smarty_Internal_Runtime_WriteFile $_writeFile * * Method extensions - * @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars - * @property Smarty_Internal_Method_Append $append - * @property Smarty_Internal_Method_AppendByRef $appendByRef - * @property Smarty_Internal_Method_AssignGlobal $assignGlobal - * @property Smarty_Internal_Method_AssignByRef $assignByRef - * @property Smarty_Internal_Method_LoadFilter $loadFilter - * @property Smarty_Internal_Method_LoadPlugin $loadPlugin - * @property Smarty_Internal_Method_RegisterFilter $registerFilter - * @property Smarty_Internal_Method_RegisterObject $registerObject - * @property Smarty_Internal_Method_RegisterPlugin $registerPlugin - * @property mixed|\Smarty_Template_Cached configLoad + * @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars + * @property Smarty_Internal_Method_Append $append + * @property Smarty_Internal_Method_AppendByRef $appendByRef + * @property Smarty_Internal_Method_AssignGlobal $assignGlobal + * @property Smarty_Internal_Method_AssignByRef $assignByRef + * @property Smarty_Internal_Method_LoadFilter $loadFilter + * @property Smarty_Internal_Method_LoadPlugin $loadPlugin + * @property Smarty_Internal_Method_RegisterFilter $registerFilter + * @property Smarty_Internal_Method_RegisterObject $registerObject + * @property Smarty_Internal_Method_RegisterPlugin $registerPlugin + * @property mixed|\Smarty_Template_Cached configLoad */ class Smarty_Internal_Extension_Handler { @@ -50,7 +49,7 @@ class Smarty_Internal_Extension_Handler */ private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0, 'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0, - 'TemplateVars' => 0, 'Literals' => 'Literals',);# + 'TemplateVars' => 0, 'Literals' => 'Literals',);// private $resolvedProperties = array(); @@ -71,8 +70,9 @@ class Smarty_Internal_Extension_Handler if (!isset($smarty->ext->$name)) { if (preg_match('/^((set|get)|(.*?))([A-Z].*)$/', $name, $match)) { $basename = $this->upperCase($match[4]); - if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ]) && - is_string($this->_property_info[ $basename ])) { + if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ]) + && is_string($this->_property_info[ $basename ]) + ) { $class = 'Smarty_Internal_Method_' . $this->_property_info[ $basename ]; if (class_exists($class)) { $classObj = new $class(); @@ -90,12 +90,18 @@ class Smarty_Internal_Extension_Handler if (!isset($this->resolvedProperties[ $match[0] ][ $objType ])) { $property = isset($this->resolvedProperties['property'][ $basename ]) ? $this->resolvedProperties['property'][ $basename ] : - $property = $this->resolvedProperties['property'][ $basename ] = strtolower(join('_', - preg_split('/([A-Z][^A-Z]*)/', - $basename, - -1, - PREG_SPLIT_NO_EMPTY | - PREG_SPLIT_DELIM_CAPTURE))); + $property = $this->resolvedProperties['property'][ $basename ] = strtolower( + join( + '_', + preg_split( + '/([A-Z][^A-Z]*)/', + $basename, + -1, + PREG_SPLIT_NO_EMPTY | + PREG_SPLIT_DELIM_CAPTURE + ) + ) + ); if ($property !== false) { if (property_exists($data, $property)) { @@ -193,4 +199,4 @@ class Smarty_Internal_Extension_Handler return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), array($this)); } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_addautoloadfilters.php b/libs/sysplugins/smarty_internal_method_addautoloadfilters.php index 7bd75bfb..26ed4b77 100644 --- a/libs/sysplugins/smarty_internal_method_addautoloadfilters.php +++ b/libs/sysplugins/smarty_internal_method_addautoloadfilters.php @@ -17,11 +17,12 @@ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_S * @api Smarty::setAutoloadFilters() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array $filters filters to load automatically - * @param string $type "pre", "output", … specify the - * filter type to set. Defaults to - * none treating $filters' keys as - * the appropriate types + * @param array $filters filters to load automatically + * @param string $type "pre", "output", … specify + * the filter type to set. + * Defaults to none treating + * $filters' keys as the + * appropriate types * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -49,4 +50,4 @@ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_S } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php b/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php index afb0b68d..c3feb3d8 100644 --- a/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php +++ b/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_AddDefaultModifiers * @api Smarty::addDefaultModifiers() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array|string $modifiers modifier or list of modifiers + * @param array|string $modifiers modifier or list of modifiers * to add * * @return \Smarty|\Smarty_Internal_Template @@ -39,4 +39,4 @@ class Smarty_Internal_Method_AddDefaultModifiers } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_append.php b/libs/sysplugins/smarty_internal_method_append.php index a1422cf5..601da6d6 100644 --- a/libs/sysplugins/smarty_internal_method_append.php +++ b/libs/sysplugins/smarty_internal_method_append.php @@ -25,10 +25,10 @@ class Smarty_Internal_Method_Append * @link http://www.smarty.net/docs/en/api.append.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @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 + * @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 @@ -52,8 +52,8 @@ class Smarty_Internal_Method_Append $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) + 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'); } @@ -71,4 +71,4 @@ class Smarty_Internal_Method_Append } return $data; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_appendbyref.php b/libs/sysplugins/smarty_internal_method_appendbyref.php index 9185a8e8..2a1be792 100644 --- a/libs/sysplugins/smarty_internal_method_appendbyref.php +++ b/libs/sysplugins/smarty_internal_method_appendbyref.php @@ -19,9 +19,9 @@ class Smarty_Internal_Method_AppendByRef * @link http://www.smarty.net/docs/en/api.append.by.ref.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $tpl_var the template variable name - * @param mixed &$value the referenced value to append - * @param bool $merge flag if array elements shall be merged + * @param string $tpl_var the template variable name + * @param mixed &$value the referenced value to append + * @param bool $merge flag if array elements shall be merged * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -47,4 +47,4 @@ class Smarty_Internal_Method_AppendByRef } return $data; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_assignbyref.php b/libs/sysplugins/smarty_internal_method_assignbyref.php index 1c513ce9..3b7b7627 100644 --- a/libs/sysplugins/smarty_internal_method_assignbyref.php +++ b/libs/sysplugins/smarty_internal_method_assignbyref.php @@ -17,8 +17,8 @@ class Smarty_Internal_Method_AssignByRef * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param string $tpl_var the template variable name - * @param $value - * @param boolean $nocache if true any output of this variable will be not cached + * @param $value + * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -33,4 +33,4 @@ class Smarty_Internal_Method_AssignByRef } return $data; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_assignglobal.php b/libs/sysplugins/smarty_internal_method_assignglobal.php index 0e169041..b6e7627f 100644 --- a/libs/sysplugins/smarty_internal_method_assignglobal.php +++ b/libs/sysplugins/smarty_internal_method_assignglobal.php @@ -22,9 +22,9 @@ class Smarty_Internal_Method_AssignGlobal * assigns a global Smarty variable * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @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 + * @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 */ @@ -40,4 +40,4 @@ class Smarty_Internal_Method_AssignGlobal } return $data; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_clearallassign.php b/libs/sysplugins/smarty_internal_method_clearallassign.php index 1e5fec4b..97f1af08 100644 --- a/libs/sysplugins/smarty_internal_method_clearallassign.php +++ b/libs/sysplugins/smarty_internal_method_clearallassign.php @@ -34,4 +34,4 @@ class Smarty_Internal_Method_ClearAllAssign return $data; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_clearallcache.php b/libs/sysplugins/smarty_internal_method_clearallcache.php index 9641e2ba..30d55f7d 100644 --- a/libs/sysplugins/smarty_internal_method_clearallcache.php +++ b/libs/sysplugins/smarty_internal_method_clearallcache.php @@ -24,9 +24,9 @@ class Smarty_Internal_Method_ClearAllCache * @api Smarty::clearAllCache() * @link http://www.smarty.net/docs/en/api.clear.all.cache.tpl * - * @param \Smarty $smarty - * @param integer $exp_time expiration time - * @param string $type resource type + * @param \Smarty $smarty + * @param integer $exp_time expiration time + * @param string $type resource type * * @return int number of cache files deleted * @throws \SmartyException @@ -38,4 +38,4 @@ class Smarty_Internal_Method_ClearAllCache $_cache_resource = Smarty_CacheResource::load($smarty, $type); return $_cache_resource->clearAll($smarty, $exp_time); } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_clearassign.php b/libs/sysplugins/smarty_internal_method_clearassign.php index 060a2ac4..c2f927f0 100644 --- a/libs/sysplugins/smarty_internal_method_clearassign.php +++ b/libs/sysplugins/smarty_internal_method_clearassign.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_ClearAssign * @link http://www.smarty.net/docs/en/api.clear.assign.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string|array $tpl_var the template variable(s) to clear + * @param string|array $tpl_var the template variable(s) to clear * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -41,4 +41,4 @@ class Smarty_Internal_Method_ClearAssign return $data; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_clearcache.php b/libs/sysplugins/smarty_internal_method_clearcache.php index 6d56c13d..74bd92ac 100644 --- a/libs/sysplugins/smarty_internal_method_clearcache.php +++ b/libs/sysplugins/smarty_internal_method_clearcache.php @@ -24,22 +24,22 @@ class Smarty_Internal_Method_ClearCache * @api Smarty::clearCache() * @link http://www.smarty.net/docs/en/api.clear.cache.tpl * - * @param \Smarty $smarty - * @param string $template_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time - * @param string $type resource type + * @param \Smarty $smarty + * @param string $template_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer $exp_time expiration time + * @param string $type resource type * * @return int number of cache files deleted * @throws \SmartyException */ public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, - $type = null) - { + $type = null + ) { $smarty->_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); } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php b/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php index c019c59d..9874a3bc 100644 --- a/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php +++ b/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php @@ -24,10 +24,10 @@ class Smarty_Internal_Method_ClearCompiledTemplate * @api Smarty::clearCompiledTemplate() * @link http://www.smarty.net/docs/en/api.clear.compiled.template.tpl * - * @param \Smarty $smarty - * @param string $resource_name template name - * @param string $compile_id compile id - * @param integer $exp_time expiration time + * @param \Smarty $smarty + * @param string $resource_name template name + * @param string $compile_id compile id + * @param integer $exp_time expiration time * * @return int number of template files deleted * @throws \SmartyException @@ -90,18 +90,20 @@ class Smarty_Internal_Method_ClearCompiledTemplate continue; } $unlink = false; - if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a = - !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) && - (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) && - substr_compare($_filepath, - $_resource_part_1, - -$_resource_part_1_length, - $_resource_part_1_length) === - 0) || (isset($_filepath[ $_resource_part_2_length ]) && - substr_compare($_filepath, - $_resource_part_2, - -$_resource_part_2_length, - $_resource_part_2_length) === 0)) + if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a =!strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) + && (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) + && substr_compare( + $_filepath, + $_resource_part_1, + -$_resource_part_1_length, + $_resource_part_1_length + ) ===0) || (isset($_filepath[ $_resource_part_2_length ]) + && substr_compare( + $_filepath, + $_resource_part_2, + -$_resource_part_2_length, + $_resource_part_2_length + ) === 0)) ) { if (isset($exp_time)) { if (is_file($_filepath) && time() - filemtime($_filepath) >= $exp_time) { @@ -125,4 +127,4 @@ class Smarty_Internal_Method_ClearCompiledTemplate } return $_count; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_clearconfig.php b/libs/sysplugins/smarty_internal_method_clearconfig.php index 37124780..15bf492a 100644 --- a/libs/sysplugins/smarty_internal_method_clearconfig.php +++ b/libs/sysplugins/smarty_internal_method_clearconfig.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_ClearConfig * @link http://www.smarty.net/docs/en/api.clear.config.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string|null $name variable name or null + * @param string|null $name variable name or null * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -38,4 +38,4 @@ class Smarty_Internal_Method_ClearConfig } return $data; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_compileallconfig.php b/libs/sysplugins/smarty_internal_method_compileallconfig.php index 767031bd..88e4826f 100644 --- a/libs/sysplugins/smarty_internal_method_compileallconfig.php +++ b/libs/sysplugins/smarty_internal_method_compileallconfig.php @@ -15,19 +15,19 @@ class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_Com /** * Compile all config files * - * @api Smarty::compileAllConfig() + * @api Smarty::compileAllConfig() * * @param \Smarty $smarty passed smarty object - * @param string $extension file extension - * @param bool $force_compile force all to recompile - * @param int $time_limit - * @param int $max_errors + * @param string $extension file extension + * @param bool $force_compile force all to recompile + * @param int $time_limit + * @param int $max_errors * * @return int number of template files recompiled */ public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0, - $max_errors = null) - { + $max_errors = null + ) { return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true); } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_compilealltemplates.php b/libs/sysplugins/smarty_internal_method_compilealltemplates.php index 6e7c40cd..415199e8 100644 --- a/libs/sysplugins/smarty_internal_method_compilealltemplates.php +++ b/libs/sysplugins/smarty_internal_method_compilealltemplates.php @@ -20,22 +20,22 @@ class Smarty_Internal_Method_CompileAllTemplates /** * Compile all template files * - * @api Smarty::compileAllTemplates() + * @api Smarty::compileAllTemplates() * * @param \Smarty $smarty passed smarty object - * @param string $extension file extension - * @param bool $force_compile force all to recompile - * @param int $time_limit - * @param int $max_errors + * @param string $extension file extension + * @param bool $force_compile force all to recompile + * @param int $time_limit + * @param int $max_errors * * @return integer number of template files recompiled */ public function compileAllTemplates(Smarty $smarty, - $extension = '.tpl', - $force_compile = false, - $time_limit = 0, - $max_errors = null) - { + $extension = '.tpl', + $force_compile = false, + $time_limit = 0, + $max_errors = null + ) { return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors); } @@ -43,21 +43,21 @@ class Smarty_Internal_Method_CompileAllTemplates * 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 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) - { + $extension, + $force_compile, + $time_limit, + $max_errors, + $isConfig = false + ) { // switch off time limit if (function_exists('set_time_limit')) { @set_time_limit($time_limit); @@ -67,8 +67,10 @@ class Smarty_Internal_Method_CompileAllTemplates $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_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(); @@ -122,4 +124,4 @@ class Smarty_Internal_Method_CompileAllTemplates echo "\n<br>"; return $_count; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_configload.php b/libs/sysplugins/smarty_internal_method_configload.php index eb8672fe..43c3fffc 100644 --- a/libs/sysplugins/smarty_internal_method_configload.php +++ b/libs/sysplugins/smarty_internal_method_configload.php @@ -25,8 +25,8 @@ class Smarty_Internal_Method_ConfigLoad * @link http://www.smarty.net/docs/en/api.config.load.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $config_file filename - * @param mixed $sections array of section names, single + * @param string $config_file filename + * @param mixed $sections array of section names, single * section or null * * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template @@ -45,9 +45,10 @@ class Smarty_Internal_Method_ConfigLoad * @link http://www.smarty.net/docs/en/api.config.load.tpl * * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data - * @param string $config_file filename - * @param mixed $sections array of section names, single + * @param string $config_file filename + * @param mixed $sections array of section names, single * section or null + * @param int $scope scope into which config variables * shall be loaded * @@ -75,8 +76,7 @@ class Smarty_Internal_Method_ConfigLoad * load config variables into template object * * @param \Smarty_Internal_Template $tpl - * @param array $new_config_vars - * + * @param array $new_config_vars */ public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars) { @@ -111,7 +111,7 @@ class Smarty_Internal_Method_ConfigLoad * * @param array $config_vars config variables in scope * @param \Smarty_Internal_Template $tpl - * @param array $new_config_vars loaded config variables + * @param array $new_config_vars loaded config variables */ public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars) { @@ -159,7 +159,7 @@ class Smarty_Internal_Method_ConfigLoad * gets a config variable value * * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data - * @param string $varName the name of the config variable + * @param string $varName the name of the config variable * @param bool $errorEnable * * @return null|string the value of the config variable diff --git a/libs/sysplugins/smarty_internal_method_createdata.php b/libs/sysplugins/smarty_internal_method_createdata.php index 43ce8943..333b9953 100644 --- a/libs/sysplugins/smarty_internal_method_createdata.php +++ b/libs/sysplugins/smarty_internal_method_createdata.php @@ -41,4 +41,4 @@ class Smarty_Internal_Method_CreateData } return $dataObj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_getautoloadfilters.php b/libs/sysplugins/smarty_internal_method_getautoloadfilters.php index b957b60d..4145db10 100644 --- a/libs/sysplugins/smarty_internal_method_getautoloadfilters.php +++ b/libs/sysplugins/smarty_internal_method_getautoloadfilters.php @@ -17,7 +17,7 @@ class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_S * @api Smarty::getAutoloadFilters() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type type of filter to get auto loads + * @param string $type type of filter to get auto loads * for. Defaults to all autoload * filters * @@ -34,4 +34,4 @@ class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_S } return $smarty->autoload_filters; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_getconfigvariable.php b/libs/sysplugins/smarty_internal_method_getconfigvariable.php index 4dd39820..9ebda425 100644 --- a/libs/sysplugins/smarty_internal_method_getconfigvariable.php +++ b/libs/sysplugins/smarty_internal_method_getconfigvariable.php @@ -22,7 +22,7 @@ class Smarty_Internal_Method_GetConfigVariable * gets a config variable value * * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data - * @param string $varName the name of the config variable + * @param string $varName the name of the config variable * @param bool $errorEnable * * @return null|string the value of the config variable @@ -31,4 +31,4 @@ class Smarty_Internal_Method_GetConfigVariable { return $data->ext->configLoad->_getConfigVariable($data, $varName, $errorEnable); } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_getconfigvars.php b/libs/sysplugins/smarty_internal_method_getconfigvars.php index b75cf817..1d11e44c 100644 --- a/libs/sysplugins/smarty_internal_method_getconfigvars.php +++ b/libs/sysplugins/smarty_internal_method_getconfigvars.php @@ -25,8 +25,8 @@ class Smarty_Internal_Method_GetConfigVars * @link http://www.smarty.net/docs/en/api.get.config.vars.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $varname variable name or null - * @param bool $search_parents include parent templates? + * @param string $varname variable name or null + * @param bool $search_parents include parent templates? * * @return mixed variable value or or array of variables */ @@ -55,4 +55,4 @@ class Smarty_Internal_Method_GetConfigVars return $var_array; } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_getdebugtemplate.php b/libs/sysplugins/smarty_internal_method_getdebugtemplate.php index 52073c14..77d908c1 100644 --- a/libs/sysplugins/smarty_internal_method_getdebugtemplate.php +++ b/libs/sysplugins/smarty_internal_method_getdebugtemplate.php @@ -32,4 +32,4 @@ class Smarty_Internal_Method_GetDebugTemplate $smarty = $obj->_getSmartyObj(); return $smarty->debug_tpl; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php b/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php index f65ab791..57da85c4 100644 --- a/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php +++ b/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php @@ -32,4 +32,4 @@ class Smarty_Internal_Method_GetDefaultModifiers $smarty = $obj->_getSmartyObj(); return $smarty->default_modifiers; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_getglobal.php b/libs/sysplugins/smarty_internal_method_getglobal.php index 0f00da53..850323b3 100644 --- a/libs/sysplugins/smarty_internal_method_getglobal.php +++ b/libs/sysplugins/smarty_internal_method_getglobal.php @@ -21,10 +21,10 @@ class Smarty_Internal_Method_GetGlobal /** * Returns a single or all global variables * - * @api Smarty::getGlobal() + * @api Smarty::getGlobal() * * @param \Smarty_Internal_Data $data - * @param string $varName variable name or null + * @param string $varName variable name or null * * @return string|array variable value or or array of variables */ @@ -44,4 +44,4 @@ class Smarty_Internal_Method_GetGlobal return $_result; } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_getregisteredobject.php b/libs/sysplugins/smarty_internal_method_getregisteredobject.php index c5c06466..df6ede13 100644 --- a/libs/sysplugins/smarty_internal_method_getregisteredobject.php +++ b/libs/sysplugins/smarty_internal_method_getregisteredobject.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_GetRegisteredObject * @link http://www.smarty.net/docs/en/api.get.registered.object.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $object_name object name + * @param string $object_name object name * * @return object * @throws \SmartyException if no such object is found @@ -41,4 +41,4 @@ class Smarty_Internal_Method_GetRegisteredObject } return $smarty->registered_objects[ $object_name ][ 0 ]; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_getstreamvariable.php b/libs/sysplugins/smarty_internal_method_getstreamvariable.php index b922fd08..abb295cc 100644 --- a/libs/sysplugins/smarty_internal_method_getstreamvariable.php +++ b/libs/sysplugins/smarty_internal_method_getstreamvariable.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_GetStreamVariable * @api Smarty::getStreamVariable() * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $variable the stream of the variable + * @param string $variable the stream of the variable * * @return mixed * @throws \SmartyException @@ -48,4 +48,4 @@ class Smarty_Internal_Method_GetStreamVariable return null; } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_gettags.php b/libs/sysplugins/smarty_internal_method_gettags.php index afaa4b91..c07ae07e 100644 --- a/libs/sysplugins/smarty_internal_method_gettags.php +++ b/libs/sysplugins/smarty_internal_method_gettags.php @@ -60,4 +60,4 @@ class Smarty_Internal_Method_GetTags } throw new SmartyException('Missing template specification'); } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_gettemplatevars.php b/libs/sysplugins/smarty_internal_method_gettemplatevars.php index 510bab0f..5e239d82 100644 --- a/libs/sysplugins/smarty_internal_method_gettemplatevars.php +++ b/libs/sysplugins/smarty_internal_method_gettemplatevars.php @@ -25,15 +25,15 @@ class Smarty_Internal_Method_GetTemplateVars * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $varName variable name or null + * @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? + * @param bool $searchParents include parent templates? * * @return mixed variable value or or array of variables */ public function getTemplateVars(Smarty_Internal_Data $data, $varName = null, Smarty_Internal_Data $_ptr = null, - $searchParents = true) - { + $searchParents = true + ) { if (isset($varName)) { $_var = $this->_getVariable($data, $varName, $_ptr, $searchParents, false); if (is_object($_var)) { @@ -82,8 +82,8 @@ class Smarty_Internal_Method_GetTemplateVars * @return \Smarty_Variable */ public function _getVariable(Smarty_Internal_Data $data, $varName, Smarty_Internal_Data $_ptr = null, - $searchParents = true, $errorEnable = true) - { + $searchParents = true, $errorEnable = true + ) { if ($_ptr === null) { $_ptr = $data; } @@ -110,4 +110,4 @@ class Smarty_Internal_Method_GetTemplateVars return new Smarty_Undefined_Variable; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_literals.php b/libs/sysplugins/smarty_internal_method_literals.php index 08e1a473..bfa3f58e 100644 --- a/libs/sysplugins/smarty_internal_method_literals.php +++ b/libs/sysplugins/smarty_internal_method_literals.php @@ -39,8 +39,8 @@ class Smarty_Internal_Method_Literals * @api Smarty::addLiterals() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array|string $literals literal or list of literals - * to add + * @param array|string $literals literal or list of literals + * to addto add * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -59,8 +59,8 @@ class Smarty_Internal_Method_Literals * @api Smarty::setLiterals() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array|string $literals literal or list of literals - * to set + * @param array|string $literals literal or list of literals + * to setto set * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -80,7 +80,7 @@ class Smarty_Internal_Method_Literals * Smarty::$literals array gets filled with identical key values * * @param \Smarty $smarty - * @param array $literals + * @param array $literals * * @throws \SmartyException */ @@ -90,9 +90,11 @@ class Smarty_Internal_Method_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'); + 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); } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_loadfilter.php b/libs/sysplugins/smarty_internal_method_loadfilter.php index 239fd6dd..2ae74011 100644 --- a/libs/sysplugins/smarty_internal_method_loadfilter.php +++ b/libs/sysplugins/smarty_internal_method_loadfilter.php @@ -28,13 +28,13 @@ class Smarty_Internal_Method_LoadFilter /** * load a filter of specified type and name * - * @api Smarty::loadFilter() + * @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 + * @param string $type filter type + * @param string $name filter name * * @return bool * @throws SmartyException if filter could not be loaded @@ -74,4 +74,4 @@ class Smarty_Internal_Method_LoadFilter throw new SmartyException("Illegal filter type '{$type}'"); } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_loadplugin.php b/libs/sysplugins/smarty_internal_method_loadplugin.php index 2454d9c9..3bd659cb 100644 --- a/libs/sysplugins/smarty_internal_method_loadplugin.php +++ b/libs/sysplugins/smarty_internal_method_loadplugin.php @@ -24,8 +24,8 @@ class Smarty_Internal_Method_LoadPlugin * plugin filename format: plugintype.pluginname.php * * @param \Smarty $smarty - * @param string $plugin_name class plugin name to load - * @param bool $check check if already loaded + * @param string $plugin_name class plugin name to load + * @param bool $check check if already loaded * * @return bool|string * @throws \SmartyException @@ -50,7 +50,7 @@ class Smarty_Internal_Method_LoadPlugin } else { if (is_file($file)) { $this->plugin_files[ $file ] = $file; - require_once($file); + include_once $file; return $file; } else { $this->plugin_files[ $file ] = false; @@ -87,7 +87,7 @@ class Smarty_Internal_Method_LoadPlugin $file = $_plugin_dir . $name; if (is_file($file)) { $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = $file; - require_once($file); + include_once $file; return $file; } $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = false; @@ -100,7 +100,7 @@ class Smarty_Internal_Method_LoadPlugin $file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty); $this->plugin_files[ 'include_path' ][ $_lower_filename ] = $file; if ($file !== false) { - require_once($file); + include_once $file; return $file; } } @@ -108,4 +108,4 @@ class Smarty_Internal_Method_LoadPlugin // no plugin loaded return false; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_mustcompile.php b/libs/sysplugins/smarty_internal_method_mustcompile.php index 62c16f62..d1b53654 100644 --- a/libs/sysplugins/smarty_internal_method_mustcompile.php +++ b/libs/sysplugins/smarty_internal_method_mustcompile.php @@ -48,4 +48,4 @@ class Smarty_Internal_Method_MustCompile return $_template->mustCompile; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registercacheresource.php b/libs/sysplugins/smarty_internal_method_registercacheresource.php index ae387272..4f77cf58 100644 --- a/libs/sysplugins/smarty_internal_method_registercacheresource.php +++ b/libs/sysplugins/smarty_internal_method_registercacheresource.php @@ -25,16 +25,16 @@ class Smarty_Internal_Method_RegisterCacheResource * @link http://www.smarty.net/docs/en/api.register.cacheresource.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $name name of resource type + * @param string $name name of resource type * @param \Smarty_CacheResource $resource_handler * * @return \Smarty|\Smarty_Internal_Template */ public function registerCacheResource(Smarty_Internal_TemplateBase $obj, $name, - Smarty_CacheResource $resource_handler) - { + Smarty_CacheResource $resource_handler + ) { $smarty = $obj->_getSmartyObj(); $smarty->registered_cache_resources[ $name ] = $resource_handler; return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registerclass.php b/libs/sysplugins/smarty_internal_method_registerclass.php index 5469b98a..8d18547e 100644 --- a/libs/sysplugins/smarty_internal_method_registerclass.php +++ b/libs/sysplugins/smarty_internal_method_registerclass.php @@ -25,8 +25,8 @@ class Smarty_Internal_Method_RegisterClass * @link http://www.smarty.net/docs/en/api.register.class.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $class_name - * @param string $class_impl the referenced PHP class to + * @param string $class_name + * @param string $class_impl the referenced PHP class to * register * * @return \Smarty|\Smarty_Internal_Template @@ -43,4 +43,4 @@ class Smarty_Internal_Method_RegisterClass $smarty->registered_classes[ $class_name ] = $class_impl; return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php b/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php index c8c5ae73..b340f178 100644 --- a/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php +++ b/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php @@ -21,10 +21,10 @@ class Smarty_Internal_Method_RegisterDefaultConfigHandler /** * Register config default handler * - * @api Smarty::registerDefaultConfigHandler() + * @api Smarty::registerDefaultConfigHandler() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param callable $callback class/method name + * @param callable $callback class/method name * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException if $callback is not callable @@ -39,4 +39,4 @@ class Smarty_Internal_Method_RegisterDefaultConfigHandler } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php b/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php index d9aecb4a..a9fb78dc 100644 --- a/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php +++ b/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_RegisterDefaultPluginHandler * @link http://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param callable $callback class/method name + * @param callable $callback class/method name * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException if $callback is not callable @@ -40,4 +40,4 @@ class Smarty_Internal_Method_RegisterDefaultPluginHandler } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php b/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php index 4c5d396e..38e14c11 100644 --- a/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php +++ b/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php @@ -21,10 +21,10 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler /** * Register template default handler * - * @api Smarty::registerDefaultTemplateHandler() + * @api Smarty::registerDefaultTemplateHandler() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param callable $callback class/method name + * @param callable $callback class/method name * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException if $callback is not callable @@ -55,16 +55,20 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler $default_handler = $source->smarty->default_template_handler_func; } $_content = $_timestamp = null; - $_return = call_user_func_array($default_handler, - array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty)); + $_return = call_user_func_array( + $default_handler, + array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty) + ); if (is_string($_return)) { $source->exists = is_file($_return); if ($source->exists) { $source->timestamp = filemtime($_return); } else { - throw new SmartyException('Default handler: Unable to load ' . + throw new SmartyException( + 'Default handler: Unable to load ' . ($source->isConfig ? 'config' : 'template') . - " default file '{$_return}' for '{$source->type}:{$source->name}'"); + " default file '{$_return}' for '{$source->type}:{$source->name}'" + ); } $source->name = $source->filepath = $_return; $source->uid = sha1($source->filepath); @@ -75,8 +79,10 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler $source->handler = Smarty_Resource::load($source->smarty, 'eval'); } else { $source->exists = false; - throw new SmartyException('Default handler: No ' . ($source->isConfig ? 'config' : 'template') . - " default content for '{$source->type}:{$source->name}'"); + throw new SmartyException( + 'Default handler: No ' . ($source->isConfig ? 'config' : 'template') . + " default content for '{$source->type}:{$source->name}'" + ); } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registerfilter.php b/libs/sysplugins/smarty_internal_method_registerfilter.php index 77e41f37..e01e9ae4 100644 --- a/libs/sysplugins/smarty_internal_method_registerfilter.php +++ b/libs/sysplugins/smarty_internal_method_registerfilter.php @@ -28,14 +28,14 @@ class Smarty_Internal_Method_RegisterFilter /** * Registers a filter function * - * @api Smarty::registerFilter() + * @api Smarty::registerFilter() * * @link http://www.smarty.net/docs/en/api.register.filter.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type filter type - * @param callback $callback - * @param string|null $name optional filter name + * @param string $type filter type + * @param callback $callback + * @param string|null $name optional filter name * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -55,7 +55,7 @@ class Smarty_Internal_Method_RegisterFilter /** * Return internal filter name * - * @param callback $function_name + * @param callback $function_name * * @return string internal filter name */ @@ -85,4 +85,4 @@ class Smarty_Internal_Method_RegisterFilter throw new SmartyException("Illegal filter type '{$type}'"); } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registerobject.php b/libs/sysplugins/smarty_internal_method_registerobject.php index ba699b21..e27aba6b 100644 --- a/libs/sysplugins/smarty_internal_method_registerobject.php +++ b/libs/sysplugins/smarty_internal_method_registerobject.php @@ -25,28 +25,35 @@ class Smarty_Internal_Method_RegisterObject * @link http://www.smarty.net/docs/en/api.register.object.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $object_name - * @param object $object the + * @param string $object_name + * @param object $object the * referenced - * PHP object to + * PHP + * object + * to * register - * @param array $allowed_methods_properties list of + * + * @param array $allowed_methods_properties list of * allowed * methods - * (empty = all) - * @param bool $format smarty + * (empty + * = all) + * + * @param bool $format smarty * argument - * format, else + * format, + * else * traditional - * @param array $block_methods list of + * + * @param array $block_methods list of * block-methods * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException */ public function registerObject(Smarty_Internal_TemplateBase $obj, $object_name, $object, - $allowed_methods_properties = array(), $format = true, $block_methods = array()) - { + $allowed_methods_properties = array(), $format = true, $block_methods = array() + ) { $smarty = $obj->_getSmartyObj(); // test if allowed methods callable if (!empty($allowed_methods_properties)) { @@ -69,4 +76,4 @@ class Smarty_Internal_Method_RegisterObject array($object, (array) $allowed_methods_properties, (boolean) $format, (array) $block_methods); return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registerplugin.php b/libs/sysplugins/smarty_internal_method_registerplugin.php index 64bf0ef1..b2d54165 100644 --- a/libs/sysplugins/smarty_internal_method_registerplugin.php +++ b/libs/sysplugins/smarty_internal_method_registerplugin.php @@ -25,19 +25,20 @@ class Smarty_Internal_Method_RegisterPlugin * @link http://www.smarty.net/docs/en/api.register.plugin.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @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 + * @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 + + * @param mixed $cache_attr caching attributes if any * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException when the plugin tag is invalid */ public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true, - $cache_attr = null) - { + $cache_attr = null + ) { $smarty = $obj->_getSmartyObj(); if (isset($smarty->registered_plugins[ $type ][ $name ])) { throw new SmartyException("Plugin tag '{$name}' already registered"); @@ -48,4 +49,4 @@ class Smarty_Internal_Method_RegisterPlugin } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_registerresource.php b/libs/sysplugins/smarty_internal_method_registerresource.php index 44534b73..7c7d0f78 100644 --- a/libs/sysplugins/smarty_internal_method_registerresource.php +++ b/libs/sysplugins/smarty_internal_method_registerresource.php @@ -25,11 +25,13 @@ class Smarty_Internal_Method_RegisterResource * @link http://www.smarty.net/docs/en/api.register.resource.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $name name of resource type - * @param Smarty_Resource|array $resource_handler or instance of - * Smarty_Resource, or - * array of callbacks to - * handle resource + * @param string $name name of resource type + * @param Smarty_Resource|array $resource_handler or instance of + * Smarty_Resource, + * or array of + * callbacks to + * handle + * resource * (deprecated) * * @return \Smarty|\Smarty_Internal_Template @@ -41,4 +43,4 @@ class Smarty_Internal_Method_RegisterResource $resource_handler instanceof Smarty_Resource ? $resource_handler : array($resource_handler, false); return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_setautoloadfilters.php b/libs/sysplugins/smarty_internal_method_setautoloadfilters.php index 29653b08..1f807238 100644 --- a/libs/sysplugins/smarty_internal_method_setautoloadfilters.php +++ b/libs/sysplugins/smarty_internal_method_setautoloadfilters.php @@ -31,11 +31,12 @@ class Smarty_Internal_Method_SetAutoloadFilters * @api Smarty::setAutoloadFilters() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array $filters filters to load automatically - * @param string $type "pre", "output", … specify the - * filter type to set. Defaults to - * none treating $filters' keys as - * the appropriate types + * @param array $filters filters to load automatically + * @param string $type "pre", "output", … specify + * the filter type to set. + * Defaults to none treating + * $filters' keys as the + * appropriate types * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -68,4 +69,4 @@ class Smarty_Internal_Method_SetAutoloadFilters throw new SmartyException("Illegal filter type '{$type}'"); } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_setdebugtemplate.php b/libs/sysplugins/smarty_internal_method_setdebugtemplate.php index 76c87deb..cc9d23e2 100644 --- a/libs/sysplugins/smarty_internal_method_setdebugtemplate.php +++ b/libs/sysplugins/smarty_internal_method_setdebugtemplate.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_SetDebugTemplate * @api Smarty::setDebugTemplate() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $tpl_name + * @param string $tpl_name * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException if file is not readable @@ -38,4 +38,4 @@ class Smarty_Internal_Method_SetDebugTemplate $smarty->debug_tpl = $tpl_name; return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php b/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php index 81434b96..431e6381 100644 --- a/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php +++ b/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_SetDefaultModifiers * @api Smarty::setDefaultModifiers() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array|string $modifiers modifier or list of modifiers + * @param array|string $modifiers modifier or list of modifiers * to set * * @return \Smarty|\Smarty_Internal_Template @@ -35,4 +35,4 @@ class Smarty_Internal_Method_SetDefaultModifiers $smarty->default_modifiers = (array) $modifiers; return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_unloadfilter.php b/libs/sysplugins/smarty_internal_method_unloadfilter.php index 1a5fdf19..1a858207 100644 --- a/libs/sysplugins/smarty_internal_method_unloadfilter.php +++ b/libs/sysplugins/smarty_internal_method_unloadfilter.php @@ -14,13 +14,13 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil /** * load a filter of specified type and name * - * @api Smarty::unloadFilter() + * @api Smarty::unloadFilter() * * @link http://www.smarty.net/docs/en/api.unload.filter.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type filter type - * @param string $name filter name + * @param string $type filter type + * @param string $name filter name * * @return Smarty_Internal_TemplateBase * @throws \SmartyException @@ -32,7 +32,7 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil if (isset($smarty->registered_filters[ $type ])) { $_filter_name = "smarty_{$type}filter_{$name}"; if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) { - unset ($smarty->registered_filters[ $type ][ $_filter_name ]); + unset($smarty->registered_filters[ $type ][ $_filter_name ]); if (empty($smarty->registered_filters[ $type ])) { unset($smarty->registered_filters[ $type ]); } @@ -40,4 +40,4 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_unregistercacheresource.php b/libs/sysplugins/smarty_internal_method_unregistercacheresource.php index 1a157ffb..65c0cf73 100644 --- a/libs/sysplugins/smarty_internal_method_unregistercacheresource.php +++ b/libs/sysplugins/smarty_internal_method_unregistercacheresource.php @@ -21,11 +21,11 @@ class Smarty_Internal_Method_UnregisterCacheResource /** * Registers a resource to fetch a template * - * @api Smarty::unregisterCacheResource() - * @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl + * @api Smarty::unregisterCacheResource() + * @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param $name + * @param $name * * @return \Smarty|\Smarty_Internal_Template */ @@ -37,4 +37,4 @@ class Smarty_Internal_Method_UnregisterCacheResource } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_unregisterfilter.php b/libs/sysplugins/smarty_internal_method_unregisterfilter.php index fcc4e5d8..bf72999f 100644 --- a/libs/sysplugins/smarty_internal_method_unregisterfilter.php +++ b/libs/sysplugins/smarty_internal_method_unregisterfilter.php @@ -14,13 +14,13 @@ class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_Reg /** * Unregisters a filter function * - * @api Smarty::unregisterFilter() + * @api Smarty::unregisterFilter() * * @link http://www.smarty.net/docs/en/api.unregister.filter.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type filter type - * @param callback|string $callback + * @param string $type filter type + * @param callback|string $callback * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -40,4 +40,4 @@ class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_Reg } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_unregisterobject.php b/libs/sysplugins/smarty_internal_method_unregisterobject.php index 76d48661..1e592b33 100644 --- a/libs/sysplugins/smarty_internal_method_unregisterobject.php +++ b/libs/sysplugins/smarty_internal_method_unregisterobject.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_UnregisterObject * @link http://www.smarty.net/docs/en/api.unregister.object.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $object_name name of object + * @param string $object_name name of object * * @return \Smarty|\Smarty_Internal_Template */ @@ -37,4 +37,4 @@ class Smarty_Internal_Method_UnregisterObject } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_unregisterplugin.php b/libs/sysplugins/smarty_internal_method_unregisterplugin.php index b5f0d505..f39e3167 100644 --- a/libs/sysplugins/smarty_internal_method_unregisterplugin.php +++ b/libs/sysplugins/smarty_internal_method_unregisterplugin.php @@ -25,8 +25,8 @@ class Smarty_Internal_Method_UnregisterPlugin * @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type plugin type - * @param string $name name of template tag + * @param string $type plugin type + * @param string $name name of template tag * * @return \Smarty|\Smarty_Internal_Template */ @@ -38,4 +38,4 @@ class Smarty_Internal_Method_UnregisterPlugin } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_method_unregisterresource.php b/libs/sysplugins/smarty_internal_method_unregisterresource.php index ed4801d4..a79db429 100644 --- a/libs/sysplugins/smarty_internal_method_unregisterresource.php +++ b/libs/sysplugins/smarty_internal_method_unregisterresource.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_UnregisterResource * @link http://www.smarty.net/docs/en/api.unregister.resource.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type name of resource type + * @param string $type name of resource type * * @return \Smarty|\Smarty_Internal_Template */ @@ -37,4 +37,4 @@ class Smarty_Internal_Method_UnregisterResource } return $obj; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_nocache_insert.php b/libs/sysplugins/smarty_internal_nocache_insert.php index 2629d51f..b0dba5fc 100644 --- a/libs/sysplugins/smarty_internal_nocache_insert.php +++ b/libs/sysplugins/smarty_internal_nocache_insert.php @@ -19,11 +19,11 @@ class Smarty_Internal_Nocache_Insert /** * Compiles code for the {insert} tag into cache file * - * @param string $_function insert function name - * @param array $_attr array with parameter - * @param Smarty_Internal_Template $_template template object - * @param string $_script script name to load or 'null' - * @param string $_assign optional variable name + * @param string $_function insert function name + * @param array $_attr array with parameter + * @param Smarty_Internal_Template $_template template object + * @param string $_script script name to load or 'null' + * @param string $_assign optional variable name * * @return string compiled code */ diff --git a/libs/sysplugins/smarty_internal_parsetree_dq.php b/libs/sysplugins/smarty_internal_parsetree_dq.php index a57e629c..499ea154 100644 --- a/libs/sysplugins/smarty_internal_parsetree_dq.php +++ b/libs/sysplugins/smarty_internal_parsetree_dq.php @@ -40,17 +40,21 @@ class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree) { $last_subtree = count($this->subtrees) - 1; - if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag && - $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level + if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag + && $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level ) { if ($subtree instanceof Smarty_Internal_ParseTree_Code) { $this->subtrees[ $last_subtree ]->data = - $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, - '<?php echo ' . $subtree->data . ';?>'); + $parser->compiler->appendCode( + $this->subtrees[ $last_subtree ]->data, + '<?php echo ' . $subtree->data . ';?>' + ); } elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) { $this->subtrees[ $last_subtree ]->data = - $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, - '<?php echo "' . $subtree->data . '";?>'); + $parser->compiler->appendCode( + $this->subtrees[ $last_subtree ]->data, + '<?php echo "' . $subtree->data . '";?>' + ); } else { $this->subtrees[ $last_subtree ]->data = $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data); diff --git a/libs/sysplugins/smarty_internal_parsetree_template.php b/libs/sysplugins/smarty_internal_parsetree_template.php index 26612d4c..a9101f4c 100644 --- a/libs/sysplugins/smarty_internal_parsetree_template.php +++ b/libs/sysplugins/smarty_internal_parsetree_template.php @@ -28,7 +28,6 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree /** * Create root of parse tree for template elements - * */ public function __construct() { @@ -101,8 +100,10 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree if ($subtree === '') { continue; } - $code .= preg_replace('/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "<?php echo '\$1'; ?>\n", - $subtree); + $code .= preg_replace( + '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "<?php echo '\$1'; ?>\n", + $subtree + ); continue; } if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) { diff --git a/libs/sysplugins/smarty_internal_resource_eval.php b/libs/sysplugins/smarty_internal_resource_eval.php index d3088bdd..ac12f223 100644 --- a/libs/sysplugins/smarty_internal_resource_eval.php +++ b/libs/sysplugins/smarty_internal_resource_eval.php @@ -21,8 +21,8 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled /** * populate Source Object with meta data from Resource * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -37,7 +37,7 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled * * @uses decode() to decode base64 and urlencoded template_resources * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source */ @@ -49,7 +49,7 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled /** * decode base64 and urlencode * - * @param string $string template_resource to decode + * @param string $string template_resource to decode * * @return string decoded template_resource */ @@ -70,9 +70,9 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled /** * modify resource_name according to resource handlers specifications * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource * * @return string unique resource name */ @@ -84,7 +84,7 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ diff --git a/libs/sysplugins/smarty_internal_resource_file.php b/libs/sysplugins/smarty_internal_resource_file.php index 9dcda7fc..7e13b392 100644 --- a/libs/sysplugins/smarty_internal_resource_file.php +++ b/libs/sysplugins/smarty_internal_resource_file.php @@ -20,8 +20,8 @@ class Smarty_Internal_Resource_File extends Smarty_Resource /** * build template filepath by traversing the template_dir array * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return string fully qualified filepath * @throws SmartyException @@ -35,11 +35,11 @@ class Smarty_Internal_Resource_File extends Smarty_Resource return is_file($file) ? $file : false; } // go relative to a given template? - if ($file[ 0 ] === '.' && $_template && $_template->_isSubTpl() && - preg_match('#^[.]{1,2}[\\\/]#', $file) + if ($file[ 0 ] === '.' && $_template && $_template->_isSubTpl() + && preg_match('#^[.]{1,2}[\\\/]#', $file) ) { - if ($_template->parent->source->type !== 'file' && $_template->parent->source->type !== 'extends' && - !isset($_template->parent->_cache[ 'allow_relative_path' ]) + if ($_template->parent->source->type !== 'file' && $_template->parent->source->type !== 'extends' + && !isset($_template->parent->_cache[ 'allow_relative_path' ]) ) { throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'"); } @@ -124,8 +124,10 @@ class Smarty_Internal_Resource_File extends Smarty_Resource $source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig); } $source->exists = true; - $source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir : - $source->smarty->_joined_template_dir)); + $source->uid = sha1( + $source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir : + $source->smarty->_joined_template_dir) + ); $source->timestamp = filemtime($source->filepath); } else { $source->timestamp = $source->exists = false; @@ -150,7 +152,7 @@ class Smarty_Internal_Resource_File extends Smarty_Resource /** * Load template's source from file into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -160,14 +162,16 @@ class Smarty_Internal_Resource_File extends Smarty_Resource if ($source->exists) { return file_get_contents($source->filepath); } - throw new SmartyException('Unable to read ' . ($source->isConfig ? 'config' : 'template') . - " {$source->type} '{$source->name}'"); + throw new SmartyException( + 'Unable to read ' . ($source->isConfig ? 'config' : 'template') . + " {$source->type} '{$source->name}'" + ); } /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ diff --git a/libs/sysplugins/smarty_internal_resource_php.php b/libs/sysplugins/smarty_internal_resource_php.php index 6f685abe..88bbc26c 100644 --- a/libs/sysplugins/smarty_internal_resource_php.php +++ b/libs/sysplugins/smarty_internal_resource_php.php @@ -43,7 +43,7 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File /** * Load template's source from file into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -76,8 +76,8 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File /** * Render and output the template (without using the compiler) * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @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 @@ -88,8 +88,10 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File 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}'" : '')); + throw new SmartyException( + "Unable to load template '{$source->type}:{$source->name}'" . + ($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : '') + ); } // prepare variables @@ -99,11 +101,14 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File if (function_exists('ini_set')) { ini_set('short_open_tag', '1'); } - /** @var Smarty_Internal_Template $_smarty_template + /** +* + * + * @var Smarty_Internal_Template $_smarty_template * used in included file */ $_smarty_template = $_template; - include($source->filepath); + include $source->filepath; if (function_exists('ini_set')) { ini_set('short_open_tag', $this->short_open_tag); } diff --git a/libs/sysplugins/smarty_internal_resource_registered.php b/libs/sysplugins/smarty_internal_resource_registered.php index 8535257a..e7bb8add 100644 --- a/libs/sysplugins/smarty_internal_resource_registered.php +++ b/libs/sysplugins/smarty_internal_resource_registered.php @@ -21,8 +21,8 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource /** * populate Source Object with meta data from Resource * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -37,7 +37,7 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource /** * populate Source Object with timestamp and exists from Resource * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return void */ @@ -50,7 +50,7 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource /** * Get timestamp (epoch) the template source was modified * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return integer|boolean timestamp (epoch) the template was modified, false if resources has no timestamp */ @@ -58,8 +58,10 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource { // return timestamp $time_stamp = false; - call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ], - array($source->name, &$time_stamp, $source->smarty)); + call_user_func_array( + $source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ], + array($source->name, &$time_stamp, $source->smarty) + ); return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp; } @@ -67,7 +69,7 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource /** * Load template's source by invoking the registered callback into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -76,8 +78,10 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource { // return template string $content = null; - $t = call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ], - array($source->name, &$content, $source->smarty)); + $t = call_user_func_array( + $source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ], + array($source->name, &$content, $source->smarty) + ); if (is_bool($t) && !$t) { throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); } @@ -88,7 +92,7 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ diff --git a/libs/sysplugins/smarty_internal_resource_stream.php b/libs/sysplugins/smarty_internal_resource_stream.php index f358db01..95d766f7 100644 --- a/libs/sysplugins/smarty_internal_resource_stream.php +++ b/libs/sysplugins/smarty_internal_resource_stream.php @@ -68,9 +68,9 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled /** * modify resource_name according to resource handlers specifications * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource * * @return string unique resource name */ diff --git a/libs/sysplugins/smarty_internal_resource_string.php b/libs/sysplugins/smarty_internal_resource_string.php index 0175d518..5537e5c2 100644 --- a/libs/sysplugins/smarty_internal_resource_string.php +++ b/libs/sysplugins/smarty_internal_resource_string.php @@ -21,8 +21,8 @@ class Smarty_Internal_Resource_String extends Smarty_Resource /** * populate Source Object with meta data from Resource * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -37,7 +37,7 @@ class Smarty_Internal_Resource_String extends Smarty_Resource * * @uses decode() to decode base64 and urlencoded template_resources * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source */ @@ -49,7 +49,7 @@ class Smarty_Internal_Resource_String extends Smarty_Resource /** * decode base64 and urlencode * - * @param string $string template_resource to decode + * @param string $string template_resource to decode * * @return string decoded template_resource */ @@ -70,9 +70,9 @@ class Smarty_Internal_Resource_String extends Smarty_Resource /** * modify resource_name according to resource handlers specifications * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource * * @return string unique resource name */ @@ -85,7 +85,7 @@ class Smarty_Internal_Resource_String extends Smarty_Resource * Determine basename for compiled filename * Always returns an empty string. * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ diff --git a/libs/sysplugins/smarty_internal_runtime_cachemodify.php b/libs/sysplugins/smarty_internal_runtime_cachemodify.php index dfbf7115..c55eaaaf 100644 --- a/libs/sysplugins/smarty_internal_runtime_cachemodify.php +++ b/libs/sysplugins/smarty_internal_runtime_cachemodify.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_CacheModify { @@ -15,7 +14,7 @@ class Smarty_Internal_Runtime_CacheModify * * @param \Smarty_Template_Cached $cached * @param \Smarty_Internal_Template $_template - * @param string $content + * @param string $content * * @throws \Exception * @throws \SmartyException @@ -27,43 +26,43 @@ class Smarty_Internal_Runtime_CacheModify @substr($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ], 0, strpos($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ], 'GMT') + 3); if ($_isCached && $cached->timestamp <= strtotime($_last_modified_date)) { switch (PHP_SAPI) { - case 'cgi': // php-cgi < 5.3 - case 'cgi-fcgi': // php-cgi >= 5.3 - case 'fpm-fcgi': // php-fpm >= 5.3.3 - header('Status: 304 Not Modified'); - break; + case 'cgi': // php-cgi < 5.3 + case 'cgi-fcgi': // php-cgi >= 5.3 + case 'fpm-fcgi': // php-fpm >= 5.3.3 + header('Status: 304 Not Modified'); + break; - case 'cli': - if ( /* ^phpunit */ + case 'cli': + if (/* ^phpunit */ !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ - ) { - $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified'; - } - break; + ) { + $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified'; + } + break; - default: - if ( /* ^phpunit */ + default: + if (/* ^phpunit */ !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ - ) { - $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified'; - } else { - header($_SERVER[ 'SERVER_PROTOCOL' ] . ' 304 Not Modified'); - } - break; + ) { + $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified'; + } else { + header($_SERVER[ 'SERVER_PROTOCOL' ] . ' 304 Not Modified'); + } + break; } } else { switch (PHP_SAPI) { - case 'cli': - if ( /* ^phpunit */ + case 'cli': + if (/* ^phpunit */ !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ - ) { - $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = - 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT'; - } - break; - default: - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT'); - break; + ) { + $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = + 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT'; + } + break; + default: + header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT'); + break; } echo $content; } diff --git a/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php b/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php index a9ff5789..aa8f5390 100644 --- a/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php +++ b/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php @@ -88,8 +88,8 @@ class Smarty_Internal_Runtime_CacheResourceFile } } // check compile id - if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) || - $_parts[ $_parts_count - 2 - $_compile_id_offset ] !== $_compile_id) + if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) + || $_parts[ $_parts_count - 2 - $_compile_id_offset ] !== $_compile_id) ) { continue; } @@ -135,4 +135,4 @@ class Smarty_Internal_Runtime_CacheResourceFile } return $_count; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_runtime_capture.php b/libs/sysplugins/smarty_internal_runtime_capture.php index 80ffa35b..cb31c38d 100644 --- a/libs/sysplugins/smarty_internal_runtime_capture.php +++ b/libs/sysplugins/smarty_internal_runtime_capture.php @@ -55,9 +55,9 @@ class Smarty_Internal_Runtime_Capture * Open capture section * * @param \Smarty_Internal_Template $_template - * @param string $buffer capture name - * @param string $assign variable name - * @param string $append variable name + * @param string $buffer capture name + * @param string $assign variable name + * @param string $append variable name */ public function open(Smarty_Internal_Template $_template, $buffer, $assign, $append) { @@ -137,7 +137,7 @@ class Smarty_Internal_Runtime_Capture * Return content of named capture buffer by key or as array * * @param \Smarty_Internal_Template $_template - * @param string|null $name + * @param string|null $name * * @return string|string[]|null */ @@ -166,4 +166,4 @@ class Smarty_Internal_Runtime_Capture } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_runtime_codeframe.php b/libs/sysplugins/smarty_internal_runtime_codeframe.php index 80a50eb8..9fd557cb 100644 --- a/libs/sysplugins/smarty_internal_runtime_codeframe.php +++ b/libs/sysplugins/smarty_internal_runtime_codeframe.php @@ -26,8 +26,8 @@ class Smarty_Internal_Runtime_CodeFrame * @return string */ public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false, - Smarty_Internal_TemplateCompilerBase $compiler = null) - { + Smarty_Internal_TemplateCompilerBase $compiler = null + ) { // build property code $properties[ 'version' ] = Smarty::SMARTY_VERSION; $properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true)); @@ -35,14 +35,14 @@ class Smarty_Internal_Runtime_CodeFrame $properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code; $properties[ 'file_dependency' ] = $_template->compiled->file_dependency; $properties[ 'includes' ] = $_template->compiled->includes; - } else { + } else { $properties[ 'has_nocache_code' ] = $_template->cached->has_nocache_code; $properties[ 'file_dependency' ] = $_template->cached->file_dependency; $properties[ 'cache_lifetime' ] = $_template->cache_lifetime; } $output = "<?php\n"; $output .= "/* Smarty version {$properties[ 'version' ]}, created on " . strftime("%Y-%m-%d %H:%M:%S") . - "\n from '" . str_replace('*/','* /',$_template->source->filepath) . "' */\n\n"; + "\n from '" . str_replace('*/', '* /', $_template->source->filepath) . "' */\n\n"; $output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n"; $dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ')'; @@ -65,11 +65,15 @@ class Smarty_Internal_Runtime_CodeFrame $output .= "<?php }\n"; // remove unneeded PHP tags if (preg_match('/\s*\?>[\n]?<\?php\s*/', $output)) { - $curr_split = preg_split('/\s*\?>[\n]?<\?php\s*/', - $output); - preg_match_all('/\s*\?>[\n]?<\?php\s*/', - $output, - $curr_parts); + $curr_split = preg_split( + '/\s*\?>[\n]?<\?php\s*/', + $output + ); + preg_match_all( + '/\s*\?>[\n]?<\?php\s*/', + $output, + $curr_parts + ); $output = ''; foreach ($curr_split as $idx => $curr_output) { $output .= $curr_output; @@ -79,8 +83,10 @@ class Smarty_Internal_Runtime_CodeFrame } } if (preg_match('/\?>\s*$/', $output)) { - $curr_split = preg_split('/\?>\s*$/', - $output); + $curr_split = preg_split( + '/\?>\s*$/', + $output + ); $output = ''; foreach ($curr_split as $idx => $curr_output) { $output .= $curr_output; @@ -88,4 +94,4 @@ class Smarty_Internal_Runtime_CodeFrame } return $output; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_runtime_filterhandler.php b/libs/sysplugins/smarty_internal_runtime_filterhandler.php index 9d7d2db2..5377e44b 100644 --- a/libs/sysplugins/smarty_internal_runtime_filterhandler.php +++ b/libs/sysplugins/smarty_internal_runtime_filterhandler.php @@ -23,9 +23,9 @@ class Smarty_Internal_Runtime_FilterHandler * plugin filename format: filtertype.filtername.php * Smarty2 filter plugins could be used * - * @param string $type the type of filter ('pre','post','output') which shall run - * @param string $content the content which shall be processed by the filters - * @param Smarty_Internal_Template $template template object + * @param string $type the type of filter ('pre','post','output') which shall run + * @param string $content the content which shall be processed by the filters + * @param Smarty_Internal_Template $template template object * * @throws SmartyException * @return string the filtered content diff --git a/libs/sysplugins/smarty_internal_runtime_foreach.php b/libs/sysplugins/smarty_internal_runtime_foreach.php index 4fa29d5b..ec5fb1ce 100644 --- a/libs/sysplugins/smarty_internal_runtime_foreach.php +++ b/libs/sysplugins/smarty_internal_runtime_foreach.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * */ class Smarty_Internal_Runtime_Foreach { @@ -35,8 +34,8 @@ class Smarty_Internal_Runtime_Foreach * @return mixed $from */ public function init(Smarty_Internal_Template $tpl, $from, $item, $needTotal = false, $key = null, $name = null, - $properties = array()) - { + $properties = array() + ) { $needTotal = $needTotal || isset($properties[ 'total' ]); $saveVars = array(); $total = null; @@ -97,10 +96,9 @@ class Smarty_Internal_Runtime_Foreach } /** - * * [util function] counts an array, arrayAccess/traversable or PDOStatement object * - * @param mixed $value + * @param mixed $value * * @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0 * for empty elements diff --git a/libs/sysplugins/smarty_internal_runtime_getincludepath.php b/libs/sysplugins/smarty_internal_runtime_getincludepath.php index 54b1bb3d..e550f580 100644 --- a/libs/sysplugins/smarty_internal_runtime_getincludepath.php +++ b/libs/sysplugins/smarty_internal_runtime_getincludepath.php @@ -104,18 +104,16 @@ class Smarty_Internal_Runtime_GetIncludePath /** * Return full file path from PHP include_path * - * @param string[] $dirs - * @param string $file - * @param \Smarty $smarty + * @param string[] $dirs + * @param string $file + * @param \Smarty $smarty * * @return bool|string full filepath or false - * */ public function getIncludePath($dirs, $file, Smarty $smarty) { //if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = false)) { - if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : - $this->_has_stream_include = function_exists('stream_resolve_include_path')) + if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = function_exists('stream_resolve_include_path')) ) { $this->isNewIncludePath($smarty); } diff --git a/libs/sysplugins/smarty_internal_runtime_inheritance.php b/libs/sysplugins/smarty_internal_runtime_inheritance.php index b593b78e..c7eb7ff1 100644 --- a/libs/sysplugins/smarty_internal_runtime_inheritance.php +++ b/libs/sysplugins/smarty_internal_runtime_inheritance.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_Inheritance { @@ -64,7 +63,6 @@ class Smarty_Internal_Runtime_Inheritance * @param \Smarty_Internal_Template $tpl template object of caller * @param bool $initChild if true init for child template * @param array $blockNames outer level block name - * */ public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array()) { @@ -113,18 +111,21 @@ class Smarty_Internal_Runtime_Inheritance ob_end_clean(); $this->state = 2; } - if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends') || - $tpl->smarty->extends_recursion)) { - $tpl->_subTemplateRender($template, - $tpl->cache_id, - $tpl->compile_id, - $tpl->caching ? 9999 : 0, - $tpl->cache_lifetime, - array(), - 2, - false, - $uid, - $func); + if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends') + || $tpl->smarty->extends_recursion) + ) { + $tpl->_subTemplateRender( + $template, + $tpl->cache_id, + $tpl->compile_id, + $tpl->caching ? 9999 : 0, + $tpl->cache_lifetime, + array(), + 2, + false, + $uid, + $func + ); } } @@ -134,7 +135,7 @@ class Smarty_Internal_Runtime_Inheritance * - otherwise process inheritance and render * * @param \Smarty_Internal_Template $tpl - * @param $className + * @param $className * @param string $name * @param int|null $tplIndex index of outer level {block} if nested * @@ -167,8 +168,8 @@ class Smarty_Internal_Runtime_Inheritance * @throws \SmartyException */ public function process(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block, - Smarty_Internal_Block $parent = null) - { + Smarty_Internal_Block $parent = null + ) { if ($block->hide && !isset($block->child)) { return; } @@ -187,8 +188,8 @@ class Smarty_Internal_Runtime_Inheritance if ($block->prepend && isset($parent)) { $this->callParent($tpl, $block, '{block prepend}'); if ($block->append) { - if ($block->callsChild || !isset($block->child) || - ($block->child->hide && !isset($block->child->child)) + if ($block->callsChild || !isset($block->child) + || ($block->child->hide && !isset($block->child->child)) ) { $this->callBlock($block, $tpl); } else { diff --git a/libs/sysplugins/smarty_internal_runtime_make_nocache.php b/libs/sysplugins/smarty_internal_runtime_make_nocache.php index 65382772..0f55a65a 100644 --- a/libs/sysplugins/smarty_internal_runtime_make_nocache.php +++ b/libs/sysplugins/smarty_internal_runtime_make_nocache.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * */ class Smarty_Internal_Runtime_Make_Nocache { @@ -38,8 +37,8 @@ class Smarty_Internal_Runtime_Make_Nocache * Store variable value saved while rendering compiled template in cached template context * * @param \Smarty_Internal_Template $tpl - * @param string $var variable name - * @param array $properties + * @param string $var variable name + * @param array $properties */ public function store(Smarty_Internal_Template $tpl, $var, $properties) { diff --git a/libs/sysplugins/smarty_internal_runtime_tplfunction.php b/libs/sysplugins/smarty_internal_runtime_tplfunction.php index b86563cb..d963653c 100644 --- a/libs/sysplugins/smarty_internal_runtime_tplfunction.php +++ b/libs/sysplugins/smarty_internal_runtime_tplfunction.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_TplFunction { @@ -36,14 +35,14 @@ class Smarty_Internal_Runtime_TplFunction } if (function_exists($function)) { $this->saveTemplateVariables($tpl, $name); - $function ($tpl, $params); + $function($tpl, $params); $this->restoreTemplateVariables($tpl, $name); return; } // try to load template function dynamically if ($this->addTplFuncToCache($tpl, $name, $function)) { $this->saveTemplateVariables($tpl, $name); - $function ($tpl, $params); + $function($tpl, $params); $this->restoreTemplateVariables($tpl, $name); return; } @@ -55,7 +54,7 @@ class Smarty_Internal_Runtime_TplFunction * Register template functions defined by template * * @param \Smarty|\Smarty_Internal_Template|\Smarty_Internal_TemplateBase $obj - * @param array $tplFunctions source information array of template functions defined in template + * @param array $tplFunctions source information array of template functions defined in template * @param bool $override if true replace existing functions with same name */ public function registerTplFunctions(Smarty_Internal_TemplateBase $obj, $tplFunctions, $override = true) @@ -90,7 +89,6 @@ class Smarty_Internal_Runtime_TplFunction } /** - * * Add template function to cache file for nocache calls * * @param Smarty_Internal_Template $tpl @@ -126,11 +124,15 @@ class Smarty_Internal_Runtime_TplFunction if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) { $content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content); } - $tplPtr->smarty->ext->_updateCache->write($tplPtr, - preg_replace('/\s*\?>\s*$/', "\n", $content) . - "\n" . preg_replace(array('/^\s*<\?php\s+/', + $tplPtr->smarty->ext->_updateCache->write( + $tplPtr, + preg_replace('/\s*\?>\s*$/', "\n", $content) . + "\n" . preg_replace( + array('/^\s*<\?php\s+/', '/\s*\?>\s*$/',), "\n", - $match[ 0 ])); + $match[ 0 ] + ) + ); } } return true; @@ -144,7 +146,7 @@ class Smarty_Internal_Runtime_TplFunction * Save current template variables on stack * * @param \Smarty_Internal_Template $tpl - * @param string $name stack name + * @param string $name stack name */ public function saveTemplateVariables(Smarty_Internal_Template $tpl, $name) { @@ -156,7 +158,7 @@ class Smarty_Internal_Runtime_TplFunction * Restore saved variables into template objects * * @param \Smarty_Internal_Template $tpl - * @param string $name stack name + * @param string $name stack name */ public function restoreTemplateVariables(Smarty_Internal_Template $tpl, $name) { diff --git a/libs/sysplugins/smarty_internal_runtime_updatecache.php b/libs/sysplugins/smarty_internal_runtime_updatecache.php index bb3e4e13..229b3e2d 100644 --- a/libs/sysplugins/smarty_internal_runtime_updatecache.php +++ b/libs/sysplugins/smarty_internal_runtime_updatecache.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_UpdateCache { @@ -15,7 +14,7 @@ class Smarty_Internal_Runtime_UpdateCache * * @param \Smarty_Template_Cached $cached * @param Smarty_Internal_Template $_template - * @param string $content + * @param string $content */ public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content) { @@ -26,7 +25,7 @@ class Smarty_Internal_Runtime_UpdateCache * * @param \Smarty_Template_Cached $cached * @param \Smarty_Internal_Template $_template - * @param $no_output_filter + * @param $no_output_filter * * @throws \Exception */ @@ -66,9 +65,9 @@ class Smarty_Internal_Runtime_UpdateCache * @throws \SmartyException */ public function removeNoCacheHash(Smarty_Template_Cached $cached, - Smarty_Internal_Template $_template, - $no_output_filter) - { + Smarty_Internal_Template $_template, + $no_output_filter + ) { $php_pattern = '/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/'; $content = ob_get_clean(); $hash_array = $cached->hashes; @@ -78,22 +77,30 @@ class Smarty_Internal_Runtime_UpdateCache $_template->cached->has_nocache_code = false; // get text between non-cached items $cache_split = - preg_split("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", - $content); + preg_split( + "!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", + $content + ); // get non-cached items - preg_match_all("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", - $content, - $cache_parts); + preg_match_all( + "!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", + $content, + $cache_parts + ); $content = ''; // loop over items, stitch back together foreach ($cache_split as $curr_idx => $curr_split) { if (preg_match($php_pattern, $curr_split)) { // escape PHP tags in template content - $php_split = preg_split($php_pattern, - $curr_split); - preg_match_all($php_pattern, - $curr_split, - $php_parts); + $php_split = preg_split( + $php_pattern, + $curr_split + ); + preg_match_all( + $php_pattern, + $curr_split, + $php_parts + ); foreach ($php_split as $idx_php => $curr_php) { $content .= $curr_php; if (isset($php_parts[ 0 ][ $idx_php ])) { @@ -108,9 +115,9 @@ class Smarty_Internal_Runtime_UpdateCache $content .= $cache_parts[ 2 ][ $curr_idx ]; } } - if (!$no_output_filter && !$_template->cached->has_nocache_code && - (isset($_template->smarty->autoload_filters[ 'output' ]) || - isset($_template->smarty->registered_filters[ 'output' ])) + if (!$no_output_filter && !$_template->cached->has_nocache_code + && (isset($_template->smarty->autoload_filters[ 'output' ]) + || isset($_template->smarty->registered_filters[ 'output' ])) ) { $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template); } @@ -174,4 +181,4 @@ class Smarty_Internal_Runtime_UpdateCache return false; } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_internal_runtime_updatescope.php b/libs/sysplugins/smarty_internal_runtime_updatescope.php index 2d62c60b..d28872e1 100644 --- a/libs/sysplugins/smarty_internal_runtime_updatescope.php +++ b/libs/sysplugins/smarty_internal_runtime_updatescope.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_UpdateScope { @@ -14,17 +13,17 @@ class Smarty_Internal_Runtime_UpdateScope /** * Update new assigned template or config variable in other effected scopes * - * @param Smarty_Internal_Template $tpl data object - * @param string|null $varName variable name - * @param int $tagScope tag scope to which bubble up variable value - * + * @param Smarty_Internal_Template $tpl data object + * @param string|null $varName variable name + * @param int $tagScope tag scope to which bubble up variable value */ public function _updateScope(Smarty_Internal_Template $tpl, $varName, $tagScope = 0) { if ($tagScope) { $this->_updateVarStack($tpl, $varName); $tagScope = $tagScope & ~Smarty::SCOPE_LOCAL; - if (!$tpl->scope && !$tagScope) return; + if (!$tpl->scope && !$tagScope) { return; + } } $mergedScope = $tagScope | $tpl->scope; if ($mergedScope) { @@ -35,7 +34,8 @@ class Smarty_Internal_Runtime_UpdateScope foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) { $this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName); if($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) { - $this->_updateVarStack($ptr, $varName); } + $this->_updateVarStack($ptr, $varName); + } } } } @@ -84,9 +84,9 @@ class Smarty_Internal_Runtime_UpdateScope /** * Update variable in other scope * - * @param array $tpl_vars template variable array + * @param array $tpl_vars template variable array * @param \Smarty_Internal_Template $from - * @param string $varName variable name + * @param string $varName variable name */ public function _updateVariableInOtherScope(&$tpl_vars, Smarty_Internal_Template $from, $varName) { diff --git a/libs/sysplugins/smarty_internal_runtime_writefile.php b/libs/sysplugins/smarty_internal_runtime_writefile.php index dc9019f4..28c977b8 100644 --- a/libs/sysplugins/smarty_internal_runtime_writefile.php +++ b/libs/sysplugins/smarty_internal_runtime_writefile.php @@ -17,9 +17,9 @@ class Smarty_Internal_Runtime_WriteFile /** * Writes file in a safe way to disk * - * @param string $_filepath complete filepath - * @param string $_contents file content - * @param Smarty $smarty smarty instance + * @param string $_filepath complete filepath + * @param string $_contents file content + * @param Smarty $smarty smarty instance * * @throws SmartyException * @return boolean true diff --git a/libs/sysplugins/smarty_internal_smartytemplatecompiler.php b/libs/sysplugins/smarty_internal_smartytemplatecompiler.php index bdf74065..a99d6f6d 100644 --- a/libs/sysplugins/smarty_internal_smartytemplatecompiler.php +++ b/libs/sysplugins/smarty_internal_smartytemplatecompiler.php @@ -76,8 +76,8 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom /** * method to compile a Smarty template * - * @param mixed $_content template source - * @param bool $isTemplateSource + * @param mixed $_content template source + * @param bool $isTemplateSource * * @return bool true if compiling succeeded, false if it failed * @throws \SmartyCompilerException @@ -89,9 +89,15 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom then written to compiled files. */ // init the lexer/parser to compile the template $this->parser = - new $this->parser_class(new $this->lexer_class(str_replace(array("\r\n", - "\r"), "\n", $_content), $this), - $this); + new $this->parser_class( + new $this->lexer_class( + str_replace( + array("\r\n", + "\r"), "\n", $_content + ), $this + ), + $this + ); if ($isTemplateSource && $this->template->caching) { $this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n"); } @@ -127,8 +133,10 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom if (count($this->_tag_stack) > 0) { // get stacked info list($openTag, $_data) = array_pop($this->_tag_stack); - $this->trigger_template_error("unclosed {$this->smarty->left_delimiter}" . $openTag . - "{$this->smarty->right_delimiter} tag"); + $this->trigger_template_error( + "unclosed {$this->smarty->left_delimiter}" . $openTag . + "{$this->smarty->right_delimiter} tag" + ); } // call post compile callbacks foreach ($this->postCompileCallbacks as $cb) { @@ -148,7 +156,6 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom * @param array $parameter optional parameter array * @param string $key optional key for callback * @param bool $replace if true replace existing keyed callback - * */ public function registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false) { diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 21f60f99..982301c9 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -144,9 +144,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * @throws \SmartyException */ public function __construct($template_resource, Smarty $smarty, Smarty_Internal_Data $_parent = null, - $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null, - $_isConfig = false) - { + $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null, + $_isConfig = false + ) { $this->smarty = $smarty; // Smarty parameter $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id; @@ -167,8 +167,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * render template * - * @param bool $no_output_filter if true do not run output filter - * @param null|bool $display true: display, false: fetch null: sub-template + * @param bool $no_output_filter if true do not run output filter + * @param null|bool $display true: display, false: fetch null: sub-template * * @return string * @throws \Exception @@ -184,8 +184,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } // checks if template exists if (!$this->source->exists) { - throw new SmartyException("Unable to load template '{$this->source->type}:{$this->source->name}'" . - ($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : '')); + throw new SmartyException( + "Unable to load template '{$this->source->type}:{$this->source->name}'" . + ($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : '') + ); } // disable caching for evaluated code if ($this->source->handler->recompiled) { @@ -193,8 +195,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } // read from cache or render if ($this->caching === Smarty::CACHING_LIFETIME_CURRENT || $this->caching === Smarty::CACHING_LIFETIME_SAVED) { - if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id || - $this->cached->compile_id !== $this->compile_id + if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id + || $this->cached->compile_id !== $this->compile_id ) { $this->loadCached(true); } @@ -209,12 +211,14 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase // display or fetch if ($display) { if ($this->caching && $this->smarty->cache_modified_check) { - $this->smarty->ext->_cacheModify->cacheModifiedCheck($this->cached, $this, - isset($content) ? $content : ob_get_clean()); + $this->smarty->ext->_cacheModify->cacheModifiedCheck( + $this->cached, $this, + isset($content) ? $content : ob_get_clean() + ); } else { - if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && - !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ]) || - isset($this->smarty->registered_filters[ 'output' ])) + if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) + && !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ]) + || isset($this->smarty->registered_filters[ 'output' ])) ) { echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this); } else { @@ -234,10 +238,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $this->smarty->_debug->display_debug($this, true); } } - if (!$no_output_filter && - (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && - (isset($this->smarty->autoload_filters[ 'output' ]) || - isset($this->smarty->registered_filters[ 'output' ])) + if (!$no_output_filter + && (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) + && (isset($this->smarty->autoload_filters[ 'output' ]) + || isset($this->smarty->registered_filters[ 'output' ])) ) { return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this); } @@ -264,8 +268,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * @throws \SmartyException */ public function _subTemplateRender($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $scope, - $forceTplCache, $uid = null, $content_func = null) - { + $forceTplCache, $uid = null, $content_func = null + ) { $tpl = clone $this; $tpl->parent = $this; $smarty = &$this->smarty; @@ -322,9 +326,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $tpl->scope = $scope; if (!isset(self::$tplObjCache[ $tpl->templateId ]) && !$tpl->source->handler->recompiled) { // check if template object should be cached - if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ]) && - self::$subTplInfo[ $tpl->template_resource ] > 1) || - ($tpl->_isSubTpl() && isset(self::$tplObjCache[ $tpl->parent->templateId ])) + if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ]) + && self::$subTplInfo[ $tpl->template_resource ] > 1) + || ($tpl->_isSubTpl() && isset(self::$tplObjCache[ $tpl->parent->templateId ])) ) { self::$tplObjCache[ $tpl->templateId ] = $tpl; } @@ -369,7 +373,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * Get called sub-templates and save call count - * */ public function _subTemplateRegister() { @@ -399,7 +402,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * @param mixed $value value * @param bool $nocache nocache flag * @param int $scope scope into which variable shall be assigned - * */ public function _assignInScope($varName, $value, $nocache = false, $scope = 0) { @@ -426,14 +428,15 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * * @throws \SmartyException */ - public function _checkPlugins($plugins) { + public function _checkPlugins($plugins) + { static $checked = array(); foreach($plugins as $plugin) { $name = join('::', (array)$plugin[ 'function' ]); if (!isset($checked[$name])) { if (!is_callable($plugin['function'])) { if (is_file($plugin['file'])) { - require_once $plugin['file']; + include_once $plugin['file']; if (is_callable($plugin['function'])) { $checked[ $name ] = true; } @@ -458,8 +461,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * - Check if compiled or cache file is valid * * @param \Smarty_Internal_Template $tpl - * @param array $properties special template properties - * @param bool $cache flag if called from cache file + * @param array $properties special template properties + * @param bool $cache flag if called from cache file * * @return bool flag if compiled or cache file is valid * @throws \SmartyException @@ -476,8 +479,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase return false; } $is_valid = true; - if (!empty($properties[ 'file_dependency' ]) && - ((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON) + if (!empty($properties[ 'file_dependency' ]) + && ((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON) ) { // check file dependencies at compiled code foreach ($properties[ 'file_dependency' ] as $_file_to_check) { @@ -507,8 +510,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } if ($cache) { // CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc - if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0 && - (time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ])) + if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0 + && (time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ])) ) { $is_valid = false; } @@ -596,7 +599,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * Load inheritance object - * */ public function _loadInheritance() { @@ -607,7 +609,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * Unload inheritance object - * */ public function _cleanUp() { @@ -627,8 +628,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $this->smarty->loadPlugin($this->source->compiler_class); } $this->compiler = - new $this->source->compiler_class($this->source->template_lexer_class, $this->source->template_parser_class, - $this->smarty); + new $this->source->compiler_class( + $this->source->template_lexer_class, $this->source->template_parser_class, + $this->smarty + ); } /** @@ -661,17 +664,17 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase public function __set($property_name, $value) { switch ($property_name) { - case 'compiled': - case 'cached': - case 'compiler': - $this->$property_name = $value; + case 'compiled': + case 'cached': + case 'compiler': + $this->$property_name = $value; + return; + default: + // Smarty property ? + if (property_exists($this->smarty, $property_name)) { + $this->smarty->$property_name = $value; return; - default: - // Smarty property ? - if (property_exists($this->smarty, $property_name)) { - $this->smarty->$property_name = $value; - return; - } + } } throw new SmartyException("invalid template property '$property_name'."); } @@ -687,22 +690,22 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase public function __get($property_name) { switch ($property_name) { - case 'compiled': - $this->loadCompiled(); - return $this->compiled; + case 'compiled': + $this->loadCompiled(); + return $this->compiled; - case 'cached': - $this->loadCached(); - return $this->cached; + case 'cached': + $this->loadCached(); + return $this->cached; - case 'compiler': - $this->loadCompiler(); - return $this->compiler; - default: - // Smarty property ? - if (property_exists($this->smarty, $property_name)) { - return $this->smarty->$property_name; - } + case 'compiler': + $this->loadCompiler(); + return $this->compiler; + default: + // Smarty property ? + if (property_exists($this->smarty, $property_name)) { + return $this->smarty->$property_name; + } } throw new SmartyException("template property '$property_name' does not exist."); } diff --git a/libs/sysplugins/smarty_internal_templatebase.php b/libs/sysplugins/smarty_internal_templatebase.php index 17474fe2..1e5f4ae4 100644 --- a/libs/sysplugins/smarty_internal_templatebase.php +++ b/libs/sysplugins/smarty_internal_templatebase.php @@ -11,8 +11,8 @@ /** * Class with shared smarty/template methods * - * @package Smarty - * @subpackage Template + * @package Smarty + * @subpackage Template * * @property int $_objType * @@ -102,10 +102,10 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data /** * 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 $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 @@ -140,10 +140,10 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @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 + * @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 @@ -157,11 +157,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data /** * 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 + * @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 @@ -264,11 +264,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @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 + * @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 @@ -284,8 +284,8 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @api Smarty::loadFilter() * @link http://www.smarty.net/docs/en/api.load.filter.tpl * - * @param string $type filter type - * @param string $name filter name + * @param string $type filter type + * @param string $name filter name * * @return bool * @throws SmartyException if filter could not be loaded @@ -301,9 +301,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @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 + * @param string $type filter type + * @param callback $callback + * @param string|null $name optional filter name * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -319,20 +319,22 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @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 + * @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); + $block_methods = array() + ) { + return $this->ext->registerObject->registerObject( + $this, $object_name, $object, $allowed_methods_properties, + $format, $block_methods + ); } /** diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index f414e1d0..d9f38eb3 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -16,8 +16,8 @@ * * @property Smarty_Internal_SmartyTemplateCompiler $prefixCompiledCode = '' * @property Smarty_Internal_SmartyTemplateCompiler $postfixCompiledCode = '' - * @method registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false) - * @method unregisterPostCompileCallback($key) + * @method registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false) + * @method unregisterPostCompileCallback($key) */ abstract class Smarty_Internal_TemplateCompilerBase { @@ -324,35 +324,41 @@ abstract class Smarty_Internal_TemplateCompilerBase public function __construct(Smarty $smarty) { $this->smarty = $smarty; - $this->nocache_hash = str_replace(array('.', + $this->nocache_hash = str_replace( + array('.', ','), - '_', - uniqid(rand(), true)); + '_', + uniqid(rand(), true) + ); } /** * Method to compile a Smarty template * - * @param Smarty_Internal_Template $template template object to compile - * @param bool $nocache true is shall be compiled in nocache mode + * @param Smarty_Internal_Template $template template object to compile + * @param bool $nocache true is shall be compiled in nocache mode * @param null|Smarty_Internal_TemplateCompilerBase $parent_compiler * * @return bool true if compiling succeeded, false if it failed * @throws \Exception */ public function compileTemplate(Smarty_Internal_Template $template, - $nocache = null, - Smarty_Internal_TemplateCompilerBase $parent_compiler = null) - { + $nocache = null, + Smarty_Internal_TemplateCompilerBase $parent_compiler = null + ) { // get code frame of compiled template - $_compiled_code = $template->smarty->ext->_codeFrame->create($template, - $this->compileTemplateSource($template, - $nocache, - $parent_compiler), - $this->postFilter($this->blockOrFunctionCode) . + $_compiled_code = $template->smarty->ext->_codeFrame->create( + $template, + $this->compileTemplateSource( + $template, + $nocache, + $parent_compiler + ), + $this->postFilter($this->blockOrFunctionCode) . join('', $this->mergedSubTemplatesCode), - false, - $this); + false, + $this + ); return $_compiled_code; } @@ -360,16 +366,16 @@ abstract class Smarty_Internal_TemplateCompilerBase * Compile template source and run optional post filter * * @param \Smarty_Internal_Template $template - * @param null|bool $nocache flag if template must be compiled in nocache mode + * @param null|bool $nocache flag if template must be compiled in nocache mode * @param \Smarty_Internal_TemplateCompilerBase $parent_compiler * * @return string * @throws \Exception */ public function compileTemplateSource(Smarty_Internal_Template $template, - $nocache = null, - Smarty_Internal_TemplateCompilerBase $parent_compiler = null) - { + $nocache = null, + Smarty_Internal_TemplateCompilerBase $parent_compiler = null + ) { try { // save template object in compiler class $this->template = $template; @@ -422,7 +428,7 @@ abstract class Smarty_Internal_TemplateCompilerBase } $_compiled_code = $this->postFilter($this->doCompile($this->preFilter($_content), true)); if (!empty($this->required_plugins[ 'compiled' ]) || !empty($this->required_plugins[ 'nocache' ])) { - $_compiled_code = '<?php ' . $this->compileRequiredPlugins() . "?>\n" . $_compiled_code; + $_compiled_code = '<?php ' . $this->compileRequiredPlugins() . "?>\n" . $_compiled_code; } } catch (Exception $e) { @@ -455,8 +461,8 @@ abstract class Smarty_Internal_TemplateCompilerBase public function postFilter($code) { // run post filter if on code - if (!empty($code) && - (isset($this->smarty->autoload_filters[ 'post' ]) || isset($this->smarty->registered_filters[ 'post' ])) + if (!empty($code) + && (isset($this->smarty->autoload_filters[ 'post' ]) || isset($this->smarty->registered_filters[ 'post' ])) ) { return $this->smarty->ext->_filterHandler->runFilter('post', $code, $this->template); } else { @@ -475,8 +481,8 @@ abstract class Smarty_Internal_TemplateCompilerBase public function preFilter($_content) { // run pre filter if required - if ($_content !== '' && - ((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ]))) + if ($_content !== '' + && ((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ]))) ) { return $this->smarty->ext->_filterHandler->runFilter('pre', $_content, $this->template); } else { @@ -493,9 +499,9 @@ abstract class Smarty_Internal_TemplateCompilerBase * Merge tag prefix code with saved one * (required nested tags in attributes) * - * @param string $tag tag name - * @param array $args array with tag attributes - * @param array $parameter array with compilation parameter + * @param string $tag tag name + * @param array $args array with tag attributes + * @param array $parameter array with compilation parameter * * @throws SmartyCompilerException * @throws SmartyException @@ -523,11 +529,13 @@ abstract class Smarty_Internal_TemplateCompilerBase // not a variable variable $var = trim($variable, '\''); $this->tag_nocache = $this->tag_nocache | - $this->template->ext->getTemplateVars->_getVariable($this->template, - $var, - null, - true, - false)->nocache; + $this->template->ext->getTemplateVars->_getVariable( + $this->template, + $var, + null, + true, + false + )->nocache; // todo $this->template->compiled->properties['variables'][$var] = $this->tag_nocache | $this->nocache; } return '$_smarty_tpl->tpl_vars[' . $variable . ']->value'; @@ -549,8 +557,8 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * compile PHP function call * - * @param string $name - * @param array $parameter + * @param string $name + * @param array $parameter * * @return string * @throws \SmartyCompilerException @@ -558,8 +566,8 @@ abstract class Smarty_Internal_TemplateCompilerBase public function compilePHPFunctionCall($name, $parameter) { if (!$this->smarty->security_policy || $this->smarty->security_policy->isTrustedPhpFunction($name, $this)) { - if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0 || - strcasecmp($name, 'array') === 0 || is_callable($name) + if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0 + || strcasecmp($name, 'array') === 0 || is_callable($name) ) { $func_name = strtolower($name); $par = implode(',', $parameter); @@ -578,13 +586,16 @@ abstract class Smarty_Internal_TemplateCompilerBase $isset_par = str_replace("')->value", "',null,true,false)->value", $par); } return $name . '(' . $isset_par . ')'; - } else if (in_array($func_name, - array('empty', + } else if (in_array( + $func_name, + array('empty', 'reset', 'current', 'end', 'prev', - 'next'))) { + 'next') + ) + ) { if (count($parameter) !== 1) { $this->trigger_template_error("Illegal number of parameter in '{$func_name()}'"); } @@ -625,8 +636,11 @@ abstract class Smarty_Internal_TemplateCompilerBase if (strpos($text, '<') !== false) { // capture html elements not to be messed with $_offset = 0; - if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', - $text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { + if (preg_match_all( + '#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', + $text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER + ) + ) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); @@ -648,8 +662,11 @@ abstract class Smarty_Internal_TemplateCompilerBase $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)) { + 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 ] ]; @@ -674,11 +691,11 @@ abstract class Smarty_Internal_TemplateCompilerBase * 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 + * @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 @@ -697,7 +714,7 @@ abstract class Smarty_Internal_TemplateCompilerBase * class name format: Smarty_Internal_Compile_TagName * plugin filename format: Smarty_Internal_TagName.php * - * @param string $tag tag name + * @param string $tag tag name * * @return bool|\Smarty_Internal_CompileBase tag compiler object or false if not found * @throws \SmartyCompilerException @@ -710,8 +727,8 @@ abstract class Smarty_Internal_TemplateCompilerBase $_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)) + 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 { @@ -724,8 +741,8 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Check for plugins and return function name * - * @param $plugin_name - * @param string $plugin_type type of plugin + * @param $plugin_name + * @param string $plugin_type type of plugin * * @return string call name of function * @throws \SmartyException @@ -790,8 +807,8 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Check for plugins by default plugin handler * - * @param string $tag name of tag - * @param string $plugin_type type of plugin + * @param string $tag name of tag + * @param string $plugin_type type of plugin * * @return bool true if found * @throws \SmartyCompilerException @@ -801,13 +818,15 @@ abstract class Smarty_Internal_TemplateCompilerBase $callback = null; $script = null; $cacheable = true; - $result = call_user_func_array($this->smarty->default_plugin_handler_func, - array($tag, + $result = call_user_func_array( + $this->smarty->default_plugin_handler_func, + array($tag, $plugin_type, $this->template, &$callback, &$script, - &$cacheable,)); + &$cacheable,) + ); if ($result) { $this->tag_nocache = $this->tag_nocache || !$cacheable; if ($script !== null) { @@ -823,7 +842,7 @@ abstract class Smarty_Internal_TemplateCompilerBase $this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] = $callback; } - require_once $script; + include_once $script; } else { $this->trigger_template_error("Default plugin handler: Returned script file '{$script}' for '{$tag}' not found"); } @@ -865,8 +884,8 @@ abstract class Smarty_Internal_TemplateCompilerBase * 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 + * @param string $content content of template element + * @param boolean $is_code true if content is compiled code * * @return string content */ @@ -875,8 +894,8 @@ abstract class Smarty_Internal_TemplateCompilerBase // 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) + 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, '\'\\'); @@ -950,7 +969,7 @@ abstract class Smarty_Internal_TemplateCompilerBase } /** - * @param array $_attr tag attributes + * @param array $_attr tag attributes * @param array $validScopes * * @return int|string @@ -997,8 +1016,8 @@ abstract class Smarty_Internal_TemplateCompilerBase * 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 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 @@ -1015,14 +1034,21 @@ abstract class Smarty_Internal_TemplateCompilerBase } 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 ? + 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)); + '...' : $lex->data + ) + ); } else { $templateName = $this->template->source->type . ':' . $this->template->source->filepath; } @@ -1069,7 +1095,7 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Return var_export() value with all white spaces removed * - * @param mixed $value + * @param mixed $value * * @return string */ @@ -1104,11 +1130,13 @@ abstract class Smarty_Internal_TemplateCompilerBase */ public function replaceDelimiter($lexerPreg) { - return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'), - array($this->ldelPreg, $this->literalPreg, $this->rdelPreg, + 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); + $lexerPreg + ); } /** @@ -1153,9 +1181,11 @@ abstract class Smarty_Internal_TemplateCompilerBase { if (array_pop($this->_tag_stack_count) !== $this->getTagStackCount()) { $tag = $this->getOpenBlockTag(); - $this->trigger_template_error("unclosed '{{$tag}}' in doubled quoted string", - null, - true); + $this->trigger_template_error( + "unclosed '{{$tag}}' in doubled quoted string", + null, + true + ); } } @@ -1350,7 +1380,7 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * method to compile a Smarty template * - * @param mixed $_content template source + * @param mixed $_content template source * @param bool $isTemplateSource * * @return bool true if compiling succeeded, false if it failed @@ -1360,9 +1390,9 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Compile Tag * - * @param string $tag tag name - * @param array $args array with tag attributes - * @param array $parameter array with compilation parameter + * @param string $tag tag name + * @param array $args array with tag attributes + * @param array $parameter array with compilation parameter * * @throws SmartyCompilerException * @throws SmartyException @@ -1395,9 +1425,9 @@ abstract class Smarty_Internal_TemplateCompilerBase } // 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) + 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}'"; @@ -1428,23 +1458,27 @@ abstract class Smarty_Internal_TemplateCompilerBase // 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 ])) + 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); + 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 "' . + $this->trigger_template_error( + 'not allowed method "' . $method . '" in registered object "' . $tag . '"', - null, - true); + null, + true + ); } } // check if tag is registered @@ -1465,25 +1499,29 @@ abstract class Smarty_Internal_TemplateCompilerBase 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)); + 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); + 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)) + 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)) { @@ -1507,14 +1545,16 @@ abstract class Smarty_Internal_TemplateCompilerBase 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) + if (!isset($this->smarty->security_policy) + || $this->smarty->security_policy->isTrustedTag($tag, $this) ) { - return $this->callTagCompiler('private_' . $plugin_type . '_plugin', - $args, - $parameter, - $tag, - $function); + return $this->callTagCompiler( + 'private_' . $plugin_type . '_plugin', + $args, + $parameter, + $tag, + $function + ); } } } @@ -1548,14 +1588,18 @@ abstract class Smarty_Internal_TemplateCompilerBase $new_args[ $key ] = $mixed; } } - return call_user_func_array($this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ], - array($new_args, - $this)); + 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); + return $this->callTagCompiler( + 'private_registered_' . $plugin_type, + $args, + $parameter, + $tag + ); } } } @@ -1566,22 +1610,26 @@ abstract class Smarty_Internal_TemplateCompilerBase 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); + return $this->callTagCompiler( + 'private_object_block_function', + $args, + $parameter, + $tag, + $method + ); } else { // throw exception - $this->trigger_template_error('not allowed closing tag method "' . $method . + $this->trigger_template_error( + 'not allowed closing tag method "' . $method . '" in registered object "' . $base_tag . '"', - null, - true); + 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 ]) + 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); } @@ -1595,8 +1643,8 @@ abstract class Smarty_Internal_TemplateCompilerBase } // function plugin? if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) { - if (!isset($this->smarty->security_policy) || - $this->smarty->security_policy->isTrustedTag($tag, $this) + if (!isset($this->smarty->security_policy) + || $this->smarty->security_policy->isTrustedTag($tag, $this) ) { return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function); } @@ -1608,9 +1656,11 @@ abstract class Smarty_Internal_TemplateCompilerBase 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)); + 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; diff --git a/libs/sysplugins/smarty_internal_templatelexer.php b/libs/sysplugins/smarty_internal_templatelexer.php index 3045a7b0..64594904 100644 --- a/libs/sysplugins/smarty_internal_templatelexer.php +++ b/libs/sysplugins/smarty_internal_templatelexer.php @@ -13,7 +13,6 @@ * This is the template file lexer. * It is generated from the smarty_internal_templatelexer.plex file * - * * @author Uwe Tews <uwe.tews@googlemail.com> */ class Smarty_Internal_Templatelexer @@ -198,7 +197,7 @@ class Smarty_Internal_Templatelexer /** * constructor * - * @param string $source template source + * @param string $source template source * @param Smarty_Internal_TemplateCompilerBase $compiler */ function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler) @@ -219,7 +218,6 @@ class Smarty_Internal_Templatelexer /** * open lexer/parser trace file - * */ public function PrintTrace() { @@ -240,10 +238,10 @@ class Smarty_Internal_Templatelexer } /** - * check if current value is an autoliteral left delimiter - * - * @return bool - */ + * check if current value is an autoliteral left delimiter + * + * @return bool + */ public function isAutoLiteral() { return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ? @@ -258,39 +256,47 @@ class Smarty_Internal_Templatelexer 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); + 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); + 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); + 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); + 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 + ); } } @@ -298,15 +304,17 @@ class Smarty_Internal_Templatelexer { $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); + 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() + public function yylex1() { if (!isset($this->yy_global_pattern1)) { $this->yy_global_pattern1 = @@ -326,10 +334,14 @@ public function yylex1() $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'); + 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 @@ -354,8 +366,10 @@ public function yylex1() continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -368,11 +382,13 @@ public function yylex1() function yy_r1_2() { - preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", - $this->data, - $match, - PREG_OFFSET_CAPTURE, - $this->counter); + 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 { @@ -398,7 +414,7 @@ public function yylex1() $this->yypushstate(self::LITERAL); } - function yy_r1_12() + function yy_r1_12() { $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; $this->yypushstate(self::LITERAL); @@ -420,7 +436,7 @@ public function yylex1() $this->token = Smarty_Internal_Templateparser::TP_TEXT; } -public function yylex2() + public function yylex2() { if (!isset($this->yy_global_pattern2)) { $this->yy_global_pattern2 = @@ -440,10 +456,14 @@ public function yylex2() $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'); + 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 @@ -468,8 +488,10 @@ public function yylex2() continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -531,7 +553,7 @@ public function yylex2() $this->taglineno = $this->line; } - function yy_r2_20() + function yy_r2_20() { if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) { $this->yypopstate(); @@ -559,7 +581,7 @@ public function yylex2() $this->taglineno = $this->line; } -public function yylex3() + public function yylex3() { if (!isset($this->yy_global_pattern3)) { $this->yy_global_pattern3 = @@ -579,10 +601,14 @@ public function yylex3() $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'); + 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 @@ -607,8 +633,10 @@ public function yylex3() continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -766,8 +794,8 @@ public function yylex3() 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()) { + 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; @@ -837,7 +865,7 @@ public function yylex3() $this->token = Smarty_Internal_Templateparser::TP_HEX; } - function yy_r3_58() + function yy_r3_58() { $this->token = Smarty_Internal_Templateparser::TP_SPACE; } // end function @@ -847,7 +875,7 @@ public function yylex3() $this->token = Smarty_Internal_Templateparser::TP_TEXT; } -public function yylex4() + public function yylex4() { if (!isset($this->yy_global_pattern4)) { $this->yy_global_pattern4 = @@ -867,10 +895,14 @@ public function yylex4() $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'); + 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 @@ -895,8 +927,10 @@ public function yylex4() continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -919,12 +953,12 @@ public function yylex4() } } - function yy_r4_5() + function yy_r4_5() { $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } // end function -public function yylex5() + public function yylex5() { if (!isset($this->yy_global_pattern5)) { $this->yy_global_pattern5 = @@ -944,10 +978,14 @@ public function yylex5() $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'); + 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 @@ -972,8 +1010,10 @@ public function yylex5() continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . - ': ' . $this->data[ $this->counter ]); + throw new Exception( + 'Unexpected input at line' . $this->line . + ': ' . $this->data[ $this->counter ] + ); } break; } while (true); @@ -1043,4 +1083,4 @@ public function yylex5() } } -
\ No newline at end of file + diff --git a/libs/sysplugins/smarty_internal_templateparser.php b/libs/sysplugins/smarty_internal_templateparser.php index d8219dae..0ebea38d 100644 --- a/libs/sysplugins/smarty_internal_templateparser.php +++ b/libs/sysplugins/smarty_internal_templateparser.php @@ -10,7 +10,7 @@ class TP_yyStackEntry } ; -#line 11 "../smarty/lexer/smarty_internal_templateparser.y" +// line 11 "../smarty/lexer/smarty_internal_templateparser.y" /** * Smarty Template Parser Class @@ -22,7 +22,7 @@ class TP_yyStackEntry */ class Smarty_Internal_Templateparser { - #line 23 "../smarty/lexer/smarty_internal_templateparser.y" + // line 23 "../smarty/lexer/smarty_internal_templateparser.y" const Err1 = 'Security error: Call to private object member not allowed'; const Err2 = 'Security error: Call to dynamic object member not allowed'; const Err3 = 'PHP in template not allowed. Use SmartyBC to enable it'; @@ -1050,9 +1050,9 @@ class Smarty_Internal_Templateparser public static $yyFallback = array(); public $yyTraceFILE; public $yyTracePrompt; -public $yyidx; -public $yyerrcnt; -public $yystack = array(); + public $yyidx; + public $yyerrcnt; + public $yystack = array(); public $yyTokenName = array( '$', 'VERT', 'COLON', 'UNIMATH', 'PHP', 'TEXT', 'STRIPON', 'STRIPOFF', @@ -1458,7 +1458,7 @@ public $yystack = array(); array(0 => 106, 1 => 1), array(0 => 106, 1 => 1), ); - public static $yyReduceMap = array( + public static $yyReduceMap = array( 0 => 0, 1 => 1, 2 => 2, @@ -1645,7 +1645,7 @@ public $yystack = array(); 184 => 184, 185 => 185, ); /* Index of top element in stack */ - private $_retvalue; /* Shifts left before out of the error */ + private $_retvalue; /* Shifts left before out of the error */ /** * constructor @@ -1675,7 +1675,6 @@ public $yystack = array(); /** * error rundown - * */ public function errorRunDown() { @@ -1737,8 +1736,8 @@ public $yystack = array(); public static function yy_destructor($yymajor, $yypminor) { switch ($yymajor) { - default: - break; /* If no destructor action specified: do nothing */ + default: + break; /* If no destructor action specified: do nothing */ } } @@ -1749,9 +1748,11 @@ public $yystack = array(); } $yytos = array_pop($this->yystack); if ($this->yyTraceFILE && $this->yyidx >= 0) { - fwrite($this->yyTraceFILE, - $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . - "\n"); + fwrite( + $this->yyTraceFILE, + $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . + "\n" + ); } $yymajor = $yytos->major; self::yy_destructor($yymajor, $yytos->minor); @@ -1803,7 +1804,8 @@ public $yystack = array(); $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; $nextstate = $this->yy_find_reduce_action( $this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + self::$yyRuleInfo[ $yyruleno ][ 0 ] + ); if (isset(self::$yyExpectedTokens[ $nextstate ])) { $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); if (isset($res4[ $nextstate ][ $token ])) { @@ -1813,8 +1815,8 @@ public $yystack = array(); return array_unique($expected); } } else { - if ($res4[ $nextstate ][ $token ] = - in_array($token, self::$yyExpectedTokens[ $nextstate ], true)) { + if ($res4[ $nextstate ][ $token ] = in_array($token, self::$yyExpectedTokens[ $nextstate ], true) + ) { $this->yyidx = $yyidx; $this->yystack = $stack; return array_unique($expected); @@ -1889,7 +1891,8 @@ public $yystack = array(); $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; $nextstate = $this->yy_find_reduce_action( $this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + self::$yyRuleInfo[ $yyruleno ][ 0 ] + ); if (isset($res2[ $nextstate ][ $token ])) { if ($res2[ $nextstate ][ $token ]) { $this->yyidx = $yyidx; @@ -1897,10 +1900,13 @@ public $yystack = array(); return true; } } else { - if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && - in_array($token, - self::$yyExpectedTokens[ $nextstate ], - true))) { + if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) + && in_array( + $token, + self::$yyExpectedTokens[ $nextstate ], + true + )) + ) { $this->yyidx = $yyidx; $this->yystack = $stack; return true; @@ -1958,15 +1964,19 @@ public $yystack = array(); return self::YY_NO_ACTION; } $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || - self::$yy_lookahead[ $i ] != $iLookAhead) { + if ($i < 0 || $i >= self::YY_SZ_ACTTAB + || self::$yy_lookahead[ $i ] != $iLookAhead + ) { if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) - && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) { + && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0 + ) { if ($this->yyTraceFILE) { - fwrite($this->yyTraceFILE, - $this->yyTracePrompt . 'FALLBACK ' . + fwrite( + $this->yyTraceFILE, + $this->yyTracePrompt . 'FALLBACK ' . $this->yyTokenName[ $iLookAhead ] . ' => ' . - $this->yyTokenName[ $iFallback ] . "\n"); + $this->yyTokenName[ $iFallback ] . "\n" + ); } return $this->yy_find_shift_action($iFallback); } @@ -1990,15 +2000,16 @@ public $yystack = array(); return self::YY_NO_ACTION; } $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || - self::$yy_lookahead[ $i ] != $iLookAhead) { + if ($i < 0 || $i >= self::YY_SZ_ACTTAB + || self::$yy_lookahead[ $i ] != $iLookAhead + ) { return self::$yy_default[ $stateno ]; } else { return self::$yy_action[ $i ]; } } - #line 234 "../smarty/lexer/smarty_internal_templateparser.y" + // line 234 "../smarty/lexer/smarty_internal_templateparser.y" public function yy_shift($yyNewState, $yyMajor, $yypMinor) { @@ -2011,7 +2022,7 @@ public $yystack = array(); while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 221 "../smarty/lexer/smarty_internal_templateparser.y" + // line 221 "../smarty/lexer/smarty_internal_templateparser.y" $this->internalError = true; $this->compiler->trigger_template_error('Stack overflow in template parser'); return; @@ -2022,21 +2033,25 @@ public $yystack = array(); $yytos->minor = $yypMinor; $this->yystack[] = $yytos; if ($this->yyTraceFILE && $this->yyidx > 0) { - fprintf($this->yyTraceFILE, - "%sShift %d\n", - $this->yyTracePrompt, - $yyNewState); + fprintf( + $this->yyTraceFILE, + "%sShift %d\n", + $this->yyTracePrompt, + $yyNewState + ); fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); for ($i = 1; $i <= $this->yyidx; $i++) { - fprintf($this->yyTraceFILE, - " %s", - $this->yyTokenName[ $this->yystack[ $i ]->major ]); + fprintf( + $this->yyTraceFILE, + " %s", + $this->yyTokenName[ $this->yystack[ $i ]->major ] + ); } fwrite($this->yyTraceFILE, "\n"); } } - #line 242 "../smarty/lexer/smarty_internal_templateparser.y" + // line 242 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r0() { @@ -2045,129 +2060,161 @@ public $yystack = array(); $this->_retvalue = $this->root_buffer->to_smarty_php($this); } - #line 251 "../smarty/lexer/smarty_internal_templateparser.y" + // line 251 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r1() { - $code = $this->compiler->compileTag('private_php', - array(array('code' => $this->yystack[ $this->yyidx + 0 ]->minor), + $code = $this->compiler->compileTag( + 'private_php', + array(array('code' => $this->yystack[ $this->yyidx + 0 ]->minor), array('type' => $this->lex->phpType)), - array()); + array() + ); if ($this->compiler->has_code && !empty($code)) { $tmp = ''; foreach ($this->compiler->prefix_code as $code) { $tmp .= $code; } $this->compiler->prefix_code = array(); - $this->current_buffer->append_subtree($this, - new Smarty_Internal_ParseTree_Tag($this, - $this->compiler->processNocacheCode($tmp . + $this->current_buffer->append_subtree( + $this, + new Smarty_Internal_ParseTree_Tag( + $this, + $this->compiler->processNocacheCode( + $tmp . $code, - true))); + true + ) + ) + ); } } - #line 255 "../smarty/lexer/smarty_internal_templateparser.y" + // line 255 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r2() { - $this->current_buffer->append_subtree($this, - $this->compiler->processText($this->yystack[ $this->yyidx + 0 ]->minor)); + $this->current_buffer->append_subtree( + $this, + $this->compiler->processText($this->yystack[ $this->yyidx + 0 ]->minor) + ); } - #line 259 "../smarty/lexer/smarty_internal_templateparser.y" + // line 259 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r3() { $this->strip = true; } - #line 264 "../smarty/lexer/smarty_internal_templateparser.y" + // line 264 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r4() { $this->strip = false; } - #line 269 "../smarty/lexer/smarty_internal_templateparser.y" + // line 269 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r5() { - $this->current_buffer->append_subtree($this, - new Smarty_Internal_ParseTree_Text($this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->current_buffer->append_subtree( + $this, + new Smarty_Internal_ParseTree_Text( + $this->yystack[ $this->yyidx + + -1 ]->minor + ) + ); } - #line 272 "../smarty/lexer/smarty_internal_templateparser.y" + // line 272 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r6() { $this->_retvalue = $this->yystack[ $this->yyidx + -3 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 276 "../smarty/lexer/smarty_internal_templateparser.y" + // line 276 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r7() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 281 "../smarty/lexer/smarty_internal_templateparser.y" + // line 281 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r8() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 285 "../smarty/lexer/smarty_internal_templateparser.y" + // line 285 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r9() { $this->_retvalue = ''; } - #line 297 "../smarty/lexer/smarty_internal_templateparser.y" + // line 297 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r10() { if ($this->compiler->has_code) { - $this->current_buffer->append_subtree($this, - $this->mergePrefixCode($this->yystack[ $this->yyidx + 0 ]->minor)); + $this->current_buffer->append_subtree( + $this, + $this->mergePrefixCode($this->yystack[ $this->yyidx + 0 ]->minor) + ); } $this->compiler->has_variable_string = false; $this->block_nesting_level = count($this->compiler->_tag_stack); } - #line 307 "../smarty/lexer/smarty_internal_templateparser.y" + // line 307 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r12() { - $var = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler->getLdelLength(), - -$this->compiler->getRdelLength()), - ' $'); + $var = trim( + substr( + $this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength() + ), + ' $' + ); if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - array('nocache'), - array('value' => $this->compiler->compileVariable('\'' . + $this->_retvalue = $this->compiler->compileTag( + 'private_print_expression', + array('nocache'), + array('value' => $this->compiler->compileVariable( + '\'' . $match[ 1 ] . - '\''))); + '\'' + )) + ); } else { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - array(), - array('value' => $this->compiler->compileVariable('\'' . + $this->_retvalue = $this->compiler->compileTag( + 'private_print_expression', + array(), + array('value' => $this->compiler->compileVariable( + '\'' . $var . - '\''))); + '\'' + )) + ); } } - #line 328 "../smarty/lexer/smarty_internal_templateparser.y" + // line 328 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r13() { - $tag = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler->getLdelLength(), - -$this->compiler->getRdelLength())); + $tag = trim( + substr( + $this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength() + ) + ); if ($tag == 'strip') { $this->strip = true; $this->_retvalue = null;; @@ -2188,7 +2235,7 @@ public $yystack = array(); } } - #line 339 "../smarty/lexer/smarty_internal_templateparser.y" + // line 339 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r14() { @@ -2204,73 +2251,85 @@ public $yystack = array(); } } - #line 343 "../smarty/lexer/smarty_internal_templateparser.y" + // line 343 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r15() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 347 "../smarty/lexer/smarty_internal_templateparser.y" + // line 347 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r16() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 356 "../smarty/lexer/smarty_internal_templateparser.y" + // line 356 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r17() { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ], - array('value' => $this->yystack[ $this->yyidx + - 0 ]->minor[ 0 ])); + $this->_retvalue = $this->compiler->compileTag( + 'private_print_expression', + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ], + array('value' => $this->yystack[ $this->yyidx + + 0 ]->minor[ 0 ]) + ); } - #line 360 "../smarty/lexer/smarty_internal_templateparser.y" + // line 360 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r18() { - $this->_retvalue = $this->compiler->compileTag('assign', - array_merge(array(array('value' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'assign', + array_merge( + array(array('value' => $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ]), array('var' => '\'' . - substr($this->yystack[ $this->yyidx + + substr( + $this->yystack[ $this->yyidx + -1 ]->minor, - 1) . '\'')), - $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ])); + 1 + ) . '\'')), + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ] + ) + ); } - #line 364 "../smarty/lexer/smarty_internal_templateparser.y" + // line 364 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r19() { - $this->_retvalue = $this->compiler->compileTag('assign', - array_merge(array(array('value' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'assign', + array_merge( + array(array('value' => $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ]), array('var' => $this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ])), - $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]), - array('smarty_internal_index' => $this->yystack[ $this->yyidx + - -1 ]->minor[ 'smarty_internal_index' ])); + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ] + ), + array('smarty_internal_index' => $this->yystack[ $this->yyidx + + -1 ]->minor[ 'smarty_internal_index' ]) + ); } - #line 368 "../smarty/lexer/smarty_internal_templateparser.y" + // line 368 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r20() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 383 "../smarty/lexer/smarty_internal_templateparser.y" + // line 383 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r21() { $this->_retvalue = array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 393 "../smarty/lexer/smarty_internal_templateparser.y" + // line 393 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r25() { @@ -2278,17 +2337,21 @@ public $yystack = array(); if ($this->security) { $this->security->isTrustedConstant($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler); } - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - $this->yystack[ $this->yyidx + 0 ]->minor, - array('value' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + 'private_print_expression', + $this->yystack[ $this->yyidx + 0 ]->minor, + array('value' => $this->yystack[ $this->yyidx + + -1 ]->minor) + ); } else { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = $this->compiler->compileTag( + $this->yystack[ $this->yyidx + -1 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor + ); } } - #line 406 "../smarty/lexer/smarty_internal_templateparser.y" + // line 406 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r26() { @@ -2296,15 +2359,17 @@ public $yystack = array(); if ($this->security) { $this->security->isTrustedConstant($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler); } - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - array(), - array('value' => $this->yystack[ $this->yyidx + 0 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + 'private_print_expression', + array(), + array('value' => $this->yystack[ $this->yyidx + 0 ]->minor) + ); } else { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor, array()); } } - #line 418 "../smarty/lexer/smarty_internal_templateparser.y" + // line 418 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r27() { @@ -2312,204 +2377,256 @@ public $yystack = array(); if ($this->security) { $this->security->isTrustedConstant($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler); } - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - $this->yystack[ $this->yyidx + 0 ]->minor, - array('value' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'private_print_expression', + $this->yystack[ $this->yyidx + 0 ]->minor, + array('value' => $this->yystack[ $this->yyidx + -2 ]->minor, 'modifierlist' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + -1 ]->minor) + ); } else { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, - array('modifierlist' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + $this->yystack[ $this->yyidx + -2 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, + array('modifierlist' => $this->yystack[ $this->yyidx + + -1 ]->minor) + ); } } - #line 423 "../smarty/lexer/smarty_internal_templateparser.y" + // line 423 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r28() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, - array('object_method' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + $this->yystack[ $this->yyidx + -3 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, + array('object_method' => $this->yystack[ $this->yyidx + + -1 ]->minor) + ); } - #line 428 "../smarty/lexer/smarty_internal_templateparser.y" + // line 428 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r29() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -4 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, - array('modifierlist' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + $this->yystack[ $this->yyidx + -4 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, + array('modifierlist' => $this->yystack[ $this->yyidx + -1 ]->minor, 'object_method' => $this->yystack[ $this->yyidx + - -2 ]->minor)); + -2 ]->minor) + ); } - #line 433 "../smarty/lexer/smarty_internal_templateparser.y" + // line 433 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r30() { - $this->_retvalue = $this->compiler->compileTag('make_nocache', - array(array('var' => '\'' . substr($this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'make_nocache', + array(array('var' => '\'' . substr( + $this->yystack[ $this->yyidx + 0 ]->minor, - 1) . '\''))); + 1 + ) . '\'')) + ); } - #line 438 "../smarty/lexer/smarty_internal_templateparser.y" + // line 438 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r31() { $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength())); - $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, - array(), - array('if condition' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + ($tag === 'else if') ? 'elseif' : $tag, + array(), + array('if condition' => $this->yystack[ $this->yyidx + + 0 ]->minor) + ); } - #line 443 "../smarty/lexer/smarty_internal_templateparser.y" + // line 443 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r32() { $tag = trim(substr($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler->getLdelLength())); - $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, - $this->yystack[ $this->yyidx + 0 ]->minor, - array('if condition' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + ($tag === 'else if') ? 'elseif' : $tag, + $this->yystack[ $this->yyidx + 0 ]->minor, + array('if condition' => $this->yystack[ $this->yyidx + + -1 ]->minor) + ); } - #line 454 "../smarty/lexer/smarty_internal_templateparser.y" + // line 454 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r33() { $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength())); - $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, - array(), - array('if condition' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + ($tag === 'else if') ? 'elseif' : $tag, + array(), + array('if condition' => $this->yystack[ $this->yyidx + + 0 ]->minor) + ); } - #line 458 "../smarty/lexer/smarty_internal_templateparser.y" + // line 458 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r35() { - $this->_retvalue = $this->compiler->compileTag('for', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'for', + array_merge( + $this->yystack[ $this->yyidx + 0 ]->minor, + array(array('start' => $this->yystack[ $this->yyidx + -6 ]->minor), array('ifexp' => $this->yystack[ $this->yyidx + -4 ]->minor), array('var' => $this->yystack[ $this->yyidx + -2 ]->minor), array('step' => $this->yystack[ $this->yyidx + - -1 ]->minor))), - 1); + -1 ]->minor)) + ), + 1 + ); } - #line 466 "../smarty/lexer/smarty_internal_templateparser.y" + // line 466 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r36() { $this->_retvalue = '=' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 470 "../smarty/lexer/smarty_internal_templateparser.y" + // line 470 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r38() { - $this->_retvalue = $this->compiler->compileTag('for', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'for', + array_merge( + $this->yystack[ $this->yyidx + 0 ]->minor, + array(array('start' => $this->yystack[ $this->yyidx + -3 ]->minor), array('to' => $this->yystack[ $this->yyidx + - -1 ]->minor))), - 0); + -1 ]->minor)) + ), + 0 + ); } - #line 475 "../smarty/lexer/smarty_internal_templateparser.y" + // line 475 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r39() { - $this->_retvalue = $this->compiler->compileTag('for', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'for', + array_merge( + $this->yystack[ $this->yyidx + 0 ]->minor, + array(array('start' => $this->yystack[ $this->yyidx + -5 ]->minor), array('to' => $this->yystack[ $this->yyidx + -3 ]->minor), array('step' => $this->yystack[ $this->yyidx + - -1 ]->minor))), - 0); + -1 ]->minor)) + ), + 0 + ); } - #line 479 "../smarty/lexer/smarty_internal_templateparser.y" + // line 479 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r40() { - $this->_retvalue = $this->compiler->compileTag('foreach', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('from' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'foreach', + array_merge( + $this->yystack[ $this->yyidx + 0 ]->minor, + array(array('from' => $this->yystack[ $this->yyidx + -3 ]->minor), array('item' => $this->yystack[ $this->yyidx + - -1 ]->minor)))); + -1 ]->minor)) + ) + ); } - #line 482 "../smarty/lexer/smarty_internal_templateparser.y" + // line 482 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r41() { - $this->_retvalue = $this->compiler->compileTag('foreach', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('from' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'foreach', + array_merge( + $this->yystack[ $this->yyidx + 0 ]->minor, + array(array('from' => $this->yystack[ $this->yyidx + -5 ]->minor), array('item' => $this->yystack[ $this->yyidx + -1 ]->minor), array('key' => $this->yystack[ $this->yyidx + - -3 ]->minor)))); + -3 ]->minor)) + ) + ); } - #line 487 "../smarty/lexer/smarty_internal_templateparser.y" + // line 487 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r42() { $this->_retvalue = $this->compiler->compileTag('foreach', $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 491 "../smarty/lexer/smarty_internal_templateparser.y" + // line 491 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r43() { - $this->_retvalue = $this->compiler->compileTag('setfilter', - array(), - array('modifier_list' => array(array_merge(array($this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'setfilter', + array(), + array('modifier_list' => array(array_merge( + array($this->yystack[ $this->yyidx + -1 ]->minor), - $this->yystack[ $this->yyidx + - 0 ]->minor)))); + $this->yystack[ $this->yyidx + + 0 ]->minor + ))) + ); } - #line 497 "../smarty/lexer/smarty_internal_templateparser.y" + // line 497 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r44() { - $this->_retvalue = $this->compiler->compileTag('setfilter', - array(), - array('modifier_list' => array_merge(array(array_merge(array($this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'setfilter', + array(), + array('modifier_list' => array_merge( + array(array_merge( + array($this->yystack[ $this->yyidx + -2 ]->minor), - $this->yystack[ $this->yyidx + - -1 ]->minor)), - $this->yystack[ $this->yyidx + - 0 ]->minor))); + $this->yystack[ $this->yyidx + + -1 ]->minor + )), + $this->yystack[ $this->yyidx + + 0 ]->minor + )) + ); } - #line 506 "../smarty/lexer/smarty_internal_templateparser.y" + // line 506 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r45() { - $tag = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler->getLdelLength(), - -$this->compiler->getRdelLength()), - ' /'); + $tag = trim( + substr( + $this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength() + ), + ' /' + ); if ($tag === 'strip') { $this->strip = false; $this->_retvalue = null; @@ -2518,46 +2635,52 @@ public $yystack = array(); } } - #line 510 "../smarty/lexer/smarty_internal_templateparser.y" + // line 510 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r46() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor . 'close', array()); } - #line 515 "../smarty/lexer/smarty_internal_templateparser.y" + // line 515 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r47() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor . 'close', - array(), - array('modifier_list' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + $this->yystack[ $this->yyidx + -1 ]->minor . 'close', + array(), + array('modifier_list' => $this->yystack[ $this->yyidx + + 0 ]->minor) + ); } - #line 519 "../smarty/lexer/smarty_internal_templateparser.y" + // line 519 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r48() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor . 'close', - array(), - array('object_method' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = $this->compiler->compileTag( + $this->yystack[ $this->yyidx + -2 ]->minor . 'close', + array(), + array('object_method' => $this->yystack[ $this->yyidx + + 0 ]->minor) + ); } - #line 527 "../smarty/lexer/smarty_internal_templateparser.y" + // line 527 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r49() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor . 'close', - array(), - array('object_method' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + $this->yystack[ $this->yyidx + -3 ]->minor . 'close', + array(), + array('object_method' => $this->yystack[ $this->yyidx + -1 ]->minor, 'modifier_list' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + 0 ]->minor) + ); } - #line 533 "../smarty/lexer/smarty_internal_templateparser.y" + // line 533 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r50() { @@ -2565,21 +2688,21 @@ public $yystack = array(); $this->_retvalue[] = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 538 "../smarty/lexer/smarty_internal_templateparser.y" + // line 538 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r51() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 543 "../smarty/lexer/smarty_internal_templateparser.y" + // line 543 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r52() { $this->_retvalue = array(); } - #line 554 "../smarty/lexer/smarty_internal_templateparser.y" + // line 554 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r53() { @@ -2596,7 +2719,7 @@ public $yystack = array(); } } - #line 562 "../smarty/lexer/smarty_internal_templateparser.y" + // line 562 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r54() { @@ -2605,14 +2728,14 @@ public $yystack = array(); 0 ]->minor); } - #line 574 "../smarty/lexer/smarty_internal_templateparser.y" + // line 574 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r56() { $this->_retvalue = '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\''; } - #line 587 "../smarty/lexer/smarty_internal_templateparser.y" + // line 587 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r59() { @@ -2620,7 +2743,7 @@ public $yystack = array(); array($this->yystack[ $this->yyidx + -2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 592 "../smarty/lexer/smarty_internal_templateparser.y" + // line 592 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r61() { @@ -2628,7 +2751,7 @@ public $yystack = array(); $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor; } - #line 599 "../smarty/lexer/smarty_internal_templateparser.y" + // line 599 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r62() { @@ -2636,7 +2759,7 @@ public $yystack = array(); 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 603 "../smarty/lexer/smarty_internal_templateparser.y" + // line 603 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r64() { @@ -2644,14 +2767,14 @@ public $yystack = array(); 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 623 "../smarty/lexer/smarty_internal_templateparser.y" + // line 623 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r65() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 628 "../smarty/lexer/smarty_internal_templateparser.y" + // line 628 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r68() { @@ -2660,7 +2783,7 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor . '\')'; } - #line 642 "../smarty/lexer/smarty_internal_templateparser.y" + // line 642 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r69() { @@ -2669,19 +2792,21 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 648 "../smarty/lexer/smarty_internal_templateparser.y" + // line 648 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r72() { - $this->_retvalue = $this->compiler->compileTag('private_modifier', - array(), - array('value' => $this->yystack[ $this->yyidx + + $this->_retvalue = $this->compiler->compileTag( + 'private_modifier', + array(), + array('value' => $this->yystack[ $this->yyidx + -1 ]->minor, 'modifierlist' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + 0 ]->minor) + ); } - #line 652 "../smarty/lexer/smarty_internal_templateparser.y" + // line 652 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r73() { @@ -2690,7 +2815,7 @@ public $yystack = array(); $this->yystack[ $this->yyidx + -1 ]->minor[ 'op' ] . $this->yystack[ $this->yyidx + 0 ]->minor . ')'; } - #line 656 "../smarty/lexer/smarty_internal_templateparser.y" + // line 656 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r74() { @@ -2698,14 +2823,14 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 660 "../smarty/lexer/smarty_internal_templateparser.y" + // line 660 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r75() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 664 "../smarty/lexer/smarty_internal_templateparser.y" + // line 664 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r76() { @@ -2714,7 +2839,7 @@ public $yystack = array(); ')'; } - #line 672 "../smarty/lexer/smarty_internal_templateparser.y" + // line 672 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r77() { @@ -2722,19 +2847,23 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor . ')'; } - #line 676 "../smarty/lexer/smarty_internal_templateparser.y" + // line 676 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r78() { - $this->_retvalue = $this->yystack[ $this->yyidx + -5 ]->minor . ' ? ' . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + + $this->_retvalue = $this->yystack[ $this->yyidx + -5 ]->minor . ' ? ' . $this->compiler->compileVariable( + '\'' . + substr( + $this->yystack[ $this->yyidx + -2 ]->minor, - 1) . - '\'') . + 1 + ) . + '\'' + ) . ' : ' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 686 "../smarty/lexer/smarty_internal_templateparser.y" + // line 686 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r79() { @@ -2743,42 +2872,42 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 691 "../smarty/lexer/smarty_internal_templateparser.y" + // line 691 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r81() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 712 "../smarty/lexer/smarty_internal_templateparser.y" + // line 712 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r82() { $this->_retvalue = '!' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 716 "../smarty/lexer/smarty_internal_templateparser.y" + // line 716 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r87() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 720 "../smarty/lexer/smarty_internal_templateparser.y" + // line 720 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r88() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.'; } - #line 725 "../smarty/lexer/smarty_internal_templateparser.y" + // line 725 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r89() { $this->_retvalue = '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 742 "../smarty/lexer/smarty_internal_templateparser.y" + // line 742 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r90() { @@ -2792,14 +2921,14 @@ public $yystack = array(); } } - #line 746 "../smarty/lexer/smarty_internal_templateparser.y" + // line 746 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r92() { $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 764 "../smarty/lexer/smarty_internal_templateparser.y" + // line 764 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r93() { @@ -2807,30 +2936,38 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 775 "../smarty/lexer/smarty_internal_templateparser.y" + // line 775 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r97() { $prefixVar = $this->compiler->getNewPrefixVariable(); if ($this->yystack[ $this->yyidx + -2 ]->minor[ 'var' ] === '\'smarty\'') { - $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . - $this->compiler->compileTag('private_special_variable', - array(), - $this->yystack[ $this->yyidx + - -2 ]->minor[ 'smarty_internal_index' ]) . - ';?>'); + $this->compiler->appendPrefixCode( + "<?php {$prefixVar} = " . + $this->compiler->compileTag( + 'private_special_variable', + array(), + $this->yystack[ $this->yyidx + + -2 ]->minor[ 'smarty_internal_index' ] + ) . + ';?>' + ); } else { - $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . - $this->compiler->compileVariable($this->yystack[ $this->yyidx + - -2 ]->minor[ 'var' ]) . + $this->compiler->appendPrefixCode( + "<?php {$prefixVar} = " . + $this->compiler->compileVariable( + $this->yystack[ $this->yyidx + + -2 ]->minor[ 'var' ] + ) . $this->yystack[ $this->yyidx + -2 ]->minor[ 'smarty_internal_index' ] . - ';?>'); + ';?>' + ); } $this->_retvalue = $prefixVar . '::' . $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } - #line 792 "../smarty/lexer/smarty_internal_templateparser.y" + // line 792 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r98() { @@ -2840,14 +2977,17 @@ public $yystack = array(); $this->_retvalue = $prefixVar; } - #line 811 "../smarty/lexer/smarty_internal_templateparser.y" + // line 811 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r101() { - if (!in_array(strtolower($this->yystack[ $this->yyidx + -2 ]->minor), array('self', 'parent')) && - (!$this->security || $this->security->isTrustedStaticClassAccess($this->yystack[ $this->yyidx + -2 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler))) { + if (!in_array(strtolower($this->yystack[ $this->yyidx + -2 ]->minor), array('self', 'parent')) + && (!$this->security || $this->security->isTrustedStaticClassAccess( + $this->yystack[ $this->yyidx + -2 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler + )) + ) { if (isset($this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ])) { $this->_retvalue = $this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ] . '::' . @@ -2858,19 +2998,21 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } } else { - $this->compiler->trigger_template_error('static class \'' . $this->yystack[ $this->yyidx + -2 ]->minor . - '\' is undefined or not allowed by security setting'); + $this->compiler->trigger_template_error( + 'static class \'' . $this->yystack[ $this->yyidx + -2 ]->minor . + '\' is undefined or not allowed by security setting' + ); } } - #line 822 "../smarty/lexer/smarty_internal_templateparser.y" + // line 822 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r103() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 825 "../smarty/lexer/smarty_internal_templateparser.y" + // line 825 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r104() { @@ -2878,15 +3020,17 @@ public $yystack = array(); $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''); } - #line 838 "../smarty/lexer/smarty_internal_templateparser.y" + // line 838 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r105() { if ($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ] === '\'smarty\'') { - $smarty_var = $this->compiler->compileTag('private_special_variable', - array(), - $this->yystack[ $this->yyidx + - 0 ]->minor[ 'smarty_internal_index' ]); + $smarty_var = $this->compiler->compileTag( + 'private_special_variable', + array(), + $this->yystack[ $this->yyidx + + 0 ]->minor[ 'smarty_internal_index' ] + ); $this->_retvalue = $smarty_var; } else { // used for array reset,next,prev,end,current @@ -2897,7 +3041,7 @@ public $yystack = array(); } } - #line 848 "../smarty/lexer/smarty_internal_templateparser.y" + // line 848 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r106() { @@ -2905,7 +3049,7 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 852 "../smarty/lexer/smarty_internal_templateparser.y" + // line 852 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r108() { @@ -2913,24 +3057,26 @@ public $yystack = array(); $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -1 ]->minor . '\''); } - #line 856 "../smarty/lexer/smarty_internal_templateparser.y" + // line 856 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r109() { $this->_retvalue = '(is_array($tmp = ' . - $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -2 ]->minor . - '\'') . ') ? $tmp' . + $this->compiler->compileConfigVariable( + '\'' . $this->yystack[ $this->yyidx + -2 ]->minor . + '\'' + ) . ') ? $tmp' . $this->yystack[ $this->yyidx + 0 ]->minor . ' :null)'; } - #line 860 "../smarty/lexer/smarty_internal_templateparser.y" + // line 860 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r110() { $this->_retvalue = $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -1 ]->minor); } - #line 864 "../smarty/lexer/smarty_internal_templateparser.y" + // line 864 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r111() { @@ -2939,7 +3085,7 @@ public $yystack = array(); ') ? $tmp' . $this->yystack[ $this->yyidx + 0 ]->minor . ' : null)'; } - #line 867 "../smarty/lexer/smarty_internal_templateparser.y" + // line 867 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r112() { @@ -2947,7 +3093,7 @@ public $yystack = array(); 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 880 "../smarty/lexer/smarty_internal_templateparser.y" + // line 880 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r113() { @@ -2955,14 +3101,14 @@ public $yystack = array(); 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 886 "../smarty/lexer/smarty_internal_templateparser.y" + // line 886 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r115() { return; } - #line 889 "../smarty/lexer/smarty_internal_templateparser.y" + // line 889 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r116() { @@ -2971,14 +3117,14 @@ public $yystack = array(); ']'; } - #line 893 "../smarty/lexer/smarty_internal_templateparser.y" + // line 893 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r117() { $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + 0 ]->minor) . ']'; } - #line 897 "../smarty/lexer/smarty_internal_templateparser.y" + // line 897 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r118() { @@ -2986,120 +3132,134 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor . ']'; } - #line 901 "../smarty/lexer/smarty_internal_templateparser.y" + // line 901 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r119() { $this->_retvalue = '[\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\']'; } - #line 906 "../smarty/lexer/smarty_internal_templateparser.y" + // line 906 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r120() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + 0 ]->minor . ']'; } - #line 911 "../smarty/lexer/smarty_internal_templateparser.y" + // line 911 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r121() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']'; } - #line 915 "../smarty/lexer/smarty_internal_templateparser.y" + // line 915 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r122() { - $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', - array(), - '[\'section\'][\'' . + $this->_retvalue = '[' . $this->compiler->compileTag( + 'private_special_variable', + array(), + '[\'section\'][\'' . $this->yystack[ $this->yyidx + -1 ]->minor . - '\'][\'index\']') . ']'; + '\'][\'index\']' + ) . ']'; } - #line 918 "../smarty/lexer/smarty_internal_templateparser.y" + // line 918 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r123() { - $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', - array(), - '[\'section\'][\'' . + $this->_retvalue = '[' . $this->compiler->compileTag( + 'private_special_variable', + array(), + '[\'section\'][\'' . $this->yystack[ $this->yyidx + -3 ]->minor . '\'][\'' . - $this->yystack[ $this->yyidx + -1 ]->minor . '\']') . ']'; + $this->yystack[ $this->yyidx + -1 ]->minor . '\']' + ) . ']'; } - #line 924 "../smarty/lexer/smarty_internal_templateparser.y" + // line 924 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r124() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']'; } - #line 940 "../smarty/lexer/smarty_internal_templateparser.y" + // line 940 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r126() { - $this->_retvalue = '[' . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + -1 ]->minor, - 1) . '\'') . ']';; + $this->_retvalue = '[' . $this->compiler->compileVariable( + '\'' . + substr( + $this->yystack[ $this->yyidx + -1 ]->minor, + 1 + ) . '\'' + ) . ']';; } - #line 950 "../smarty/lexer/smarty_internal_templateparser.y" + // line 950 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r130() { $this->_retvalue = '[]'; } - #line 954 "../smarty/lexer/smarty_internal_templateparser.y" + // line 954 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r131() { $this->_retvalue = '\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''; } - #line 959 "../smarty/lexer/smarty_internal_templateparser.y" + // line 959 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r132() { $this->_retvalue = '\'\''; } - #line 967 "../smarty/lexer/smarty_internal_templateparser.y" + // line 967 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r133() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 973 "../smarty/lexer/smarty_internal_templateparser.y" + // line 973 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r135() { - $var = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler->getLdelLength(), - -$this->compiler->getRdelLength()), - ' $'); + $var = trim( + substr( + $this->yystack[ $this->yyidx + 0 ]->minor, + $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength() + ), + ' $' + ); $this->_retvalue = $this->compiler->compileVariable('\'' . $var . '\''); } - #line 980 "../smarty/lexer/smarty_internal_templateparser.y" + // line 980 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r136() { $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 989 "../smarty/lexer/smarty_internal_templateparser.y" + // line 989 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r137() { if ($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ] === '\'smarty\'') { - $this->_retvalue = $this->compiler->compileTag('private_special_variable', - array(), - $this->yystack[ $this->yyidx + - -1 ]->minor[ 'smarty_internal_index' ]) . + $this->_retvalue = $this->compiler->compileTag( + 'private_special_variable', + array(), + $this->yystack[ $this->yyidx + + -1 ]->minor[ 'smarty_internal_index' ] + ) . $this->yystack[ $this->yyidx + 0 ]->minor; } else { $this->_retvalue = $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ]) . @@ -3108,21 +3268,21 @@ public $yystack = array(); } } - #line 994 "../smarty/lexer/smarty_internal_templateparser.y" + // line 994 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r138() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 999 "../smarty/lexer/smarty_internal_templateparser.y" + // line 999 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r139() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1006 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1006 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r140() { @@ -3133,7 +3293,7 @@ public $yystack = array(); '->' . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1013 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1013 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r141() { @@ -3144,7 +3304,7 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1020 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1020 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r142() { @@ -3155,7 +3315,7 @@ public $yystack = array(); '->{' . $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1028 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1028 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r143() { @@ -3167,22 +3327,24 @@ public $yystack = array(); $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1036 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1036 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r144() { $this->_retvalue = '->' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1044 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1044 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r145() { - $this->_retvalue = $this->compiler->compilePHPFunctionCall($this->yystack[ $this->yyidx + -3 ]->minor, - $this->yystack[ $this->yyidx + -1 ]->minor); + $this->_retvalue = $this->compiler->compilePHPFunctionCall( + $this->yystack[ $this->yyidx + -3 ]->minor, + $this->yystack[ $this->yyidx + -1 ]->minor + ); } - #line 1051 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1051 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r146() { @@ -3193,7 +3355,7 @@ public $yystack = array(); implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ')'; } - #line 1062 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1062 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r147() { @@ -3201,15 +3363,21 @@ public $yystack = array(); $this->compiler->trigger_template_error(self::Err2); } $prefixVar = $this->compiler->getNewPrefixVariable(); - $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + + $this->compiler->appendPrefixCode( + "<?php {$prefixVar} = " . $this->compiler->compileVariable( + '\'' . + substr( + $this->yystack[ $this->yyidx + -3 ]->minor, - 1) . '\'') . - ';?>'); + 1 + ) . '\'' + ) . + ';?>' + ); $this->_retvalue = $prefixVar . '(' . implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ')'; } - #line 1079 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1079 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r148() { @@ -3217,16 +3385,20 @@ public $yystack = array(); array_merge($this->yystack[ $this->yyidx + -2 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 1083 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1083 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r151() { - $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -2 ]->minor, - array(array_merge($this->yystack[ $this->yyidx + -1 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor))); + $this->_retvalue = array_merge( + $this->yystack[ $this->yyidx + -2 ]->minor, + array(array_merge( + $this->yystack[ $this->yyidx + -1 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor + )) + ); } - #line 1091 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1091 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r152() { @@ -3234,14 +3406,14 @@ public $yystack = array(); array(array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 1099 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1099 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r154() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1118 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1118 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r155() { @@ -3249,14 +3421,14 @@ public $yystack = array(); array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1123 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1123 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r159() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, '', 'method'); } - #line 1128 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1128 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r160() { @@ -3264,14 +3436,14 @@ public $yystack = array(); array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'method'); } - #line 1133 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1133 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r161() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, ''); } - #line 1138 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1138 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r162() { @@ -3279,7 +3451,7 @@ public $yystack = array(); array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'property'); } - #line 1144 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1144 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r163() { @@ -3288,14 +3460,14 @@ public $yystack = array(); 'property'); } - #line 1148 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1148 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r164() { $this->_retvalue = ' ' . trim($this->yystack[ $this->yyidx + 0 ]->minor) . ' '; } - #line 1167 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1167 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r165() { @@ -3318,7 +3490,7 @@ public $yystack = array(); $this->_retvalue = $lops[ $op ]; } - #line 1180 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1180 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r166() { @@ -3334,7 +3506,7 @@ public $yystack = array(); $this->_retvalue = $tlops[ $op ]; } - #line 1194 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1194 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r167() { @@ -3348,21 +3520,21 @@ public $yystack = array(); $this->_retvalue = $scond[ $op ]; } - #line 1202 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1202 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r168() { $this->_retvalue = 'array(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 1210 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1210 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r170() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . ',' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1214 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1214 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r172() { @@ -3370,7 +3542,7 @@ public $yystack = array(); $this->yystack[ $this->yyidx + -2 ]->minor . '=>' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1230 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1230 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r173() { @@ -3378,7 +3550,7 @@ public $yystack = array(); '\'' . $this->yystack[ $this->yyidx + -2 ]->minor . '\'=>' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1236 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1236 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r176() { @@ -3386,7 +3558,7 @@ public $yystack = array(); $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor->to_smarty_php($this); } - #line 1241 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1241 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r177() { @@ -3394,21 +3566,21 @@ public $yystack = array(); $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 1245 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1245 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r178() { $this->_retvalue = new Smarty_Internal_ParseTree_Dq($this, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1249 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1249 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r179() { $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)' . $this->yystack[ $this->yyidx + -1 ]->minor); } - #line 1253 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1253 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r180() { @@ -3416,16 +3588,18 @@ public $yystack = array(); new Smarty_Internal_ParseTree_Code('(string)(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'); } - #line 1265 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1265 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r181() { - $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\'' . + $this->_retvalue = new Smarty_Internal_ParseTree_Code( + '(string)$_smarty_tpl->tpl_vars[\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . - '\']->value'); + '\']->value' + ); } - #line 1269 "../smarty/lexer/smarty_internal_templateparser.y" + // line 1269 "../smarty/lexer/smarty_internal_templateparser.y" function yy_r184() { @@ -3440,12 +3614,15 @@ public $yystack = array(); public function yy_reduce($yyruleno) { if ($this->yyTraceFILE && $yyruleno >= 0 - && $yyruleno < count(self::$yyRuleName)) { - fprintf($this->yyTraceFILE, - "%sReduce (%d) [%s].\n", - $this->yyTracePrompt, - $yyruleno, - self::$yyRuleName[ $yyruleno ]); + && $yyruleno < count(self::$yyRuleName) + ) { + fprintf( + $this->yyTraceFILE, + "%sReduce (%d) [%s].\n", + $this->yyTracePrompt, + $yyruleno, + self::$yyRuleName[ $yyruleno ] + ); } $this->_retvalue = $yy_lefthand_side = null; if (isset(self::$yyReduceMap[ $yyruleno ])) { @@ -3490,7 +3667,7 @@ public $yystack = array(); public function yy_syntax_error($yymajor, $TOKEN) { - #line 214 "../smarty/lexer/smarty_internal_templateparser.y" + // line 214 "../smarty/lexer/smarty_internal_templateparser.y" $this->internalError = true; $this->yymajor = $yymajor; $this->compiler->trigger_template_error(); @@ -3504,7 +3681,7 @@ public $yystack = array(); while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 207 "../smarty/lexer/smarty_internal_templateparser.y" + // line 207 "../smarty/lexer/smarty_internal_templateparser.y" $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; @@ -3524,15 +3701,18 @@ public $yystack = array(); } $yyendofinput = ($yymajor == 0); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sInput %s\n", - $this->yyTracePrompt, - $this->yyTokenName[ $yymajor ]); + fprintf( + $this->yyTraceFILE, + "%sInput %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ] + ); } do { $yyact = $this->yy_find_shift_action($yymajor); - if ($yymajor < self::YYERRORSYMBOL && - !$this->yy_is_expected_token($yymajor)) { + if ($yymajor < self::YYERRORSYMBOL + && !$this->yy_is_expected_token($yymajor) + ) { // force a syntax error $yyact = self::YY_ERROR_ACTION; } @@ -3548,9 +3728,11 @@ public $yystack = array(); $this->yy_reduce($yyact - self::YYNSTATE); } else if ($yyact === self::YY_ERROR_ACTION) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sSyntax Error!\n", - $this->yyTracePrompt); + fprintf( + $this->yyTraceFILE, + "%sSyntax Error!\n", + $this->yyTracePrompt + ); } if (self::YYERRORSYMBOL) { if ($this->yyerrcnt < 0) { @@ -3559,10 +3741,12 @@ public $yystack = array(); $yymx = $this->yystack[ $this->yyidx ]->major; if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sDiscard input token %s\n", - $this->yyTracePrompt, - $this->yyTokenName[ $yymajor ]); + fprintf( + $this->yyTraceFILE, + "%sDiscard input token %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ] + ); } $this->yy_destructor($yymajor, $yytokenvalue); $yymajor = self::YYNOCODE; diff --git a/libs/sysplugins/smarty_internal_testinstall.php b/libs/sysplugins/smarty_internal_testinstall.php index bea8b3a8..44f94098 100644 --- a/libs/sysplugins/smarty_internal_testinstall.php +++ b/libs/sysplugins/smarty_internal_testinstall.php @@ -21,7 +21,7 @@ class Smarty_Internal_TestInstall * If $errors is secified, the diagnostic report will be appended to the array, rather than being output. * * @param \Smarty $smarty - * @param array $errors array to push results into rather than outputting them + * @param array $errors array to push results into rather than outputting them * * @return bool status, true if everything is fine, false else */ diff --git a/libs/sysplugins/smarty_internal_undefined.php b/libs/sysplugins/smarty_internal_undefined.php index d6f4bf62..b5d35075 100644 --- a/libs/sysplugins/smarty_internal_undefined.php +++ b/libs/sysplugins/smarty_internal_undefined.php @@ -32,9 +32,9 @@ class Smarty_Internal_Undefined /** * Wrapper for obsolete class Smarty_Internal_Runtime_ValidateCompiled * - * @param \Smarty_Internal_Template $tpl - * @param array $properties special template properties - * @param bool $cache flag if called from cache file + * @param \Smarty_Internal_Template $tpl + * @param array $properties special template properties + * @param bool $cache flag if called from cache file * * @return bool false */ @@ -65,4 +65,4 @@ class Smarty_Internal_Undefined throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method"); } } -}
\ No newline at end of file +} diff --git a/libs/sysplugins/smarty_resource.php b/libs/sysplugins/smarty_resource.php index b76b9c78..fa1c1e42 100644 --- a/libs/sysplugins/smarty_resource.php +++ b/libs/sysplugins/smarty_resource.php @@ -53,8 +53,8 @@ abstract class Smarty_Resource /** * Load Resource Handler * - * @param Smarty $smarty smarty object - * @param string $type name of the resource + * @param Smarty $smarty smarty object + * @param string $type name of the resource * * @throws SmartyException * @return Smarty_Resource Resource Handler @@ -82,9 +82,11 @@ abstract class Smarty_Resource if (class_exists($_resource_class, false)) { return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class(); } else { - $smarty->registerResource($type, - array("smarty_resource_{$type}_source", "smarty_resource_{$type}_timestamp", - "smarty_resource_{$type}_secure", "smarty_resource_{$type}_trusted")); + $smarty->registerResource( + $type, + array("smarty_resource_{$type}_source", "smarty_resource_{$type}_timestamp", + "smarty_resource_{$type}_secure", "smarty_resource_{$type}_trusted") + ); // give it another try, now that the resource is registered properly return self::load($smarty, $type); } @@ -105,10 +107,11 @@ abstract class Smarty_Resource /** * extract resource_type and resource_name from template_resource and config_resource + * * @note "C:/foo.tpl" was forced to file resource up till Smarty 3.1.3 (including). * - * @param string $resource_name template_resource or config_resource to parse - * @param string $default_resource the default resource_type defined in $smarty + * @param string $resource_name template_resource or config_resource to parse + * @param string $default_resource the default resource_type defined in $smarty * * @return array with parsed resource name and type */ @@ -129,8 +132,8 @@ abstract class Smarty_Resource /** * modify template_resource according to resource handlers specifications * - * @param \Smarty_Internal_Template|\Smarty $obj Smarty instance - * @param string $template_resource template_resource to extract resource handler and name of + * @param \Smarty_Internal_Template|\Smarty $obj Smarty instance + * @param string $template_resource template_resource to extract resource handler and name of * * @return string unique resource name * @throws \SmartyException @@ -143,8 +146,8 @@ abstract class Smarty_Resource $resource = Smarty_Resource::load($smarty, $type); // go relative to a given template? $_file_is_dotted = $name[ 0 ] === '.' && ($name[ 1 ] === '.' || $name[ 1 ] === '/'); - if ($obj->_isTplObj() && $_file_is_dotted && - ($obj->source->type === 'file' || $obj->parent->source->type === 'extends') + if ($obj->_isTplObj() && $_file_is_dotted + && ($obj->source->type === 'file' || $obj->parent->source->type === 'extends') ) { $name = $smarty->_realpath(dirname($obj->parent->source->filepath) . DIRECTORY_SEPARATOR . $name); } @@ -156,24 +159,24 @@ abstract class Smarty_Resource * wrapper for backward compatibility to versions < 3.1.22 * 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 + * @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 source(Smarty_Internal_Template $_template = null, - Smarty $smarty = null, - $template_resource = null) - { + Smarty $smarty = null, + $template_resource = null + ) { return Smarty_Template_Source::load($_template, $smarty, $template_resource); } /** * Load template's source into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -201,9 +204,9 @@ abstract class Smarty_Resource /** * modify resource_name according to resource handlers specifications * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource * * @return string unique resource name */ @@ -232,7 +235,7 @@ abstract class Smarty_Resource /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ diff --git a/libs/sysplugins/smarty_resource_custom.php b/libs/sysplugins/smarty_resource_custom.php index 77f619ec..37580a1b 100644 --- a/libs/sysplugins/smarty_resource_custom.php +++ b/libs/sysplugins/smarty_resource_custom.php @@ -30,7 +30,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource * {@internal implementing this method is optional. * Only implement it if modification times can be accessed faster than loading the complete template source.}} * - * @param string $name template name + * @param string $name template name * * @return integer|boolean timestamp (epoch) the template was modified, or false if not found */ @@ -47,7 +47,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource */ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) { - $source->filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25); + $source->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); @@ -66,7 +66,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource /** * Load template's source into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -84,12 +84,12 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @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)); + return basename(substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25)); } } diff --git a/libs/sysplugins/smarty_resource_recompiled.php b/libs/sysplugins/smarty_resource_recompiled.php index 322cdabf..2d909e5c 100644 --- a/libs/sysplugins/smarty_resource_recompiled.php +++ b/libs/sysplugins/smarty_resource_recompiled.php @@ -68,8 +68,8 @@ abstract class Smarty_Resource_Recompiled extends Smarty_Resource /** * populate Compiled Object with compiled filepath * - * @param Smarty_Template_Compiled $compiled compiled object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Compiled $compiled compiled object + * @param Smarty_Internal_Template $_template template object * * @return void */ diff --git a/libs/sysplugins/smarty_security.php b/libs/sysplugins/smarty_security.php index 5378c390..5e57af01 100644 --- a/libs/sysplugins/smarty_security.php +++ b/libs/sysplugins/smarty_security.php @@ -263,16 +263,16 @@ class Smarty_Security /** * Check if PHP function is trusted. * - * @param string $function_name - * @param object $compiler compiler object + * @param string $function_name + * @param object $compiler compiler object * * @return boolean true if function is trusted * @throws SmartyCompilerException if php function is not trusted */ public function isTrustedPhpFunction($function_name, $compiler) { - if (isset($this->php_functions) && - (empty($this->php_functions) || in_array($function_name, $this->php_functions)) + if (isset($this->php_functions) + && (empty($this->php_functions) || in_array($function_name, $this->php_functions)) ) { return true; } @@ -285,16 +285,16 @@ class Smarty_Security /** * Check if static class is trusted. * - * @param string $class_name - * @param object $compiler compiler object + * @param string $class_name + * @param object $compiler compiler object * * @return boolean true if class is trusted * @throws SmartyCompilerException if static class is not trusted */ public function isTrustedStaticClass($class_name, $compiler) { - if (isset($this->static_classes) && - (empty($this->static_classes) || in_array($class_name, $this->static_classes)) + if (isset($this->static_classes) + && (empty($this->static_classes) || in_array($class_name, $this->static_classes)) ) { return true; } @@ -307,9 +307,9 @@ class Smarty_Security /** * Check if static class method/property is trusted. * - * @param string $class_name - * @param string $params - * @param object $compiler compiler object + * @param string $class_name + * @param string $params + * @param object $compiler compiler object * * @return boolean true if class method is trusted * @throws SmartyCompilerException if static class method is not trusted @@ -333,8 +333,8 @@ class Smarty_Security // fall back return $this->isTrustedStaticClass($class_name, $compiler); } - if (isset($allowed[ $class_name ]) && - (empty($allowed[ $class_name ]) || in_array($name, $allowed[ $class_name ])) + if (isset($allowed[ $class_name ]) + && (empty($allowed[ $class_name ]) || in_array($name, $allowed[ $class_name ])) ) { return true; } @@ -346,16 +346,16 @@ class Smarty_Security /** * Check if PHP modifier is trusted. * - * @param string $modifier_name - * @param object $compiler compiler object + * @param string $modifier_name + * @param object $compiler compiler object * * @return boolean true if modifier is trusted * @throws SmartyCompilerException if modifier is not trusted */ public function isTrustedPhpModifier($modifier_name, $compiler) { - if (isset($this->php_modifiers) && - (empty($this->php_modifiers) || in_array($modifier_name, $this->php_modifiers)) + if (isset($this->php_modifiers) + && (empty($this->php_modifiers) || in_array($modifier_name, $this->php_modifiers)) ) { return true; } @@ -368,8 +368,8 @@ class Smarty_Security /** * Check if tag is trusted. * - * @param string $tag_name - * @param object $compiler compiler object + * @param string $tag_name + * @param object $compiler compiler object * * @return boolean true if tag is trusted * @throws SmartyCompilerException if modifier is not trusted @@ -377,11 +377,14 @@ class Smarty_Security public function isTrustedTag($tag_name, $compiler) { // check for internal always required tags - if (in_array($tag_name, - array('assign', 'call', 'private_filter', 'private_block_plugin', 'private_function_plugin', + if (in_array( + $tag_name, + array('assign', 'call', 'private_filter', 'private_block_plugin', 'private_function_plugin', 'private_object_block_function', 'private_object_function', 'private_registered_function', 'private_registered_block', 'private_special_variable', 'private_print_expression', - 'private_modifier'))) { + 'private_modifier') + ) + ) { return true; } // check security settings @@ -403,8 +406,8 @@ class Smarty_Security /** * Check if special $smarty variable is trusted. * - * @param string $var_name - * @param object $compiler compiler object + * @param string $var_name + * @param object $compiler compiler object * * @return boolean true if tag is trusted * @throws SmartyCompilerException if modifier is not trusted @@ -414,8 +417,10 @@ class Smarty_Security if (!in_array($var_name, $this->disabled_special_smarty_vars)) { return true; } else { - $compiler->trigger_template_error("special variable '\$smarty.{$var_name}' not allowed by security setting", - null, true); + $compiler->trigger_template_error( + "special variable '\$smarty.{$var_name}' not allowed by security setting", + null, true + ); } return false; // should not, but who knows what happens to the compiler in the future? @@ -424,8 +429,8 @@ class Smarty_Security /** * Check if modifier plugin is trusted. * - * @param string $modifier_name - * @param object $compiler compiler object + * @param string $modifier_name + * @param object $compiler compiler object * * @return boolean true if tag is trusted * @throws SmartyCompilerException if modifier is not trusted @@ -441,16 +446,20 @@ class Smarty_Security if (empty($this->disabled_modifiers) || !in_array($modifier_name, $this->disabled_modifiers)) { return true; } else { - $compiler->trigger_template_error("modifier '{$modifier_name}' disabled by security setting", null, - true); + $compiler->trigger_template_error( + "modifier '{$modifier_name}' disabled by security setting", null, + true + ); } - } elseif (in_array($modifier_name, $this->allowed_modifiers) && - !in_array($modifier_name, $this->disabled_modifiers) + } elseif (in_array($modifier_name, $this->allowed_modifiers) + && !in_array($modifier_name, $this->disabled_modifiers) ) { return true; } else { - $compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting", null, - true); + $compiler->trigger_template_error( + "modifier '{$modifier_name}' not allowed by security setting", null, + true + ); } return false; // should not, but who knows what happens to the compiler in the future? @@ -459,8 +468,8 @@ class Smarty_Security /** * Check if constants are enabled or trusted * - * @param string $const constant name - * @param object $compiler compiler object + * @param string $const constant name + * @param object $compiler compiler object * * @return bool */ @@ -486,7 +495,7 @@ class Smarty_Security /** * Check if stream is trusted. * - * @param string $stream_name + * @param string $stream_name * * @return boolean true if stream is trusted * @throws SmartyException if stream is not trusted @@ -503,7 +512,7 @@ class Smarty_Security /** * Check if directory of file resource is trusted. * - * @param string $filepath + * @param string $filepath * @param null|bool $isConfig * * @return bool true if directory is trusted @@ -521,28 +530,28 @@ class Smarty_Security } $_dir = $this->smarty->getTemplateDir(); - if ($this->_template_dir !== $_dir) { - $this->_updateResourceDir($this->_template_dir, $_dir); - $this->_template_dir = $_dir; - } + if ($this->_template_dir !== $_dir) { + $this->_updateResourceDir($this->_template_dir, $_dir); + $this->_template_dir = $_dir; + } $_dir = $this->smarty->getConfigDir(); - if ($this->_config_dir !== $_dir) { - $this->_updateResourceDir($this->_config_dir, $_dir); - $this->_config_dir = $_dir; - } + if ($this->_config_dir !== $_dir) { + $this->_updateResourceDir($this->_config_dir, $_dir); + $this->_config_dir = $_dir; + } if ($this->_secure_dir !== $this->secure_dir) { $this->secure_dir = (array)$this->secure_dir; foreach($this->secure_dir as $k => $d) { - $this->secure_dir[$k] = $this->smarty->_realpath($d. DIRECTORY_SEPARATOR,true); + $this->secure_dir[$k] = $this->smarty->_realpath($d. DIRECTORY_SEPARATOR, true); } $this->_updateResourceDir($this->_secure_dir, $this->secure_dir); $this->_secure_dir = $this->secure_dir; } $addPath = $this->_checkDir($filepath, $this->_resource_dir); if ($addPath !== false) { - $this->_resource_dir = array_merge($this->_resource_dir, $addPath); + $this->_resource_dir = array_merge($this->_resource_dir, $addPath); } return true; } @@ -553,11 +562,11 @@ class Smarty_Security * So "http://username:password@hello.world.example.org:8080/some-path?some=query-string" * is reduced to "http://hello.world.example.org" prior to applying the patters from {@link $trusted_uri}. * - * @param string $uri + * @param string $uri * * @return boolean true if URI is trusted * @throws SmartyException if URI is not trusted - * @uses $trusted_uri for list of patterns to match against $uri + * @uses $trusted_uri for list of patterns to match against $uri */ public function isTrustedUri($uri) { @@ -577,7 +586,7 @@ class Smarty_Security /** * Check if directory of file resource is trusted. * - * @param string $filepath + * @param string $filepath * * @return boolean true if directory is trusted * @throws SmartyException if PHP directory is not trusted @@ -600,7 +609,7 @@ class Smarty_Security } $addPath = $this->_checkDir($filepath, $this->_php_resource_dir); if ($addPath !== false) { - $this->_php_resource_dir = array_merge($this->_php_resource_dir, $addPath); + $this->_php_resource_dir = array_merge($this->_php_resource_dir, $addPath); } return true; } @@ -611,18 +620,19 @@ class Smarty_Security * @param array $oldDir * @param array $newDir */ - private function _updateResourceDir($oldDir, $newDir) { + private function _updateResourceDir($oldDir, $newDir) + { foreach ($oldDir as $directory) { - // $directory = $this->smarty->_realpath($directory, true); + // $directory = $this->smarty->_realpath($directory, true); $length = strlen($directory); foreach ($this->_resource_dir as $dir) { - if (substr($dir, 0,$length) === $directory) { + if (substr($dir, 0, $length) === $directory) { unset($this->_resource_dir[ $dir ]); } } } foreach ($newDir as $directory) { - // $directory = $this->smarty->_realpath($directory, true); + // $directory = $this->smarty->_realpath($directory, true); $this->_resource_dir[ $directory ] = true; } } @@ -630,7 +640,7 @@ class Smarty_Security * Check if file is inside a valid directory * * @param string $filepath - * @param array $dirs valid directories + * @param array $dirs valid directories * * @return array|bool * @throws \SmartyException @@ -639,32 +649,32 @@ class Smarty_Security { $directory = dirname($this->smarty->_realpath($filepath, true)) . DIRECTORY_SEPARATOR; $_directory = array(); - if (!preg_match('#[\\\\/][.][.][\\\\/]#',$directory)) { + if (!preg_match('#[\\\\/][.][.][\\\\/]#', $directory)) { while (true) { - // test if the directory is trusted - if (isset($dirs[ $directory ])) { - return $_directory; - } - // abort if we've reached root - if (!preg_match('#[\\\\/][^\\\\/]+[\\\\/]$#', $directory)) { - // give up - break; - } - // remember the directory to add it to _resource_dir in case we're successful - $_directory[ $directory ] = true; - // bubble up one level - $directory = preg_replace('#[\\\\/][^\\\\/]+[\\\\/]$#', DIRECTORY_SEPARATOR, $directory); + // test if the directory is trusted + if (isset($dirs[ $directory ])) { + return $_directory; + } + // abort if we've reached root + if (!preg_match('#[\\\\/][^\\\\/]+[\\\\/]$#', $directory)) { + // give up + break; + } + // remember the directory to add it to _resource_dir in case we're successful + $_directory[ $directory ] = true; + // bubble up one level + $directory = preg_replace('#[\\\\/][^\\\\/]+[\\\\/]$#', DIRECTORY_SEPARATOR, $directory); } } // give up - throw new SmartyException(sprintf('Smarty Security: not trusted file path \'%s\' ',$filepath)); + throw new SmartyException(sprintf('Smarty Security: not trusted file path \'%s\' ', $filepath)); } /** * Loads security class and enables security * - * @param \Smarty $smarty - * @param string|Smarty_Security $security_class if a string is used, it must be class-name + * @param \Smarty $smarty + * @param string|Smarty_Security $security_class if a string is used, it must be class-name * * @return \Smarty current Smarty instance for chaining * @throws \SmartyException when an invalid class name is provided @@ -705,7 +715,6 @@ class Smarty_Security /** * Exit template processing - * */ public function endTemplate() { diff --git a/libs/sysplugins/smarty_template_cached.php b/libs/sysplugins/smarty_template_cached.php index 45c83c89..981d527c 100644 --- a/libs/sysplugins/smarty_template_cached.php +++ b/libs/sysplugins/smarty_template_cached.php @@ -92,7 +92,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base $this->cache_id = $_template->cache_id; $this->source = $_template->source; if (!class_exists('Smarty_CacheResource', false)) { - require SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php'; + include SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php'; } $this->handler = Smarty_CacheResource::load($_template->smarty); } @@ -118,7 +118,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base * Render cache template * * @param \Smarty_Internal_Template $_template - * @param bool $no_output_filter + * @param bool $no_output_filter * * @throws \Exception */ @@ -163,14 +163,14 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base } else { $this->valid = true; } - if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_CURRENT && - $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime) + 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 + if ($this->valid && $_template->compile_check === Smarty::COMPILECHECK_ON + && $_template->source->getTimeStamp() > $this->timestamp ) { $this->valid = false; } @@ -204,9 +204,9 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base } 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)) + 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; } diff --git a/libs/sysplugins/smarty_template_compiled.php b/libs/sysplugins/smarty_template_compiled.php index 7ca2ebcb..b020f652 100644 --- a/libs/sysplugins/smarty_template_compiled.php +++ b/libs/sysplugins/smarty_template_compiled.php @@ -7,7 +7,7 @@ * @package Smarty * @subpackage TemplateResources * @author Rodney Rehm - * @property string $content compiled content + * @property string $content compiled content */ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base { @@ -21,7 +21,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base /** * get a Compiled Object of this source * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return Smarty_Template_Compiled compiled object */ @@ -135,8 +135,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base 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()) + if (!$this->exists || $smarty->force_compile + || ($_smarty_tpl->compile_check && $source->getTimeStamp() > $this->getTimeStamp()) ) { $this->compileTemplateSource($_smarty_tpl); $compileCheck = $_smarty_tpl->compile_check; @@ -145,7 +145,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base $_smarty_tpl->compile_check = $compileCheck; } else { $_smarty_tpl->mustCompile = true; - @include($this->filepath); + @include $this->filepath; if ($_smarty_tpl->mustCompile) { $this->compileTemplateSource($_smarty_tpl); $compileCheck = $_smarty_tpl->compile_check; @@ -252,7 +252,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base if (defined('HHVM_VERSION')) { eval('?>' . file_get_contents($this->filepath)); } else { - include($this->filepath); + include $this->filepath; } } } diff --git a/libs/sysplugins/smarty_template_config.php b/libs/sysplugins/smarty_template_config.php index 44cdba6f..c61d0d95 100644 --- a/libs/sysplugins/smarty_template_config.php +++ b/libs/sysplugins/smarty_template_config.php @@ -14,7 +14,6 @@ * @package Smarty * @subpackage TemplateResources * @author Uwe Tews - * */ class Smarty_Template_Config extends Smarty_Template_Source { @@ -64,16 +63,16 @@ class Smarty_Template_Config extends Smarty_Template_Source * 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 + * @param Smarty_Internal_Template $_template template object + * @param Smarty $smarty smarty object + * @param string $template_resource resource identifier * * @return Smarty_Template_Config Source Object * @throws SmartyException */ public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null, - $template_resource = null) - { + $template_resource = null + ) { static $_incompatible_resources = array('extends' => true, 'php' => true); if ($_template) { $smarty = $_template->smarty; @@ -86,7 +85,7 @@ class Smarty_Template_Config extends Smarty_Template_Source list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $smarty->default_config_type); // make sure configs are not loaded via anything smarty can't handle if (isset($_incompatible_resources[ $type ])) { - throw new SmartyException ("Unable to use resource '{$type}' for config"); + throw new SmartyException("Unable to use resource '{$type}' for config"); } $source = new Smarty_Template_Config($smarty, $template_resource, $type, $name); $source->handler->populate($source, $_template); diff --git a/libs/sysplugins/smarty_template_resource_base.php b/libs/sysplugins/smarty_template_resource_base.php index 951e02af..8b4a3313 100644 --- a/libs/sysplugins/smarty_template_resource_base.php +++ b/libs/sysplugins/smarty_template_resource_base.php @@ -99,7 +99,7 @@ abstract class Smarty_Template_Resource_Base * get rendered template content by calling compiled or cached template code * * @param \Smarty_Internal_Template $_template - * @param string $unifunc function with template code + * @param string $unifunc function with template code * * @throws \Exception */ diff --git a/libs/sysplugins/smarty_template_source.php b/libs/sysplugins/smarty_template_source.php index 4868706c..4ba188ec 100644 --- a/libs/sysplugins/smarty_template_source.php +++ b/libs/sysplugins/smarty_template_source.php @@ -7,7 +7,6 @@ * @package Smarty * @subpackage TemplateResources * @author Rodney Rehm - * */ class Smarty_Template_Source { @@ -131,7 +130,7 @@ class Smarty_Template_Source * @param string $type type of resource * @param string $name resource name * - * @throws \SmartyException + * @throws \SmartyException * @internal param \Smarty_Resource $handler Resource Handler this source object communicates with */ public function __construct(Smarty $smarty, $resource, $type, $name) @@ -149,16 +148,16 @@ class Smarty_Template_Source * 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 + * @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) - { + $template_resource = null + ) { if ($_template) { $smarty = $_template->smarty; $template_resource = $_template->template_resource; diff --git a/libs/sysplugins/smarty_undefined_variable.php b/libs/sysplugins/smarty_undefined_variable.php index e064f655..ee6c8fcb 100644 --- a/libs/sysplugins/smarty_undefined_variable.php +++ b/libs/sysplugins/smarty_undefined_variable.php @@ -12,7 +12,7 @@ class Smarty_Undefined_Variable extends Smarty_Variable /** * Returns null for not existing properties * - * @param string $name + * @param string $name * * @return null */ |
