diff --git a/change_log.txt b/change_log.txt index f23563ab..c373bf7a 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,12 @@ ===== trunk ===== +9.12.2011 +- bugfix {capture} tags around recursive {include} calls did throw exception (Forum Topic 20549) +- bugfix $auto_literal = false did not work with { block} tags in child templates (Forum Topic 20581) +- bugfix template inheritance: do not include code of {include} in overloaded {block} into compiled + parent template (Issue 66} +- bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return expected + result (Forum Topic 20564) + ===== Smarty-3.1.6 ===== 30.11.2011 - bugfix is_cache() for individual cached subtemplates with $smarty->caching = CACHING_OFF did produce diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index 3a9f91b6..b129eafd 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -1,56 +1,56 @@ getAttributes($compiler, $args); - $save = array($_attr, $compiler->parser->current_buffer, $compiler->nocache, $compiler->smarty->merge_compiled_includes); + $save = array($_attr, $compiler->parser->current_buffer, $compiler->nocache, $compiler->smarty->merge_compiled_includes, $compiler->merged_templates, $compiler->smarty->merged_templates_func, $compiler->template->properties, $compiler->template->has_nocache_code); $this->openTag($compiler, 'block', $save); if ($_attr['nocache'] == true) { $compiler->nocache = true; @@ -66,33 +66,54 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { } /** - * Save or replace child block source by block name during parsing - * - * @param string $block_content block source content - * @param string $block_tag opening block tag - * @param object $template template object - * @param string $filepath filepath of template source - */ + * Save or replace child block source by block name during parsing + * + * @param string $block_content block source content + * @param string $block_tag opening block tag + * @param object $template template object + * @param string $filepath filepath of template source + */ public static function saveBlockData($block_content, $block_tag, $template, $filepath) { $_rdl = preg_quote($template->smarty->right_delimiter); $_ldl = preg_quote($template->smarty->left_delimiter); - - if (0 == preg_match("!({$_ldl}block\s+)(name=)?(\w+|'.*'|\".*\")(\s*?)?((append|prepend|nocache)?(\s*)?(hide)?)?(\s*{$_rdl})!", $block_tag, $_match)) { + if ($template->smarty->auto_literal) { + $al = '\s*'; + } else { + $al = ''; + } + if (0 == preg_match("!({$_ldl}{$al}block\s+)(name=)?(\w+|'.*'|\".*\")(\s*?)?((append|prepend|nocache)?(\s*)?(hide)?)?(\s*{$_rdl})!", $block_tag, $_match)) { $error_text = 'Syntax Error in template "' . $template->source->filepath . '" "' . htmlspecialchars($block_tag) . '" illegal options'; throw new SmartyCompilerException($error_text); } else { $_name = trim($_match[3], '\'"'); if ($_match[8] != 'hide' || isset($template->block_data[$_name])) { // replace {$smarty.block.child} - if (strpos($block_content, $template->smarty->left_delimiter . '$smarty.block.child' . $template->smarty->right_delimiter) !== false) { + // do we have {$smart.block.child} in nested {block} tags? + if (0 != preg_match_all("!({$_ldl}{$al}block\s+)(name=)?(\w+|'.*'|\".*\")([\s\S]*?{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child{$_rdl})([\s\S]*?{$_ldl}{$al}/block{$_rdl})!", $block_content, $_match2)) { + foreach($_match2[3] as $name) { + // get it's replacement + $_name2 = trim($name, '\'"'); + if (isset($template->block_data[$_name2])) { + $replacement = $template->block_data[$_name2]['source']; + } else { + $replacement = ''; + } + // replace {$smarty.block.child} tag + $search = array("%({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child{$_rdl})([\s\S]*?{$_ldl}{$al}/block{$_rdl})%","/§§§child§§§/"); + $replace = array('\2§§§child§§§', $replacement); + $block_content = preg_replace($search, $replace , $block_content); + } + } + // do we have not nested {$smart.block.child} + if (0 != preg_match("/({$_ldl}{$al}\\\$smarty\.block\.child{$_rdl})/", $block_content, $_match2)) { + // get child replacement for this block if (isset($template->block_data[$_name])) { - $block_content = str_replace($template->smarty->left_delimiter . '$smarty.block.child' . $template->smarty->right_delimiter, - $template->block_data[$_name]['source'], $block_content); + $replacement = $template->block_data[$_name]['source']; unset($template->block_data[$_name]); } else { - $block_content = str_replace($template->smarty->left_delimiter . '$smarty.block.child' . $template->smarty->right_delimiter, - '', $block_content); + $replacement = ''; } + $block_content = preg_replace("/({$_ldl}{$al}\\\$smarty\.block\.child{$_rdl})/", $replacement, $block_content); } if (isset($template->block_data[$_name])) { if (strpos($template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) { @@ -119,12 +140,12 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { } /** - * Compile saved child block source - * - * @param object $compiler compiler object - * @param string $_name optional name of child block - * @return string compiled code of schild block - */ + * Compile saved child block source + * + * @param object $compiler compiler object + * @param string $_name optional name of child block + * @return string compiled code of schild block + */ public static function compileChildBlock($compiler, $_name = null) { $_output = ''; @@ -191,20 +212,20 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { } /** - * Smarty Internal Plugin Compile BlockClose Class - * - * @package Smarty - * @subpackage Compiler +* Smarty Internal Plugin Compile BlockClose Class +* +* @package Smarty +* @subpackage Compiler */ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { /** - * Compiles code for the {/block} tag - * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @return string compiled code - */ + * Compiles code for the {/block} tag + * + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * @return string compiled code + */ public function compile($args, $compiler) { $compiler->has_code = true; @@ -213,6 +234,11 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { $saved_data = $this->closeTag($compiler, array('block')); $_name = trim($saved_data[0]['name'], "\"'"); if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) { + // restore to status before {block} tag as new subtemplate code of parent {block} is not needed + $compiler->merged_templates = $saved_data[4]; + $compiler->smarty->merged_templates_func = $saved_data[5]; + $compiler->template->properties = $saved_data[6]; + $compiler->template->has_nocache_code = $saved_data[7]; $_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name); } else { if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) { diff --git a/libs/sysplugins/smarty_internal_compile_capture.php b/libs/sysplugins/smarty_internal_compile_capture.php index fe54b36b..9a5071eb 100644 --- a/libs/sysplugins/smarty_internal_compile_capture.php +++ b/libs/sysplugins/smarty_internal_compile_capture.php @@ -48,10 +48,10 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase { $assign = isset($_attr['assign']) ? $_attr['assign'] : 'null'; $append = isset($_attr['append']) ? $_attr['append'] : 'null'; - $compiler->_capture_stack[] = array($buffer, $assign, $append, $compiler->nocache); + $compiler->_capture_stack[0][] = array($buffer, $assign, $append, $compiler->nocache); // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - $_output = "_capture_stack[] = array($buffer, $assign, $append); ob_start(); ?>"; + $_output = "_capture_stack[0][] = array($buffer, $assign, $append); ob_start(); ?>"; return $_output; } @@ -82,9 +82,9 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase { $compiler->tag_nocache = true; } - list($buffer, $assign, $append, $compiler->nocache) = array_pop($compiler->_capture_stack); + list($buffer, $assign, $append, $compiler->nocache) = array_pop($compiler->_capture_stack[0]); - $_output = "_capture_stack);\n"; + $_output = "_capture_stack[0]);\n"; $_output .= "if (!empty(\$_capture_buffer)) {\n"; $_output .= " if (isset(\$_capture_assign)) \$_smarty_tpl->assign(\$_capture_assign, ob_get_contents());\n"; $_output .= " if (isset( \$_capture_append)) \$_smarty_tpl->append( \$_capture_append, ob_get_contents());\n"; diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 6367c0d1..94b27b9c 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -97,7 +97,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { * internal capture runtime stack * @var array */ - public $_capture_stack = array(); + public $_capture_stack = array(0 => array()); /** * Create template data object diff --git a/libs/sysplugins/smarty_internal_templatebase.php b/libs/sysplugins/smarty_internal_templatebase.php index 65f50224..356324e8 100644 --- a/libs/sysplugins/smarty_internal_templatebase.php +++ b/libs/sysplugins/smarty_internal_templatebase.php @@ -1,34 +1,34 @@ template_class) { @@ -43,8 +43,8 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } // create template object if necessary $_template = ($template instanceof $this->template_class) - ? $template - : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false); + ? $template + : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false); // if called by Smarty object make sure we use current caching status if ($this instanceof Smarty) { $_template->caching = $this->caching; @@ -173,10 +173,16 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) { throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'"); } + array_unshift($_template->_capture_stack,array()); + // + // render compiled template + // $_template->properties['unifunc']($_template); - if (isset($_template->_capture_stack[0])) { + // any unclosed {capture} tags ? + if (isset($_template->_capture_stack[0][0])) { $_template->capture_error(); } + array_shift($_template->_capture_stack); } catch (Exception $e) { ob_get_clean(); throw $e; @@ -268,10 +274,16 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } try { ob_start(); + array_unshift($_template->_capture_stack,array()); + // + // render cached template + // $_template->properties['unifunc']($_template); - if (isset($_template->_capture_stack[0])) { + // any unclosed {capture} tags ? + if (isset($_template->_capture_stack[0][0])) { $_template->capture_error(); } + array_shift($_template->_capture_stack); $_output = ob_get_clean(); } catch (Exception $e) { ob_get_clean(); @@ -297,30 +309,30 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { case 'cgi': // php-cgi < 5.3 case 'cgi-fcgi': // php-cgi >= 5.3 case 'fpm-fcgi': // php-fpm >= 5.3.3 - header('Status: 304 Not Modified'); - break; + header('Status: 304 Not Modified'); + break; case 'cli': - if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) { - $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified'; - } - break; + if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) { + $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified'; + } + break; default: - header('HTTP/1.1 304 Not Modified'); - break; + header('HTTP/1.1 304 Not Modified'); + break; } } else { switch (PHP_SAPI) { case 'cli': - if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) { - $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'; - } - break; + if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) { + $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'; + } + break; default: - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'); - break; + header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'); + break; } echo $_output; } @@ -349,13 +361,13 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * displays a Smarty template - * - * @param string $template the resource handle of the template file or template object - * @param mixed $cache_id cache id to be used with this template - * @param mixed $compile_id compile id to be used with this template - * @param object $parent next higher level of Smarty variables - */ + * displays a Smarty template + * + * @param string $template the resource handle of the template file or template object + * @param mixed $cache_id cache id to be used with this template + * @param mixed $compile_id compile id to be used with this template + * @param object $parent next higher level of Smarty variables + */ public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) { // display template @@ -363,14 +375,14 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * test if cache is valid - * - * @param string|object $template the resource handle of the template file or template object - * @param mixed $cache_id cache id to be used with this template - * @param mixed $compile_id compile id to be used with this template - * @param object $parent next higher level of Smarty variables - * @return boolean cache status - */ + * test if cache is valid + * + * @param string|object $template the resource handle of the template file or template object + * @param mixed $cache_id cache id to be used with this template + * @param mixed $compile_id compile id to be used with this template + * @param object $parent next higher level of Smarty variables + * @return boolean cache status + */ public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null) { if ($template === null && $this instanceof $this->template_class) { @@ -387,26 +399,26 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * creates a data object - * - * @param object $parent next higher level of Smarty variables - * @returns Smarty_Data data object - */ + * creates a data object + * + * @param object $parent next higher level of Smarty variables + * @returns Smarty_Data data object + */ public function createData($parent = null) { return new Smarty_Data($parent, $this); } /** - * Registers plugin to be used in templates - * - * @param string $type plugin type - * @param string $tag name of template tag - * @param callback $callback PHP callback to register - * @param boolean $cacheable if true (default) this fuction is cachable - * @param array $cache_attr caching attributes if any - * @throws SmartyException when the plugin tag is invalid - */ + * Registers plugin to be used in templates + * + * @param string $type plugin type + * @param string $tag name of template tag + * @param callback $callback PHP callback to register + * @param boolean $cacheable if true (default) this fuction is cachable + * @param array $cache_attr caching attributes if any + * @throws SmartyException when the plugin tag is invalid + */ public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null) { if (isset($this->smarty->registered_plugins[$type][$tag])) { @@ -419,11 +431,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Unregister Plugin - * - * @param string $type of plugin - * @param string $tag name of plugin - */ + * Unregister Plugin + * + * @param string $type of plugin + * @param string $tag name of plugin + */ public function unregisterPlugin($type, $tag) { if (isset($this->smarty->registered_plugins[$type][$tag])) { @@ -432,21 +444,21 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Registers a resource to fetch a template - * - * @param string $type name of resource type - * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated) - */ + * Registers a resource to fetch a template + * + * @param string $type name of resource type + * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated) + */ public function registerResource($type, $callback) { $this->smarty->registered_resources[$type] = $callback instanceof Smarty_Resource ? $callback : array($callback, false); } /** - * Unregisters a resource - * - * @param string $type name of resource type - */ + * Unregisters a resource + * + * @param string $type name of resource type + */ public function unregisterResource($type) { if (isset($this->smarty->registered_resources[$type])) { @@ -455,21 +467,21 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Registers a cache resource to cache a template's output - * - * @param string $type name of cache resource type - * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching - */ + * Registers a cache resource to cache a template's output + * + * @param string $type name of cache resource type + * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching + */ public function registerCacheResource($type, Smarty_CacheResource $callback) { $this->smarty->registered_cache_resources[$type] = $callback; } /** - * Unregisters a cache resource - * - * @param string $type name of cache resource type - */ + * Unregisters a cache resource + * + * @param string $type name of cache resource type + */ public function unregisterCacheResource($type) { if (isset($this->smarty->registered_cache_resources[$type])) { @@ -478,16 +490,16 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Registers object to be used in templates - * - * @param string $object name of template object - * @param object $object_impl the referenced PHP object to register - * @param array $allowed list of allowed methods (empty = all) - * @param boolean $smarty_args smarty argument format, else traditional - * @param array $block_methods list of block-methods - * @param array $block_functs list of methods that are block format - * @throws SmartyException if any of the methods in $allowed or $block_methods are invalid - */ + * Registers object to be used in templates + * + * @param string $object name of template object + * @param object $object_impl the referenced PHP object to register + * @param array $allowed list of allowed methods (empty = all) + * @param boolean $smarty_args smarty argument format, else traditional + * @param array $block_methods list of block-methods + * @param array $block_functs list of methods that are block format + * @throws SmartyException if any of the methods in $allowed or $block_methods are invalid + */ public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) { // test if allowed methodes callable @@ -508,16 +520,16 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } // register the object $this->smarty->registered_objects[$object_name] = - array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods); + array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods); } /** - * return a reference to a registered object - * - * @param string $name object name - * @return object - * @throws SmartyException if no such object is found - */ + * return a reference to a registered object + * + * @param string $name object name + * @return object + * @throws SmartyException if no such object is found + */ public function getRegisteredObject($name) { if (!isset($this->smarty->registered_objects[$name])) { @@ -530,11 +542,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * unregister an object - * - * @param string $name object name - * @throws SmartyException if no such object is found - */ + * unregister an object + * + * @param string $name object name + * @throws SmartyException if no such object is found + */ public function unregisterObject($name) { unset($this->smarty->registered_objects[$name]); @@ -542,12 +554,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Registers static classes to be used in templates - * - * @param string $class name of template class - * @param string $class_impl the referenced PHP class to register - * @throws SmartyException if $class_impl does not refer to an existing class - */ + * Registers static classes to be used in templates + * + * @param string $class name of template class + * @param string $class_impl the referenced PHP class to register + * @throws SmartyException if $class_impl does not refer to an existing class + */ public function registerClass($class_name, $class_impl) { // test if exists @@ -559,11 +571,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Registers a default plugin handler - * - * @param callable $callback class/method name - * @throws SmartyException if $callback is not callable - */ + * Registers a default plugin handler + * + * @param callable $callback class/method name + * @throws SmartyException if $callback is not callable + */ public function registerDefaultPluginHandler($callback) { if (is_callable($callback)) { @@ -574,11 +586,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Registers a default template handler - * - * @param callable $callback class/method name - * @throws SmartyException if $callback is not callable - */ + * Registers a default template handler + * + * @param callable $callback class/method name + * @throws SmartyException if $callback is not callable + */ public function registerDefaultTemplateHandler($callback) { if (is_callable($callback)) { @@ -589,11 +601,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Registers a default template handler - * - * @param callable $callback class/method name - * @throws SmartyException if $callback is not callable - */ + * Registers a default template handler + * + * @param callable $callback class/method name + * @throws SmartyException if $callback is not callable + */ public function registerDefaultConfigHandler($callback) { if (is_callable($callback)) { @@ -604,22 +616,22 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Registers a filter function - * - * @param string $type filter type - * @param callback $callback - */ + * Registers a filter function + * + * @param string $type filter type + * @param callback $callback + */ public function registerFilter($type, $callback) { $this->smarty->registered_filters[$type][$this->_get_filter_name($callback)] = $callback; } /** - * Unregisters a filter function - * - * @param string $type filter type - * @param callback $callback - */ + * Unregisters a filter function + * + * @param string $type filter type + * @param callback $callback + */ public function unregisterFilter($type, $callback) { $name = $this->_get_filter_name($callback); @@ -629,15 +641,15 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * Return internal filter name - * - * @param callback $function_name - */ + * Return internal filter name + * + * @param callback $function_name + */ public function _get_filter_name($function_name) { if (is_array($function_name)) { $_class_name = (is_object($function_name[0]) ? - get_class($function_name[0]) : $function_name[0]); + get_class($function_name[0]) : $function_name[0]); return $_class_name . '_' . $function_name[1]; } else { return $function_name; @@ -645,12 +657,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * load a filter of specified type and name - * - * @param string $type filter type - * @param string $name filter name - * @return bool - */ + * load a filter of specified type and name + * + * @param string $type filter type + * @param string $name filter name + * @return bool + */ public function loadFilter($type, $name) { $_plugin = "smarty_{$type}filter_{$name}"; @@ -669,12 +681,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * unload a filter of specified type and name - * - * @param string $type filter type - * @param string $name filter name - * @return bool - */ + * unload a filter of specified type and name + * + * @param string $type filter type + * @param string $name filter name + * @return bool + */ public function unloadFilter($type, $name) { $_filter_name = "smarty_{$type}filter_{$name}"; @@ -687,21 +699,21 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } /** - * preg_replace callback to convert camelcase getter/setter to underscore property names - * - * @param string $match match string - * @return string replacemant - */ + * preg_replace callback to convert camelcase getter/setter to underscore property names + * + * @param string $match match string + * @return string replacemant + */ private function replaceCamelcase($match) { return "_" . strtolower($match[1]); } /** - * Handle unknown class methods - * - * @param string $name unknown method-name - * @param array $args argument array - */ + * Handle unknown class methods + * + * @param string $name unknown method-name + * @param array $args argument array + */ public function __call($name, $args) { static $_prefixes = array('set' => true, 'get' => true); @@ -738,14 +750,14 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { } if ($_is_this) { if ($first3 == 'get') - return $this->$property_name; + return $this->$property_name; else - return $this->$property_name = $args[0]; + return $this->$property_name = $args[0]; } else if ($_is_this === false) { if ($first3 == 'get') - return $this->smarty->$property_name; + return $this->smarty->$property_name; else - return $this->smarty->$property_name = $args[0]; + return $this->smarty->$property_name = $args[0]; } else { throw new SmartyException("property '$property_name' does not exist."); return false;