@@ -11,41 +11,41 @@ |
||
11 | 11 | */ |
12 | 12 | class Smarty_Internal_Method_RegisterPlugin |
13 | 13 | { |
14 | - /** |
|
15 | - * Valid for Smarty and template object |
|
16 | - * |
|
17 | - * @var int |
|
18 | - */ |
|
19 | - public $objMap = 3; |
|
14 | + /** |
|
15 | + * Valid for Smarty and template object |
|
16 | + * |
|
17 | + * @var int |
|
18 | + */ |
|
19 | + public $objMap = 3; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Registers plugin to be used in templates |
|
23 | - * |
|
24 | - * @api Smarty::registerPlugin() |
|
25 | - * @link http://www.smarty.net/docs/en/api.register.plugin.tpl |
|
26 | - * |
|
27 | - * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj |
|
28 | - * @param string $type plugin type |
|
29 | - * @param string $name name of template tag |
|
30 | - * @param callback $callback PHP callback to register |
|
31 | - * @param bool $cacheable if true (default) this |
|
32 | - * function is cache able |
|
33 | - * @param mixed $cache_attr caching attributes if any |
|
34 | - * |
|
35 | - * @return \Smarty|\Smarty_Internal_Template |
|
36 | - * @throws SmartyException when the plugin tag is invalid |
|
37 | - */ |
|
38 | - public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true, |
|
39 | - $cache_attr = null) |
|
40 | - { |
|
41 | - $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
|
42 | - if (isset($smarty->registered_plugins[ $type ][ $name ])) { |
|
43 | - throw new SmartyException("Plugin tag \"{$name}\" already registered"); |
|
44 | - } elseif (!is_callable($callback)) { |
|
45 | - throw new SmartyException("Plugin \"{$name}\" not callable"); |
|
46 | - } else { |
|
47 | - $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr); |
|
48 | - } |
|
49 | - return $obj; |
|
50 | - } |
|
21 | + /** |
|
22 | + * Registers plugin to be used in templates |
|
23 | + * |
|
24 | + * @api Smarty::registerPlugin() |
|
25 | + * @link http://www.smarty.net/docs/en/api.register.plugin.tpl |
|
26 | + * |
|
27 | + * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj |
|
28 | + * @param string $type plugin type |
|
29 | + * @param string $name name of template tag |
|
30 | + * @param callback $callback PHP callback to register |
|
31 | + * @param bool $cacheable if true (default) this |
|
32 | + * function is cache able |
|
33 | + * @param mixed $cache_attr caching attributes if any |
|
34 | + * |
|
35 | + * @return \Smarty|\Smarty_Internal_Template |
|
36 | + * @throws SmartyException when the plugin tag is invalid |
|
37 | + */ |
|
38 | + public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true, |
|
39 | + $cache_attr = null) |
|
40 | + { |
|
41 | + $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
|
42 | + if (isset($smarty->registered_plugins[ $type ][ $name ])) { |
|
43 | + throw new SmartyException("Plugin tag \"{$name}\" already registered"); |
|
44 | + } elseif (!is_callable($callback)) { |
|
45 | + throw new SmartyException("Plugin \"{$name}\" not callable"); |
|
46 | + } else { |
|
47 | + $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr); |
|
48 | + } |
|
49 | + return $obj; |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | \ No newline at end of file |
@@ -39,12 +39,12 @@ |
||
39 | 39 | $cache_attr = null) |
40 | 40 | { |
41 | 41 | $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
42 | - if (isset($smarty->registered_plugins[ $type ][ $name ])) { |
|
42 | + if (isset($smarty->registered_plugins[$type][$name])) { |
|
43 | 43 | throw new SmartyException("Plugin tag \"{$name}\" already registered"); |
44 | 44 | } elseif (!is_callable($callback)) { |
45 | 45 | throw new SmartyException("Plugin \"{$name}\" not callable"); |
46 | 46 | } else { |
47 | - $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr); |
|
47 | + $smarty->registered_plugins[$type][$name] = array($callback, (bool) $cacheable, (array) $cache_attr); |
|
48 | 48 | } |
49 | 49 | return $obj; |
50 | 50 | } |
@@ -16,57 +16,57 @@ |
||
16 | 16 | */ |
17 | 17 | class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase |
18 | 18 | { |
19 | - /** |
|
20 | - * Attribute definition: Overwrites base class. |
|
21 | - * |
|
22 | - * @var array |
|
23 | - * @see Smarty_Internal_CompileBase |
|
24 | - */ |
|
25 | - public $required_attributes = array('var'); |
|
19 | + /** |
|
20 | + * Attribute definition: Overwrites base class. |
|
21 | + * |
|
22 | + * @var array |
|
23 | + * @see Smarty_Internal_CompileBase |
|
24 | + */ |
|
25 | + public $required_attributes = array('var'); |
|
26 | 26 | |
27 | - /** |
|
28 | - * Attribute definition: Overwrites base class. |
|
29 | - * |
|
30 | - * @var array |
|
31 | - * @see Smarty_Internal_CompileBase |
|
32 | - */ |
|
33 | - public $optional_attributes = array('assign'); |
|
27 | + /** |
|
28 | + * Attribute definition: Overwrites base class. |
|
29 | + * |
|
30 | + * @var array |
|
31 | + * @see Smarty_Internal_CompileBase |
|
32 | + */ |
|
33 | + public $optional_attributes = array('assign'); |
|
34 | 34 | |
35 | - /** |
|
36 | - * Attribute definition: Overwrites base class. |
|
37 | - * |
|
38 | - * @var array |
|
39 | - * @see Smarty_Internal_CompileBase |
|
40 | - */ |
|
41 | - public $shorttag_order = array('var', 'assign'); |
|
35 | + /** |
|
36 | + * Attribute definition: Overwrites base class. |
|
37 | + * |
|
38 | + * @var array |
|
39 | + * @see Smarty_Internal_CompileBase |
|
40 | + */ |
|
41 | + public $shorttag_order = array('var', 'assign'); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Compiles code for the {eval} tag |
|
45 | - * |
|
46 | - * @param array $args array with attributes from parser |
|
47 | - * @param object $compiler compiler object |
|
48 | - * |
|
49 | - * @return string compiled code |
|
50 | - */ |
|
51 | - public function compile($args, $compiler) |
|
52 | - { |
|
53 | - // check and get attributes |
|
54 | - $_attr = $this->getAttributes($compiler, $args); |
|
55 | - if (isset($_attr[ 'assign' ])) { |
|
56 | - // output will be stored in a smarty variable instead of being displayed |
|
57 | - $_assign = $_attr[ 'assign' ]; |
|
58 | - } |
|
43 | + /** |
|
44 | + * Compiles code for the {eval} tag |
|
45 | + * |
|
46 | + * @param array $args array with attributes from parser |
|
47 | + * @param object $compiler compiler object |
|
48 | + * |
|
49 | + * @return string compiled code |
|
50 | + */ |
|
51 | + public function compile($args, $compiler) |
|
52 | + { |
|
53 | + // check and get attributes |
|
54 | + $_attr = $this->getAttributes($compiler, $args); |
|
55 | + if (isset($_attr[ 'assign' ])) { |
|
56 | + // output will be stored in a smarty variable instead of being displayed |
|
57 | + $_assign = $_attr[ 'assign' ]; |
|
58 | + } |
|
59 | 59 | |
60 | - // create template object |
|
61 | - $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] . |
|
62 | - ", \$_smarty_tpl->smarty, \$_smarty_tpl);"; |
|
63 | - //was there an assign attribute? |
|
64 | - if (isset($_assign)) { |
|
65 | - $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());"; |
|
66 | - } else { |
|
67 | - $_output .= "echo \$_template->fetch();"; |
|
68 | - } |
|
60 | + // create template object |
|
61 | + $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] . |
|
62 | + ", \$_smarty_tpl->smarty, \$_smarty_tpl);"; |
|
63 | + //was there an assign attribute? |
|
64 | + if (isset($_assign)) { |
|
65 | + $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());"; |
|
66 | + } else { |
|
67 | + $_output .= "echo \$_template->fetch();"; |
|
68 | + } |
|
69 | 69 | |
70 | - return "<?php $_output ?>"; |
|
71 | - } |
|
70 | + return "<?php $_output ?>"; |
|
71 | + } |
|
72 | 72 | } |
@@ -52,13 +52,13 @@ |
||
52 | 52 | { |
53 | 53 | // check and get attributes |
54 | 54 | $_attr = $this->getAttributes($compiler, $args); |
55 | - if (isset($_attr[ 'assign' ])) { |
|
55 | + if (isset($_attr['assign'])) { |
|
56 | 56 | // output will be stored in a smarty variable instead of being displayed |
57 | - $_assign = $_attr[ 'assign' ]; |
|
57 | + $_assign = $_attr['assign']; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // create template object |
61 | - $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] . |
|
61 | + $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr['var'] . |
|
62 | 62 | ", \$_smarty_tpl->smarty, \$_smarty_tpl);"; |
63 | 63 | //was there an assign attribute? |
64 | 64 | if (isset($_assign)) { |
@@ -16,25 +16,25 @@ |
||
16 | 16 | */ |
17 | 17 | class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase |
18 | 18 | { |
19 | - /** |
|
20 | - * Compiles code for the {ldelim} tag |
|
21 | - * This tag does output the left delimiter |
|
22 | - * |
|
23 | - * @param array $args array with attributes from parser |
|
24 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
25 | - * |
|
26 | - * @return string compiled code |
|
27 | - * @throws \SmartyCompilerException |
|
28 | - */ |
|
29 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|
30 | - { |
|
31 | - $_attr = $this->getAttributes($compiler, $args); |
|
32 | - if ($_attr[ 'nocache' ] === true) { |
|
33 | - $compiler->trigger_template_error('nocache option not allowed', null, true); |
|
34 | - } |
|
35 | - // this tag does not return compiled code |
|
36 | - $compiler->has_code = true; |
|
19 | + /** |
|
20 | + * Compiles code for the {ldelim} tag |
|
21 | + * This tag does output the left delimiter |
|
22 | + * |
|
23 | + * @param array $args array with attributes from parser |
|
24 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
25 | + * |
|
26 | + * @return string compiled code |
|
27 | + * @throws \SmartyCompilerException |
|
28 | + */ |
|
29 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|
30 | + { |
|
31 | + $_attr = $this->getAttributes($compiler, $args); |
|
32 | + if ($_attr[ 'nocache' ] === true) { |
|
33 | + $compiler->trigger_template_error('nocache option not allowed', null, true); |
|
34 | + } |
|
35 | + // this tag does not return compiled code |
|
36 | + $compiler->has_code = true; |
|
37 | 37 | |
38 | - return $compiler->smarty->left_delimiter; |
|
39 | - } |
|
38 | + return $compiler->smarty->left_delimiter; |
|
39 | + } |
|
40 | 40 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
30 | 30 | { |
31 | 31 | $_attr = $this->getAttributes($compiler, $args); |
32 | - if ($_attr[ 'nocache' ] === true) { |
|
32 | + if ($_attr['nocache'] === true) { |
|
33 | 33 | $compiler->trigger_template_error('nocache option not allowed', null, true); |
34 | 34 | } |
35 | 35 | // this tag does not return compiled code |
@@ -12,26 +12,26 @@ |
||
12 | 12 | class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get autoload filters |
|
17 | - * |
|
18 | - * @api Smarty::getAutoloadFilters() |
|
19 | - * |
|
20 | - * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj |
|
21 | - * @param string $type type of filter to get auto loads |
|
22 | - * for. Defaults to all autoload |
|
23 | - * filters |
|
24 | - * |
|
25 | - * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type |
|
26 | - * was specified |
|
27 | - */ |
|
28 | - public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null) |
|
29 | - { |
|
30 | - $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
|
31 | - if ($type !== null) { |
|
32 | - $this->_checkFilterType($type); |
|
33 | - return isset($smarty->autoload_filters[ $type ]) ? $smarty->autoload_filters[ $type ] : array(); |
|
34 | - } |
|
35 | - return $smarty->autoload_filters; |
|
36 | - } |
|
15 | + /** |
|
16 | + * Get autoload filters |
|
17 | + * |
|
18 | + * @api Smarty::getAutoloadFilters() |
|
19 | + * |
|
20 | + * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj |
|
21 | + * @param string $type type of filter to get auto loads |
|
22 | + * for. Defaults to all autoload |
|
23 | + * filters |
|
24 | + * |
|
25 | + * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type |
|
26 | + * was specified |
|
27 | + */ |
|
28 | + public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null) |
|
29 | + { |
|
30 | + $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
|
31 | + if ($type !== null) { |
|
32 | + $this->_checkFilterType($type); |
|
33 | + return isset($smarty->autoload_filters[ $type ]) ? $smarty->autoload_filters[ $type ] : array(); |
|
34 | + } |
|
35 | + return $smarty->autoload_filters; |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
31 | 31 | if ($type !== null) { |
32 | 32 | $this->_checkFilterType($type); |
33 | - return isset($smarty->autoload_filters[ $type ]) ? $smarty->autoload_filters[ $type ] : array(); |
|
33 | + return isset($smarty->autoload_filters[$type]) ? $smarty->autoload_filters[$type] : array(); |
|
34 | 34 | } |
35 | 35 | return $smarty->autoload_filters; |
36 | 36 | } |
@@ -11,30 +11,30 @@ |
||
11 | 11 | */ |
12 | 12 | class Smarty_Internal_Method_ClearAllCache |
13 | 13 | { |
14 | - /** |
|
15 | - * Valid for Smarty object |
|
16 | - * |
|
17 | - * @var int |
|
18 | - */ |
|
19 | - public $objMap = 1; |
|
14 | + /** |
|
15 | + * Valid for Smarty object |
|
16 | + * |
|
17 | + * @var int |
|
18 | + */ |
|
19 | + public $objMap = 1; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Empty cache folder |
|
23 | - * |
|
24 | - * @api Smarty::clearAllCache() |
|
25 | - * @link http://www.smarty.net/docs/en/api.clear.all.cache.tpl |
|
26 | - * |
|
27 | - * @param \Smarty $smarty |
|
28 | - * @param integer $exp_time expiration time |
|
29 | - * @param string $type resource type |
|
30 | - * |
|
31 | - * @return integer number of cache files deleted |
|
32 | - */ |
|
33 | - public function clearAllCache(Smarty $smarty, $exp_time = null, $type = null) |
|
34 | - { |
|
35 | - $smarty->_clearTemplateCache(); |
|
36 | - // load cache resource and call clearAll |
|
37 | - $_cache_resource = Smarty_CacheResource::load($smarty, $type); |
|
38 | - return $_cache_resource->clearAll($smarty, $exp_time); |
|
39 | - } |
|
21 | + /** |
|
22 | + * Empty cache folder |
|
23 | + * |
|
24 | + * @api Smarty::clearAllCache() |
|
25 | + * @link http://www.smarty.net/docs/en/api.clear.all.cache.tpl |
|
26 | + * |
|
27 | + * @param \Smarty $smarty |
|
28 | + * @param integer $exp_time expiration time |
|
29 | + * @param string $type resource type |
|
30 | + * |
|
31 | + * @return integer number of cache files deleted |
|
32 | + */ |
|
33 | + public function clearAllCache(Smarty $smarty, $exp_time = null, $type = null) |
|
34 | + { |
|
35 | + $smarty->_clearTemplateCache(); |
|
36 | + // load cache resource and call clearAll |
|
37 | + $_cache_resource = Smarty_CacheResource::load($smarty, $type); |
|
38 | + return $_cache_resource->clearAll($smarty, $exp_time); |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -16,71 +16,71 @@ |
||
16 | 16 | */ |
17 | 17 | class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase |
18 | 18 | { |
19 | - /** |
|
20 | - * Attribute definition: Overwrites base class. |
|
21 | - * |
|
22 | - * @var array |
|
23 | - * @see Smarty_Internal_CompileBase |
|
24 | - */ |
|
25 | - public $optional_attributes = array('_any'); |
|
19 | + /** |
|
20 | + * Attribute definition: Overwrites base class. |
|
21 | + * |
|
22 | + * @var array |
|
23 | + * @see Smarty_Internal_CompileBase |
|
24 | + */ |
|
25 | + public $optional_attributes = array('_any'); |
|
26 | 26 | |
27 | - /** |
|
28 | - * Compiles code for the execution of function plugin |
|
29 | - * |
|
30 | - * @param array $args array with attributes from parser |
|
31 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
32 | - * @param array $parameter array with compilation parameter |
|
33 | - * @param string $tag name of function |
|
34 | - * @param string $method name of method to call |
|
35 | - * |
|
36 | - * @return string compiled code |
|
37 | - */ |
|
38 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $method) |
|
39 | - { |
|
40 | - // check and get attributes |
|
41 | - $_attr = $this->getAttributes($compiler, $args); |
|
42 | - //Does tag create output |
|
43 | - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
27 | + /** |
|
28 | + * Compiles code for the execution of function plugin |
|
29 | + * |
|
30 | + * @param array $args array with attributes from parser |
|
31 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
32 | + * @param array $parameter array with compilation parameter |
|
33 | + * @param string $tag name of function |
|
34 | + * @param string $method name of method to call |
|
35 | + * |
|
36 | + * @return string compiled code |
|
37 | + */ |
|
38 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $method) |
|
39 | + { |
|
40 | + // check and get attributes |
|
41 | + $_attr = $this->getAttributes($compiler, $args); |
|
42 | + //Does tag create output |
|
43 | + $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
44 | 44 | |
45 | - unset($_attr[ 'nocache' ]); |
|
46 | - $_assign = null; |
|
47 | - if (isset($_attr[ 'assign' ])) { |
|
48 | - $_assign = $_attr[ 'assign' ]; |
|
49 | - unset($_attr[ 'assign' ]); |
|
50 | - } |
|
51 | - // method or property ? |
|
52 | - if (is_callable(array($compiler->smarty->registered_objects[ $tag ][ 0 ], $method))) { |
|
53 | - // convert attributes into parameter array string |
|
54 | - if ($compiler->smarty->registered_objects[ $tag ][ 2 ]) { |
|
55 | - $_paramsArray = array(); |
|
56 | - foreach ($_attr as $_key => $_value) { |
|
57 | - if (is_int($_key)) { |
|
58 | - $_paramsArray[] = "$_key=>$_value"; |
|
59 | - } else { |
|
60 | - $_paramsArray[] = "'$_key'=>$_value"; |
|
61 | - } |
|
62 | - } |
|
63 | - $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
|
64 | - $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; |
|
65 | - } else { |
|
66 | - $_params = implode(",", $_attr); |
|
67 | - $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; |
|
68 | - } |
|
69 | - } else { |
|
70 | - // object property |
|
71 | - $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}"; |
|
72 | - } |
|
73 | - if (!empty($parameter[ 'modifierlist' ])) { |
|
74 | - $output = $compiler->compileTag('private_modifier', array(), |
|
75 | - array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)); |
|
76 | - } |
|
77 | - //Does tag create output |
|
78 | - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
45 | + unset($_attr[ 'nocache' ]); |
|
46 | + $_assign = null; |
|
47 | + if (isset($_attr[ 'assign' ])) { |
|
48 | + $_assign = $_attr[ 'assign' ]; |
|
49 | + unset($_attr[ 'assign' ]); |
|
50 | + } |
|
51 | + // method or property ? |
|
52 | + if (is_callable(array($compiler->smarty->registered_objects[ $tag ][ 0 ], $method))) { |
|
53 | + // convert attributes into parameter array string |
|
54 | + if ($compiler->smarty->registered_objects[ $tag ][ 2 ]) { |
|
55 | + $_paramsArray = array(); |
|
56 | + foreach ($_attr as $_key => $_value) { |
|
57 | + if (is_int($_key)) { |
|
58 | + $_paramsArray[] = "$_key=>$_value"; |
|
59 | + } else { |
|
60 | + $_paramsArray[] = "'$_key'=>$_value"; |
|
61 | + } |
|
62 | + } |
|
63 | + $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
|
64 | + $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; |
|
65 | + } else { |
|
66 | + $_params = implode(",", $_attr); |
|
67 | + $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; |
|
68 | + } |
|
69 | + } else { |
|
70 | + // object property |
|
71 | + $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}"; |
|
72 | + } |
|
73 | + if (!empty($parameter[ 'modifierlist' ])) { |
|
74 | + $output = $compiler->compileTag('private_modifier', array(), |
|
75 | + array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)); |
|
76 | + } |
|
77 | + //Does tag create output |
|
78 | + $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
79 | 79 | |
80 | - if (empty($_assign)) { |
|
81 | - return "<?php echo {$output};?>\n"; |
|
82 | - } else { |
|
83 | - return "<?php \$_smarty_tpl->assign({$_assign},{$output});?>\n"; |
|
84 | - } |
|
85 | - } |
|
80 | + if (empty($_assign)) { |
|
81 | + return "<?php echo {$output};?>\n"; |
|
82 | + } else { |
|
83 | + return "<?php \$_smarty_tpl->assign({$_assign},{$output});?>\n"; |
|
84 | + } |
|
85 | + } |
|
86 | 86 | } |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | // check and get attributes |
41 | 41 | $_attr = $this->getAttributes($compiler, $args); |
42 | 42 | //Does tag create output |
43 | - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
43 | + $compiler->has_output = isset($_attr['assign']) ? false : true; |
|
44 | 44 | |
45 | - unset($_attr[ 'nocache' ]); |
|
45 | + unset($_attr['nocache']); |
|
46 | 46 | $_assign = null; |
47 | - if (isset($_attr[ 'assign' ])) { |
|
48 | - $_assign = $_attr[ 'assign' ]; |
|
49 | - unset($_attr[ 'assign' ]); |
|
47 | + if (isset($_attr['assign'])) { |
|
48 | + $_assign = $_attr['assign']; |
|
49 | + unset($_attr['assign']); |
|
50 | 50 | } |
51 | 51 | // method or property ? |
52 | - if (is_callable(array($compiler->smarty->registered_objects[ $tag ][ 0 ], $method))) { |
|
52 | + if (is_callable(array($compiler->smarty->registered_objects[$tag][0], $method))) { |
|
53 | 53 | // convert attributes into parameter array string |
54 | - if ($compiler->smarty->registered_objects[ $tag ][ 2 ]) { |
|
54 | + if ($compiler->smarty->registered_objects[$tag][2]) { |
|
55 | 55 | $_paramsArray = array(); |
56 | 56 | foreach ($_attr as $_key => $_value) { |
57 | 57 | if (is_int($_key)) { |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | // object property |
71 | 71 | $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}"; |
72 | 72 | } |
73 | - if (!empty($parameter[ 'modifierlist' ])) { |
|
73 | + if (!empty($parameter['modifierlist'])) { |
|
74 | 74 | $output = $compiler->compileTag('private_modifier', array(), |
75 | - array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)); |
|
75 | + array('modifierlist' => $parameter['modifierlist'], 'value' => $output)); |
|
76 | 76 | } |
77 | 77 | //Does tag create output |
78 | - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
78 | + $compiler->has_output = isset($_attr['assign']) ? false : true; |
|
79 | 79 | |
80 | 80 | if (empty($_assign)) { |
81 | 81 | return "<?php echo {$output};?>\n"; |
@@ -18,25 +18,25 @@ |
||
18 | 18 | */ |
19 | 19 | class Smarty_Internal_ParseTree_DqContent extends Smarty_Internal_ParseTree |
20 | 20 | { |
21 | - /** |
|
22 | - * Create parse tree buffer with string content |
|
23 | - * |
|
24 | - * @param string $data string section |
|
25 | - */ |
|
26 | - public function __construct($data) |
|
27 | - { |
|
28 | - $this->data = $data; |
|
29 | - } |
|
21 | + /** |
|
22 | + * Create parse tree buffer with string content |
|
23 | + * |
|
24 | + * @param string $data string section |
|
25 | + */ |
|
26 | + public function __construct($data) |
|
27 | + { |
|
28 | + $this->data = $data; |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Return content as double quoted string |
|
33 | - * |
|
34 | - * @param \Smarty_Internal_Templateparser $parser |
|
35 | - * |
|
36 | - * @return string doubled quoted string |
|
37 | - */ |
|
38 | - public function to_smarty_php(Smarty_Internal_Templateparser $parser) |
|
39 | - { |
|
40 | - return '"' . $this->data . '"'; |
|
41 | - } |
|
31 | + /** |
|
32 | + * Return content as double quoted string |
|
33 | + * |
|
34 | + * @param \Smarty_Internal_Templateparser $parser |
|
35 | + * |
|
36 | + * @return string doubled quoted string |
|
37 | + */ |
|
38 | + public function to_smarty_php(Smarty_Internal_Templateparser $parser) |
|
39 | + { |
|
40 | + return '"' . $this->data . '"'; |
|
41 | + } |
|
42 | 42 | } |
@@ -16,67 +16,67 @@ |
||
16 | 16 | */ |
17 | 17 | class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase |
18 | 18 | { |
19 | - /** |
|
20 | - * Attribute definition: Overwrites base class. |
|
21 | - * |
|
22 | - * @var array |
|
23 | - * @see Smarty_Internal_CompileBase |
|
24 | - */ |
|
25 | - public $optional_attributes = array('_any'); |
|
19 | + /** |
|
20 | + * Attribute definition: Overwrites base class. |
|
21 | + * |
|
22 | + * @var array |
|
23 | + * @see Smarty_Internal_CompileBase |
|
24 | + */ |
|
25 | + public $optional_attributes = array('_any'); |
|
26 | 26 | |
27 | - /** |
|
28 | - * Compiles code for the execution of a registered function |
|
29 | - * |
|
30 | - * @param array $args array with attributes from parser |
|
31 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
32 | - * @param array $parameter array with compilation parameter |
|
33 | - * @param string $tag name of function |
|
34 | - * |
|
35 | - * @return string compiled code |
|
36 | - */ |
|
37 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag) |
|
38 | - { |
|
39 | - // check and get attributes |
|
40 | - $_attr = $this->getAttributes($compiler, $args); |
|
41 | - unset($_attr[ 'nocache' ]); |
|
42 | - if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) { |
|
43 | - $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; |
|
44 | - } else { |
|
45 | - $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; |
|
46 | - } |
|
47 | - // not cachable? |
|
48 | - $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ]; |
|
49 | - // convert attributes into parameter array string |
|
50 | - $_paramsArray = array(); |
|
51 | - foreach ($_attr as $_key => $_value) { |
|
52 | - if (is_int($_key)) { |
|
53 | - $_paramsArray[] = "$_key=>$_value"; |
|
54 | - } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) { |
|
55 | - $_value = str_replace("'", "^#^", $_value); |
|
56 | - $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; |
|
57 | - } else { |
|
58 | - $_paramsArray[] = "'$_key'=>$_value"; |
|
59 | - } |
|
60 | - } |
|
61 | - $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
|
62 | - $function = $tag_info[ 0 ]; |
|
63 | - // compile code |
|
64 | - if (!is_array($function)) { |
|
65 | - $output = "{$function}({$_params},\$_smarty_tpl)"; |
|
66 | - } elseif (is_object($function[ 0 ])) { |
|
67 | - $output = |
|
68 | - "\$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl)"; |
|
69 | - } else { |
|
70 | - $output = "{$function[0]}::{$function[1]}({$_params},\$_smarty_tpl)"; |
|
71 | - } |
|
72 | - if (!empty($parameter[ 'modifierlist' ])) { |
|
73 | - $output = $compiler->compileTag('private_modifier', array(), |
|
74 | - array('modifierlist' => $parameter[ 'modifierlist' ], |
|
75 | - 'value' => $output)); |
|
76 | - } |
|
77 | - //Does tag create output |
|
78 | - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
79 | - $output = "<?php " . ($compiler->has_output ? "echo " : '') . "{$output};?>\n"; |
|
80 | - return $output; |
|
81 | - } |
|
27 | + /** |
|
28 | + * Compiles code for the execution of a registered function |
|
29 | + * |
|
30 | + * @param array $args array with attributes from parser |
|
31 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
32 | + * @param array $parameter array with compilation parameter |
|
33 | + * @param string $tag name of function |
|
34 | + * |
|
35 | + * @return string compiled code |
|
36 | + */ |
|
37 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag) |
|
38 | + { |
|
39 | + // check and get attributes |
|
40 | + $_attr = $this->getAttributes($compiler, $args); |
|
41 | + unset($_attr[ 'nocache' ]); |
|
42 | + if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) { |
|
43 | + $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; |
|
44 | + } else { |
|
45 | + $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; |
|
46 | + } |
|
47 | + // not cachable? |
|
48 | + $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ]; |
|
49 | + // convert attributes into parameter array string |
|
50 | + $_paramsArray = array(); |
|
51 | + foreach ($_attr as $_key => $_value) { |
|
52 | + if (is_int($_key)) { |
|
53 | + $_paramsArray[] = "$_key=>$_value"; |
|
54 | + } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) { |
|
55 | + $_value = str_replace("'", "^#^", $_value); |
|
56 | + $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; |
|
57 | + } else { |
|
58 | + $_paramsArray[] = "'$_key'=>$_value"; |
|
59 | + } |
|
60 | + } |
|
61 | + $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
|
62 | + $function = $tag_info[ 0 ]; |
|
63 | + // compile code |
|
64 | + if (!is_array($function)) { |
|
65 | + $output = "{$function}({$_params},\$_smarty_tpl)"; |
|
66 | + } elseif (is_object($function[ 0 ])) { |
|
67 | + $output = |
|
68 | + "\$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl)"; |
|
69 | + } else { |
|
70 | + $output = "{$function[0]}::{$function[1]}({$_params},\$_smarty_tpl)"; |
|
71 | + } |
|
72 | + if (!empty($parameter[ 'modifierlist' ])) { |
|
73 | + $output = $compiler->compileTag('private_modifier', array(), |
|
74 | + array('modifierlist' => $parameter[ 'modifierlist' ], |
|
75 | + 'value' => $output)); |
|
76 | + } |
|
77 | + //Does tag create output |
|
78 | + $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
79 | + $output = "<?php " . ($compiler->has_output ? "echo " : '') . "{$output};?>\n"; |
|
80 | + return $output; |
|
81 | + } |
|
82 | 82 | } |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | { |
39 | 39 | // check and get attributes |
40 | 40 | $_attr = $this->getAttributes($compiler, $args); |
41 | - unset($_attr[ 'nocache' ]); |
|
42 | - if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) { |
|
43 | - $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; |
|
41 | + unset($_attr['nocache']); |
|
42 | + if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag])) { |
|
43 | + $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag]; |
|
44 | 44 | } else { |
45 | - $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; |
|
45 | + $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_FUNCTION][$tag]; |
|
46 | 46 | } |
47 | 47 | // not cachable? |
48 | - $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ]; |
|
48 | + $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[1]; |
|
49 | 49 | // convert attributes into parameter array string |
50 | 50 | $_paramsArray = array(); |
51 | 51 | foreach ($_attr as $_key => $_value) { |
52 | 52 | if (is_int($_key)) { |
53 | 53 | $_paramsArray[] = "$_key=>$_value"; |
54 | - } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) { |
|
54 | + } elseif ($compiler->template->caching && in_array($_key, $tag_info[2])) { |
|
55 | 55 | $_value = str_replace("'", "^#^", $_value); |
56 | 56 | $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; |
57 | 57 | } else { |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | } |
60 | 60 | } |
61 | 61 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
62 | - $function = $tag_info[ 0 ]; |
|
62 | + $function = $tag_info[0]; |
|
63 | 63 | // compile code |
64 | 64 | if (!is_array($function)) { |
65 | 65 | $output = "{$function}({$_params},\$_smarty_tpl)"; |
66 | - } elseif (is_object($function[ 0 ])) { |
|
66 | + } elseif (is_object($function[0])) { |
|
67 | 67 | $output = |
68 | 68 | "\$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl)"; |
69 | 69 | } else { |
70 | 70 | $output = "{$function[0]}::{$function[1]}({$_params},\$_smarty_tpl)"; |
71 | 71 | } |
72 | - if (!empty($parameter[ 'modifierlist' ])) { |
|
72 | + if (!empty($parameter['modifierlist'])) { |
|
73 | 73 | $output = $compiler->compileTag('private_modifier', array(), |
74 | - array('modifierlist' => $parameter[ 'modifierlist' ], |
|
74 | + array('modifierlist' => $parameter['modifierlist'], |
|
75 | 75 | 'value' => $output)); |
76 | 76 | } |
77 | 77 | //Does tag create output |
78 | - $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; |
|
78 | + $compiler->has_output = isset($_attr['assign']) ? false : true; |
|
79 | 79 | $output = "<?php " . ($compiler->has_output ? "echo " : '') . "{$output};?>\n"; |
80 | 80 | return $output; |
81 | 81 | } |
@@ -17,52 +17,52 @@ |
||
17 | 17 | */ |
18 | 18 | class Smarty_Data extends Smarty_Internal_Data |
19 | 19 | { |
20 | - /** |
|
21 | - * Counter |
|
22 | - * |
|
23 | - * @var int |
|
24 | - */ |
|
25 | - static $count = 0; |
|
20 | + /** |
|
21 | + * Counter |
|
22 | + * |
|
23 | + * @var int |
|
24 | + */ |
|
25 | + static $count = 0; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Data block name |
|
29 | - * |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - public $dataObjectName = ''; |
|
27 | + /** |
|
28 | + * Data block name |
|
29 | + * |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + public $dataObjectName = ''; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Smarty object |
|
36 | - * |
|
37 | - * @var Smarty |
|
38 | - */ |
|
39 | - public $smarty = null; |
|
34 | + /** |
|
35 | + * Smarty object |
|
36 | + * |
|
37 | + * @var Smarty |
|
38 | + */ |
|
39 | + public $smarty = null; |
|
40 | 40 | |
41 | - /** |
|
42 | - * create Smarty data object |
|
43 | - * |
|
44 | - * @param Smarty|array $_parent parent template |
|
45 | - * @param Smarty|Smarty_Internal_Template $smarty global smarty instance |
|
46 | - * @param string $name optional data block name |
|
47 | - * |
|
48 | - * @throws SmartyException |
|
49 | - */ |
|
50 | - public function __construct($_parent = null, $smarty = null, $name = null) |
|
51 | - { |
|
52 | - parent::__construct(); |
|
53 | - self::$count ++; |
|
54 | - $this->dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count); |
|
55 | - $this->smarty = $smarty; |
|
56 | - if (is_object($_parent)) { |
|
57 | - // when object set up back pointer |
|
58 | - $this->parent = $_parent; |
|
59 | - } elseif (is_array($_parent)) { |
|
60 | - // set up variable values |
|
61 | - foreach ($_parent as $_key => $_val) { |
|
62 | - $this->tpl_vars[ $_key ] = new Smarty_Variable($_val); |
|
63 | - } |
|
64 | - } elseif ($_parent != null) { |
|
65 | - throw new SmartyException("Wrong type for template variables"); |
|
66 | - } |
|
67 | - } |
|
41 | + /** |
|
42 | + * create Smarty data object |
|
43 | + * |
|
44 | + * @param Smarty|array $_parent parent template |
|
45 | + * @param Smarty|Smarty_Internal_Template $smarty global smarty instance |
|
46 | + * @param string $name optional data block name |
|
47 | + * |
|
48 | + * @throws SmartyException |
|
49 | + */ |
|
50 | + public function __construct($_parent = null, $smarty = null, $name = null) |
|
51 | + { |
|
52 | + parent::__construct(); |
|
53 | + self::$count ++; |
|
54 | + $this->dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count); |
|
55 | + $this->smarty = $smarty; |
|
56 | + if (is_object($_parent)) { |
|
57 | + // when object set up back pointer |
|
58 | + $this->parent = $_parent; |
|
59 | + } elseif (is_array($_parent)) { |
|
60 | + // set up variable values |
|
61 | + foreach ($_parent as $_key => $_val) { |
|
62 | + $this->tpl_vars[ $_key ] = new Smarty_Variable($_val); |
|
63 | + } |
|
64 | + } elseif ($_parent != null) { |
|
65 | + throw new SmartyException("Wrong type for template variables"); |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function __construct($_parent = null, $smarty = null, $name = null) |
51 | 51 | { |
52 | 52 | parent::__construct(); |
53 | - self::$count ++; |
|
53 | + self::$count++; |
|
54 | 54 | $this->dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count); |
55 | 55 | $this->smarty = $smarty; |
56 | 56 | if (is_object($_parent)) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } elseif (is_array($_parent)) { |
60 | 60 | // set up variable values |
61 | 61 | foreach ($_parent as $_key => $_val) { |
62 | - $this->tpl_vars[ $_key ] = new Smarty_Variable($_val); |
|
62 | + $this->tpl_vars[$_key] = new Smarty_Variable($_val); |
|
63 | 63 | } |
64 | 64 | } elseif ($_parent != null) { |
65 | 65 | throw new SmartyException("Wrong type for template variables"); |