From c99f9fdbb2cfe4a932d3ca521f6b436eddab3e71 Mon Sep 17 00:00:00 2001 From: mohrt Date: Mon, 17 Feb 2003 14:58:36 +0000 Subject: [PATCH] fix E_NOTICE messages --- NEWS | 4 ++++ debug.tpl | 5 ++--- libs/debug.tpl | 5 ++--- libs/plugins/modifier.count_words.php | 2 +- libs/plugins/modifier.escape.php | 2 ++ plugins/modifier.count_words.php | 2 +- plugins/modifier.escape.php | 2 ++ 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 4f458795..c587fa99 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ + - remove E_NOTICE warnings from debug.tpl, + escape modifier (Kanstantin, Monte) + - don't count non-ascii chars in count_words modifier + (Kanstantin, Monte) - clean up param calls to _parse_var and _parse_attrs (Monte) - define $template_source var, elude possible warning (Monte) diff --git a/debug.tpl b/debug.tpl index 2b5cd94e..3e939baa 100644 --- a/debug.tpl +++ b/debug.tpl @@ -5,12 +5,11 @@ {assign_debug_info} {if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"} -Smarty Debug Console_"+self.name+" {section name=templates loop=$_debug_tpls} - + {sectionelse} {/section} @@ -42,7 +41,7 @@ _smarty_console.document.write(""); _smarty_console.document.write(""); {section name=templates loop=$_debug_tpls} - _smarty_console.document.write(""); + _smarty_console.document.write(""); {sectionelse} _smarty_console.document.write(""); {/section} diff --git a/libs/debug.tpl b/libs/debug.tpl index 2b5cd94e..3e939baa 100644 --- a/libs/debug.tpl +++ b/libs/debug.tpl @@ -5,12 +5,11 @@ {assign_debug_info} {if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"} -Smarty Debug Console_"+self.name+"
Smarty Debug Console
included templates & config files (load time in seconds):
{section name=indent loop=$_debug_tpls[templates].depth}   {/section}{$_debug_tpls[templates].filename} ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}
{section name=indent loop=$_debug_tpls[templates].depth}   {/section}{$_debug_tpls[templates].filename}{if isset($_debug_tpls[templates].exec_time)} ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}{/if}
no templates included
Smarty Debug Console
included templates & config files (load time in seconds):
{section name=indent loop=$_debug_tpls[templates].depth}   {/section}{$_debug_tpls[templates].filename} ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}
{section name=indent loop=$_debug_tpls[templates].depth}   {/section}{$_debug_tpls[templates].filename}{if isset($_debug_tpls[templates].exec_time)} ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}{/if}
no templates included
{section name=templates loop=$_debug_tpls} - + {sectionelse} {/section} @@ -42,7 +41,7 @@ _smarty_console.document.write(""); _smarty_console.document.write(""); {section name=templates loop=$_debug_tpls} - _smarty_console.document.write(""); + _smarty_console.document.write(""); {sectionelse} _smarty_console.document.write(""); {/section} diff --git a/libs/plugins/modifier.count_words.php b/libs/plugins/modifier.count_words.php index 8f84febd..b2f79e6c 100644 --- a/libs/plugins/modifier.count_words.php +++ b/libs/plugins/modifier.count_words.php @@ -13,7 +13,7 @@ function smarty_modifier_count_words($string) // split text by ' ',\r,\n,\f,\t $split_array = preg_split('/\s+/',$string); // count matches that contain alphanumerics - $word_count = preg_grep('/[a-zA-Z0-9]/', $split_array); + $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array); return count($word_count); } diff --git a/libs/plugins/modifier.escape.php b/libs/plugins/modifier.escape.php index ac4fba7e..c95d1d7f 100644 --- a/libs/plugins/modifier.escape.php +++ b/libs/plugins/modifier.escape.php @@ -26,12 +26,14 @@ function smarty_modifier_escape($string, $esc_type = 'html') case 'hex': // escape every character into hex + return = ''; for ($x=0; $x < strlen($string); $x++) { $return .= '%' . bin2hex($string[$x]); } return $return; case 'hexentity': + return = ''; for ($x=0; $x < strlen($string); $x++) { $return .= '&#x' . bin2hex($string[$x]) . ';'; } diff --git a/plugins/modifier.count_words.php b/plugins/modifier.count_words.php index 8f84febd..b2f79e6c 100644 --- a/plugins/modifier.count_words.php +++ b/plugins/modifier.count_words.php @@ -13,7 +13,7 @@ function smarty_modifier_count_words($string) // split text by ' ',\r,\n,\f,\t $split_array = preg_split('/\s+/',$string); // count matches that contain alphanumerics - $word_count = preg_grep('/[a-zA-Z0-9]/', $split_array); + $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array); return count($word_count); } diff --git a/plugins/modifier.escape.php b/plugins/modifier.escape.php index ac4fba7e..c95d1d7f 100644 --- a/plugins/modifier.escape.php +++ b/plugins/modifier.escape.php @@ -26,12 +26,14 @@ function smarty_modifier_escape($string, $esc_type = 'html') case 'hex': // escape every character into hex + return = ''; for ($x=0; $x < strlen($string); $x++) { $return .= '%' . bin2hex($string[$x]); } return $return; case 'hexentity': + return = ''; for ($x=0; $x < strlen($string); $x++) { $return .= '&#x' . bin2hex($string[$x]) . ';'; }
Smarty Debug Console
included templates & config files (load time in seconds):
{section name=indent loop=$_debug_tpls[templates].depth}   {/section}{$_debug_tpls[templates].filename} ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}
{section name=indent loop=$_debug_tpls[templates].depth}   {/section}{$_debug_tpls[templates].filename}{if isset($_debug_tpls[templates].exec_time)} ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}{/if}
no templates included
Smarty Debug Console
included templates & config files (load time in seconds):
{section name=indent loop=$_debug_tpls[templates].depth}   {/section}{$_debug_tpls[templates].filename} ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}
{section name=indent loop=$_debug_tpls[templates].depth}   {/section}{$_debug_tpls[templates].filename}{if isset($_debug_tpls[templates].exec_time)} ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}{/if}
no templates included