- correction of PHPDoc blocks

- minor code cleanup
This commit is contained in:
Uwe Tews
2017-10-26 10:25:41 +02:00
parent 812758225c
commit dd9c076dfa
76 changed files with 613 additions and 141 deletions

View File

@@ -6,6 +6,8 @@
as Smarty does no longer use error suppression like @filemtime().
for backward compatibility code is moved from Smarty class to an external class and still can be
called.
- correction of PHPDoc blocks
- minor code cleanup
21.10.2017
- bugfix custom delimiters could fail since modification of version 3.1.32-dev-23

View File

@@ -34,6 +34,9 @@
* Sets SMARTY_DIR only if user application has not already defined it.
*/
if (!defined('SMARTY_DIR')) {
/**
*
*/
define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
}
/**
@@ -41,12 +44,21 @@ if (!defined('SMARTY_DIR')) {
* Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it.
*/
if (!defined('SMARTY_SYSPLUGINS_DIR')) {
/**
*
*/
define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR);
}
if (!defined('SMARTY_PLUGINS_DIR')) {
/**
*
*/
define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DIRECTORY_SEPARATOR);
}
if (!defined('SMARTY_MBSTRING')) {
/**
*
*/
define('SMARTY_MBSTRING', function_exists('mb_get_info'));
}
if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
@@ -100,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.32-dev-30';
const SMARTY_VERSION = '3.1.32-dev-31';
/**
* define variable scopes
*/
@@ -620,7 +632,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* Enable error handler to mute expected messages
*
* @return void
* @return boolean
* @deprecated
*/
public static function muteExpectedErrors()
@@ -643,7 +655,8 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @param string $resource_name template name
*
* @return boolean status
* @return bool status
* @throws \SmartyException
*/
public function templateExists($resource_name)
{
@@ -922,7 +935,8 @@ class Smarty extends Smarty_Internal_TemplateBase
* @param object $parent next higher level of Smarty variables
* @param boolean $do_clone flag is Smarty object shall be cloned
*
* @return object template object
* @return object template object
* @throws \SmartyException
*/
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
{
@@ -1002,6 +1016,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* @param \Smarty_Internal_Template $template
*
* @return string
* @throws \SmartyException
*/
public function _getTemplateId($template_name,
$cache_id = null,
@@ -1259,6 +1274,16 @@ class Smarty extends Smarty_Internal_TemplateBase
Smarty_Internal_TestInstall::testInstall($this, $errors);
}
/**
* Get Smarty object
*
* @return Smarty
*/
public function _getSmartyObj()
{
return $this;
}
/**
* <<magic>> Generic getter.
* Calls the appropriate getter function.

View File

@@ -100,6 +100,8 @@ class SmartyBC extends Smarty
* @param string $function_impl the name of the PHP function to register
* @param bool $cacheable
* @param mixed $cache_attrs
*
* @throws \SmartyException
*/
public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
{
@@ -153,6 +155,8 @@ class SmartyBC extends Smarty
* @param string $block_impl PHP function to register
* @param bool $cacheable
* @param mixed $cache_attrs
*
* @throws \SmartyException
*/
public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
{
@@ -175,6 +179,8 @@ class SmartyBC extends Smarty
* @param string $function name of template function
* @param string $function_impl name of PHP function to register
* @param bool $cacheable
*
* @throws \SmartyException
*/
public function register_compiler_function($function, $function_impl, $cacheable = true)
{
@@ -196,6 +202,8 @@ class SmartyBC extends Smarty
*
* @param string $modifier name of template modifier
* @param string $modifier_impl name of PHP function to register
*
* @throws \SmartyException
*/
public function register_modifier($modifier, $modifier_impl)
{
@@ -238,6 +246,8 @@ class SmartyBC extends Smarty
* to a template before compiling
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_prefilter($function)
{
@@ -259,6 +269,8 @@ class SmartyBC extends Smarty
* to a compiled template after compilation
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_postfilter($function)
{
@@ -280,6 +292,8 @@ class SmartyBC extends Smarty
* to a template output
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_outputfilter($function)
{
@@ -301,6 +315,8 @@ class SmartyBC extends Smarty
*
* @param string $type filter type
* @param string $name filter name
*
* @throws \SmartyException
*/
public function load_filter($type, $name)
{
@@ -341,7 +357,9 @@ class SmartyBC extends Smarty
* @param string $cache_id
* @param string $compile_id
*
* @return boolean
* @return bool
* @throws \Exception
* @throws \SmartyException
*/
public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
{
@@ -377,7 +395,8 @@ class SmartyBC extends Smarty
*
* @param string $tpl_file
*
* @return boolean
* @return bool
* @throws \SmartyException
*/
public function template_exists($tpl_file)
{

View File

@@ -179,9 +179,21 @@ function smarty_function_html_checkboxes($params, $template)
return implode("\n", $_html_result);
}
}
/**
* @param $name
* @param $value
* @param $output
* @param $selected
* @param $extra
* @param $separator
* @param $labels
* @param $label_ids
* @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 = '';

View File

@@ -157,7 +157,16 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat
return $_html_result;
}
/**
* @param $key
* @param $value
* @param $selected
* @param $id
* @param $class
* @param $idx
*
* @return string
*/
function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
{
if (!is_array($value)) {
@@ -196,7 +205,16 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
return $_html_result;
}
/**
* @param $key
* @param $values
* @param $selected
* @param $id
* @param $class
* @param $idx
*
* @return string
*/
function smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)
{
$optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";

View File

@@ -166,9 +166,21 @@ function smarty_function_html_radios($params, $template)
return implode("\n", $_html_result);
}
}
/**
* @param $name
* @param $value
* @param $output
* @param $selected
* @param $extra
* @param $separator
* @param $labels
* @param $label_ids
* @param $escape
*
* @return string
*/
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids,
$escape)
$escape)
{
$_output = '';

View File

@@ -163,7 +163,13 @@ function smarty_function_html_table($params)
return $output;
}
/**
* @param $name
* @param $var
* @param $no
*
* @return string
*/
function smarty_function_html_table_cycle($name, $var, $no)
{
if (!is_array($var)) {

View File

@@ -80,21 +80,38 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
*
* @author Kyle Renfrow
*/
/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_mbconvert_cb($matches)
{
return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
}
/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_mbconvert2_cb($matches)
{
return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
}
/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_ucfirst_cb($matches)
{
return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ]));
}
/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_ucfirst2_cb($matches)
{
return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 3 ]));

View File

@@ -26,7 +26,6 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
{
static $_double_encode = null;
static $is_loaded1 = false;
static $is_loaded2 = false;
if ($_double_encode === null) {
$_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
}

View File

@@ -5,7 +5,6 @@
* @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty wordwrap modifier plugin
* Type: modifier<br>
@@ -15,10 +14,11 @@
* @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
* @param $compiler
* @param array $params parameters
* @param \Smarty_Internal_TemplateCompilerBase $compiler
*
* @return string with compiled code
* @throws \SmartyException
*/
function smarty_modifiercompiler_wordwrap($params, Smarty_Internal_TemplateCompilerBase $compiler)
{

View File

@@ -6,14 +6,13 @@
* @subpackage PluginsShared
*/
if (!function_exists('smarty_mb_str_replace')) {
/**
* Multibyte string replace
*
* @param string $search the string to be searched
* @param 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
@@ -29,7 +28,7 @@ if (!function_exists('smarty_mb_str_replace')) {
$string = smarty_mb_str_replace($search, $replace, $string, $c);
$count += $c;
}
} elseif (is_array($search)) {
} else if (is_array($search)) {
if (!is_array($replace)) {
foreach ($search as &$string) {
$subject = smarty_mb_str_replace($string, $replace, $subject, $c);
@@ -37,7 +36,7 @@ if (!function_exists('smarty_mb_str_replace')) {
}
} else {
$n = max(count($search), count($replace));
while ($n --) {
while ($n--) {
$subject = smarty_mb_str_replace(current($search), current($replace), $subject, $c);
$count += $c;
next($search);
@@ -49,7 +48,6 @@ if (!function_exists('smarty_mb_str_replace')) {
$count = count($parts) - 1;
$subject = implode($replace, $parts);
}
return $subject;
}
}

View File

@@ -204,7 +204,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
* @param string $compile_id compile id
* @param integer $exp_time expiration time (number of seconds, not timestamp)
*
* @return integer number of cache files deleted
* @return int number of cache files deleted
* @throws \SmartyException
*/
public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
{

View File

@@ -180,7 +180,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
* @param string $compile_id compile id
* @param integer $exp_time expiration time [being ignored]
*
* @return integer number of cache files deleted [always -1]
* @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

View File

@@ -106,7 +106,8 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
* @param Smarty_Internal_Template $_template template object
* @param string $content content to cache
*
* @return boolean success
* @return bool success
* @throws \SmartyException
*/
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
{

View File

@@ -24,6 +24,7 @@ class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign
* @param array $parameter array with compilation parameter
*
* @return string compiled code
* @throws \SmartyCompilerException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
{

View File

@@ -57,13 +57,12 @@ 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
*
* @return string compiled code
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
if (!isset($compiler->_cache['blockNesting'])) {
$compiler->_cache['blockNesting'] = 0;
@@ -151,13 +150,13 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
/**
* 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
*
* @return string compiled code
* @internal param array $parameter array with compilation parameter
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block'));
// init block parameter

View File

@@ -35,13 +35,13 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase
/**
* Compiles code for the {break} 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
*
* @return string compiled code
* @throws \SmartyCompilerException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
list($levels, $foreachLevels) = $this->checkLevels($args, $compiler);
$output = "<?php\n";

View File

@@ -16,18 +16,17 @@
*/
class Smarty_Internal_Compile_Continue extends Smarty_Internal_Compile_Break
{
/**
* Compiles code for the {continue} 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
*
* @return string compiled code
* @throws \SmartyCompilerException
* @internal param array $parameter array with compilation parameter
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
list($levels, $foreachLevels) = $this->checkLevels($args, $compiler, 'continue');
$output = "<?php\n";

View File

@@ -95,6 +95,9 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh
*
* @param \Smarty_Internal_TemplateCompilerBase $compiler
* @param null|string $template optional inheritance parent template
*
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
private function compileEndChild(Smarty_Internal_TemplateCompilerBase $compiler, $template = null)
{
@@ -117,6 +120,9 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh
*
* @param \Smarty_Internal_TemplateCompilerBase $compiler
* @param string $template subtemplate name
*
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $template)
{

View File

@@ -78,14 +78,14 @@ 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 \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
*
* @return string compiled code
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
$compiler->loopNesting ++;
// init
@@ -277,13 +277,12 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase
/**
* Compiles code for the {foreachelse} 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
*
* @return string compiled code
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
@@ -310,13 +309,13 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase
/**
* Compiles code for the {/foreach} 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
*
* @return string compiled code
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
* @throws \SmartyCompilerException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
$compiler->loopNesting --;
// must endblock be nocache?

View File

@@ -44,14 +44,13 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase
/**
* Compiles code for the {function} 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
*
* @return bool true
* @throws \SmartyCompilerException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
@@ -91,13 +90,12 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
/**
* Compiles code for the {/function} tag
*
* @param array $args array with attributes from parser
* @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object
* @param array $parameter array with compilation parameter
* @param array $args array with attributes from parser
* @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object
*
* @return bool true
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
$this->compiler = $compiler;
$saved_data = $this->closeTag($compiler, array('function'));

View File

@@ -80,13 +80,12 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase
/**
* Compiles code for the {else} 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
*
* @return string compiled code
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
$this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache));
@@ -188,13 +187,12 @@ class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase
/**
* Compiles code for the {/if} 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
*
* @return string compiled code
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
// must endblock be nocache?
if ($compiler->nocache) {

View File

@@ -59,14 +59,15 @@ 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 $parameter array with compilation parameter
* @param array $args array with attributes from parser
* @param Smarty_Internal_SmartyTemplateCompiler $compiler compiler object
*
* @throws SmartyCompilerException
* @return string compiled code
* @return string
* @throws \Exception
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_SmartyTemplateCompiler $compiler, $parameter)
public function compile($args, Smarty_Internal_SmartyTemplateCompiler $compiler)
{
$uid = $t_hash = null;
// check and get attributes
@@ -271,6 +272,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
* @param string $t_hash
*
* @return bool
* @throws \Exception
* @throws \SmartyException
*/
public function compileInlineTemplate(Smarty_Internal_SmartyTemplateCompiler $compiler,
Smarty_Internal_Template $tpl,

View File

@@ -46,6 +46,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
*
* @return string compiled code
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{

View File

@@ -41,14 +41,12 @@ 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 \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
*
* @return string compiled code
* @throws \SmartyCompilerException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);

View File

@@ -41,6 +41,8 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
* @param string $function PHP function name
*
* @return string compiled code
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function = null)
{

View File

@@ -76,6 +76,8 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com
*
* @param array $attributes
* @param \Smarty_Internal_TemplateCompilerBase $compiler
*
* @throws \SmartyException
*/
public function scanForProperties($attributes, Smarty_Internal_TemplateCompilerBase $compiler)
{
@@ -161,6 +163,8 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com
* Find matches in all parent template source
*
* @param \Smarty_Internal_TemplateCompilerBase $compiler
*
* @throws \SmartyException
*/
public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
{

View File

@@ -42,6 +42,8 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co
* @param string $function PHP function name
*
* @return string compiled code
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function)
{

View File

@@ -26,6 +26,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
*
* @return string compiled code
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
{
@@ -34,6 +35,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
$output = $parameter[ 'value' ];
// loop over list of modifiers
foreach ($parameter[ 'modifierlist' ] as $single_modifier) {
/* @var string $modifier */
$modifier = $single_modifier[ 0 ];
$single_modifier[ 0 ] = $output;
$params = implode(',', $single_modifier);

View File

@@ -34,6 +34,8 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
* @param string $method name of method to call
*
* @return string compiled code
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $method)
{

View File

@@ -107,9 +107,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
*
* This code has been moved from lexer here fo easier debugging and maintenance
*
* @param $lex
* @param Smarty_Internal_Templatelexer $lex
*
* @throws \SmartyCompilerException
*/
public function parsePhp($lex)
public function parsePhp(Smarty_Internal_Templatelexer $lex)
{
$lex->token = Smarty_Internal_Templateparser::TP_PHP;
$close = 0;

View File

@@ -134,6 +134,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
* @param string $output embedded output
*
* @return string
* @throws \SmartyException
*/
private function compile_output_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output)
{

View File

@@ -33,6 +33,8 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
* @param string $tag name of function
*
* @return string compiled code
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag)
{

View File

@@ -84,6 +84,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
*
* @return string compiled code
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{

View File

@@ -97,6 +97,7 @@ class Smarty_Internal_Config_File_Compiler
* @param Smarty_Internal_Template $template
*
* @return bool true if compiling succeeded, false if it failed
* @throws \SmartyException
*/
public function compileTemplate(Smarty_Internal_Template $template)
{

View File

@@ -153,6 +153,9 @@ class Smarty_Internal_Configfilelexer
$this->yyTracePrompt = '<br>';
} // end function
/**
* @param $state
*/
public function yybegin($state)
{
$this->_yy_state = $state;
@@ -165,7 +168,11 @@ class Smarty_Internal_Configfilelexer
}
}
public function yylex1()
/**
* @return bool
* @throws \Exception
*/
public function yylex1()
{
if (!isset($this->yy_global_pattern1)) {
$this->yy_global_pattern1 =
@@ -221,11 +228,19 @@ public function yylex1()
}
/**
* @param $input
*
* @return mixed
*/
public function replace($input)
{
return $input;
}
/**
* @return mixed
*/
public function yylex()
{
return $this->{'yylex' . $this->_yy_state}();
@@ -238,6 +253,9 @@ public function yylex1()
$this->yypushstate(self::COMMENT);
}
/**
* @param $state
*/
public function yypushstate($state)
{
if ($this->yyTraceFILE) {
@@ -278,6 +296,9 @@ public function yylex1()
$this->yypushstate(self::VALUE);
}
/**
* @return bool
*/
function yy_r1_5()
{
@@ -302,7 +323,11 @@ public function yylex1()
$this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
}
public function yylex2()
/**
* @return bool
* @throws \Exception
*/
public function yylex2()
{
if (!isset($this->yy_global_pattern2)) {
$this->yy_global_pattern2 =
@@ -358,6 +383,9 @@ public function yylex2()
}
/**
* @return bool
*/
function yy_r2_1()
{
@@ -419,6 +447,9 @@ public function yylex2()
$this->yypopstate();
} // end function
/**
* @return bool
*/
function yy_r2_7()
{
@@ -448,7 +479,11 @@ public function yylex2()
$this->yypopstate();
} // end function
public function yylex3()
/**
* @return bool
* @throws \Exception
*/
public function yylex3()
{
if (!isset($this->yy_global_pattern3)) {
$this->yy_global_pattern3 = $this->replace("/\G([^\n]+?(?=[ \t\r]*\n))/isS");
@@ -510,7 +545,11 @@ public function yylex3()
$this->yypopstate();
}
public function yylex4()
/**
* @return bool
* @throws \Exception
*/
public function yylex4()
{
if (!isset($this->yy_global_pattern4)) {
$this->yy_global_pattern4 = $this->replace("/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS");
@@ -565,6 +604,9 @@ public function yylex4()
}
/**
* @return bool
*/
function yy_r4_1()
{
@@ -584,7 +626,11 @@ public function yylex4()
$this->yypopstate();
}
public function yylex5()
/**
* @return bool
* @throws \Exception
*/
public function yylex5()
{
if (!isset($this->yy_global_pattern5)) {
$this->yy_global_pattern5 = $this->replace("/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS");
@@ -652,7 +698,11 @@ public function yylex5()
$this->yypopstate();
} // end function
public function yylex6()
/**
* @return bool
* @throws \Exception
*/
public function yylex6()
{
if (!isset($this->yy_global_pattern6)) {
$this->yy_global_pattern6 = $this->replace("/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS");

View File

@@ -1,10 +1,19 @@
<?php
/**
* Class TPC_yyToken
*/
class TPC_yyToken implements ArrayAccess
{
public $string = '';
public $metadata = array();
/**
* TPC_yyToken constructor.
*
* @param $s
* @param array $m
*/
public function __construct($s, $m = array())
{
if ($s instanceof TPC_yyToken) {
@@ -20,21 +29,38 @@ class TPC_yyToken implements ArrayAccess
}
}
/**
* @return string
*/
public function __toString()
{
return $this->string;
}
/**
* @param mixed $offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->metadata[ $offset ]);
}
/**
* @param mixed $offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return $this->metadata[ $offset ];
}
/**
* @param mixed $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
{
if ($offset === null) {
@@ -58,12 +84,18 @@ class TPC_yyToken implements ArrayAccess
}
}
/**
* @param mixed $offset
*/
public function offsetUnset($offset)
{
unset($this->metadata[ $offset ]);
}
}
/**
* Class TPC_yyStackEntry
*/
class TPC_yyStackEntry
{
public $stateno; /* The state-number */
@@ -247,6 +279,10 @@ public $yystack = array();
$this->configReadHidden = $this->smarty->config_read_hidden;
}
/**
* @param $TraceFILE
* @param $zTracePrompt
*/
public function Trace($TraceFILE, $zTracePrompt)
{
if (!$TraceFILE) {
@@ -263,7 +299,11 @@ public $yystack = array();
$this->yyTraceFILE = fopen('php://output', 'w');
$this->yyTracePrompt = '<br>';
} /* Index of top element in stack */
/**
* @param $tokenType
*
* @return mixed|string
*/
public function tokenName($tokenType)
{
if ($tokenType === 0) {
@@ -303,6 +343,10 @@ public $yystack = array();
return $yymajor;
}
/**
* @param $yymajor
* @param $yypminor
*/
public static function yy_destructor($yymajor, $yypminor)
{
switch ($yymajor) {
@@ -311,6 +355,11 @@ public $yystack = array();
}
}
/**
* @param $token
*
* @return array|mixed
*/
public function yy_get_expected_tokens($token)
{
static $res3 = array();
@@ -395,6 +444,11 @@ public $yystack = array();
return array_unique($expected);
}
/**
* @param $iLookAhead
*
* @return int|mixed
*/
public function yy_find_shift_action($iLookAhead)
{
$stateno = $this->yystack[ $this->yyidx ]->stateno;
@@ -430,6 +484,12 @@ public $yystack = array();
}
}
/**
* @param $stateno
* @param $iLookAhead
*
* @return int|mixed
*/
public function yy_find_reduce_action($stateno, $iLookAhead)
{
/* $stateno = $this->yystack[$this->yyidx]->stateno; */
@@ -692,6 +752,12 @@ public $yystack = array();
#line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
/**
* @param $yymajor
* @param $yytokenvalue
*
* @throws \SmartyCompilerException
*/
public function doParse($yymajor, $yytokenvalue)
{
$yyerrorhit = 0; /* True if yymajor has invoked an error */
@@ -784,6 +850,11 @@ public $yystack = array();
} while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
}
/**
* @param $token
*
* @return bool
*/
public function yy_is_expected_token($token)
{
static $res = array();
@@ -873,6 +944,13 @@ public $yystack = array();
return true;
}
/**
* @param $yyNewState
* @param $yyMajor
* @param $yypMinor
*
* @throws \SmartyCompilerException
*/
public function yy_shift($yyNewState, $yyMajor, $yypMinor)
{
$this->yyidx++;
@@ -911,6 +989,11 @@ public $yystack = array();
}
}
/**
* @param $yyruleno
*
* @throws \SmartyCompilerException
*/
public function yy_reduce($yyruleno)
{
if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) {
@@ -967,6 +1050,12 @@ public $yystack = array();
$this->retvalue = $this->_retvalue;
}
/**
* @param $yymajor
* @param $TOKEN
*
* @throws \SmartyCompilerException
*/
public function yy_syntax_error($yymajor, $TOKEN)
{
#line 232 "../smarty/lexer/smarty_internal_configfileparser.y"

View File

@@ -19,6 +19,7 @@
* The following methods will be dynamically loaded by the extension handler when they are called.
* They are located in a corresponding Smarty_Internal_Method_xxxx class
*
* @method mixed _getConfigVariable(string $varName, bool $errorEnable = true)
* @method mixed getConfigVariable(string $varName, bool $errorEnable = true)
* @method mixed getConfigVars(string $varName = null, bool $searchParents = true)
* @method mixed getGlobal(string $varName = null)
@@ -266,7 +267,7 @@ class Smarty_Internal_Data
*/
public function _getSmartyObj()
{
return $this->_objType === 1 ? $this : $this->smarty;
return $this->smarty;
}
/**

View File

@@ -193,6 +193,9 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
*
* @param Smarty_Internal_Template|Smarty $obj object to debug
* @param bool $full
*
* @throws \Exception
* @throws \SmartyException
*/
public function display_debug($obj, $full = false)
{

View File

@@ -25,7 +25,7 @@ class Smarty_Internal_ErrorHandler
/**
* Enable error handler to mute expected messages
*
* @return void
* @return boolean
*/
public static function muteExpectedErrors()
{

View File

@@ -11,7 +11,6 @@
*/
class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
{
/**
* Add autoload filters
*
@@ -25,6 +24,7 @@ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_S
* the appropriate types
*
* @return \Smarty|\Smarty_Internal_Template
* @throws \SmartyException
*/
public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
{

View File

@@ -28,7 +28,8 @@ class Smarty_Internal_Method_ClearAllCache
* @param integer $exp_time expiration time
* @param string $type resource type
*
* @return integer number of cache files deleted
* @return int number of cache files deleted
* @throws \SmartyException
*/
public function clearAllCache(Smarty $smarty, $exp_time = null, $type = null)
{

View File

@@ -31,7 +31,8 @@ class Smarty_Internal_Method_ClearCache
* @param integer $exp_time expiration time
* @param string $type resource type
*
* @return integer number of cache files deleted
* @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)

View File

@@ -29,7 +29,8 @@ class Smarty_Internal_Method_ClearCompiledTemplate
* @param string $compile_id compile id
* @param integer $exp_time expiration time
*
* @return integer number of template files deleted
* @return int number of template files deleted
* @throws \SmartyException
*/
public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $compile_id = null, $exp_time = null)
{

View File

@@ -30,7 +30,7 @@ class Smarty_Internal_Method_ConfigLoad
* section or null
*
* @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
* @throws \SmartyException
* @throws \Exception
*/
public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null)
{
@@ -52,7 +52,7 @@ class Smarty_Internal_Method_ConfigLoad
* shall be loaded
*
* @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
* @throws \SmartyException
* @throws \Exception
*/
public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
{
@@ -94,6 +94,7 @@ class Smarty_Internal_Method_ConfigLoad
$mergedScope = $tagScope | $tpl->scope;
if ($mergedScope) {
// update scopes
/* @var \Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $ptr */
foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) {
$this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars);
if ($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) {

View File

@@ -11,7 +11,6 @@
*/
class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
{
/**
* Get autoload filters
*
@@ -22,8 +21,9 @@ class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_S
* for. Defaults to all autoload
* filters
*
* @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
* @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
* was specified
* @throws \SmartyException
*/
public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null)
{

View File

@@ -24,9 +24,9 @@ class Smarty_Internal_Method_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 variable value or or array of variables
* @return string|array variable value or or array of variables
*/
public function getGlobal(Smarty_Internal_Data $data, $varName = null)
{

View File

@@ -28,6 +28,7 @@ class Smarty_Internal_Method_GetTags
* @param null|string|Smarty_Internal_Template $template
*
* @return array of tag/attributes
* @throws \Exception
* @throws \SmartyException
*/
public function getTags(Smarty_Internal_TemplateBase $obj, $template = null)

View File

@@ -43,6 +43,7 @@ class Smarty_Internal_Method_Literals
* to add
*
* @return \Smarty|\Smarty_Internal_Template
* @throws \SmartyException
*/
public function addLiterals(Smarty_Internal_TemplateBase $obj, $literals = null)
{
@@ -62,6 +63,7 @@ class Smarty_Internal_Method_Literals
* to set
*
* @return \Smarty|\Smarty_Internal_Template
* @throws \SmartyException
*/
public function setLiterals(Smarty_Internal_TemplateBase $obj, $literals = null)
{

View File

@@ -38,6 +38,7 @@ class Smarty_Internal_Method_SetAutoloadFilters
* the appropriate types
*
* @return \Smarty|\Smarty_Internal_Template
* @throws \SmartyException
*/
public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
{

View File

@@ -22,7 +22,8 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil
* @param string $type filter type
* @param string $name filter name
*
* @return bool
* @return Smarty_Internal_TemplateBase
* @throws \SmartyException
*/
public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
{

View File

@@ -23,6 +23,7 @@ class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_Reg
* @param callback|string $callback
*
* @return \Smarty|\Smarty_Internal_Template
* @throws \SmartyException
*/
public function unregisterFilter(Smarty_Internal_TemplateBase $obj, $type, $callback)
{

View File

@@ -1,7 +1,7 @@
<?php
/**
* Smarty Internal Plugin Templateparser Parsetrees
* These are classes to build parsetrees in the template parser
* Smarty Internal Plugin Templateparser Parsetree
* These are classes to build parsetree in the template parser
*
* @package Smarty
* @subpackage Compiler

View File

@@ -118,6 +118,9 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource
*
* @return bool
*/
/**
* @return bool
*/
public function checkTimestamps()
{
return false;

View File

@@ -112,6 +112,8 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
*
* @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object
*
* @throws \SmartyException
*/
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{

View File

@@ -26,6 +26,7 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled
* @param Smarty_Internal_Template $_template template object
*
* @return void
* @throws \SmartyException
*/
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{

View File

@@ -99,6 +99,9 @@ class Smarty_Internal_Resource_String extends Smarty_Resource
*
* @return bool
*/
/**
* @return bool
*/
public function checkTimestamps()
{
return false;

View File

@@ -16,6 +16,9 @@ class Smarty_Internal_Runtime_CacheModify
* @param \Smarty_Template_Cached $cached
* @param \Smarty_Internal_Template $_template
* @param string $content
*
* @throws \Exception
* @throws \SmartyException
*/
public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
{

View File

@@ -41,7 +41,7 @@ class Smarty_Internal_Runtime_CodeFrame
$properties[ 'cache_lifetime' ] = $_template->cache_lifetime;
}
$output = "<?php\n";
$output .= "/* Smarty version {Smarty::SMARTY_VERSION}, created on " . strftime("%Y-%m-%d %H:%M:%S") .
$output .= "/* Smarty version {$properties[ 'version' ]}, created on " . strftime("%Y-%m-%d %H:%M:%S") .
"\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) . ',' .

View File

@@ -36,7 +36,7 @@ class Smarty_Internal_Runtime_GetIncludePath
/**
* stream cache
*
* @var string[]
* @var string[][]
*/
public $isFile = array();
/**

View File

@@ -103,6 +103,9 @@ class Smarty_Internal_Runtime_Inheritance
* @param null|string $template optional name of inheritance parent template
* @param null|string $uid uid of inline template
* @param null|string $func function call name of inline template
*
* @throws \Exception
* @throws \SmartyException
*/
public function endChild(Smarty_Internal_Template $tpl, $template = null, $uid = null, $func = null)
{
@@ -135,6 +138,8 @@ class Smarty_Internal_Runtime_Inheritance
* @param $className
* @param string $name
* @param int|null $tplIndex index of outer level {block} if nested
*
* @throws \SmartyException
*/
public function instanceBlock(Smarty_Internal_Template $tpl, $className, $name, $tplIndex = null)
{
@@ -203,7 +208,8 @@ class Smarty_Internal_Runtime_Inheritance
* @param \Smarty_Internal_Block $block
* @param boolean $returnContent flag if content shall be returned
*
* @return null|string null or block content dependent on $returnContent
* @return null|string null or block content dependent on $returnContent
* @throws \SmartyException
*/
public function callChild(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block, $returnContent = false)
{

View File

@@ -117,9 +117,11 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
public static $isCacheTplObj = array();
/**
* Subtemplate Info Cache
* Sub template Info Cache
* - index name
* - value use count
*
* @var string[]int[]
* @var int[]
*/
public static $subTplInfo = array();
@@ -170,6 +172,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
* @param null|bool $display true: display, false: fetch null: sub-template
*
* @return string
* @throws \Exception
* @throws \SmartyException
*/
public function render($no_output_filter = true, $display = null)
@@ -269,6 +272,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
* @param string $uid file dependency uid
* @param string $content_func function name
*
* @throws \Exception
* @throws \SmartyException
*/
public function _subTemplateRender($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $scope,
$forceTplCache, $uid = null, $content_func = null)
@@ -528,6 +533,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
* Get unique template id
*
* @return string
* @throws \SmartyException
*/
public function _getTemplateId()
{

View File

@@ -117,6 +117,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
* @param mixed $cache_id cache id to be used with this template
* @param mixed $compile_id compile id to be used with this template
* @param object $parent next higher level of Smarty variables
*
* @throws \Exception
* @throws \SmartyException
*/
public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
{
@@ -135,7 +138,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
* @param mixed $compile_id compile id to be used with this template
* @param object $parent next higher level of Smarty variables
*
* @return boolean cache status
* @return bool cache status
* @throws \Exception
* @throws \SmartyException
*/
public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
{

View File

@@ -534,6 +534,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
* @param array $parameter
*
* @return string
* @throws \SmartyCompilerException
*/
public function compilePHPFunctionCall($name, $parameter)
{
@@ -662,7 +663,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
* @param mixed $param2 optional parameter
* @param mixed $param3 optional parameter
*
* @return string|bool compiled code or false
* @return bool|string compiled code or false
* @throws \SmartyCompilerException
*/
public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null)
{
@@ -680,7 +682,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
*
* @param string $tag tag name
*
* @return Smarty_Internal_CompileBase|bool tag compiler object or false if not found
* @return bool|\Smarty_Internal_CompileBase tag compiler object or false if not found
* @throws \SmartyCompilerException
*/
public function getTagCompiler($tag)
{
@@ -708,6 +711,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
* @param string $plugin_type type of plugin
*
* @return string call name of function
* @throws \SmartyException
*/
public function getPlugin($plugin_name, $plugin_type)
{
@@ -772,7 +776,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
* @param string $tag name of tag
* @param string $plugin_type type of plugin
*
* @return boolean true if found
* @return bool true if found
* @throws \SmartyCompilerException
*/
public function getPluginFromDefaultHandler($tag, $plugin_type)
{

View File

@@ -250,11 +250,17 @@ class Smarty_Internal_Templatelexer
strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
} // end function
/**
* @return mixed
*/
public function yylex()
{
return $this->{'yylex' . $this->_yy_state}();
}
/**
* @param $state
*/
public function yypushstate($state)
{
if ($this->yyTraceFILE) {
@@ -294,6 +300,9 @@ class Smarty_Internal_Templatelexer
}
}
/**
* @param $state
*/
public function yybegin($state)
{
$this->_yy_state = $state;
@@ -306,6 +315,10 @@ class Smarty_Internal_Templatelexer
}
}
/**
* @return bool
* @throws \Exception
*/
public function yylex1()
{
if (!isset($this->yy_global_pattern1)) {
@@ -366,6 +379,10 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
/**
* @return bool
* @throws \SmartyCompilerException
*/
function yy_r1_2()
{
preg_match("/[*]{$this->compiler->getRdelPreg()}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
@@ -400,6 +417,9 @@ class Smarty_Internal_Templatelexer
$this->yypushstate(self::LITERAL);
} // end function
/**
* @return bool
*/
function yy_r1_14()
{
$this->yypushstate(self::TAG);
@@ -416,6 +436,10 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
/**
* @return bool
* @throws \Exception
*/
public function yylex2()
{
if (!isset($this->yy_global_pattern2)) {
@@ -548,6 +572,10 @@ class Smarty_Internal_Templatelexer
$this->taglineno = $this->line;
}
/**
* @return bool
* @throws \Exception
*/
public function yylex3()
{
if (!isset($this->yy_global_pattern3)) {
@@ -609,6 +637,9 @@ class Smarty_Internal_Templatelexer
$this->yypopstate();
}
/**
* @return bool
*/
function yy_r3_2()
{
$this->yypushstate(self::TAG);
@@ -836,6 +867,10 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
/**
* @return bool
* @throws \Exception
*/
public function yylex4()
{
if (!isset($this->yy_global_pattern4)) {
@@ -913,6 +948,10 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} // end function
/**
* @return bool
* @throws \Exception
*/
public function yylex5()
{
if (!isset($this->yy_global_pattern5)) {
@@ -983,12 +1022,18 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
/**
* @return bool
*/
function yy_r5_7()
{
$this->yypushstate(self::TAG);
return true;
}
/**
* @return bool
*/
function yy_r5_9()
{
$this->yypushstate(self::TAG);

View File

@@ -1,10 +1,19 @@
<?php
/**
* Class TP_yyToken
*/
class TP_yyToken implements ArrayAccess
{
public $string = '';
public $metadata = array();
/**
* TP_yyToken constructor.
*
* @param $s
* @param array $m
*/
public function __construct($s, $m = array())
{
if ($s instanceof TP_yyToken) {
@@ -20,21 +29,38 @@ class TP_yyToken implements ArrayAccess
}
}
/**
* @return string
*/
public function __toString()
{
return $this->string;
}
/**
* @param mixed $offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->metadata[ $offset ]);
}
/**
* @param mixed $offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return $this->metadata[ $offset ];
}
/**
* @param mixed $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
{
if ($offset === null) {
@@ -58,12 +84,18 @@ class TP_yyToken implements ArrayAccess
}
}
/**
* @param mixed $offset
*/
public function offsetUnset($offset)
{
unset($this->metadata[ $offset ]);
}
}
/**
* Class TP_yyStackEntry
*/
class TP_yyStackEntry
{
public $stateno; /* The state-number */
@@ -1727,6 +1759,10 @@ class Smarty_Internal_Templateparser
$this->security = isset($this->smarty->security_policy) ? $this->smarty->security_policy : false;
$this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template();
} /* The parser's stack */
/**
* @param $yymajor
* @param $yypminor
*/
public static function yy_destructor($yymajor, $yypminor)
{
switch ($yymajor) {
@@ -1777,6 +1813,10 @@ class Smarty_Internal_Templateparser
return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp, true));
}
/**
* @param $TraceFILE
* @param $zTracePrompt
*/
public function Trace($TraceFILE, $zTracePrompt)
{
if (!$TraceFILE) {
@@ -1794,6 +1834,11 @@ class Smarty_Internal_Templateparser
$this->yyTracePrompt = '<br>';
}
/**
* @param $tokenType
*
* @return mixed|string
*/
public function tokenName($tokenType)
{
if ($tokenType === 0) {
@@ -1833,6 +1878,11 @@ class Smarty_Internal_Templateparser
}
}
/**
* @param $token
*
* @return array|mixed
*/
public function yy_get_expected_tokens($token)
{
static $res3 = array();
@@ -1917,6 +1967,11 @@ class Smarty_Internal_Templateparser
return array_unique($expected);
}
/**
* @param $token
*
* @return bool
*/
public function yy_is_expected_token($token)
{
static $res = array();
@@ -2006,6 +2061,11 @@ class Smarty_Internal_Templateparser
return true;
}
/**
* @param $iLookAhead
*
* @return int|mixed
*/
public function yy_find_shift_action($iLookAhead)
{
$stateno = $this->yystack[ $this->yyidx ]->stateno;
@@ -2040,6 +2100,12 @@ class Smarty_Internal_Templateparser
}
}
/**
* @param $stateno
* @param $iLookAhead
*
* @return int|mixed
*/
public function yy_find_reduce_action($stateno, $iLookAhead)
{
/* $stateno = $this->yystack[$this->yyidx]->stateno; */
@@ -2063,6 +2129,14 @@ class Smarty_Internal_Templateparser
}
#line 234 "../smarty/lexer/smarty_internal_templateparser.y"
/**
* @param $yyNewState
* @param $yyMajor
* @param $yypMinor
*
* @throws \SmartyCompilerException
*/
public function yy_shift($yyNewState, $yyMajor, $yypMinor)
{
$this->yyidx++;
@@ -3356,6 +3430,11 @@ class Smarty_Internal_Templateparser
$this->_retvalue = new Smarty_Internal_ParseTree_DqContent($this->yystack[ $this->yyidx + 0 ]->minor);
}
/**
* @param $yyruleno
*
* @throws \SmartyCompilerException
*/
public function yy_reduce($yyruleno)
{
if ($this->yyTraceFILE && $yyruleno >= 0
@@ -3407,6 +3486,12 @@ class Smarty_Internal_Templateparser
}
}
/**
* @param $yymajor
* @param $TOKEN
*
* @throws \SmartyCompilerException
*/
public function yy_syntax_error($yymajor, $TOKEN)
{
#line 214 "../smarty/lexer/smarty_internal_templateparser.y"
@@ -3429,6 +3514,12 @@ class Smarty_Internal_Templateparser
$this->retvalue = $this->_retvalue;
}
/**
* @param $yymajor
* @param $yytokenvalue
*
* @throws \SmartyCompilerException
*/
public function doParse($yymajor, $yytokenvalue)
{
$yyerrorhit = 0; /* True if yymajor has invoked an error */

View File

@@ -133,6 +133,7 @@ abstract class Smarty_Resource
* @param string $template_resource template_resource to extract resource handler and name of
*
* @return string unique resource name
* @throws \SmartyException
*/
public static function getUniqueTemplateName($obj, $template_resource)
{
@@ -159,7 +160,8 @@ abstract class Smarty_Resource
* @param Smarty $smarty smarty object
* @param string $template_resource resource identifier
*
* @return Smarty_Template_Source Source Object
* @return \Smarty_Template_Source Source Object
* @throws \SmartyException
*/
public static function source(Smarty_Internal_Template $_template = null,
Smarty $smarty = null,
@@ -239,6 +241,9 @@ abstract class Smarty_Resource
return basename(preg_replace('![^\w]+!', '_', $source->name));
}
/**
* @return bool
*/
public function checkTimestamps()
{
return true;

View File

@@ -85,6 +85,9 @@ abstract class Smarty_Resource_Recompiled extends Smarty_Resource
*
* @return bool
*/
/**
* @return bool
*/
public function checkTimestamps()
{
return false;

View File

@@ -676,7 +676,7 @@ class Smarty_Security
{
if ($security_class instanceof Smarty_Security) {
$smarty->security_policy = $security_class;
return;
return $smarty;
} elseif (is_object($security_class)) {
throw new SmartyException("Class '" . get_class($security_class) . "' must extend Smarty_Security.");
}
@@ -690,7 +690,7 @@ class Smarty_Security
} else {
$smarty->security_policy = new $security_class($smarty);
}
return;
return $smarty;
}
/**
* Start template processing

View File

@@ -83,6 +83,8 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
* create Cached Object container
*
* @param Smarty_Internal_Template $_template template object
*
* @throws \SmartyException
*/
public function __construct(Smarty_Internal_Template $_template)
{

View File

@@ -201,7 +201,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
* @param Smarty_Internal_Template $_template template object
* @param string $code compiled code
*
* @return boolean success
* @return bool success
* @throws \SmartyException
*/
public function write(Smarty_Internal_Template $_template, $code)
{

View File

@@ -80,9 +80,11 @@ abstract class Smarty_Template_Resource_Base
public $required_plugins = array();
/**
* Included subtemplates
* Included sub templates
* - index name
* - value use count
*
* @var array
* @var int[]
*/
public $includes = array();

View File

@@ -126,12 +126,13 @@ class Smarty_Template_Source
/**
* create Source Object container
*
* @param Smarty_Resource $handler Resource Handler this source object communicates with
* @param Smarty $smarty Smarty instance this source object belongs to
* @param string $resource full template_resource
* @param string $type type of resource
* @param string $name resource name
* @param Smarty $smarty Smarty instance this source object belongs to
* @param string $resource full template_resource
* @param string $type type of resource
* @param string $name resource name
*
* @throws \SmartyException
* @internal param \Smarty_Resource $handler Resource Handler this source object communicates with
*/
public function __construct(Smarty $smarty, $resource, $type, $name)
{
@@ -202,6 +203,7 @@ class Smarty_Template_Source
* Get source content
*
* @return string
* @throws \SmartyException
*/
public function getContent()
{

View File

@@ -7,22 +7,18 @@
* @package Smarty
* @subpackage Template
*/
class Smarty_Undefined_Variable
class Smarty_Undefined_Variable extends Smarty_Variable
{
/**
* Returns FALSE for 'nocache' and NULL otherwise.
* Returns null for not existing properties
*
* @param string $name
*
* @return bool
* @return null
*/
public function __get($name)
{
if ($name == 'nocache') {
return false;
} else {
return null;
}
}
/**

View File

@@ -7,6 +7,9 @@
*/
class SmartyCompilerException extends SmartyException
{
/**
* @return string
*/
public function __toString()
{
return ' --> Smarty Compiler: ' . $this->message . ' <-- ';

View File

@@ -9,6 +9,9 @@ class SmartyException extends Exception
{
public static $escape = false;
/**
* @return string
*/
public function __toString()
{
return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';