@@ -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"); |
@@ -12,25 +12,25 @@ |
||
| 12 | 12 | class Smarty_Internal_Method_AssignByRef |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * assigns values to template variables by reference |
|
| 17 | - * |
|
| 18 | - * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data |
|
| 19 | - * @param string $tpl_var the template variable name |
|
| 20 | - * @param $value |
|
| 21 | - * @param boolean $nocache if true any output of this variable will be not cached |
|
| 22 | - * |
|
| 23 | - * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
| 24 | - */ |
|
| 25 | - public function assignByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $nocache) |
|
| 26 | - { |
|
| 27 | - if ($tpl_var != '') { |
|
| 28 | - $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache); |
|
| 29 | - $data->tpl_vars[ $tpl_var ]->value = &$value; |
|
| 30 | - if ($data->_objType == 2 && $data->scope) { |
|
| 31 | - $data->ext->_updateScope->_updateScope($data, $tpl_var); |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - return $data; |
|
| 35 | - } |
|
| 15 | + /** |
|
| 16 | + * assigns values to template variables by reference |
|
| 17 | + * |
|
| 18 | + * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data |
|
| 19 | + * @param string $tpl_var the template variable name |
|
| 20 | + * @param $value |
|
| 21 | + * @param boolean $nocache if true any output of this variable will be not cached |
|
| 22 | + * |
|
| 23 | + * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
| 24 | + */ |
|
| 25 | + public function assignByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $nocache) |
|
| 26 | + { |
|
| 27 | + if ($tpl_var != '') { |
|
| 28 | + $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache); |
|
| 29 | + $data->tpl_vars[ $tpl_var ]->value = &$value; |
|
| 30 | + if ($data->_objType == 2 && $data->scope) { |
|
| 31 | + $data->ext->_updateScope->_updateScope($data, $tpl_var); |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + return $data; |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -25,8 +25,8 @@ |
||
| 25 | 25 | public function assignByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $nocache) |
| 26 | 26 | { |
| 27 | 27 | if ($tpl_var != '') { |
| 28 | - $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache); |
|
| 29 | - $data->tpl_vars[ $tpl_var ]->value = &$value; |
|
| 28 | + $data->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache); |
|
| 29 | + $data->tpl_vars[$tpl_var]->value = &$value; |
|
| 30 | 30 | if ($data->_objType == 2 && $data->scope) { |
| 31 | 31 | $data->ext->_updateScope->_updateScope($data, $tpl_var); |
| 32 | 32 | } |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | // check and get attributes |
| 57 | 57 | $_attr = $this->getAttributes($compiler, $args); |
| 58 | 58 | |
| 59 | - if ($_attr[ 'nocache' ] === true) { |
|
| 59 | + if ($_attr['nocache'] === true) { |
|
| 60 | 60 | $compiler->trigger_template_error('nocache option not allowed', null, true); |
| 61 | 61 | } |
| 62 | - unset($_attr[ 'nocache' ]); |
|
| 63 | - $_name = trim($_attr[ 'name' ], "'\""); |
|
| 64 | - $compiler->parent_compiler->tpl_function[ $_name ] = array(); |
|
| 62 | + unset($_attr['nocache']); |
|
| 63 | + $_name = trim($_attr['name'], "'\""); |
|
| 64 | + $compiler->parent_compiler->tpl_function[$_name] = array(); |
|
| 65 | 65 | $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, |
| 66 | 66 | $compiler->template->caching); |
| 67 | 67 | $this->openTag($compiler, 'function', $save); |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $this->compiler = $compiler; |
| 103 | 103 | $saved_data = $this->closeTag($compiler, array('function')); |
| 104 | - $_attr = $saved_data[ 0 ]; |
|
| 105 | - $_name = trim($_attr[ 'name' ], "'\""); |
|
| 106 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] = |
|
| 104 | + $_attr = $saved_data[0]; |
|
| 105 | + $_name = trim($_attr['name'], "'\""); |
|
| 106 | + $compiler->parent_compiler->tpl_function[$_name]['compiled_filepath'] = |
|
| 107 | 107 | $compiler->parent_compiler->template->compiled->filepath; |
| 108 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid; |
|
| 108 | + $compiler->parent_compiler->tpl_function[$_name]['uid'] = $compiler->template->source->uid; |
|
| 109 | 109 | $_parameter = $_attr; |
| 110 | - unset($_parameter[ 'name' ]); |
|
| 110 | + unset($_parameter['name']); |
|
| 111 | 111 | // default parameter |
| 112 | 112 | $_paramsArray = array(); |
| 113 | 113 | foreach ($_parameter as $_key => $_value) { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}"; |
| 131 | 131 | $_funcNameCaching = $_funcName . '_nocache'; |
| 132 | 132 | if ($compiler->template->compiled->has_nocache_code) { |
| 133 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name_caching' ] = $_funcNameCaching; |
|
| 133 | + $compiler->parent_compiler->tpl_function[$_name]['call_name_caching'] = $_funcNameCaching; |
|
| 134 | 134 | $output = "<?php\n"; |
| 135 | 135 | $output .= "/* {$_funcNameCaching} */\n"; |
| 136 | 136 | $output .= "if (!function_exists('{$_funcNameCaching}')) {\n"; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | array($this, 'removeNocache'), |
| 163 | 163 | $_functionCode->to_smarty_php($compiler->parser))); |
| 164 | 164 | } |
| 165 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName; |
|
| 165 | + $compiler->parent_compiler->tpl_function[$_name]['call_name'] = $_funcName; |
|
| 166 | 166 | $output = "<?php\n"; |
| 167 | 167 | $output .= "/* {$_funcName} */\n"; |
| 168 | 168 | $output .= "if (!function_exists('{$_funcName}')) {\n"; |
@@ -181,20 +181,20 @@ discard block |
||
| 181 | 181 | $output)); |
| 182 | 182 | $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
| 183 | 183 | // nocache plugins must be copied |
| 184 | - if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
| 185 | - foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
| 184 | + if (!empty($compiler->template->compiled->required_plugins['nocache'])) { |
|
| 185 | + foreach ($compiler->template->compiled->required_plugins['nocache'] as $plugin => $tmp) { |
|
| 186 | 186 | foreach ($tmp as $type => $data) { |
| 187 | - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
| 187 | + $compiler->parent_compiler->template->compiled->required_plugins['compiled'][$plugin][$type] = |
|
| 188 | 188 | $data; |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | // restore old buffer |
| 193 | 193 | |
| 194 | - $compiler->parser->current_buffer = $saved_data[ 1 ]; |
|
| 194 | + $compiler->parser->current_buffer = $saved_data[1]; |
|
| 195 | 195 | // restore old status |
| 196 | - $compiler->template->compiled->has_nocache_code = $saved_data[ 2 ]; |
|
| 197 | - $compiler->template->caching = $saved_data[ 3 ]; |
|
| 196 | + $compiler->template->compiled->has_nocache_code = $saved_data[2]; |
|
| 197 | + $compiler->template->caching = $saved_data[3]; |
|
| 198 | 198 | return true; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | $code = |
| 211 | 211 | preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
| 212 | - '', $match[ 0 ]); |
|
| 212 | + '', $match[0]); |
|
| 213 | 213 | $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code); |
| 214 | 214 | return $code; |
| 215 | 215 | } |
@@ -17,59 +17,59 @@ discard block |
||
| 17 | 17 | class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Attribute definition: Overwrites base class. |
|
| 22 | - * |
|
| 23 | - * @var array |
|
| 24 | - * @see Smarty_Internal_CompileBase |
|
| 25 | - */ |
|
| 26 | - public $required_attributes = array('name'); |
|
| 20 | + /** |
|
| 21 | + * Attribute definition: Overwrites base class. |
|
| 22 | + * |
|
| 23 | + * @var array |
|
| 24 | + * @see Smarty_Internal_CompileBase |
|
| 25 | + */ |
|
| 26 | + public $required_attributes = array('name'); |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Attribute definition: Overwrites base class. |
|
| 30 | - * |
|
| 31 | - * @var array |
|
| 32 | - * @see Smarty_Internal_CompileBase |
|
| 33 | - */ |
|
| 34 | - public $shorttag_order = array('name'); |
|
| 28 | + /** |
|
| 29 | + * Attribute definition: Overwrites base class. |
|
| 30 | + * |
|
| 31 | + * @var array |
|
| 32 | + * @see Smarty_Internal_CompileBase |
|
| 33 | + */ |
|
| 34 | + public $shorttag_order = array('name'); |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Attribute definition: Overwrites base class. |
|
| 38 | - * |
|
| 39 | - * @var array |
|
| 40 | - * @see Smarty_Internal_CompileBase |
|
| 41 | - */ |
|
| 42 | - public $optional_attributes = array('_any'); |
|
| 36 | + /** |
|
| 37 | + * Attribute definition: Overwrites base class. |
|
| 38 | + * |
|
| 39 | + * @var array |
|
| 40 | + * @see Smarty_Internal_CompileBase |
|
| 41 | + */ |
|
| 42 | + public $optional_attributes = array('_any'); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Compiles code for the {function} tag |
|
| 46 | - * |
|
| 47 | - * @param array $args array with attributes from parser |
|
| 48 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 49 | - * @param array $parameter array with compilation parameter |
|
| 50 | - * |
|
| 51 | - * @return bool true |
|
| 52 | - * @throws \SmartyCompilerException |
|
| 53 | - */ |
|
| 54 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 55 | - { |
|
| 56 | - // check and get attributes |
|
| 57 | - $_attr = $this->getAttributes($compiler, $args); |
|
| 44 | + /** |
|
| 45 | + * Compiles code for the {function} tag |
|
| 46 | + * |
|
| 47 | + * @param array $args array with attributes from parser |
|
| 48 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 49 | + * @param array $parameter array with compilation parameter |
|
| 50 | + * |
|
| 51 | + * @return bool true |
|
| 52 | + * @throws \SmartyCompilerException |
|
| 53 | + */ |
|
| 54 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 55 | + { |
|
| 56 | + // check and get attributes |
|
| 57 | + $_attr = $this->getAttributes($compiler, $args); |
|
| 58 | 58 | |
| 59 | - if ($_attr[ 'nocache' ] === true) { |
|
| 60 | - $compiler->trigger_template_error('nocache option not allowed', null, true); |
|
| 61 | - } |
|
| 62 | - unset($_attr[ 'nocache' ]); |
|
| 63 | - $_name = trim($_attr[ 'name' ], "'\""); |
|
| 64 | - $compiler->parent_compiler->tpl_function[ $_name ] = array(); |
|
| 65 | - $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, |
|
| 66 | - $compiler->template->caching); |
|
| 67 | - $this->openTag($compiler, 'function', $save); |
|
| 68 | - // Init temporary context |
|
| 69 | - $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
| 70 | - $compiler->template->compiled->has_nocache_code = false; |
|
| 71 | - return true; |
|
| 72 | - } |
|
| 59 | + if ($_attr[ 'nocache' ] === true) { |
|
| 60 | + $compiler->trigger_template_error('nocache option not allowed', null, true); |
|
| 61 | + } |
|
| 62 | + unset($_attr[ 'nocache' ]); |
|
| 63 | + $_name = trim($_attr[ 'name' ], "'\""); |
|
| 64 | + $compiler->parent_compiler->tpl_function[ $_name ] = array(); |
|
| 65 | + $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, |
|
| 66 | + $compiler->template->caching); |
|
| 67 | + $this->openTag($compiler, 'function', $save); |
|
| 68 | + // Init temporary context |
|
| 69 | + $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
| 70 | + $compiler->template->compiled->has_nocache_code = false; |
|
| 71 | + return true; |
|
| 72 | + } |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -81,136 +81,136 @@ discard block |
||
| 81 | 81 | class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase |
| 82 | 82 | { |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Compiler object |
|
| 86 | - * |
|
| 87 | - * @var object |
|
| 88 | - */ |
|
| 89 | - private $compiler = null; |
|
| 84 | + /** |
|
| 85 | + * Compiler object |
|
| 86 | + * |
|
| 87 | + * @var object |
|
| 88 | + */ |
|
| 89 | + private $compiler = null; |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Compiles code for the {/function} tag |
|
| 93 | - * |
|
| 94 | - * @param array $args array with attributes from parser |
|
| 95 | - * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 96 | - * @param array $parameter array with compilation parameter |
|
| 97 | - * |
|
| 98 | - * @return bool true |
|
| 99 | - */ |
|
| 100 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 101 | - { |
|
| 102 | - $this->compiler = $compiler; |
|
| 103 | - $saved_data = $this->closeTag($compiler, array('function')); |
|
| 104 | - $_attr = $saved_data[ 0 ]; |
|
| 105 | - $_name = trim($_attr[ 'name' ], "'\""); |
|
| 106 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] = |
|
| 107 | - $compiler->parent_compiler->template->compiled->filepath; |
|
| 108 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid; |
|
| 109 | - $_parameter = $_attr; |
|
| 110 | - unset($_parameter[ 'name' ]); |
|
| 111 | - // default parameter |
|
| 112 | - $_paramsArray = array(); |
|
| 113 | - foreach ($_parameter as $_key => $_value) { |
|
| 114 | - if (is_int($_key)) { |
|
| 115 | - $_paramsArray[] = "$_key=>$_value"; |
|
| 116 | - } else { |
|
| 117 | - $_paramsArray[] = "'$_key'=>$_value"; |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - if (!empty($_paramsArray)) { |
|
| 121 | - $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
|
| 122 | - $_paramsCode = "\$params = array_merge($_params, \$params);\n"; |
|
| 123 | - } else { |
|
| 124 | - $_paramsCode = ''; |
|
| 125 | - } |
|
| 126 | - $_functionCode = $compiler->parser->current_buffer; |
|
| 127 | - // setup buffer for template function code |
|
| 128 | - $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
| 91 | + /** |
|
| 92 | + * Compiles code for the {/function} tag |
|
| 93 | + * |
|
| 94 | + * @param array $args array with attributes from parser |
|
| 95 | + * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 96 | + * @param array $parameter array with compilation parameter |
|
| 97 | + * |
|
| 98 | + * @return bool true |
|
| 99 | + */ |
|
| 100 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 101 | + { |
|
| 102 | + $this->compiler = $compiler; |
|
| 103 | + $saved_data = $this->closeTag($compiler, array('function')); |
|
| 104 | + $_attr = $saved_data[ 0 ]; |
|
| 105 | + $_name = trim($_attr[ 'name' ], "'\""); |
|
| 106 | + $compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] = |
|
| 107 | + $compiler->parent_compiler->template->compiled->filepath; |
|
| 108 | + $compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid; |
|
| 109 | + $_parameter = $_attr; |
|
| 110 | + unset($_parameter[ 'name' ]); |
|
| 111 | + // default parameter |
|
| 112 | + $_paramsArray = array(); |
|
| 113 | + foreach ($_parameter as $_key => $_value) { |
|
| 114 | + if (is_int($_key)) { |
|
| 115 | + $_paramsArray[] = "$_key=>$_value"; |
|
| 116 | + } else { |
|
| 117 | + $_paramsArray[] = "'$_key'=>$_value"; |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + if (!empty($_paramsArray)) { |
|
| 121 | + $_params = 'array(' . implode(",", $_paramsArray) . ')'; |
|
| 122 | + $_paramsCode = "\$params = array_merge($_params, \$params);\n"; |
|
| 123 | + } else { |
|
| 124 | + $_paramsCode = ''; |
|
| 125 | + } |
|
| 126 | + $_functionCode = $compiler->parser->current_buffer; |
|
| 127 | + // setup buffer for template function code |
|
| 128 | + $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); |
|
| 129 | 129 | |
| 130 | - $_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}"; |
|
| 131 | - $_funcNameCaching = $_funcName . '_nocache'; |
|
| 132 | - if ($compiler->template->compiled->has_nocache_code) { |
|
| 133 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name_caching' ] = $_funcNameCaching; |
|
| 134 | - $output = "<?php\n"; |
|
| 135 | - $output .= "/* {$_funcNameCaching} */\n"; |
|
| 136 | - $output .= "if (!function_exists('{$_funcNameCaching}')) {\n"; |
|
| 137 | - $output .= "function {$_funcNameCaching} (\$_smarty_tpl,\$params) {\n"; |
|
| 138 | - $output .= "ob_start();\n"; |
|
| 139 | - $output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n"; |
|
| 140 | - $output .= $_paramsCode; |
|
| 141 | - $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}"; |
|
| 142 | - $output .= "\$params = var_export(\$params, true);\n"; |
|
| 143 | - $output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; |
|
| 144 | - $output .= "\\\$_smarty_tpl->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>"; |
|
| 145 | - $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n\";?>"; |
|
| 146 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
| 147 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 148 | - $output)); |
|
| 149 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
| 150 | - $output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; |
|
| 151 | - $output .= "\\\$_smarty_tpl->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n"; |
|
| 152 | - $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";\n?>"; |
|
| 153 | - $output .= "<?php echo str_replace('{$compiler->template->compiled->nocache_hash}', \$_smarty_tpl->compiled->nocache_hash, ob_get_clean());\n"; |
|
| 154 | - $output .= "}\n}\n"; |
|
| 155 | - $output .= "/*/ {$_funcName}_nocache */\n\n"; |
|
| 156 | - $output .= "?>\n"; |
|
| 157 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
| 158 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 159 | - $output)); |
|
| 160 | - $_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 161 | - preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
|
| 162 | - array($this, 'removeNocache'), |
|
| 163 | - $_functionCode->to_smarty_php($compiler->parser))); |
|
| 164 | - } |
|
| 165 | - $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName; |
|
| 166 | - $output = "<?php\n"; |
|
| 167 | - $output .= "/* {$_funcName} */\n"; |
|
| 168 | - $output .= "if (!function_exists('{$_funcName}')) {\n"; |
|
| 169 | - $output .= "function {$_funcName}(\$_smarty_tpl,\$params) {\n"; |
|
| 170 | - $output .= $_paramsCode; |
|
| 171 | - $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}?>"; |
|
| 172 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
| 173 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 174 | - $output)); |
|
| 175 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
| 176 | - $output = "<?php\n}}\n"; |
|
| 177 | - $output .= "/*/ {$_funcName} */\n\n"; |
|
| 178 | - $output .= "?>\n"; |
|
| 179 | - $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
| 180 | - new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 181 | - $output)); |
|
| 182 | - $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
|
| 183 | - // nocache plugins must be copied |
|
| 184 | - if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
| 185 | - foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
| 186 | - foreach ($tmp as $type => $data) { |
|
| 187 | - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
| 188 | - $data; |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - // restore old buffer |
|
| 130 | + $_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}"; |
|
| 131 | + $_funcNameCaching = $_funcName . '_nocache'; |
|
| 132 | + if ($compiler->template->compiled->has_nocache_code) { |
|
| 133 | + $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name_caching' ] = $_funcNameCaching; |
|
| 134 | + $output = "<?php\n"; |
|
| 135 | + $output .= "/* {$_funcNameCaching} */\n"; |
|
| 136 | + $output .= "if (!function_exists('{$_funcNameCaching}')) {\n"; |
|
| 137 | + $output .= "function {$_funcNameCaching} (\$_smarty_tpl,\$params) {\n"; |
|
| 138 | + $output .= "ob_start();\n"; |
|
| 139 | + $output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n"; |
|
| 140 | + $output .= $_paramsCode; |
|
| 141 | + $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}"; |
|
| 142 | + $output .= "\$params = var_export(\$params, true);\n"; |
|
| 143 | + $output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; |
|
| 144 | + $output .= "\\\$_smarty_tpl->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>"; |
|
| 145 | + $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n\";?>"; |
|
| 146 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
| 147 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 148 | + $output)); |
|
| 149 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
| 150 | + $output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; |
|
| 151 | + $output .= "\\\$_smarty_tpl->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n"; |
|
| 152 | + $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";\n?>"; |
|
| 153 | + $output .= "<?php echo str_replace('{$compiler->template->compiled->nocache_hash}', \$_smarty_tpl->compiled->nocache_hash, ob_get_clean());\n"; |
|
| 154 | + $output .= "}\n}\n"; |
|
| 155 | + $output .= "/*/ {$_funcName}_nocache */\n\n"; |
|
| 156 | + $output .= "?>\n"; |
|
| 157 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
| 158 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 159 | + $output)); |
|
| 160 | + $_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 161 | + preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
|
| 162 | + array($this, 'removeNocache'), |
|
| 163 | + $_functionCode->to_smarty_php($compiler->parser))); |
|
| 164 | + } |
|
| 165 | + $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName; |
|
| 166 | + $output = "<?php\n"; |
|
| 167 | + $output .= "/* {$_funcName} */\n"; |
|
| 168 | + $output .= "if (!function_exists('{$_funcName}')) {\n"; |
|
| 169 | + $output .= "function {$_funcName}(\$_smarty_tpl,\$params) {\n"; |
|
| 170 | + $output .= $_paramsCode; |
|
| 171 | + $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}?>"; |
|
| 172 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
| 173 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 174 | + $output)); |
|
| 175 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); |
|
| 176 | + $output = "<?php\n}}\n"; |
|
| 177 | + $output .= "/*/ {$_funcName} */\n\n"; |
|
| 178 | + $output .= "?>\n"; |
|
| 179 | + $compiler->parser->current_buffer->append_subtree($compiler->parser, |
|
| 180 | + new Smarty_Internal_ParseTree_Tag($compiler->parser, |
|
| 181 | + $output)); |
|
| 182 | + $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); |
|
| 183 | + // nocache plugins must be copied |
|
| 184 | + if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { |
|
| 185 | + foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { |
|
| 186 | + foreach ($tmp as $type => $data) { |
|
| 187 | + $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = |
|
| 188 | + $data; |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + // restore old buffer |
|
| 193 | 193 | |
| 194 | - $compiler->parser->current_buffer = $saved_data[ 1 ]; |
|
| 195 | - // restore old status |
|
| 196 | - $compiler->template->compiled->has_nocache_code = $saved_data[ 2 ]; |
|
| 197 | - $compiler->template->caching = $saved_data[ 3 ]; |
|
| 198 | - return true; |
|
| 199 | - } |
|
| 194 | + $compiler->parser->current_buffer = $saved_data[ 1 ]; |
|
| 195 | + // restore old status |
|
| 196 | + $compiler->template->compiled->has_nocache_code = $saved_data[ 2 ]; |
|
| 197 | + $compiler->template->caching = $saved_data[ 3 ]; |
|
| 198 | + return true; |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - /** |
|
| 202 | - * Remove nocache code |
|
| 203 | - * |
|
| 204 | - * @param $match |
|
| 205 | - * |
|
| 206 | - * @return string |
|
| 207 | - */ |
|
| 208 | - public function removeNocache($match) |
|
| 209 | - { |
|
| 210 | - $code = |
|
| 211 | - preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
|
| 212 | - '', $match[ 0 ]); |
|
| 213 | - $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code); |
|
| 214 | - return $code; |
|
| 215 | - } |
|
| 201 | + /** |
|
| 202 | + * Remove nocache code |
|
| 203 | + * |
|
| 204 | + * @param $match |
|
| 205 | + * |
|
| 206 | + * @return string |
|
| 207 | + */ |
|
| 208 | + public function removeNocache($match) |
|
| 209 | + { |
|
| 210 | + $code = |
|
| 211 | + preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", |
|
| 212 | + '', $match[ 0 ]); |
|
| 213 | + $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code); |
|
| 214 | + return $code; |
|
| 215 | + } |
|
| 216 | 216 | } |
@@ -16,55 +16,55 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * Compiles code for the {if} tag |
|
| 21 | - * |
|
| 22 | - * @param array $args array with attributes from parser |
|
| 23 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 24 | - * @param array $parameter array with compilation parameter |
|
| 25 | - * |
|
| 26 | - * @return string compiled code |
|
| 27 | - * @throws \SmartyCompilerException |
|
| 28 | - */ |
|
| 29 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 30 | - { |
|
| 31 | - // check and get attributes |
|
| 32 | - $_attr = $this->getAttributes($compiler, $args); |
|
| 33 | - $this->openTag($compiler, 'if', array(1, $compiler->nocache)); |
|
| 34 | - // must whole block be nocache ? |
|
| 35 | - $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
|
| 19 | + /** |
|
| 20 | + * Compiles code for the {if} tag |
|
| 21 | + * |
|
| 22 | + * @param array $args array with attributes from parser |
|
| 23 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 24 | + * @param array $parameter array with compilation parameter |
|
| 25 | + * |
|
| 26 | + * @return string compiled code |
|
| 27 | + * @throws \SmartyCompilerException |
|
| 28 | + */ |
|
| 29 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 30 | + { |
|
| 31 | + // check and get attributes |
|
| 32 | + $_attr = $this->getAttributes($compiler, $args); |
|
| 33 | + $this->openTag($compiler, 'if', array(1, $compiler->nocache)); |
|
| 34 | + // must whole block be nocache ? |
|
| 35 | + $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
|
| 36 | 36 | |
| 37 | - if (!array_key_exists("if condition", $parameter)) { |
|
| 38 | - $compiler->trigger_template_error("missing if condition", null, true); |
|
| 39 | - } |
|
| 37 | + if (!array_key_exists("if condition", $parameter)) { |
|
| 38 | + $compiler->trigger_template_error("missing if condition", null, true); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - if (is_array($parameter[ 'if condition' ])) { |
|
| 42 | - if ($compiler->nocache) { |
|
| 43 | - // create nocache var to make it know for further compiling |
|
| 44 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 45 | - $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 46 | - } else { |
|
| 47 | - $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 48 | - } |
|
| 49 | - $compiler->setNocacheInVariable($var); |
|
| 50 | - } |
|
| 51 | - $assignCompiler = new Smarty_Internal_Compile_Assign(); |
|
| 52 | - $assignAttr = array(); |
|
| 53 | - $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 54 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 55 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 56 | - $_output = $assignCompiler->compile($assignAttr, $compiler, |
|
| 57 | - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 58 | - } else { |
|
| 59 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 60 | - $_output = $assignCompiler->compile($assignAttr, $compiler, array()); |
|
| 61 | - } |
|
| 62 | - $_output .= "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 63 | - return $_output; |
|
| 64 | - } else { |
|
| 65 | - return "<?php if ({$parameter['if condition']}) {?>"; |
|
| 66 | - } |
|
| 67 | - } |
|
| 41 | + if (is_array($parameter[ 'if condition' ])) { |
|
| 42 | + if ($compiler->nocache) { |
|
| 43 | + // create nocache var to make it know for further compiling |
|
| 44 | + if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 45 | + $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 46 | + } else { |
|
| 47 | + $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 48 | + } |
|
| 49 | + $compiler->setNocacheInVariable($var); |
|
| 50 | + } |
|
| 51 | + $assignCompiler = new Smarty_Internal_Compile_Assign(); |
|
| 52 | + $assignAttr = array(); |
|
| 53 | + $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 54 | + if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 55 | + $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 56 | + $_output = $assignCompiler->compile($assignAttr, $compiler, |
|
| 57 | + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 58 | + } else { |
|
| 59 | + $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 60 | + $_output = $assignCompiler->compile($assignAttr, $compiler, array()); |
|
| 61 | + } |
|
| 62 | + $_output .= "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 63 | + return $_output; |
|
| 64 | + } else { |
|
| 65 | + return "<?php if ({$parameter['if condition']}) {?>"; |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -75,22 +75,22 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase |
| 77 | 77 | { |
| 78 | - /** |
|
| 79 | - * Compiles code for the {else} tag |
|
| 80 | - * |
|
| 81 | - * @param array $args array with attributes from parser |
|
| 82 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 83 | - * @param array $parameter array with compilation parameter |
|
| 84 | - * |
|
| 85 | - * @return string compiled code |
|
| 86 | - */ |
|
| 87 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 88 | - { |
|
| 89 | - list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); |
|
| 90 | - $this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache)); |
|
| 78 | + /** |
|
| 79 | + * Compiles code for the {else} tag |
|
| 80 | + * |
|
| 81 | + * @param array $args array with attributes from parser |
|
| 82 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 83 | + * @param array $parameter array with compilation parameter |
|
| 84 | + * |
|
| 85 | + * @return string compiled code |
|
| 86 | + */ |
|
| 87 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 88 | + { |
|
| 89 | + list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); |
|
| 90 | + $this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache)); |
|
| 91 | 91 | |
| 92 | - return "<?php } else { ?>"; |
|
| 93 | - } |
|
| 92 | + return "<?php } else { ?>"; |
|
| 93 | + } |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -101,77 +101,77 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase |
| 103 | 103 | { |
| 104 | - /** |
|
| 105 | - * Compiles code for the {elseif} tag |
|
| 106 | - * |
|
| 107 | - * @param array $args array with attributes from parser |
|
| 108 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 109 | - * @param array $parameter array with compilation parameter |
|
| 110 | - * |
|
| 111 | - * @return string compiled code |
|
| 112 | - * @throws \SmartyCompilerException |
|
| 113 | - */ |
|
| 114 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 115 | - { |
|
| 116 | - // check and get attributes |
|
| 117 | - $_attr = $this->getAttributes($compiler, $args); |
|
| 104 | + /** |
|
| 105 | + * Compiles code for the {elseif} tag |
|
| 106 | + * |
|
| 107 | + * @param array $args array with attributes from parser |
|
| 108 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 109 | + * @param array $parameter array with compilation parameter |
|
| 110 | + * |
|
| 111 | + * @return string compiled code |
|
| 112 | + * @throws \SmartyCompilerException |
|
| 113 | + */ |
|
| 114 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 115 | + { |
|
| 116 | + // check and get attributes |
|
| 117 | + $_attr = $this->getAttributes($compiler, $args); |
|
| 118 | 118 | |
| 119 | - list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); |
|
| 119 | + list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); |
|
| 120 | 120 | |
| 121 | - if (!array_key_exists("if condition", $parameter)) { |
|
| 122 | - $compiler->trigger_template_error("missing elseif condition", null, true); |
|
| 123 | - } |
|
| 121 | + if (!array_key_exists("if condition", $parameter)) { |
|
| 122 | + $compiler->trigger_template_error("missing elseif condition", null, true); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - $assignCode = ''; |
|
| 126 | - if (is_array($parameter[ 'if condition' ])) { |
|
| 127 | - $condition_by_assign = true; |
|
| 128 | - if ($compiler->nocache) { |
|
| 129 | - // create nocache var to make it know for further compiling |
|
| 130 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 131 | - $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 132 | - } else { |
|
| 133 | - $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 134 | - } |
|
| 135 | - $compiler->setNocacheInVariable($var); |
|
| 136 | - } |
|
| 137 | - $assignCompiler = new Smarty_Internal_Compile_Assign(); |
|
| 138 | - $assignAttr = array(); |
|
| 139 | - $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 140 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 141 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 142 | - $assignCode = $assignCompiler->compile($assignAttr, $compiler, |
|
| 143 | - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 144 | - } else { |
|
| 145 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 146 | - $assignCode = $assignCompiler->compile($assignAttr, $compiler, array()); |
|
| 147 | - } |
|
| 148 | - } else { |
|
| 149 | - $condition_by_assign = false; |
|
| 150 | - } |
|
| 125 | + $assignCode = ''; |
|
| 126 | + if (is_array($parameter[ 'if condition' ])) { |
|
| 127 | + $condition_by_assign = true; |
|
| 128 | + if ($compiler->nocache) { |
|
| 129 | + // create nocache var to make it know for further compiling |
|
| 130 | + if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 131 | + $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 132 | + } else { |
|
| 133 | + $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 134 | + } |
|
| 135 | + $compiler->setNocacheInVariable($var); |
|
| 136 | + } |
|
| 137 | + $assignCompiler = new Smarty_Internal_Compile_Assign(); |
|
| 138 | + $assignAttr = array(); |
|
| 139 | + $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 140 | + if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 141 | + $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 142 | + $assignCode = $assignCompiler->compile($assignAttr, $compiler, |
|
| 143 | + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 144 | + } else { |
|
| 145 | + $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 146 | + $assignCode = $assignCompiler->compile($assignAttr, $compiler, array()); |
|
| 147 | + } |
|
| 148 | + } else { |
|
| 149 | + $condition_by_assign = false; |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - $prefixCode = $compiler->getPrefixCode(); |
|
| 153 | - if (empty($prefixCode)) { |
|
| 154 | - if ($condition_by_assign) { |
|
| 155 | - $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache)); |
|
| 156 | - $_output = $compiler->appendCode("<?php } else {\n?>", $assignCode); |
|
| 157 | - return $compiler->appendCode($_output, |
|
| 158 | - "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {\n?>"); |
|
| 159 | - } else { |
|
| 160 | - $this->openTag($compiler, 'elseif', array($nesting, $compiler->tag_nocache)); |
|
| 161 | - return "<?php } elseif ({$parameter['if condition']}) {?>"; |
|
| 162 | - } |
|
| 163 | - } else { |
|
| 164 | - $_output = $compiler->appendCode("<?php } else {\n?>", $prefixCode); |
|
| 165 | - $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache)); |
|
| 166 | - if ($condition_by_assign) { |
|
| 167 | - $_output = $compiler->appendCode($_output, $assignCode); |
|
| 168 | - return $compiler->appendCode($_output, |
|
| 169 | - "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {\n?>"); |
|
| 170 | - } else { |
|
| 171 | - return $compiler->appendCode($_output, "<?php if ({$parameter['if condition']}) {?>"); |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - } |
|
| 152 | + $prefixCode = $compiler->getPrefixCode(); |
|
| 153 | + if (empty($prefixCode)) { |
|
| 154 | + if ($condition_by_assign) { |
|
| 155 | + $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache)); |
|
| 156 | + $_output = $compiler->appendCode("<?php } else {\n?>", $assignCode); |
|
| 157 | + return $compiler->appendCode($_output, |
|
| 158 | + "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {\n?>"); |
|
| 159 | + } else { |
|
| 160 | + $this->openTag($compiler, 'elseif', array($nesting, $compiler->tag_nocache)); |
|
| 161 | + return "<?php } elseif ({$parameter['if condition']}) {?>"; |
|
| 162 | + } |
|
| 163 | + } else { |
|
| 164 | + $_output = $compiler->appendCode("<?php } else {\n?>", $prefixCode); |
|
| 165 | + $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache)); |
|
| 166 | + if ($condition_by_assign) { |
|
| 167 | + $_output = $compiler->appendCode($_output, $assignCode); |
|
| 168 | + return $compiler->appendCode($_output, |
|
| 169 | + "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {\n?>"); |
|
| 170 | + } else { |
|
| 171 | + return $compiler->appendCode($_output, "<?php if ({$parameter['if condition']}) {?>"); |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + } |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -182,27 +182,27 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase |
| 184 | 184 | { |
| 185 | - /** |
|
| 186 | - * Compiles code for the {/if} tag |
|
| 187 | - * |
|
| 188 | - * @param array $args array with attributes from parser |
|
| 189 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 190 | - * @param array $parameter array with compilation parameter |
|
| 191 | - * |
|
| 192 | - * @return string compiled code |
|
| 193 | - */ |
|
| 194 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 195 | - { |
|
| 196 | - // must endblock be nocache? |
|
| 197 | - if ($compiler->nocache) { |
|
| 198 | - $compiler->tag_nocache = true; |
|
| 199 | - } |
|
| 200 | - list($nesting, $compiler->nocache) = $this->closeTag($compiler, array('if', 'else', 'elseif')); |
|
| 201 | - $tmp = ''; |
|
| 202 | - for ($i = 0; $i < $nesting; $i ++) { |
|
| 203 | - $tmp .= '}'; |
|
| 204 | - } |
|
| 185 | + /** |
|
| 186 | + * Compiles code for the {/if} tag |
|
| 187 | + * |
|
| 188 | + * @param array $args array with attributes from parser |
|
| 189 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 190 | + * @param array $parameter array with compilation parameter |
|
| 191 | + * |
|
| 192 | + * @return string compiled code |
|
| 193 | + */ |
|
| 194 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 195 | + { |
|
| 196 | + // must endblock be nocache? |
|
| 197 | + if ($compiler->nocache) { |
|
| 198 | + $compiler->tag_nocache = true; |
|
| 199 | + } |
|
| 200 | + list($nesting, $compiler->nocache) = $this->closeTag($compiler, array('if', 'else', 'elseif')); |
|
| 201 | + $tmp = ''; |
|
| 202 | + for ($i = 0; $i < $nesting; $i ++) { |
|
| 203 | + $tmp .= '}'; |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | - return "<?php {$tmp}?>"; |
|
| 207 | - } |
|
| 206 | + return "<?php {$tmp}?>"; |
|
| 207 | + } |
|
| 208 | 208 | } |
@@ -38,28 +38,28 @@ discard block |
||
| 38 | 38 | $compiler->trigger_template_error("missing if condition", null, true); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if (is_array($parameter[ 'if condition' ])) { |
|
| 41 | + if (is_array($parameter['if condition'])) { |
|
| 42 | 42 | if ($compiler->nocache) { |
| 43 | 43 | // create nocache var to make it know for further compiling |
| 44 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 45 | - $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 44 | + if (is_array($parameter['if condition']['var'])) { |
|
| 45 | + $var = $parameter['if condition']['var']['var']; |
|
| 46 | 46 | } else { |
| 47 | - $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 47 | + $var = $parameter['if condition']['var']; |
|
| 48 | 48 | } |
| 49 | 49 | $compiler->setNocacheInVariable($var); |
| 50 | 50 | } |
| 51 | 51 | $assignCompiler = new Smarty_Internal_Compile_Assign(); |
| 52 | 52 | $assignAttr = array(); |
| 53 | - $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 54 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 55 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 53 | + $assignAttr[]['value'] = $parameter['if condition']['value']; |
|
| 54 | + if (is_array($parameter['if condition']['var'])) { |
|
| 55 | + $assignAttr[]['var'] = $parameter['if condition']['var']['var']; |
|
| 56 | 56 | $_output = $assignCompiler->compile($assignAttr, $compiler, |
| 57 | - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 57 | + array('smarty_internal_index' => $parameter['if condition']['var']['smarty_internal_index'])); |
|
| 58 | 58 | } else { |
| 59 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 59 | + $assignAttr[]['var'] = $parameter['if condition']['var']; |
|
| 60 | 60 | $_output = $assignCompiler->compile($assignAttr, $compiler, array()); |
| 61 | 61 | } |
| 62 | - $_output .= "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 62 | + $_output .= "<?php if (" . $parameter['if condition']['value'] . ") {?>"; |
|
| 63 | 63 | return $_output; |
| 64 | 64 | } else { |
| 65 | 65 | return "<?php if ({$parameter['if condition']}) {?>"; |
@@ -123,26 +123,26 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | $assignCode = ''; |
| 126 | - if (is_array($parameter[ 'if condition' ])) { |
|
| 126 | + if (is_array($parameter['if condition'])) { |
|
| 127 | 127 | $condition_by_assign = true; |
| 128 | 128 | if ($compiler->nocache) { |
| 129 | 129 | // create nocache var to make it know for further compiling |
| 130 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 131 | - $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 130 | + if (is_array($parameter['if condition']['var'])) { |
|
| 131 | + $var = $parameter['if condition']['var']['var']; |
|
| 132 | 132 | } else { |
| 133 | - $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 133 | + $var = $parameter['if condition']['var']; |
|
| 134 | 134 | } |
| 135 | 135 | $compiler->setNocacheInVariable($var); |
| 136 | 136 | } |
| 137 | 137 | $assignCompiler = new Smarty_Internal_Compile_Assign(); |
| 138 | 138 | $assignAttr = array(); |
| 139 | - $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 140 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 141 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 139 | + $assignAttr[]['value'] = $parameter['if condition']['value']; |
|
| 140 | + if (is_array($parameter['if condition']['var'])) { |
|
| 141 | + $assignAttr[]['var'] = $parameter['if condition']['var']['var']; |
|
| 142 | 142 | $assignCode = $assignCompiler->compile($assignAttr, $compiler, |
| 143 | - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 143 | + array('smarty_internal_index' => $parameter['if condition']['var']['smarty_internal_index'])); |
|
| 144 | 144 | } else { |
| 145 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 145 | + $assignAttr[]['var'] = $parameter['if condition']['var']; |
|
| 146 | 146 | $assignCode = $assignCompiler->compile($assignAttr, $compiler, array()); |
| 147 | 147 | } |
| 148 | 148 | } else { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache)); |
| 156 | 156 | $_output = $compiler->appendCode("<?php } else {\n?>", $assignCode); |
| 157 | 157 | return $compiler->appendCode($_output, |
| 158 | - "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {\n?>"); |
|
| 158 | + "<?php if (" . $parameter['if condition']['value'] . ") {\n?>"); |
|
| 159 | 159 | } else { |
| 160 | 160 | $this->openTag($compiler, 'elseif', array($nesting, $compiler->tag_nocache)); |
| 161 | 161 | return "<?php } elseif ({$parameter['if condition']}) {?>"; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | if ($condition_by_assign) { |
| 167 | 167 | $_output = $compiler->appendCode($_output, $assignCode); |
| 168 | 168 | return $compiler->appendCode($_output, |
| 169 | - "<?php if (" . $parameter[ 'if condition' ][ 'value' ] . ") {\n?>"); |
|
| 169 | + "<?php if (" . $parameter['if condition']['value'] . ") {\n?>"); |
|
| 170 | 170 | } else { |
| 171 | 171 | return $compiler->appendCode($_output, "<?php if ({$parameter['if condition']}) {?>"); |
| 172 | 172 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | list($nesting, $compiler->nocache) = $this->closeTag($compiler, array('if', 'else', 'elseif')); |
| 201 | 201 | $tmp = ''; |
| 202 | - for ($i = 0; $i < $nesting; $i ++) { |
|
| 202 | + for ($i = 0; $i < $nesting; $i++) { |
|
| 203 | 203 | $tmp .= '}'; |
| 204 | 204 | } |
| 205 | 205 | |