@@ -16,62 +16,62 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Smarty_Internal_Compile_Break 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('levels'); |
|
| 19 | + /** |
|
| 20 | + * Attribute definition: Overwrites base class. |
|
| 21 | + * |
|
| 22 | + * @var array |
|
| 23 | + * @see Smarty_Internal_CompileBase |
|
| 24 | + */ |
|
| 25 | + public $optional_attributes = array('levels'); |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Attribute definition: Overwrites base class. |
|
| 29 | - * |
|
| 30 | - * @var array |
|
| 31 | - * @see Smarty_Internal_CompileBase |
|
| 32 | - */ |
|
| 33 | - public $shorttag_order = array('levels'); |
|
| 27 | + /** |
|
| 28 | + * Attribute definition: Overwrites base class. |
|
| 29 | + * |
|
| 30 | + * @var array |
|
| 31 | + * @see Smarty_Internal_CompileBase |
|
| 32 | + */ |
|
| 33 | + public $shorttag_order = array('levels'); |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Compiles code for the {break} tag |
|
| 37 | - * |
|
| 38 | - * @param array $args array with attributes from parser |
|
| 39 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 40 | - * @param array $parameter array with compilation parameter |
|
| 41 | - * |
|
| 42 | - * @return string compiled code |
|
| 43 | - * @throws \SmartyCompilerException |
|
| 44 | - */ |
|
| 45 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 46 | - { |
|
| 47 | - static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true); |
|
| 48 | - // check and get attributes |
|
| 49 | - $_attr = $this->getAttributes($compiler, $args); |
|
| 35 | + /** |
|
| 36 | + * Compiles code for the {break} tag |
|
| 37 | + * |
|
| 38 | + * @param array $args array with attributes from parser |
|
| 39 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 40 | + * @param array $parameter array with compilation parameter |
|
| 41 | + * |
|
| 42 | + * @return string compiled code |
|
| 43 | + * @throws \SmartyCompilerException |
|
| 44 | + */ |
|
| 45 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 46 | + { |
|
| 47 | + static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true); |
|
| 48 | + // check and get attributes |
|
| 49 | + $_attr = $this->getAttributes($compiler, $args); |
|
| 50 | 50 | |
| 51 | - if ($_attr[ 'nocache' ] === true) { |
|
| 52 | - $compiler->trigger_template_error('nocache option not allowed', null, true); |
|
| 53 | - } |
|
| 51 | + if ($_attr[ 'nocache' ] === true) { |
|
| 52 | + $compiler->trigger_template_error('nocache option not allowed', null, true); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - if (isset($_attr[ 'levels' ])) { |
|
| 56 | - if (!is_numeric($_attr[ 'levels' ])) { |
|
| 57 | - $compiler->trigger_template_error('level attribute must be a numeric constant', null, true); |
|
| 58 | - } |
|
| 59 | - $_levels = $_attr[ 'levels' ]; |
|
| 60 | - } else { |
|
| 61 | - $_levels = 1; |
|
| 62 | - } |
|
| 63 | - $level_count = $_levels; |
|
| 64 | - $stack_count = count($compiler->_tag_stack) - 1; |
|
| 65 | - while ($level_count > 0 && $stack_count >= 0) { |
|
| 66 | - if (isset($_is_loopy[ $compiler->_tag_stack[ $stack_count ][ 0 ] ])) { |
|
| 67 | - $level_count --; |
|
| 68 | - } |
|
| 69 | - $stack_count --; |
|
| 70 | - } |
|
| 71 | - if ($level_count != 0) { |
|
| 72 | - $compiler->trigger_template_error("cannot break {$_levels} level(s)", null, true); |
|
| 73 | - } |
|
| 55 | + if (isset($_attr[ 'levels' ])) { |
|
| 56 | + if (!is_numeric($_attr[ 'levels' ])) { |
|
| 57 | + $compiler->trigger_template_error('level attribute must be a numeric constant', null, true); |
|
| 58 | + } |
|
| 59 | + $_levels = $_attr[ 'levels' ]; |
|
| 60 | + } else { |
|
| 61 | + $_levels = 1; |
|
| 62 | + } |
|
| 63 | + $level_count = $_levels; |
|
| 64 | + $stack_count = count($compiler->_tag_stack) - 1; |
|
| 65 | + while ($level_count > 0 && $stack_count >= 0) { |
|
| 66 | + if (isset($_is_loopy[ $compiler->_tag_stack[ $stack_count ][ 0 ] ])) { |
|
| 67 | + $level_count --; |
|
| 68 | + } |
|
| 69 | + $stack_count --; |
|
| 70 | + } |
|
| 71 | + if ($level_count != 0) { |
|
| 72 | + $compiler->trigger_template_error("cannot break {$_levels} level(s)", null, true); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return "<?php break {$_levels};?>"; |
|
| 76 | - } |
|
| 75 | + return "<?php break {$_levels};?>"; |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -48,25 +48,25 @@ |
||
| 48 | 48 | // check and get attributes |
| 49 | 49 | $_attr = $this->getAttributes($compiler, $args); |
| 50 | 50 | |
| 51 | - if ($_attr[ 'nocache' ] === true) { |
|
| 51 | + if ($_attr['nocache'] === true) { |
|
| 52 | 52 | $compiler->trigger_template_error('nocache option not allowed', null, true); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (isset($_attr[ 'levels' ])) { |
|
| 56 | - if (!is_numeric($_attr[ 'levels' ])) { |
|
| 55 | + if (isset($_attr['levels'])) { |
|
| 56 | + if (!is_numeric($_attr['levels'])) { |
|
| 57 | 57 | $compiler->trigger_template_error('level attribute must be a numeric constant', null, true); |
| 58 | 58 | } |
| 59 | - $_levels = $_attr[ 'levels' ]; |
|
| 59 | + $_levels = $_attr['levels']; |
|
| 60 | 60 | } else { |
| 61 | 61 | $_levels = 1; |
| 62 | 62 | } |
| 63 | 63 | $level_count = $_levels; |
| 64 | 64 | $stack_count = count($compiler->_tag_stack) - 1; |
| 65 | 65 | while ($level_count > 0 && $stack_count >= 0) { |
| 66 | - if (isset($_is_loopy[ $compiler->_tag_stack[ $stack_count ][ 0 ] ])) { |
|
| 67 | - $level_count --; |
|
| 66 | + if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) { |
|
| 67 | + $level_count--; |
|
| 68 | 68 | } |
| 69 | - $stack_count --; |
|
| 69 | + $stack_count--; |
|
| 70 | 70 | } |
| 71 | 71 | if ($level_count != 0) { |
| 72 | 72 | $compiler->trigger_template_error("cannot break {$_levels} level(s)", null, true); |
@@ -11,30 +11,30 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class Smarty_Internal_Method_UnregisterResource |
| 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 a resource to fetch a template |
|
| 23 | - * |
|
| 24 | - * @api Smarty::unregisterResource() |
|
| 25 | - * @link http://www.smarty.net/docs/en/api.unregister.resource.tpl |
|
| 26 | - * |
|
| 27 | - * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj |
|
| 28 | - * @param string $type name of resource type |
|
| 29 | - * |
|
| 30 | - * @return \Smarty|\Smarty_Internal_Template |
|
| 31 | - */ |
|
| 32 | - public function unregisterResource(Smarty_Internal_TemplateBase $obj, $type) |
|
| 33 | - { |
|
| 34 | - $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
|
| 35 | - if (isset($smarty->registered_resources[ $type ])) { |
|
| 36 | - unset($smarty->registered_resources[ $type ]); |
|
| 37 | - } |
|
| 38 | - return $obj; |
|
| 39 | - } |
|
| 21 | + /** |
|
| 22 | + * Registers a resource to fetch a template |
|
| 23 | + * |
|
| 24 | + * @api Smarty::unregisterResource() |
|
| 25 | + * @link http://www.smarty.net/docs/en/api.unregister.resource.tpl |
|
| 26 | + * |
|
| 27 | + * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj |
|
| 28 | + * @param string $type name of resource type |
|
| 29 | + * |
|
| 30 | + * @return \Smarty|\Smarty_Internal_Template |
|
| 31 | + */ |
|
| 32 | + public function unregisterResource(Smarty_Internal_TemplateBase $obj, $type) |
|
| 33 | + { |
|
| 34 | + $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
|
| 35 | + if (isset($smarty->registered_resources[ $type ])) { |
|
| 36 | + unset($smarty->registered_resources[ $type ]); |
|
| 37 | + } |
|
| 38 | + return $obj; |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -32,8 +32,8 @@ |
||
| 32 | 32 | public function unregisterResource(Smarty_Internal_TemplateBase $obj, $type) |
| 33 | 33 | { |
| 34 | 34 | $smarty = isset($obj->smarty) ? $obj->smarty : $obj; |
| 35 | - if (isset($smarty->registered_resources[ $type ])) { |
|
| 36 | - unset($smarty->registered_resources[ $type ]); |
|
| 35 | + if (isset($smarty->registered_resources[$type])) { |
|
| 36 | + unset($smarty->registered_resources[$type]); |
|
| 37 | 37 | } |
| 38 | 38 | return $obj; |
| 39 | 39 | } |
@@ -11,33 +11,33 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class Smarty_Internal_Method_AssignGlobal |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * Valid for all objects |
|
| 16 | - * |
|
| 17 | - * @var int |
|
| 18 | - */ |
|
| 19 | - public $objMap = 7; |
|
| 14 | + /** |
|
| 15 | + * Valid for all objects |
|
| 16 | + * |
|
| 17 | + * @var int |
|
| 18 | + */ |
|
| 19 | + public $objMap = 7; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * assigns a global Smarty variable |
|
| 23 | - * |
|
| 24 | - * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data |
|
| 25 | - * @param string $varName the global variable name |
|
| 26 | - * @param mixed $value the value to assign |
|
| 27 | - * @param boolean $nocache if true any output of this variable will be not cached |
|
| 28 | - * |
|
| 29 | - * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
| 30 | - */ |
|
| 31 | - public function assignGlobal(Smarty_Internal_Data $data, $varName, $value = null, $nocache = false) |
|
| 32 | - { |
|
| 33 | - if ($varName != '') { |
|
| 34 | - Smarty::$global_tpl_vars[ $varName ] = new Smarty_Variable($value, $nocache); |
|
| 35 | - $ptr = $data; |
|
| 36 | - while ($ptr->_objType == 2) { |
|
| 37 | - $ptr->tpl_vars[ $varName ] = clone Smarty::$global_tpl_vars[ $varName ]; |
|
| 38 | - $ptr = $ptr->parent; |
|
| 39 | - } |
|
| 40 | - } |
|
| 41 | - return $data; |
|
| 42 | - } |
|
| 21 | + /** |
|
| 22 | + * assigns a global Smarty variable |
|
| 23 | + * |
|
| 24 | + * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data |
|
| 25 | + * @param string $varName the global variable name |
|
| 26 | + * @param mixed $value the value to assign |
|
| 27 | + * @param boolean $nocache if true any output of this variable will be not cached |
|
| 28 | + * |
|
| 29 | + * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
| 30 | + */ |
|
| 31 | + public function assignGlobal(Smarty_Internal_Data $data, $varName, $value = null, $nocache = false) |
|
| 32 | + { |
|
| 33 | + if ($varName != '') { |
|
| 34 | + Smarty::$global_tpl_vars[ $varName ] = new Smarty_Variable($value, $nocache); |
|
| 35 | + $ptr = $data; |
|
| 36 | + while ($ptr->_objType == 2) { |
|
| 37 | + $ptr->tpl_vars[ $varName ] = clone Smarty::$global_tpl_vars[ $varName ]; |
|
| 38 | + $ptr = $ptr->parent; |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | + return $data; |
|
| 42 | + } |
|
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -31,10 +31,10 @@ |
||
| 31 | 31 | public function assignGlobal(Smarty_Internal_Data $data, $varName, $value = null, $nocache = false) |
| 32 | 32 | { |
| 33 | 33 | if ($varName != '') { |
| 34 | - Smarty::$global_tpl_vars[ $varName ] = new Smarty_Variable($value, $nocache); |
|
| 34 | + Smarty::$global_tpl_vars[$varName] = new Smarty_Variable($value, $nocache); |
|
| 35 | 35 | $ptr = $data; |
| 36 | 36 | while ($ptr->_objType == 2) { |
| 37 | - $ptr->tpl_vars[ $varName ] = clone Smarty::$global_tpl_vars[ $varName ]; |
|
| 37 | + $ptr->tpl_vars[$varName] = clone Smarty::$global_tpl_vars[$varName]; |
|
| 38 | 38 | $ptr = $ptr->parent; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -11,52 +11,52 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class Smarty_Internal_Method_GetTags |
| 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 | - * Return array of tag/attributes of all tags used by an template |
|
| 23 | - * |
|
| 24 | - * @api Smarty::getTags() |
|
| 25 | - * @link http://www.smarty.net/docs/en/api.get.tags.tpl |
|
| 26 | - * |
|
| 27 | - * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj |
|
| 28 | - * @param null|string|Smarty_Internal_Template $template |
|
| 29 | - * |
|
| 30 | - * @return array of tag/attributes |
|
| 31 | - * @throws \SmartyException |
|
| 32 | - */ |
|
| 33 | - public function getTags(Smarty_Internal_TemplateBase $obj, $template = null) |
|
| 34 | - { |
|
| 35 | - /* @var Smarty $smarty */ |
|
| 36 | - $smarty = isset($this->smarty) ? $this->smarty : $obj; |
|
| 37 | - if ($obj->_objType == 2 && !isset($template)) { |
|
| 38 | - $tpl = clone $obj; |
|
| 39 | - } elseif (isset($template) && $template->_objType == 2) { |
|
| 40 | - $tpl = clone $template; |
|
| 41 | - } elseif (isset($template) && is_string($template)) { |
|
| 42 | - /* @var Smarty_Internal_Template $tpl */ |
|
| 43 | - $tpl = new $smarty->template_class($template, $smarty); |
|
| 44 | - // checks if template exists |
|
| 45 | - if (!$tpl->source->exists) { |
|
| 46 | - throw new SmartyException("Unable to load template {$tpl->source->type} '{$tpl->source->name}'"); |
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - if (isset($tpl)) { |
|
| 50 | - $tpl->smarty = clone $tpl->smarty; |
|
| 51 | - $tpl->smarty->_cache[ 'get_used_tags' ] = true; |
|
| 52 | - $tpl->_cache[ 'used_tags' ] = array(); |
|
| 53 | - $tpl->smarty->merge_compiled_includes = false; |
|
| 54 | - $tpl->smarty->disableSecurity(); |
|
| 55 | - $tpl->caching = false; |
|
| 56 | - $tpl->loadCompiler(); |
|
| 57 | - $tpl->compiler->compileTemplate($tpl); |
|
| 58 | - return $tpl->_cache[ 'used_tags' ]; |
|
| 59 | - } |
|
| 60 | - throw new SmartyException("Missing template specification"); |
|
| 61 | - } |
|
| 21 | + /** |
|
| 22 | + * Return array of tag/attributes of all tags used by an template |
|
| 23 | + * |
|
| 24 | + * @api Smarty::getTags() |
|
| 25 | + * @link http://www.smarty.net/docs/en/api.get.tags.tpl |
|
| 26 | + * |
|
| 27 | + * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj |
|
| 28 | + * @param null|string|Smarty_Internal_Template $template |
|
| 29 | + * |
|
| 30 | + * @return array of tag/attributes |
|
| 31 | + * @throws \SmartyException |
|
| 32 | + */ |
|
| 33 | + public function getTags(Smarty_Internal_TemplateBase $obj, $template = null) |
|
| 34 | + { |
|
| 35 | + /* @var Smarty $smarty */ |
|
| 36 | + $smarty = isset($this->smarty) ? $this->smarty : $obj; |
|
| 37 | + if ($obj->_objType == 2 && !isset($template)) { |
|
| 38 | + $tpl = clone $obj; |
|
| 39 | + } elseif (isset($template) && $template->_objType == 2) { |
|
| 40 | + $tpl = clone $template; |
|
| 41 | + } elseif (isset($template) && is_string($template)) { |
|
| 42 | + /* @var Smarty_Internal_Template $tpl */ |
|
| 43 | + $tpl = new $smarty->template_class($template, $smarty); |
|
| 44 | + // checks if template exists |
|
| 45 | + if (!$tpl->source->exists) { |
|
| 46 | + throw new SmartyException("Unable to load template {$tpl->source->type} '{$tpl->source->name}'"); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + if (isset($tpl)) { |
|
| 50 | + $tpl->smarty = clone $tpl->smarty; |
|
| 51 | + $tpl->smarty->_cache[ 'get_used_tags' ] = true; |
|
| 52 | + $tpl->_cache[ 'used_tags' ] = array(); |
|
| 53 | + $tpl->smarty->merge_compiled_includes = false; |
|
| 54 | + $tpl->smarty->disableSecurity(); |
|
| 55 | + $tpl->caching = false; |
|
| 56 | + $tpl->loadCompiler(); |
|
| 57 | + $tpl->compiler->compileTemplate($tpl); |
|
| 58 | + return $tpl->_cache[ 'used_tags' ]; |
|
| 59 | + } |
|
| 60 | + throw new SmartyException("Missing template specification"); |
|
| 61 | + } |
|
| 62 | 62 | } |
| 63 | 63 | \ No newline at end of file |
@@ -48,14 +48,14 @@ |
||
| 48 | 48 | } |
| 49 | 49 | if (isset($tpl)) { |
| 50 | 50 | $tpl->smarty = clone $tpl->smarty; |
| 51 | - $tpl->smarty->_cache[ 'get_used_tags' ] = true; |
|
| 52 | - $tpl->_cache[ 'used_tags' ] = array(); |
|
| 51 | + $tpl->smarty->_cache['get_used_tags'] = true; |
|
| 52 | + $tpl->_cache['used_tags'] = array(); |
|
| 53 | 53 | $tpl->smarty->merge_compiled_includes = false; |
| 54 | 54 | $tpl->smarty->disableSecurity(); |
| 55 | 55 | $tpl->caching = false; |
| 56 | 56 | $tpl->loadCompiler(); |
| 57 | 57 | $tpl->compiler->compileTemplate($tpl); |
| 58 | - return $tpl->_cache[ 'used_tags' ]; |
|
| 58 | + return $tpl->_cache['used_tags']; |
|
| 59 | 59 | } |
| 60 | 60 | throw new SmartyException("Missing template specification"); |
| 61 | 61 | } |
@@ -7,36 +7,36 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class SmartyCompilerException extends SmartyException |
| 9 | 9 | { |
| 10 | - public function __toString() |
|
| 11 | - { |
|
| 12 | - return ' --> Smarty Compiler: ' . $this->message . ' <-- '; |
|
| 13 | - } |
|
| 10 | + public function __toString() |
|
| 11 | + { |
|
| 12 | + return ' --> Smarty Compiler: ' . $this->message . ' <-- '; |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * The line number of the template error |
|
| 17 | - * |
|
| 18 | - * @type int|null |
|
| 19 | - */ |
|
| 20 | - public $line = null; |
|
| 15 | + /** |
|
| 16 | + * The line number of the template error |
|
| 17 | + * |
|
| 18 | + * @type int|null |
|
| 19 | + */ |
|
| 20 | + public $line = null; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * The template source snippet relating to the error |
|
| 24 | - * |
|
| 25 | - * @type string|null |
|
| 26 | - */ |
|
| 27 | - public $source = null; |
|
| 22 | + /** |
|
| 23 | + * The template source snippet relating to the error |
|
| 24 | + * |
|
| 25 | + * @type string|null |
|
| 26 | + */ |
|
| 27 | + public $source = null; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * The raw text of the error message |
|
| 31 | - * |
|
| 32 | - * @type string|null |
|
| 33 | - */ |
|
| 34 | - public $desc = null; |
|
| 29 | + /** |
|
| 30 | + * The raw text of the error message |
|
| 31 | + * |
|
| 32 | + * @type string|null |
|
| 33 | + */ |
|
| 34 | + public $desc = null; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * The resource identifier or template name |
|
| 38 | - * |
|
| 39 | - * @type string|null |
|
| 40 | - */ |
|
| 41 | - public $template = null; |
|
| 36 | + /** |
|
| 37 | + * The resource identifier or template name |
|
| 38 | + * |
|
| 39 | + * @type string|null |
|
| 40 | + */ |
|
| 41 | + public $template = null; |
|
| 42 | 42 | } |
@@ -16,61 +16,61 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * Compiles code for the {while} 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 | - $compiler->loopNesting ++; |
|
| 32 | - // check and get attributes |
|
| 33 | - $_attr = $this->getAttributes($compiler, $args); |
|
| 34 | - $this->openTag($compiler, 'while', $compiler->nocache); |
|
| 19 | + /** |
|
| 20 | + * Compiles code for the {while} 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 | + $compiler->loopNesting ++; |
|
| 32 | + // check and get attributes |
|
| 33 | + $_attr = $this->getAttributes($compiler, $args); |
|
| 34 | + $this->openTag($compiler, 'while', $compiler->nocache); |
|
| 35 | 35 | |
| 36 | - if (!array_key_exists("if condition", $parameter)) { |
|
| 37 | - $compiler->trigger_template_error("missing while condition", null, true); |
|
| 38 | - } |
|
| 36 | + if (!array_key_exists("if condition", $parameter)) { |
|
| 37 | + $compiler->trigger_template_error("missing while condition", null, true); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - // maybe nocache because of nocache variables |
|
| 41 | - $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
|
| 42 | - if (is_array($parameter[ 'if condition' ])) { |
|
| 43 | - if ($compiler->nocache) { |
|
| 44 | - $_nocache = ',true'; |
|
| 45 | - // create nocache var to make it know for further compiling |
|
| 46 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 47 | - $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 48 | - } else { |
|
| 49 | - $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 50 | - } |
|
| 51 | - $compiler->setNocacheInVariable($var); |
|
| 52 | - } else { |
|
| 53 | - $_nocache = ''; |
|
| 54 | - } |
|
| 55 | - $assignCompiler = new Smarty_Internal_Compile_Assign(); |
|
| 56 | - $assignAttr = array(); |
|
| 57 | - $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 58 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 59 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 60 | - $_output = "<?php while (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 61 | - $_output .= $assignCompiler->compile($assignAttr, $compiler, |
|
| 62 | - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 63 | - } else { |
|
| 64 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 65 | - $_output = "<?php while (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 66 | - $_output .= $assignCompiler->compile($assignAttr, $compiler, array()); |
|
| 67 | - } |
|
| 40 | + // maybe nocache because of nocache variables |
|
| 41 | + $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
|
| 42 | + if (is_array($parameter[ 'if condition' ])) { |
|
| 43 | + if ($compiler->nocache) { |
|
| 44 | + $_nocache = ',true'; |
|
| 45 | + // create nocache var to make it know for further compiling |
|
| 46 | + if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 47 | + $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 48 | + } else { |
|
| 49 | + $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 50 | + } |
|
| 51 | + $compiler->setNocacheInVariable($var); |
|
| 52 | + } else { |
|
| 53 | + $_nocache = ''; |
|
| 54 | + } |
|
| 55 | + $assignCompiler = new Smarty_Internal_Compile_Assign(); |
|
| 56 | + $assignAttr = array(); |
|
| 57 | + $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 58 | + if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 59 | + $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 60 | + $_output = "<?php while (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 61 | + $_output .= $assignCompiler->compile($assignAttr, $compiler, |
|
| 62 | + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 63 | + } else { |
|
| 64 | + $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 65 | + $_output = "<?php while (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 66 | + $_output .= $assignCompiler->compile($assignAttr, $compiler, array()); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - return $_output; |
|
| 70 | - } else { |
|
| 71 | - return "<?php\n while ({$parameter['if condition']}) {?>"; |
|
| 72 | - } |
|
| 73 | - } |
|
| 69 | + return $_output; |
|
| 70 | + } else { |
|
| 71 | + return "<?php\n while ({$parameter['if condition']}) {?>"; |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -81,22 +81,22 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase |
| 83 | 83 | { |
| 84 | - /** |
|
| 85 | - * Compiles code for the {/while} tag |
|
| 86 | - * |
|
| 87 | - * @param array $args array with attributes from parser |
|
| 88 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 89 | - * |
|
| 90 | - * @return string compiled code |
|
| 91 | - */ |
|
| 92 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|
| 93 | - { |
|
| 94 | - $compiler->loopNesting --; |
|
| 95 | - // must endblock be nocache? |
|
| 96 | - if ($compiler->nocache) { |
|
| 97 | - $compiler->tag_nocache = true; |
|
| 98 | - } |
|
| 99 | - $compiler->nocache = $this->closeTag($compiler, array('while')); |
|
| 100 | - return "<?php }?>\n"; |
|
| 101 | - } |
|
| 84 | + /** |
|
| 85 | + * Compiles code for the {/while} tag |
|
| 86 | + * |
|
| 87 | + * @param array $args array with attributes from parser |
|
| 88 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 89 | + * |
|
| 90 | + * @return string compiled code |
|
| 91 | + */ |
|
| 92 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|
| 93 | + { |
|
| 94 | + $compiler->loopNesting --; |
|
| 95 | + // must endblock be nocache? |
|
| 96 | + if ($compiler->nocache) { |
|
| 97 | + $compiler->tag_nocache = true; |
|
| 98 | + } |
|
| 99 | + $compiler->nocache = $this->closeTag($compiler, array('while')); |
|
| 100 | + return "<?php }?>\n"; |
|
| 101 | + } |
|
| 102 | 102 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
| 30 | 30 | { |
| 31 | - $compiler->loopNesting ++; |
|
| 31 | + $compiler->loopNesting++; |
|
| 32 | 32 | // check and get attributes |
| 33 | 33 | $_attr = $this->getAttributes($compiler, $args); |
| 34 | 34 | $this->openTag($compiler, 'while', $compiler->nocache); |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // maybe nocache because of nocache variables |
| 41 | 41 | $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
| 42 | - if (is_array($parameter[ 'if condition' ])) { |
|
| 42 | + if (is_array($parameter['if condition'])) { |
|
| 43 | 43 | if ($compiler->nocache) { |
| 44 | 44 | $_nocache = ',true'; |
| 45 | 45 | // create nocache var to make it know for further compiling |
| 46 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 47 | - $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 46 | + if (is_array($parameter['if condition']['var'])) { |
|
| 47 | + $var = $parameter['if condition']['var']['var']; |
|
| 48 | 48 | } else { |
| 49 | - $var = $parameter[ 'if condition' ][ 'var' ]; |
|
| 49 | + $var = $parameter['if condition']['var']; |
|
| 50 | 50 | } |
| 51 | 51 | $compiler->setNocacheInVariable($var); |
| 52 | 52 | } else { |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | $assignCompiler = new Smarty_Internal_Compile_Assign(); |
| 56 | 56 | $assignAttr = array(); |
| 57 | - $assignAttr[][ 'value' ] = $parameter[ 'if condition' ][ 'value' ]; |
|
| 58 | - if (is_array($parameter[ 'if condition' ][ 'var' ])) { |
|
| 59 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; |
|
| 60 | - $_output = "<?php while (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 57 | + $assignAttr[]['value'] = $parameter['if condition']['value']; |
|
| 58 | + if (is_array($parameter['if condition']['var'])) { |
|
| 59 | + $assignAttr[]['var'] = $parameter['if condition']['var']['var']; |
|
| 60 | + $_output = "<?php while (" . $parameter['if condition']['value'] . ") {?>"; |
|
| 61 | 61 | $_output .= $assignCompiler->compile($assignAttr, $compiler, |
| 62 | - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); |
|
| 62 | + array('smarty_internal_index' => $parameter['if condition']['var']['smarty_internal_index'])); |
|
| 63 | 63 | } else { |
| 64 | - $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; |
|
| 65 | - $_output = "<?php while (" . $parameter[ 'if condition' ][ 'value' ] . ") {?>"; |
|
| 64 | + $assignAttr[]['var'] = $parameter['if condition']['var']; |
|
| 65 | + $_output = "<?php while (" . $parameter['if condition']['value'] . ") {?>"; |
|
| 66 | 66 | $_output .= $assignCompiler->compile($assignAttr, $compiler, array()); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
| 93 | 93 | { |
| 94 | - $compiler->loopNesting --; |
|
| 94 | + $compiler->loopNesting--; |
|
| 95 | 95 | // must endblock be nocache? |
| 96 | 96 | if ($compiler->nocache) { |
| 97 | 97 | $compiler->tag_nocache = true; |
@@ -12,19 +12,19 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Smarty_Internal_Runtime_Hhvm |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @param \Smarty_Internal_Template $_template |
|
| 17 | - * @param string $file file name |
|
| 18 | - * |
|
| 19 | - * @return mixed |
|
| 20 | - */ |
|
| 21 | - static function includeHhvm(Smarty_Internal_Template $_template, $file) |
|
| 22 | - { |
|
| 23 | - $_smarty_tpl = $_template; |
|
| 24 | - $tmp_file = $file . preg_replace('![^\w]+!', '_', uniqid(rand(), true)) . '.php'; |
|
| 25 | - file_put_contents($tmp_file, file_get_contents($file)); |
|
| 26 | - $result = @include $tmp_file; |
|
| 27 | - @unlink($tmp_file); |
|
| 28 | - return $result; |
|
| 29 | - } |
|
| 15 | + /** |
|
| 16 | + * @param \Smarty_Internal_Template $_template |
|
| 17 | + * @param string $file file name |
|
| 18 | + * |
|
| 19 | + * @return mixed |
|
| 20 | + */ |
|
| 21 | + static function includeHhvm(Smarty_Internal_Template $_template, $file) |
|
| 22 | + { |
|
| 23 | + $_smarty_tpl = $_template; |
|
| 24 | + $tmp_file = $file . preg_replace('![^\w]+!', '_', uniqid(rand(), true)) . '.php'; |
|
| 25 | + file_put_contents($tmp_file, file_get_contents($file)); |
|
| 26 | + $result = @include $tmp_file; |
|
| 27 | + @unlink($tmp_file); |
|
| 28 | + return $result; |
|
| 29 | + } |
|
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -16,67 +16,67 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Smarty_Internal_Compile_Capture 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 $shorttag_order = array('name'); |
|
| 19 | + /** |
|
| 20 | + * Attribute definition: Overwrites base class. |
|
| 21 | + * |
|
| 22 | + * @var array |
|
| 23 | + * @see Smarty_Internal_CompileBase |
|
| 24 | + */ |
|
| 25 | + public $shorttag_order = array('name'); |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Attribute definition: Overwrites base class. |
|
| 29 | - * |
|
| 30 | - * @var array |
|
| 31 | - * @see Smarty_Internal_CompileBase |
|
| 32 | - */ |
|
| 33 | - public $optional_attributes = array('name', 'assign', 'append'); |
|
| 27 | + /** |
|
| 28 | + * Attribute definition: Overwrites base class. |
|
| 29 | + * |
|
| 30 | + * @var array |
|
| 31 | + * @see Smarty_Internal_CompileBase |
|
| 32 | + */ |
|
| 33 | + public $optional_attributes = array('name', 'assign', 'append'); |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Compiles code for the {$smarty.capture.xxx} |
|
| 37 | - * |
|
| 38 | - * @param array $args array with attributes from parser |
|
| 39 | - * @param \Smarty_Internal_TemplateCompilerBase$compiler compiler object |
|
| 40 | - * @param array $parameter array with compilation parameter |
|
| 41 | - * |
|
| 42 | - * @return string compiled code |
|
| 43 | - * @throws \SmartyCompilerException |
|
| 44 | - */ |
|
| 45 | - public static function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null) |
|
| 46 | - { |
|
| 47 | - $tag = trim($parameter[ 0 ], '"\''); |
|
| 48 | - $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false; |
|
| 49 | - if (!$name) { |
|
| 50 | - $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); |
|
| 51 | - } |
|
| 52 | - return "\$_smarty_tpl->smarty->ext->_capture->getBuffer(\$_smarty_tpl, '{$name}')"; |
|
| 53 | - } |
|
| 35 | + /** |
|
| 36 | + * Compiles code for the {$smarty.capture.xxx} |
|
| 37 | + * |
|
| 38 | + * @param array $args array with attributes from parser |
|
| 39 | + * @param \Smarty_Internal_TemplateCompilerBase$compiler compiler object |
|
| 40 | + * @param array $parameter array with compilation parameter |
|
| 41 | + * |
|
| 42 | + * @return string compiled code |
|
| 43 | + * @throws \SmartyCompilerException |
|
| 44 | + */ |
|
| 45 | + public static function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null) |
|
| 46 | + { |
|
| 47 | + $tag = trim($parameter[ 0 ], '"\''); |
|
| 48 | + $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false; |
|
| 49 | + if (!$name) { |
|
| 50 | + $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); |
|
| 51 | + } |
|
| 52 | + return "\$_smarty_tpl->smarty->ext->_capture->getBuffer(\$_smarty_tpl, '{$name}')"; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Compiles code for the {capture} tag |
|
| 57 | - * |
|
| 58 | - * @param array $args array with attributes from parser |
|
| 59 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 60 | - * @param null $parameter |
|
| 61 | - * |
|
| 62 | - * @return string compiled code |
|
| 63 | - */ |
|
| 64 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null) |
|
| 65 | - { |
|
| 66 | - // check and get attributes |
|
| 67 | - $_attr = $this->getAttributes($compiler, $args, $parameter, 'capture'); |
|
| 55 | + /** |
|
| 56 | + * Compiles code for the {capture} tag |
|
| 57 | + * |
|
| 58 | + * @param array $args array with attributes from parser |
|
| 59 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 60 | + * @param null $parameter |
|
| 61 | + * |
|
| 62 | + * @return string compiled code |
|
| 63 | + */ |
|
| 64 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null) |
|
| 65 | + { |
|
| 66 | + // check and get attributes |
|
| 67 | + $_attr = $this->getAttributes($compiler, $args, $parameter, 'capture'); |
|
| 68 | 68 | |
| 69 | - $buffer = isset($_attr[ 'name' ]) ? $_attr[ 'name' ] : "'default'"; |
|
| 70 | - $assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : 'null'; |
|
| 71 | - $append = isset($_attr[ 'append' ]) ? $_attr[ 'append' ] : 'null'; |
|
| 69 | + $buffer = isset($_attr[ 'name' ]) ? $_attr[ 'name' ] : "'default'"; |
|
| 70 | + $assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : 'null'; |
|
| 71 | + $append = isset($_attr[ 'append' ]) ? $_attr[ 'append' ] : 'null'; |
|
| 72 | 72 | |
| 73 | - $compiler->_cache[ 'capture_stack' ][] = array($compiler->nocache); |
|
| 74 | - // maybe nocache because of nocache variables |
|
| 75 | - $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
|
| 76 | - $_output = "<?php \$_smarty_tpl->smarty->ext->_capture->open(\$_smarty_tpl, $buffer, $assign, $append);\n?>\n"; |
|
| 73 | + $compiler->_cache[ 'capture_stack' ][] = array($compiler->nocache); |
|
| 74 | + // maybe nocache because of nocache variables |
|
| 75 | + $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
|
| 76 | + $_output = "<?php \$_smarty_tpl->smarty->ext->_capture->open(\$_smarty_tpl, $buffer, $assign, $append);\n?>\n"; |
|
| 77 | 77 | |
| 78 | - return $_output; |
|
| 79 | - } |
|
| 78 | + return $_output; |
|
| 79 | + } |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -87,26 +87,26 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase |
| 89 | 89 | { |
| 90 | - /** |
|
| 91 | - * Compiles code for the {/capture} tag |
|
| 92 | - * |
|
| 93 | - * @param array $args array with attributes from parser |
|
| 94 | - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 95 | - * @param null $parameter |
|
| 96 | - * |
|
| 97 | - * @return string compiled code |
|
| 98 | - */ |
|
| 99 | - public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 100 | - { |
|
| 101 | - // check and get attributes |
|
| 102 | - $_attr = $this->getAttributes($compiler, $args, $parameter, '/capture'); |
|
| 103 | - // must endblock be nocache? |
|
| 104 | - if ($compiler->nocache) { |
|
| 105 | - $compiler->tag_nocache = true; |
|
| 106 | - } |
|
| 90 | + /** |
|
| 91 | + * Compiles code for the {/capture} tag |
|
| 92 | + * |
|
| 93 | + * @param array $args array with attributes from parser |
|
| 94 | + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|
| 95 | + * @param null $parameter |
|
| 96 | + * |
|
| 97 | + * @return string compiled code |
|
| 98 | + */ |
|
| 99 | + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|
| 100 | + { |
|
| 101 | + // check and get attributes |
|
| 102 | + $_attr = $this->getAttributes($compiler, $args, $parameter, '/capture'); |
|
| 103 | + // must endblock be nocache? |
|
| 104 | + if ($compiler->nocache) { |
|
| 105 | + $compiler->tag_nocache = true; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - list($compiler->nocache) = array_pop($compiler->_cache[ 'capture_stack' ]); |
|
| 108 | + list($compiler->nocache) = array_pop($compiler->_cache[ 'capture_stack' ]); |
|
| 109 | 109 | |
| 110 | - return "<?php \$_smarty_tpl->smarty->ext->_capture->close(\$_smarty_tpl);\n?>\n"; |
|
| 111 | - } |
|
| 110 | + return "<?php \$_smarty_tpl->smarty->ext->_capture->close(\$_smarty_tpl);\n?>\n"; |
|
| 111 | + } |
|
| 112 | 112 | } |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public static function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null) |
| 46 | 46 | { |
| 47 | - $tag = trim($parameter[ 0 ], '"\''); |
|
| 48 | - $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false; |
|
| 47 | + $tag = trim($parameter[0], '"\''); |
|
| 48 | + $name = isset($parameter[1]) ? $compiler->getId($parameter[1]) : false; |
|
| 49 | 49 | if (!$name) { |
| 50 | 50 | $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); |
| 51 | 51 | } |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | // check and get attributes |
| 67 | 67 | $_attr = $this->getAttributes($compiler, $args, $parameter, 'capture'); |
| 68 | 68 | |
| 69 | - $buffer = isset($_attr[ 'name' ]) ? $_attr[ 'name' ] : "'default'"; |
|
| 70 | - $assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : 'null'; |
|
| 71 | - $append = isset($_attr[ 'append' ]) ? $_attr[ 'append' ] : 'null'; |
|
| 69 | + $buffer = isset($_attr['name']) ? $_attr['name'] : "'default'"; |
|
| 70 | + $assign = isset($_attr['assign']) ? $_attr['assign'] : 'null'; |
|
| 71 | + $append = isset($_attr['append']) ? $_attr['append'] : 'null'; |
|
| 72 | 72 | |
| 73 | - $compiler->_cache[ 'capture_stack' ][] = array($compiler->nocache); |
|
| 73 | + $compiler->_cache['capture_stack'][] = array($compiler->nocache); |
|
| 74 | 74 | // maybe nocache because of nocache variables |
| 75 | 75 | $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; |
| 76 | 76 | $_output = "<?php \$_smarty_tpl->smarty->ext->_capture->open(\$_smarty_tpl, $buffer, $assign, $append);\n?>\n"; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $compiler->tag_nocache = true; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - list($compiler->nocache) = array_pop($compiler->_cache[ 'capture_stack' ]); |
|
| 108 | + list($compiler->nocache) = array_pop($compiler->_cache['capture_stack']); |
|
| 109 | 109 | |
| 110 | 110 | return "<?php \$_smarty_tpl->smarty->ext->_capture->close(\$_smarty_tpl);\n?>\n"; |
| 111 | 111 | } |
@@ -12,39 +12,39 @@ |
||
| 12 | 12 | class Smarty_Internal_Method_AppendByRef |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * appends values to template variables by reference |
|
| 17 | - * |
|
| 18 | - * @api Smarty::appendByRef() |
|
| 19 | - * @link http://www.smarty.net/docs/en/api.append.by.ref.tpl |
|
| 20 | - * |
|
| 21 | - * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data |
|
| 22 | - * @param string $tpl_var the template variable name |
|
| 23 | - * @param mixed &$value the referenced value to append |
|
| 24 | - * @param bool $merge flag if array elements shall be merged |
|
| 25 | - * |
|
| 26 | - * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
| 27 | - */ |
|
| 28 | - public static function appendByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $merge = false) |
|
| 29 | - { |
|
| 30 | - if ($tpl_var != '' && isset($value)) { |
|
| 31 | - if (!isset($data->tpl_vars[ $tpl_var ])) { |
|
| 32 | - $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(); |
|
| 33 | - } |
|
| 34 | - if (!is_array($data->tpl_vars[ $tpl_var ]->value)) { |
|
| 35 | - settype($data->tpl_vars[ $tpl_var ]->value, 'array'); |
|
| 36 | - } |
|
| 37 | - if ($merge && is_array($value)) { |
|
| 38 | - foreach ($value as $_key => $_val) { |
|
| 39 | - $data->tpl_vars[ $tpl_var ]->value[ $_key ] = &$value[ $_key ]; |
|
| 40 | - } |
|
| 41 | - } else { |
|
| 42 | - $data->tpl_vars[ $tpl_var ]->value[] = &$value; |
|
| 43 | - } |
|
| 44 | - if ($data->_objType == 2 && $data->scope) { |
|
| 45 | - $data->ext->_updateScope->_updateScope($data, $tpl_var); |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - return $data; |
|
| 49 | - } |
|
| 15 | + /** |
|
| 16 | + * appends values to template variables by reference |
|
| 17 | + * |
|
| 18 | + * @api Smarty::appendByRef() |
|
| 19 | + * @link http://www.smarty.net/docs/en/api.append.by.ref.tpl |
|
| 20 | + * |
|
| 21 | + * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data |
|
| 22 | + * @param string $tpl_var the template variable name |
|
| 23 | + * @param mixed &$value the referenced value to append |
|
| 24 | + * @param bool $merge flag if array elements shall be merged |
|
| 25 | + * |
|
| 26 | + * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty |
|
| 27 | + */ |
|
| 28 | + public static function appendByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $merge = false) |
|
| 29 | + { |
|
| 30 | + if ($tpl_var != '' && isset($value)) { |
|
| 31 | + if (!isset($data->tpl_vars[ $tpl_var ])) { |
|
| 32 | + $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(); |
|
| 33 | + } |
|
| 34 | + if (!is_array($data->tpl_vars[ $tpl_var ]->value)) { |
|
| 35 | + settype($data->tpl_vars[ $tpl_var ]->value, 'array'); |
|
| 36 | + } |
|
| 37 | + if ($merge && is_array($value)) { |
|
| 38 | + foreach ($value as $_key => $_val) { |
|
| 39 | + $data->tpl_vars[ $tpl_var ]->value[ $_key ] = &$value[ $_key ]; |
|
| 40 | + } |
|
| 41 | + } else { |
|
| 42 | + $data->tpl_vars[ $tpl_var ]->value[] = &$value; |
|
| 43 | + } |
|
| 44 | + if ($data->_objType == 2 && $data->scope) { |
|
| 45 | + $data->ext->_updateScope->_updateScope($data, $tpl_var); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + return $data; |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | \ No newline at end of file |
@@ -28,18 +28,18 @@ |
||
| 28 | 28 | public static function appendByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $merge = false) |
| 29 | 29 | { |
| 30 | 30 | if ($tpl_var != '' && isset($value)) { |
| 31 | - if (!isset($data->tpl_vars[ $tpl_var ])) { |
|
| 32 | - $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(); |
|
| 31 | + if (!isset($data->tpl_vars[$tpl_var])) { |
|
| 32 | + $data->tpl_vars[$tpl_var] = new Smarty_Variable(); |
|
| 33 | 33 | } |
| 34 | - if (!is_array($data->tpl_vars[ $tpl_var ]->value)) { |
|
| 35 | - settype($data->tpl_vars[ $tpl_var ]->value, 'array'); |
|
| 34 | + if (!is_array($data->tpl_vars[$tpl_var]->value)) { |
|
| 35 | + settype($data->tpl_vars[$tpl_var]->value, 'array'); |
|
| 36 | 36 | } |
| 37 | 37 | if ($merge && is_array($value)) { |
| 38 | 38 | foreach ($value as $_key => $_val) { |
| 39 | - $data->tpl_vars[ $tpl_var ]->value[ $_key ] = &$value[ $_key ]; |
|
| 39 | + $data->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key]; |
|
| 40 | 40 | } |
| 41 | 41 | } else { |
| 42 | - $data->tpl_vars[ $tpl_var ]->value[] = &$value; |
|
| 42 | + $data->tpl_vars[$tpl_var]->value[] = &$value; |
|
| 43 | 43 | } |
| 44 | 44 | if ($data->_objType == 2 && $data->scope) { |
| 45 | 45 | $data->ext->_updateScope->_updateScope($data, $tpl_var); |