[pLog-svn] r6803 - in plog/branches/lifetype-1.2/class/template/smarty: . plugins

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Wed Feb 18 13:56:32 EST 2009


Author: jondaley
Date: 2009-02-18 13:56:32 -0500 (Wed, 18 Feb 2009)
New Revision: 6803

Modified:
   plog/branches/lifetype-1.2/class/template/smarty/Config_File.class.php
   plog/branches/lifetype-1.2/class/template/smarty/Smarty.class.php
   plog/branches/lifetype-1.2/class/template/smarty/Smarty_Compiler.class.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/compiler.assign.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.regex_replace.php
Log:
upgraded to 2.6.19

Modified: plog/branches/lifetype-1.2/class/template/smarty/Config_File.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/Config_File.class.php	2009-02-17 21:15:32 UTC (rev 6802)
+++ plog/branches/lifetype-1.2/class/template/smarty/Config_File.class.php	2009-02-18 18:56:32 UTC (rev 6803)
@@ -18,14 +18,14 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * @link http://smarty.php.net/
- * @version 2.6.18
+ * @version 2.6.19
  * @copyright Copyright: 2001-2005 New Digital Group, Inc.
  * @author Andrei Zmievski <andrei at php.net>
  * @access public
  * @package Smarty
  */
 
-/* $Id: Config_File.class.php,v 1.88 2007/03/06 10:40:06 messju Exp $ */
+/* $Id: Config_File.class.php 2702 2007-03-08 19:11:22Z mohrt $ */
 
 /**
  * Config file reading class

Modified: plog/branches/lifetype-1.2/class/template/smarty/Smarty.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/Smarty.class.php	2009-02-17 21:15:32 UTC (rev 6802)
+++ plog/branches/lifetype-1.2/class/template/smarty/Smarty.class.php	2009-02-18 18:56:32 UTC (rev 6803)
@@ -27,10 +27,10 @@
  * @author Monte Ohrt <monte at ohrt dot com>
  * @author Andrei Zmievski <andrei at php.net>
  * @package Smarty
- * @version 2.6.18
+ * @version 2.6.19
  */
 
-/* $Id: Smarty.class.php,v 1.528 2007/03/06 10:40:06 messju Exp $ */
+/* $Id: Smarty.class.php 2722 2007-06-18 14:29:00Z danilo $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
@@ -464,7 +464,7 @@
      *
      * @var string
      */
-    var $_version              = '2.6.18';
+    var $_version              = '2.6.19';
 
     /**
      * current template inclusion depth
@@ -838,69 +838,66 @@
      * Registers a prefilter function to apply
      * to a template before compiling
      *
-     * @param string $function name of PHP function to register
+     * @param callback $function
      */
     function register_prefilter($function)
     {
-    $_name = (is_array($function)) ? $function[1] : $function;
-        $this->_plugins['prefilter'][$_name]
+        $this->_plugins['prefilter'][$this->_get_filter_name($function)]
             = array($function, null, null, false);
     }
 
     /**
      * Unregisters a prefilter function
      *
-     * @param string $function name of PHP function
+     * @param callback $function
      */
     function unregister_prefilter($function)
     {
-        unset($this->_plugins['prefilter'][$function]);
+        unset($this->_plugins['prefilter'][$this->_get_filter_name($function)]);
     }
 
     /**
      * Registers a postfilter function to apply
      * to a compiled template after compilation
      *
-     * @param string $function name of PHP function to register
+     * @param callback $function
      */
     function register_postfilter($function)
     {
-    $_name = (is_array($function)) ? $function[1] : $function;
-        $this->_plugins['postfilter'][$_name]
+        $this->_plugins['postfilter'][$this->_get_filter_name($function)]
             = array($function, null, null, false);
     }
 
     /**
      * Unregisters a postfilter function
      *
-     * @param string $function name of PHP function
+     * @param callback $function
      */
     function unregister_postfilter($function)
     {
-        unset($this->_plugins['postfilter'][$function]);
+        unset($this->_plugins['postfilter'][$this->_get_filter_name($function)]);
     }
 
     /**
      * Registers an output filter function to apply
      * to a template output
      *
-     * @param string $function name of PHP function
+     * @param callback $function
      */
     function register_outputfilter($function)
     {
-    $_name = (is_array($function)) ? $function[1] : $function;
-        $this->_plugins['outputfilter'][$_name]
+        $this->_plugins['outputfilter'][$this->_get_filter_name($function)]
             = array($function, null, null, false);
     }
 
     /**
      * Unregisters an outputfilter function
      *
-     * @param string $function name of PHP function
+     * @param callback $function
      */
     function unregister_outputfilter($function)
     {
-        unset($this->_plugins['outputfilter'][$function]);
+        unset($this->_plugins['outputfilter'][$this->_get_filter_name($function)]);
     }
 
     /**
@@ -1935,6 +1932,25 @@
     {
         return eval($code);
     }
+    
+    /**
+     * Extracts the filter name from the given callback
+     * 
+     * @param callback $function
+     * @return string
+     */
+	function _get_filter_name($function)
+	{
+		if (is_array($function)) {
+			$_class_name = (is_object($function[0]) ?
+				get_class($function[0]) : $function[0]);
+			return $_class_name . '_' . $function[1];
+		}
+		else {
+			return $function;
+		}
+	}
+    
     /**#@-*/
 
 }

Modified: plog/branches/lifetype-1.2/class/template/smarty/Smarty_Compiler.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/Smarty_Compiler.class.php	2009-02-17 21:15:32 UTC (rev 6802)
+++ plog/branches/lifetype-1.2/class/template/smarty/Smarty_Compiler.class.php	2009-02-18 18:56:32 UTC (rev 6803)
@@ -21,12 +21,12 @@
  * @link http://smarty.php.net/
  * @author Monte Ohrt <monte at ohrt dot com>
  * @author Andrei Zmievski <andrei at php.net>
- * @version 2.6.18
+ * @version 2.6.19
  * @copyright 2001-2005 New Digital Group, Inc.
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.395 2007/03/06 10:40:06 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php 2736 2007-09-16 14:47:53Z mohrt $ */
 
 /**
  * Template compiling class
@@ -869,7 +869,7 @@
             // traditional argument format
             $args = implode(',', array_values($attrs));
             if (empty($args)) {
-                $args = 'null';
+                $args = '';
             }
         }
 
@@ -1171,7 +1171,7 @@
         }
         $item = $this->_dequote($attrs['item']);
         if (!preg_match('~^\w+$~', $item)) {
-            return $this->_syntax_error("'foreach: 'item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
+            return $this->_syntax_error("foreach: 'item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
         }
 
         if (isset($attrs['key'])) {
@@ -1222,23 +1222,21 @@
         $attrs = $this->_parse_attrs($tag_args);
 
         if ($start) {
-            if (isset($attrs['name']))
-                $buffer = $attrs['name'];
-            else
-                $buffer = "'default'";
-
-            if (isset($attrs['assign']))
-                $assign = $attrs['assign'];
-            else
-                $assign = null;
+            $buffer = isset($attrs['name']) ? $attrs['name'] : "'default'";
+            $assign = isset($attrs['assign']) ? $attrs['assign'] : null;
+            $append = isset($attrs['append']) ? $attrs['append'] : null;
+            
             $output = "<?php ob_start(); ?>";
-            $this->_capture_stack[] = array($buffer, $assign);
+            $this->_capture_stack[] = array($buffer, $assign, $append);
         } else {
-            list($buffer, $assign) = array_pop($this->_capture_stack);
+            list($buffer, $assign, $append) = array_pop($this->_capture_stack);
             $output = "<?php \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); ";
             if (isset($assign)) {
                 $output .= " \$this->assign($assign, ob_get_contents());";
             }
+            if (isset($append)) {
+                $output .= " \$this->append($append, ob_get_contents());";
+            }
             $output .= "ob_end_clean(); ?>";
         }
 

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/compiler.assign.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/compiler.assign.php	2009-02-17 21:15:32 UTC (rev 6802)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/compiler.assign.php	2009-02-18 18:56:32 UTC (rev 6803)
@@ -14,7 +14,7 @@
  * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign}
  *       (Smarty online manual)
  * @author Monte Ohrt <monte at ohrt dot com> (initial author)
- * @auther messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function)
+ * @author messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function)
  * @param string containing var-attribute and value-attribute
  * @param Smarty_Compiler
  */

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.regex_replace.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.regex_replace.php	2009-02-17 21:15:32 UTC (rev 6802)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.regex_replace.php	2009-02-18 18:56:32 UTC (rev 6803)
@@ -22,6 +22,8 @@
  */
 function smarty_modifier_regex_replace($string, $search, $replace)
 {
+    if (($pos = strpos($search,"\0")) !== false)
+      $search = substr($search,0,$pos);
     if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
         /* remove eval-modifier from $search */
         $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);



More information about the pLog-svn mailing list