]> git.mxchange.org Git - friendica.git/blobdiff - library/Smarty/libs/sysplugins/smarty_internal_templatebase.php
reverting tinymce changes, updating smarty to 3.1.19
[friendica.git] / library / Smarty / libs / sysplugins / smarty_internal_templatebase.php
index abd48b79929a97b3bc3ce44546ec0483eba3f34d..955411f06508848fe79b9029361d00dd1edbfaf0 100644 (file)
@@ -1,32 +1,34 @@
 <?php\r
 /**\r
  * Smarty Internal Plugin Smarty Template  Base\r
+ * This file contains the basic shared methods for template handling\r
  *\r
- * This file contains the basic shared methodes for template handling\r
- *\r
- * @package Smarty\r
+ * @package    Smarty\r
  * @subpackage Template\r
- * @author Uwe Tews\r
+ * @author     Uwe Tews\r
  */\r
 \r
 /**\r
- * Class with shared template methodes\r
+ * Class with shared template methods\r
  *\r
- * @package Smarty\r
+ * @package    Smarty\r
  * @subpackage Template\r
  */\r
-abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {\r
-\r
+abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data\r
+{\r
     /**\r
      * fetches a rendered Smarty template\r
      *\r
-     * @param string $template          the resource handle of the template file or template object\r
-     * @param mixed  $cache_id          cache id to be used with this template\r
-     * @param mixed  $compile_id        compile id to be used with this template\r
-     * @param object $parent            next higher level of Smarty variables\r
-     * @param bool   $display           true: display, false: fetch\r
-     * @param bool   $merge_tpl_vars    if true parent template variables merged in to local scope\r
-     * @param bool   $no_output_filter  if true do not run output filter\r
+     * @param  string $template         the resource handle of the template file or template object\r
+     * @param  mixed  $cache_id         cache id to be used with this template\r
+     * @param  mixed  $compile_id       compile id to be used with this template\r
+     * @param  object $parent           next higher level of Smarty variables\r
+     * @param  bool   $display          true: display, false: fetch\r
+     * @param  bool   $merge_tpl_vars   if true parent template variables merged in to local scope\r
+     * @param  bool   $no_output_filter if true do not run output filter\r
+     *\r
+     * @throws Exception\r
+     * @throws SmartyException\r
      * @return string rendered template output\r
      */\r
     public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)\r
@@ -34,7 +36,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
         if ($template === null && $this instanceof $this->template_class) {\r
             $template = $this;\r
         }\r
-        if (!empty($cache_id) && is_object($cache_id)) {\r
+        if ($cache_id !== null && is_object($cache_id)) {\r
             $parent = $cache_id;\r
             $cache_id = null;\r
         }\r
@@ -43,8 +45,8 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
         }\r
         // create template object if necessary\r
         $_template = ($template instanceof $this->template_class)\r
-        ? $template\r
-        : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);\r
+            ? $template\r
+            : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);\r
         // if called by Smarty object make sure we use current caching status\r
         if ($this instanceof Smarty) {\r
             $_template->caching = $this->caching;\r
@@ -130,15 +132,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
         if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) {\r
             // render template (not loaded and not in cache)\r
             if (!$_template->source->uncompiled) {\r
+                /** @var Smarty_Internal_Template $_smarty_tpl\r
+                 * used in evaluated code\r
+                 */\r
                 $_smarty_tpl = $_template;\r
                 if ($_template->source->recompiled) {\r
-                    if ($this->smarty->debugging) {\r
-                        Smarty_Internal_Debug::start_compile($_template);\r
-                    }\r
                     $code = $_template->compiler->compileTemplate($_template);\r
-                    if ($this->smarty->debugging) {\r
-                        Smarty_Internal_Debug::end_compile($_template);\r
-                    }\r
                     if ($this->smarty->debugging) {\r
                         Smarty_Internal_Debug::start_render($_template);\r
                     }\r
@@ -146,13 +145,19 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                         ob_start();\r
                         eval("?>" . $code);\r
                         unset($code);\r
-                    } catch (Exception $e) {\r
+                    }\r
+                    catch (Exception $e) {\r
                         ob_get_clean();\r
                         throw $e;\r
                     }\r
                 } else {\r
                     if (!$_template->compiled->exists || ($_template->smarty->force_compile && !$_template->compiled->isCompiled)) {\r
                         $_template->compileTemplateSource();\r
+                        $code = file_get_contents($_template->compiled->filepath);\r
+                        eval("?>" . $code);\r
+                        unset($code);\r
+                        $_template->compiled->loaded = true;\r
+                        $_template->compiled->isCompiled = true;\r
                     }\r
                     if ($this->smarty->debugging) {\r
                         Smarty_Internal_Debug::start_render($_template);\r
@@ -162,7 +167,10 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                         if ($_template->mustCompile) {\r
                             // recompile and load again\r
                             $_template->compileTemplateSource();\r
-                            include($_template->compiled->filepath);\r
+                            $code = file_get_contents($_template->compiled->filepath);\r
+                            eval("?>" . $code);\r
+                            unset($code);\r
+                            $_template->compiled->isCompiled = true;\r
                         }\r
                         $_template->compiled->loaded = true;\r
                     } else {\r
@@ -173,7 +181,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                         if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) {\r
                             throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'");\r
                         }\r
-                        array_unshift($_template->_capture_stack,array());\r
+                        array_unshift($_template->_capture_stack, array());\r
                         //\r
                         // render compiled template\r
                         //\r
@@ -183,7 +191,8 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                             $_template->capture_error();\r
                         }\r
                         array_shift($_template->_capture_stack);\r
-                    } catch (Exception $e) {\r
+                    }\r
+                    catch (Exception $e) {\r
                         ob_get_clean();\r
                         throw $e;\r
                     }\r
@@ -196,7 +205,8 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                     try {\r
                         ob_start();\r
                         $_template->source->renderUncompiled($_template);\r
-                    } catch (Exception $e) {\r
+                    }\r
+                    catch (Exception $e) {\r
                         ob_get_clean();\r
                         throw $e;\r
                     }\r
@@ -235,7 +245,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                 // loop over items, stitch back together\r
                 foreach ($cache_split as $curr_idx => $curr_split) {\r
                     // escape PHP tags in template content\r
-                    $output .= preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php echo \'$1\'; ?>', $curr_split);\r
+                    $output .= preg_replace('/(<%|%>|<\?php|<\?|\?>)/', "<?php echo '\$1'; ?>\n", $curr_split);\r
                     if (isset($cache_parts[0][$curr_idx])) {\r
                         $_template->properties['has_nocache_code'] = true;\r
                         // remove nocache tags from cache output\r
@@ -246,12 +256,16 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                     $output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template);\r
                 }\r
                 // rendering (must be done before writing cache file because of {function} nocache handling)\r
+                /** @var Smarty_Internal_Template $_smarty_tpl\r
+                 * used in evaluated code\r
+                 */\r
                 $_smarty_tpl = $_template;\r
                 try {\r
                     ob_start();\r
                     eval("?>" . $output);\r
                     $_output = ob_get_clean();\r
-                } catch (Exception $e) {\r
+                }\r
+                catch (Exception $e) {\r
                     ob_get_clean();\r
                     throw $e;\r
                 }\r
@@ -274,7 +288,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
             }\r
             try {\r
                 ob_start();\r
-                array_unshift($_template->_capture_stack,array());\r
+                array_unshift($_template->_capture_stack, array());\r
                 //\r
                 // render cached template\r
                 //\r
@@ -285,7 +299,8 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                 }\r
                 array_shift($_template->_capture_stack);\r
                 $_output = ob_get_clean();\r
-            } catch (Exception $e) {\r
+            }\r
+            catch (Exception $e) {\r
                 ob_get_clean();\r
                 throw $e;\r
             }\r
@@ -306,33 +321,37 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                 $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);\r
                 if ($_isCached && $_template->cached->timestamp <= strtotime($_last_modified_date)) {\r
                     switch (PHP_SAPI) {\r
-                        case 'cgi':         // php-cgi < 5.3\r
-                        case 'cgi-fcgi':    // php-cgi >= 5.3\r
-                        case 'fpm-fcgi':    // php-fpm >= 5.3.3\r
-                        header('Status: 304 Not Modified');\r
-                        break;\r
+                        case 'cgi': // php-cgi < 5.3\r
+                        case 'cgi-fcgi': // php-cgi >= 5.3\r
+                        case 'fpm-fcgi': // php-fpm >= 5.3.3\r
+                            header('Status: 304 Not Modified');\r
+                            break;\r
 \r
                         case 'cli':\r
-                        if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {\r
-                            $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';\r
-                        }\r
-                        break;\r
+                            if ( /* ^phpunit */\r
+                            !empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS']) /* phpunit$ */\r
+                            ) {\r
+                                $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';\r
+                            }\r
+                            break;\r
 \r
                         default:\r
-                        header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');\r
-                        break;\r
+                            header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');\r
+                            break;\r
                     }\r
                 } else {\r
                     switch (PHP_SAPI) {\r
                         case 'cli':\r
-                        if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {\r
-                            $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT';\r
-                        }\r
-                        break;\r
+                            if ( /* ^phpunit */\r
+                            !empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS']) /* phpunit$ */\r
+                            ) {\r
+                                $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT';\r
+                            }\r
+                            break;\r
 \r
                         default:\r
-                        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT');\r
-                        break;\r
+                            header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT');\r
+                            break;\r
                     }\r
                     echo $_output;\r
                 }\r
@@ -341,19 +360,20 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
             }\r
             // debug output\r
             if ($this->smarty->debugging) {\r
-                Smarty_Internal_Debug::display_debug($this);\r
+                Smarty_Internal_Debug::display_debug($_template);\r
             }\r
             if ($merge_tpl_vars) {\r
                 // restore local variables\r
                 $_template->tpl_vars = $save_tpl_vars;\r
-                $_template->config_vars =  $save_config_vars;\r
+                $_template->config_vars = $save_config_vars;\r
             }\r
+\r
             return;\r
         } else {\r
             if ($merge_tpl_vars) {\r
                 // restore local variables\r
                 $_template->tpl_vars = $save_tpl_vars;\r
-                $_template->config_vars =  $save_config_vars;\r
+                $_template->config_vars = $save_config_vars;\r
             }\r
             // return fetched content\r
             return $_output;\r
@@ -377,11 +397,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * test if cache is valid\r
      *\r
-     * @param string|object $template   the resource handle of the template file or template object\r
-     * @param mixed         $cache_id   cache id to be used with this template\r
-     * @param mixed         $compile_id compile id to be used with this template\r
-     * @param object        $parent     next higher level of Smarty variables\r
-     * @return boolean cache status\r
+     * @param  string|object $template   the resource handle of the template file or template object\r
+     * @param  mixed         $cache_id   cache id to be used with this template\r
+     * @param  mixed         $compile_id compile id to be used with this template\r
+     * @param  object        $parent     next higher level of Smarty variables\r
+     *\r
+     * @return boolean       cache status\r
      */\r
     public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)\r
     {\r
@@ -402,6 +423,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
      * creates a data object\r
      *\r
      * @param object $parent next higher level of Smarty variables\r
+     *\r
      * @returns Smarty_Data data object\r
      */\r
     public function createData($parent = null)\r
@@ -412,13 +434,14 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Registers plugin to be used in templates\r
      *\r
-     * @param string   $type       plugin type\r
-     * @param string   $tag        name of template tag\r
-     * @param callback $callback   PHP callback to register\r
-     * @param boolean  $cacheable  if true (default) this fuction is cachable\r
-     * @param array    $cache_attr caching attributes if any\r
+     * @param  string   $type       plugin type\r
+     * @param  string   $tag        name of template tag\r
+     * @param  callback $callback   PHP callback to register\r
+     * @param  boolean  $cacheable  if true (default) this fuction is cachable\r
+     * @param  array    $cache_attr caching attributes if any\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
-     * @throws SmartyException when the plugin tag is invalid\r
+     * @throws SmartyException              when the plugin tag is invalid\r
      */\r
     public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null)\r
     {\r
@@ -436,8 +459,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Unregister Plugin\r
      *\r
-     * @param string $type of plugin\r
-     * @param string $tag name of plugin\r
+     * @param  string $type of plugin\r
+     * @param  string $tag  name of plugin\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function unregisterPlugin($type, $tag)\r
@@ -452,20 +476,23 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Registers a resource to fetch a template\r
      *\r
-     * @param string $type name of resource type\r
-     * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)\r
+     * @param  string                $type     name of resource type\r
+     * @param  Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function registerResource($type, $callback)\r
     {\r
         $this->smarty->registered_resources[$type] = $callback instanceof Smarty_Resource ? $callback : array($callback, false);\r
+\r
         return $this;\r
     }\r
 \r
     /**\r
      * Unregisters a resource\r
      *\r
-     * @param string $type name of resource type\r
+     * @param  string $type name of resource type\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function unregisterResource($type)\r
@@ -480,20 +507,23 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Registers a cache resource to cache a template's output\r
      *\r
-     * @param string               $type     name of cache resource type\r
-     * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching\r
+     * @param  string               $type     name of cache resource type\r
+     * @param  Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function registerCacheResource($type, Smarty_CacheResource $callback)\r
     {\r
         $this->smarty->registered_cache_resources[$type] = $callback;\r
+\r
         return $this;\r
     }\r
 \r
     /**\r
      * Unregisters a cache resource\r
      *\r
-     * @param string $type name of cache resource type\r
+     * @param  string $type name of cache resource type\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function unregisterCacheResource($type)\r
@@ -508,26 +538,26 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Registers object to be used in templates\r
      *\r
-     * @param string  $object        name of template object\r
-     * @param object  $object_impl   the referenced PHP object to register\r
-     * @param array   $allowed       list of allowed methods (empty = all)\r
-     * @param boolean $smarty_args   smarty argument format, else traditional\r
-     * @param array   $block_methods list of block-methods\r
-     * @param array $block_functs list of methods that are block format\r
+     * @param          $object_name\r
+     * @param  object  $object_impl   the referenced PHP object to register\r
+     * @param  array   $allowed       list of allowed methods (empty = all)\r
+     * @param  boolean $smarty_args   smarty argument format, else traditional\r
+     * @param  array   $block_methods list of block-methods\r
+     *\r
+     * @throws SmartyException\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
-     * @throws SmartyException if any of the methods in $allowed or $block_methods are invalid\r
      */\r
     public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())\r
     {\r
-        // test if allowed methodes callable\r
+        // test if allowed methods callable\r
         if (!empty($allowed)) {\r
             foreach ((array) $allowed as $method) {\r
-                if (!is_callable(array($object_impl, $method))) {\r
-                    throw new SmartyException("Undefined method '$method' in registered object");\r
+                if (!is_callable(array($object_impl, $method)) && !property_exists($object_impl, $method)) {\r
+                    throw new SmartyException("Undefined method or property '$method' in registered object");\r
                 }\r
             }\r
         }\r
-        // test if block methodes callable\r
+        // test if block methods callable\r
         if (!empty($block_methods)) {\r
             foreach ((array) $block_methods as $method) {\r
                 if (!is_callable(array($object_impl, $method))) {\r
@@ -537,14 +567,16 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
         }\r
         // register the object\r
         $this->smarty->registered_objects[$object_name] =\r
-        array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods);\r
+            array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods);\r
+\r
         return $this;\r
     }\r
 \r
     /**\r
      * return a reference to a registered object\r
      *\r
-     * @param string $name object name\r
+     * @param  string $name object name\r
+     *\r
      * @return object\r
      * @throws SmartyException if no such object is found\r
      */\r
@@ -556,13 +588,15 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
         if (!is_object($this->smarty->registered_objects[$name][0])) {\r
             throw new SmartyException("registered '$name' is not an object");\r
         }\r
+\r
         return $this->smarty->registered_objects[$name][0];\r
     }\r
 \r
     /**\r
      * unregister an object\r
      *\r
-     * @param string $name object name\r
+     * @param  string $name object name\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function unregisterObject($name)\r
@@ -577,10 +611,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Registers static classes to be used in templates\r
      *\r
-     * @param string $class name of template class\r
-     * @param string $class_impl the referenced PHP class to register\r
+     * @param         $class_name\r
+     * @param  string $class_impl the referenced PHP class to register\r
+     *\r
+     * @throws SmartyException\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
-     * @throws SmartyException if $class_impl does not refer to an existing class\r
      */\r
     public function registerClass($class_name, $class_impl)\r
     {\r
@@ -590,15 +625,17 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
         }\r
         // register the class\r
         $this->smarty->registered_classes[$class_name] = $class_impl;\r
+\r
         return $this;\r
     }\r
 \r
     /**\r
      * Registers a default plugin handler\r
      *\r
-     * @param callable $callback class/method name\r
+     * @param  callable $callback class/method name\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
-     * @throws SmartyException if $callback is not callable\r
+     * @throws SmartyException              if $callback is not callable\r
      */\r
     public function registerDefaultPluginHandler($callback)\r
     {\r
@@ -614,9 +651,10 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Registers a default template handler\r
      *\r
-     * @param callable $callback class/method name\r
+     * @param  callable $callback class/method name\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
-     * @throws SmartyException if $callback is not callable\r
+     * @throws SmartyException              if $callback is not callable\r
      */\r
     public function registerDefaultTemplateHandler($callback)\r
     {\r
@@ -632,9 +670,10 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Registers a default template handler\r
      *\r
-     * @param callable $callback class/method name\r
+     * @param  callable $callback class/method name\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
-     * @throws SmartyException if $callback is not callable\r
+     * @throws SmartyException              if $callback is not callable\r
      */\r
     public function registerDefaultConfigHandler($callback)\r
     {\r
@@ -650,21 +689,24 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Registers a filter function\r
      *\r
-     * @param string $type filter type\r
-     * @param callback $callback\r
+     * @param  string   $type filter type\r
+     * @param  callback $callback\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function registerFilter($type, $callback)\r
     {\r
         $this->smarty->registered_filters[$type][$this->_get_filter_name($callback)] = $callback;\r
+\r
         return $this;\r
     }\r
 \r
     /**\r
      * Unregisters a filter function\r
      *\r
-     * @param string $type filter type\r
-     * @param callback $callback\r
+     * @param  string   $type filter type\r
+     * @param  callback $callback\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function unregisterFilter($type, $callback)\r
@@ -680,14 +722,16 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * Return internal filter name\r
      *\r
-     * @param callback $function_name\r
-     * @return string internal filter name\r
+     * @param  callback $function_name\r
+     *\r
+     * @return string   internal filter name\r
      */\r
     public function _get_filter_name($function_name)\r
     {\r
         if (is_array($function_name)) {\r
             $_class_name = (is_object($function_name[0]) ?\r
-            get_class($function_name[0]) : $function_name[0]);\r
+                get_class($function_name[0]) : $function_name[0]);\r
+\r
             return $_class_name . '_' . $function_name[1];\r
         } else {\r
             return $function_name;\r
@@ -697,8 +741,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * load a filter of specified type and name\r
      *\r
-     * @param string $type filter type\r
-     * @param string $name filter name\r
+     * @param  string $type filter type\r
+     * @param  string $name filter name\r
+     *\r
      * @throws SmartyException if filter could not be loaded\r
      */\r
     public function loadFilter($type, $name)\r
@@ -711,6 +756,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
             }\r
             if (is_callable($_plugin)) {\r
                 $this->smarty->registered_filters[$type][$_filter_name] = $_plugin;\r
+\r
                 return true;\r
             }\r
         }\r
@@ -720,8 +766,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * unload a filter of specified type and name\r
      *\r
-     * @param string $type filter type\r
-     * @param string $name filter name\r
+     * @param  string $type filter type\r
+     * @param  string $name filter name\r
+     *\r
      * @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
      */\r
     public function unloadFilter($type, $name)\r
@@ -737,10 +784,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
     /**\r
      * preg_replace callback to convert camelcase getter/setter to underscore property names\r
      *\r
-     * @param string $match match string\r
+     * @param  string $match match string\r
+     *\r
      * @return string replacemant\r
      */\r
-    private function replaceCamelcase($match) {\r
+    private function replaceCamelcase($match)\r
+    {\r
         return "_" . strtolower($match[1]);\r
     }\r
 \r
@@ -749,6 +798,8 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
      *\r
      * @param string $name unknown method-name\r
      * @param array  $args argument array\r
+     *\r
+     * @throws SmartyException\r
      */\r
     public function __call($name, $args)\r
     {\r
@@ -770,7 +821,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                 // lcfirst() not available < PHP 5.3.0, so improvise\r
                 $property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);\r
                 // convert camel case to underscored name\r
-                $property_name = preg_replace_callback('/([A-Z])/', array($this,'replaceCamelcase'), $property_name);\r
+                $property_name = preg_replace_callback('/([A-Z])/', array($this, 'replaceCamelcase'), $property_name);\r
                 $_resolved_property_name[$name] = $property_name;\r
             }\r
             if (isset($_resolved_property_source[$property_name])) {\r
@@ -779,25 +830,26 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
                 $_is_this = null;\r
                 if (property_exists($this, $property_name)) {\r
                     $_is_this = true;\r
-                } else if (property_exists($this->smarty, $property_name)) {\r
+                } elseif (property_exists($this->smarty, $property_name)) {\r
                     $_is_this = false;\r
                 }\r
                 $_resolved_property_source[$property_name] = $_is_this;\r
             }\r
             if ($_is_this) {\r
-                if ($first3 == 'get')\r
-                return $this->$property_name;\r
-                else\r
-                return $this->$property_name = $args[0];\r
-            } else if ($_is_this === false) {\r
-                if ($first3 == 'get')\r
-                return $this->smarty->$property_name;\r
-                else\r
-                return $this->smarty->$property_name = $args[0];\r
+                if ($first3 == 'get') {\r
+                    return $this->$property_name;\r
+                } else {\r
+                    return $this->$property_name = $args[0];\r
+                }\r
+            } elseif ($_is_this === false) {\r
+                if ($first3 == 'get') {\r
+                    return $this->smarty->$property_name;\r
+                } else {\r
+                    return $this->smarty->$property_name = $args[0];\r
+                }\r
             } else {\r
                 throw new SmartyException("property '$property_name' does not exist.");\r
-                return false;\r
-            }\r
+           }\r
         }\r
         if ($name == 'Smarty') {\r
             throw new SmartyException("PHP5 requires you to call __construct() instead of Smarty()");\r
@@ -805,7 +857,4 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
         // must be unknown\r
         throw new SmartyException("Call of unknown method '$name'.");\r
     }\r
-\r
 }\r
-\r
-?>
\ No newline at end of file