]> git.mxchange.org Git - friendica.git/blobdiff - library/Smarty/libs/sysplugins/smarty_internal_compile_assign.php
reverting tinymce changes, updating smarty to 3.1.19
[friendica.git] / library / Smarty / libs / sysplugins / smarty_internal_compile_assign.php
index 0ac3f68cecacc5261affab31cc113d359463d3fb..caa34861f0a02644f8b543ac4bf49d722c9b59ec 100644 (file)
@@ -1,28 +1,28 @@
 <?php
 /**
  * Smarty Internal Plugin Compile Assign
- *
  * Compiles the {assign} tag
  *
- * @package Smarty
+ * @package    Smarty
  * @subpackage Compiler
- * @author Uwe Tews
+ * @author     Uwe Tews
  */
 
 /**
  * Smarty Internal Plugin Compile Assign Class
  *
- * @package Smarty
+ * @package    Smarty
  * @subpackage Compiler
  */
-class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
+{
     /**
      * Compiles code for the {assign} tag
      *
-     * @param array  $args      array with attributes from parser
-     * @param object $compiler  compiler object
-     * @param array  $parameter array with compilation parameter
+     * @param  array  $args      array with attributes from parser
+     * @param  object $compiler  compiler object
+     * @param  array  $parameter array with compilation parameter
+     *
      * @return string compiled code
      */
     public function compile($args, $compiler, $parameter)
@@ -39,7 +39,11 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
         if ($compiler->tag_nocache || $compiler->nocache) {
             $_nocache = 'true';
             // create nocache var to make it know for further compiling
-            $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true);
+            if (isset($compiler->template->tpl_vars[trim($_attr['var'], "'")])) {
+                $compiler->template->tpl_vars[trim($_attr['var'], "'")]->nocache = true;
+            } else {
+                $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true);
+            }
         }
         // scope setup
         if (isset($_attr['scope'])) {
@@ -72,13 +76,11 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
         } elseif ($_scope == Smarty::SCOPE_ROOT || $_scope == Smarty::SCOPE_GLOBAL) {
             $output .= "\n\$_ptr = \$_smarty_tpl->parent; while (\$_ptr != null) {\$_ptr->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]]; \$_ptr = \$_ptr->parent; }";
         }
-        if ( $_scope == Smarty::SCOPE_GLOBAL) {
+        if ($_scope == Smarty::SCOPE_GLOBAL) {
             $output .= "\nSmarty::\$global_tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
         }
         $output .= '?>';
+
         return $output;
     }
-
 }
-
-?>
\ No newline at end of file