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

oscar at devel.lifetype.net oscar at devel.lifetype.net
Thu Feb 22 13:17:53 EST 2007


Author: oscar
Date: 2007-02-22 13:17:53 -0500 (Thu, 22 Feb 2007)
New Revision: 4819

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/debug.tpl
   plog/branches/lifetype-1.2/class/template/smarty/internals/core.write_file.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/function.html_select_date.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/function.html_table.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/function.mailto.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.capitalize.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.date_format.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.debug_print_var.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/outputfilter.trimwhitespace.php
Log:
updated to Smarty 2.6.16, the latest stable version


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	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/Config_File.class.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -18,14 +18,14 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * @link http://smarty.php.net/
- * @version 2.6.14
+ * @version 2.6.16
  * @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.84 2006/01/18 19:02:52 mohrt Exp $ */
+/* $Id: Config_File.class.php,v 1.86 2006/11/30 17:01:28 mohrt Exp $ */
 
 /**
  * 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	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/Smarty.class.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -27,10 +27,10 @@
  * @author Monte Ohrt <monte at ohrt dot com>
  * @author Andrei Zmievski <andrei at php.net>
  * @package Smarty
- * @version 2.6.14
+ * @version 2.6.16
  */
 
-/* $Id: Smarty.class.php,v 1.524 2006/01/18 19:02:52 mohrt Exp $ */
+/* $Id: Smarty.class.php,v 1.526 2006/11/30 17:01:28 mohrt Exp $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
@@ -464,7 +464,7 @@
      *
      * @var string
      */
-    var $_version              = '2.6.14';
+    var $_version              = '2.6.16';
 
     /**
      * current template inclusion depth

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	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/Smarty_Compiler.class.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -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.14
+ * @version 2.6.16
  * @copyright 2001-2005 New Digital Group, Inc.
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.381 2006/05/25 14:46:18 boots Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.386 2006/11/30 17:01:28 mohrt Exp $ */
 
 /**
  * Template compiling class
@@ -927,8 +927,12 @@
         $name = $this->_dequote($attrs['name']);
 
         if (empty($name)) {
-            $this->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__);
+            return $this->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__);
         }
+        
+        if (!preg_match('~^\w+$~', $name)) {
+            return $this->_syntax_error("'insert: 'name' must be an insert function name", E_USER_ERROR, __FILE__, __LINE__);
+        }
 
         if (!empty($attrs['script'])) {
             $delayed_loading = true;
@@ -1160,7 +1164,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'])) {
@@ -1671,11 +1675,11 @@
         // if contains unescaped $, expand it
         if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) {
             $_match = $_match[0];
-            rsort($_match);
-            reset($_match);
+            $_replace = array();
             foreach($_match as $_var) {
-                $var_expr = str_replace ($_var, '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."', $var_expr);
+                $_replace[$_var] = '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."';
             }
+            $var_expr = strtr($var_expr, $_replace);
             $_return = preg_replace('~\.""|(?<!\\\\)""\.~', '', $var_expr);
         } else {
             $_return = $var_expr;

Modified: plog/branches/lifetype-1.2/class/template/smarty/debug.tpl
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/debug.tpl	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/debug.tpl	2007-02-22 18:17:53 UTC (rev 4819)
@@ -1,64 +1,157 @@
 {* Smarty *}
+{* debug.tpl, last updated version 2.1.0 *}
+{assign_debug_info}
+{capture assign=debug_output}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+    <title>Smarty Debug Console</title>
+{literal}
+<style type="text/css">
+/* <![CDATA[ */
+body, h1, h2, td, th, p {
+    font-family: sans-serif;
+    font-weight: normal;
+    font-size: 0.9em;
+    margin: 1px;
+    padding: 0;
+}
 
-{* debug.tpl, last updated version 2.0.1 *}
+h1 {
+    margin: 0;
+    text-align: left;
+    padding: 2px;
+    background-color: #f0c040;
+    color:  black;
+    font-weight: bold;
+    font-size: 1.2em;
+ }
 
-{assign_debug_info}
+h2 {
+    background-color: #9B410E;
+    color: white;
+    text-align: left;
+    font-weight: bold;
+    padding: 2px;
+    border-top: 1px solid black;
+}
 
+body {
+    background: black; 
+}
+
+p, table, div {
+    background: #f0ead8;
+} 
+
+p {
+    margin: 0;
+    font-style: italic;
+    text-align: center;
+}
+
+table {
+    width: 100%;
+}
+
+th, td {
+    font-family: monospace;
+    vertical-align: top;
+    text-align: left;
+    width: 50%;
+}
+
+td {
+    color: green;
+}
+
+.odd {
+    background-color: #eeeeee;
+}
+
+.even {
+    background-color: #fafafa;
+}
+
+.exectime {
+    font-size: 0.8em;
+    font-style: italic;
+}
+
+#table_assigned_vars th {
+    color: blue;
+}
+
+#table_config_vars th {
+    color: maroon;
+}
+/* ]]> */
+</style>
+{/literal}
+</head>
+<body>
+
+<h1>Smarty Debug Console</h1>
+
+<h2>included templates &amp; config files (load time in seconds)</h2>
+
+<div>
+{section name=templates loop=$_debug_tpls}
+    {section name=indent loop=$_debug_tpls[templates].depth}&nbsp;&nbsp;&nbsp;{/section}
+    <font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}>
+        {$_debug_tpls[templates].filename|escape:html}</font>
+    {if isset($_debug_tpls[templates].exec_time)}
+        <span class="exectime">
+        ({$_debug_tpls[templates].exec_time|string_format:"%.5f"})
+        {if %templates.index% eq 0}(total){/if}
+        </span>
+    {/if}
+    <br />
+{sectionelse}
+    <p>no templates included</p>
+{/section}
+</div>
+
+<h2>assigned template variables</h2>
+
+<table id="table_assigned_vars">
+    {section name=vars loop=$_debug_keys}
+        <tr class="{cycle values="odd,even"}">
+            <th>{ldelim}${$_debug_keys[vars]|escape:'html'}{rdelim}</th>
+            <td>{$_debug_vals[vars]|@debug_print_var}</td></tr>
+    {sectionelse}
+        <tr><td><p>no template variables assigned</p></td></tr>
+    {/section}
+</table>
+
+<h2>assigned config file variables (outer template scope)</h2>
+
+<table id="table_config_vars">
+    {section name=config_vars loop=$_debug_config_keys}
+        <tr class="{cycle values="odd,even"}">
+            <th>{ldelim}#{$_debug_config_keys[config_vars]|escape:'html'}#{rdelim}</th>
+            <td>{$_debug_config_vals[config_vars]|@debug_print_var}</td></tr>
+    {sectionelse}
+        <tr><td><p>no config vars assigned</p></td></tr>
+    {/section}
+</table>
+</body>
+</html>
+{/capture}
 {if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"}
-	<table border=0 width=100%>
-	<tr bgcolor=#cccccc><th colspan=2>Smarty Debug Console</th></tr>
-	<tr bgcolor=#cccccc><td colspan=2><b>included templates & config files (load time in seconds):</b></td></tr>
-	{section name=templates loop=$_debug_tpls}
-		<tr bgcolor={if %templates.index% is even}#eeeeee{else}#fafafa{/if}><td colspan=2><tt>{section name=indent loop=$_debug_tpls[templates].depth}&nbsp;&nbsp;&nbsp;{/section}<font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}>{$_debug_tpls[templates].filename|escape:html}</font>{if isset($_debug_tpls[templates].exec_time)} <font size=-1><i>({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}</i></font>{/if}</tt></td></tr>
-	{sectionelse}
-		<tr bgcolor=#eeeeee><td colspan=2><tt><i>no templates included</i></tt></td></tr>	
-	{/section}
-	<tr bgcolor=#cccccc><td colspan=2><b>assigned template variables:</b></td></tr>
-	{section name=vars loop=$_debug_keys}
-		<tr bgcolor={if %vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[vars]}{rdelim}</font></tt></td><td nowrap><tt><font color=green>{$_debug_vals[vars]|@debug_print_var}</font></tt></td></tr>
-	{sectionelse}
-		<tr bgcolor=#eeeeee><td colspan=2><tt><i>no template variables assigned</i></tt></td></tr>	
-	{/section}
-	<tr bgcolor=#cccccc><td colspan=2><b>assigned config file variables (outer template scope):</b></td></tr>
-	{section name=config_vars loop=$_debug_config_keys}
-		<tr bgcolor={if %config_vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=maroon>{ldelim}#{$_debug_config_keys[config_vars]}#{rdelim}</font></tt></td><td><tt><font color=green>{$_debug_config_vals[config_vars]|@debug_print_var}</font></tt></td></tr>
-	{sectionelse}
-		<tr bgcolor=#eeeeee><td colspan=2><tt><i>no config vars assigned</i></tt></td></tr>	
-	{/section}
-	</table>
-</BODY></HTML>
+    {$debug_output}
 {else}
-<SCRIPT language=javascript>
-	if( self.name == '' ) {ldelim}
-	   var title = 'Console';
-	{rdelim}
-	else {ldelim}
-	   var title = 'Console_' + self.name;
-	{rdelim}
-	_smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
-	_smarty_console.document.write("<HTML><HEAD><TITLE>Smarty Debug Console_"+self.name+"</TITLE></HEAD><BODY bgcolor=#ffffff>");
-	_smarty_console.document.write("<table border=0 width=100%>");
-	_smarty_console.document.write("<tr bgcolor=#cccccc><th colspan=2>Smarty Debug Console</th></tr>");
-	_smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>included templates & config files (load time in seconds):</b></td></tr>");
-	{section name=templates loop=$_debug_tpls}
-		_smarty_console.document.write("<tr bgcolor={if %templates.index% is even}#eeeeee{else}#fafafa{/if}><td colspan=2><tt>{section name=indent loop=$_debug_tpls[templates].depth}&nbsp;&nbsp;&nbsp;{/section}<font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}>{$_debug_tpls[templates].filename|escape:html|escape:javascript}</font>{if isset($_debug_tpls[templates].exec_time)} <font size=-1><i>({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}</i></font>{/if}</tt></td></tr>");
-	{sectionelse}
-		_smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no templates included</i></tt></td></tr>");	
-	{/section}
-	_smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>assigned template variables:</b></td></tr>");
-	{section name=vars loop=$_debug_keys}
-		_smarty_console.document.write("<tr bgcolor={if %vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[vars]}{rdelim}</font></tt></td><td nowrap><tt><font color=green>{$_debug_vals[vars]|@debug_print_var|escape:javascript}</font></tt></td></tr>");
-	{sectionelse}
-		_smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no template variables assigned</i></tt></td></tr>");	
-	{/section}
-	_smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>assigned config file variables (outer template scope):</b></td></tr>");
-	{section name=config_vars loop=$_debug_config_keys}
-		_smarty_console.document.write("<tr bgcolor={if %config_vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=maroon>{ldelim}#{$_debug_config_keys[config_vars]}#{rdelim}</font></tt></td><td><tt><font color=green>{$_debug_config_vals[config_vars]|@debug_print_var|escape:javascript}</font></tt></td></tr>");
-	{sectionelse}
-		_smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no config vars assigned</i></tt></td></tr>");	
-	{/section}
-	_smarty_console.document.write("</table>");
-	_smarty_console.document.write("</BODY></HTML>");
-	_smarty_console.document.close();
-</SCRIPT>
-{/if}
+<script type="text/javascript">
+// <![CDATA[
+    if ( self.name == '' ) {ldelim}
+       var title = 'Console';
+    {rdelim}
+    else {ldelim}
+       var title = 'Console_' + self.name;
+    {rdelim}
+    _smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
+    _smarty_console.document.write('{$debug_output|escape:'javascript'}');
+    _smarty_console.document.close();
+// ]]>
+</script>
+{/if}
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/class/template/smarty/internals/core.write_file.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/internals/core.write_file.php	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/internals/core.write_file.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -23,8 +23,7 @@
         smarty_core_create_dir_structure($_params, $smarty);
     }
 
-    // write to tmp file, then rename it to avoid
-    // file locking race condition
+    // write to tmp file, then rename it to avoid file locking race condition
     $_tmp_file = tempnam($_dirname, 'wrt');
 
     if (!($fd = @fopen($_tmp_file, 'wb'))) {
@@ -38,12 +37,13 @@
     fwrite($fd, $params['contents']);
     fclose($fd);
 
-    // Delete the file if it allready exists (this is needed on Win,
-    // because it cannot overwrite files with rename()
-    if (file_exists($params['filename'])) {
+    if (PHP_OS == 'Windows' || !@rename($_tmp_file, $params['filename'])) {
+        // On platforms and filesystems that cannot overwrite with rename() 
+        // delete the file before renaming it -- because windows always suffers
+        // this, it is short-circuited to avoid the initial rename() attempt
         @unlink($params['filename']);
+        @rename($_tmp_file, $params['filename']);
     }
-    @rename($_tmp_file, $params['filename']);
     @chmod($params['filename'], $smarty->_file_perms);
 
     return true;
@@ -51,4 +51,4 @@
 
 /* vim: set expandtab: */
 
-?>
+?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/function.html_select_date.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/function.html_select_date.php	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/function.html_select_date.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -24,9 +24,11 @@
  *                day values (Marcus Bointon)
  *           - 1.3.2 support negative timestamps, force year
  *             dropdown to include given date unless explicitly set (Monte)
+ *           - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
+ *             of 0000-00-00 dates (cybot, boots)
  * @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date}
  *      (Smarty online manual)
- * @version 1.3.2
+ * @version 1.3.4
  * @author Andrei Zmievski
  * @author Monte Ohrt <monte at ohrt dot com>
  * @param array
@@ -131,19 +133,21 @@
         }
     }
 
-    if(preg_match('!^-\d+$!',$time)) {
+    if (preg_match('!^-\d+$!', $time)) {
         // negative timestamp, use date()
-        $time = date('Y-m-d',$time);
+        $time = date('Y-m-d', $time);
     }
     // If $time is not in format yyyy-mm-dd
-    if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) {
+    if (preg_match('/^(\d{0,4}-\d{0,2}-\d{0,2})/', $time, $found)) {
+        $time = $found[1];
+    } else {
         // use smarty_make_timestamp to get an unix timestamp and
         // strftime to make yyyy-mm-dd
         $time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
     }
     // Now split this in pieces, which later can be used to set the select
     $time = explode("-", $time);
-    
+
     // make syntax "+N" or "-N" work with start_year and end_year
     if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
         if ($match[1] == '+') {
@@ -159,7 +163,7 @@
             $start_year = strftime('%Y') - $match[2];
         }
     }
-    if (strlen($time[0]) > 0) { 
+    if (strlen($time[0]) > 0) {
         if ($start_year > $time[0] && !isset($params['start_year'])) {
             // force start year to include given date if not explicitly set
             $start_year = $time[0];

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/function.html_table.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/function.html_table.php	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/function.html_table.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -15,12 +15,15 @@
  * Purpose:  make an html table from an array of data<br>
  * Input:<br>
  *         - loop = array to loop through
- *         - cols = number of columns
+ *         - cols = number of columns, comma separated list of column names
+ *                  or array of column names
  *         - rows = number of rows
  *         - table_attr = table attributes
+ *         - th_attr = table heading attributes (arrays are cycled)
  *         - tr_attr = table row attributes (arrays are cycled)
  *         - td_attr = table cell attributes (arrays are cycled)
  *         - trailpad = value to pad trailing cells with
+ *         - caption = text for caption element 
  *         - vdir = vertical direction (default: "down", means top-to-bottom)
  *         - hdir = horizontal direction (default: "right", means left-to-right)
  *         - inner = inner loop (default "cols": print $loop line by line,
@@ -31,10 +34,12 @@
  * <pre>
  * {table loop=$data}
  * {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
- * {table loop=$data cols=4 tr_attr=$colors}
+ * {table loop=$data cols="first,second,third" tr_attr=$colors}
  * </pre>
  * @author   Monte Ohrt <monte at ohrt dot com>
- * @version  1.0
+ * @author credit to Messju Mohr <messju at lammfellpuschen dot de>
+ * @author credit to boots <boots dot smarty at yahoo dot com>
+ * @version  1.1
  * @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table}
  *          (Smarty online manual)
  * @param array
@@ -45,13 +50,15 @@
 {
     $table_attr = 'border="1"';
     $tr_attr = '';
+    $th_attr = '';
     $td_attr = '';
-    $cols = 3;
+    $cols = $cols_count = 3;
     $rows = 3;
     $trailpad = '&nbsp;';
     $vdir = 'down';
     $hdir = 'right';
     $inner = 'cols';
+    $caption = '';
 
     if (!isset($params['loop'])) {
         $smarty->trigger_error("html_table: missing 'loop' parameter");
@@ -65,6 +72,19 @@
                 break;
 
             case 'cols':
+                if (is_array($_value) && !empty($_value)) {
+                    $cols = $_value;
+                    $cols_count = count($_value);
+                } elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) {
+                    $cols = explode(',', $_value);
+                    $cols_count = count($cols);
+                } elseif (!empty($_value)) {
+                    $cols_count = (int)$_value;
+                } else {
+                    $cols_count = $cols;
+                }
+                break;
+
             case 'rows':
                 $$_key = (int)$_value;
                 break;
@@ -74,11 +94,13 @@
             case 'hdir':
             case 'vdir':
             case 'inner':
+            case 'caption':
                 $$_key = (string)$_value;
                 break;
 
             case 'tr_attr':
             case 'td_attr':
+            case 'th_attr':
                 $$_key = $_value;
                 break;
         }
@@ -87,25 +109,42 @@
     $loop_count = count($loop);
     if (empty($params['rows'])) {
         /* no rows specified */
-        $rows = ceil($loop_count/$cols);
+        $rows = ceil($loop_count/$cols_count);
     } elseif (empty($params['cols'])) {
         if (!empty($params['rows'])) {
             /* no cols specified, but rows */
-            $cols = ceil($loop_count/$rows);
+            $cols_count = ceil($loop_count/$rows);
         }
     }
 
     $output = "<table $table_attr>\n";
 
+    if (!empty($caption)) {
+        $output .= '<caption>' . $caption . "</caption>\n";
+    }
+
+    if (is_array($cols)) {
+        $cols = ($hdir == 'right') ? $cols : array_reverse($cols);
+        $output .= "<thead><tr>\n";
+
+        for ($r=0; $r<$cols_count; $r++) {
+            $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
+            $output .= $cols[$r];
+            $output .= "</th>\n";
+        }
+        $output .= "</tr></thead>\n";
+    }
+
+    $output .= "<tbody>\n";
     for ($r=0; $r<$rows; $r++) {
         $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
-        $rx =  ($vdir == 'down') ? $r*$cols : ($rows-1-$r)*$cols;
+        $rx =  ($vdir == 'down') ? $r*$cols_count : ($rows-1-$r)*$cols_count;
 
-        for ($c=0; $c<$cols; $c++) {
-            $x =  ($hdir == 'right') ? $rx+$c : $rx+$cols-1-$c;
+        for ($c=0; $c<$cols_count; $c++) {
+            $x =  ($hdir == 'right') ? $rx+$c : $rx+$cols_count-1-$c;
             if ($inner!='cols') {
                 /* shuffle x to loop over rows*/
-                $x = floor($x/$cols) + ($x%$cols)*$rows;
+                $x = floor($x/$cols_count) + ($x%$cols_count)*$rows;
             }
 
             if ($x<$loop_count) {
@@ -116,6 +155,7 @@
         }
         $output .= "</tr>\n";
     }
+    $output .= "</tbody>\n";
     $output .= "</table>\n";
     
     return $output;

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/function.mailto.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/function.mailto.php	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/function.mailto.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -62,6 +62,8 @@
 
     // netscape and mozilla do not decode %40 (@) in BCC field (bug?)
     // so, don't encode it.
+    $search = array('%40', '%2C');
+    $replace  = array('@', ',');
     $mail_parms = array();
     foreach ($params as $var=>$value) {
         switch ($var) {
@@ -69,7 +71,7 @@
             case 'bcc':
             case 'followupto':
                 if (!empty($value))
-                    $mail_parms[] = $var.'='.str_replace('%40','@',rawurlencode($value));
+                    $mail_parms[] = $var.'='.str_replace($search,$replace,rawurlencode($value));
                 break;
                 
             case 'subject':

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.capitalize.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.capitalize.php	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.capitalize.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -21,7 +21,7 @@
 function smarty_modifier_capitalize($string, $uc_digits = false)
 {
     smarty_modifier_capitalize_ucfirst(null, $uc_digits);
-    return preg_replace_callback('!\b\w+\b!', 'smarty_modifier_capitalize_ucfirst', $string);
+    return preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', $string);
 }
 
 function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
@@ -33,7 +33,7 @@
         return;
     }
     
-    if(!preg_match('!\d!',$string[0]) || $_uc_digits)
+    if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits)
         return ucfirst($string[0]);
     else
         return $string[0];

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.date_format.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.date_format.php	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.date_format.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -31,9 +31,11 @@
 function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)
 {
     if (substr(PHP_OS,0,3) == 'WIN') {
-           $_win_from = array ('%e',  '%T',       '%D');
-           $_win_to   = array ('%#d', '%H:%M:%S', '%m/%d/%y');
-           $format = str_replace($_win_from, $_win_to, $format);
+        $hours = strftime('%I', $string);
+        $short_hours = ( $hours < 10 ) ? substr( $hours, -1) : $hours; 
+        $_win_from = array ('%e',  '%T',       '%D',        '%l');
+        $_win_to   = array ('%#d', '%H:%M:%S', '%m/%d/%y',  $short_hours);
+        $format = str_replace($_win_from, $_win_to, $format);
     }
     if($string != '') {
         return strftime($format, smarty_make_timestamp($string));

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.debug_print_var.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.debug_print_var.php	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.debug_print_var.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -22,33 +22,66 @@
  */
 function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
 {
-    $_replace = array("\n"=>'<i>&#92;n</i>', "\r"=>'<i>&#92;r</i>', "\t"=>'<i>&#92;t</i>');
-    if (is_array($var)) {
-        $results = "<b>Array (".count($var).")</b>";
-        foreach ($var as $curr_key => $curr_val) {
-            $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
-            $results .= "<br>".str_repeat('&nbsp;', $depth*2)."<b>".strtr($curr_key, $_replace)."</b> =&gt; $return";
-        }
-    } else if (is_object($var)) {
-        $object_vars = get_object_vars($var);
-        $results = "<b>".get_class($var)." Object (".count($object_vars).")</b>";
-        foreach ($object_vars as $curr_key => $curr_val) {
-            $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
-            $results .= "<br>".str_repeat('&nbsp;', $depth*2)."<b>$curr_key</b> =&gt; $return";
-        }
-    } else if (is_resource($var)) {
-        $results = '<i>'.(string)$var.'</i>';
-    } else if (empty($var) && $var != "0") {
-        $results = '<i>empty</i>';
-    } else {
-        if (strlen($var) > $length ) {
-            $results = substr($var, 0, $length-3).'...';
-        } else {
-            $results = $var;
-        }
-        $results = htmlspecialchars($results);
-        $results = strtr($results, $_replace);
+    $_replace = array(
+        "\n" => '<i>\n</i>',
+        "\r" => '<i>\r</i>',
+        "\t" => '<i>\t</i>'
+    );
+
+    switch (gettype($var)) {
+        case 'array' :
+            $results = '<b>Array (' . count($var) . ')</b>';
+            foreach ($var as $curr_key => $curr_val) {
+                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
+                    . '<b>' . strtr($curr_key, $_replace) . '</b> =&gt; '
+                    . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
+                    $depth--;
+            }
+            break;
+        case 'object' :
+            $object_vars = get_object_vars($var);
+            $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
+            foreach ($object_vars as $curr_key => $curr_val) {
+                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
+                    . '<b> -&gt;' . strtr($curr_key, $_replace) . '</b> = '
+                    . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
+                    $depth--;
+            }
+            break;
+        case 'boolean' :
+        case 'NULL' :
+        case 'resource' :
+            if (true === $var) {
+                $results = 'true';
+            } elseif (false === $var) {
+                $results = 'false';
+            } elseif (null === $var) {
+                $results = 'null';
+            } else {
+                $results = htmlspecialchars((string) $var);
+            }
+            $results = '<i>' . $results . '</i>';
+            break;
+        case 'integer' :
+        case 'float' :
+            $results = htmlspecialchars((string) $var);
+            break;
+        case 'string' :
+            $results = strtr($var, $_replace);
+            if (strlen($var) > $length ) {
+                $results = substr($var, 0, $length - 3) . '...';
+            }
+            $results = htmlspecialchars('"' . $results . '"');
+            break;
+        case 'unknown type' :
+        default :
+            $results = strtr((string) $var, $_replace);
+            if (strlen($results) > $length ) {
+                $results = substr($results, 0, $length - 3) . '...';
+            }
+            $results = htmlspecialchars($results);
     }
+
     return $results;
 }
 

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/outputfilter.trimwhitespace.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/outputfilter.trimwhitespace.php	2007-02-22 10:45:29 UTC (rev 4818)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/outputfilter.trimwhitespace.php	2007-02-22 18:17:53 UTC (rev 4819)
@@ -49,14 +49,14 @@
     // preceeded by a php close tag.
     $source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source));
 
-    // replace script blocks
-    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
+    // replace textarea blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
 
     // replace pre blocks
     smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source);
 
-    // replace textarea blocks
-    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
+    // replace script blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
 
     return $source;
 }



More information about the pLog-svn mailing list