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+"
Smarty Debug Console |
included templates & config files (load time in seconds): |
{section name=templates loop=$_debug_tpls}
- {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} |
{sectionelse}
no templates included |
{/section}
@@ -42,7 +41,7 @@
_smarty_console.document.write("Smarty Debug Console |
");
_smarty_console.document.write("included templates & config files (load time in seconds): |
");
{section name=templates loop=$_debug_tpls}
- _smarty_console.document.write("{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} |
");
+ _smarty_console.document.write("{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} |
");
{sectionelse}
_smarty_console.document.write("no templates included |
");
{/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=templates loop=$_debug_tpls}
- {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} |
{sectionelse}
no templates included |
{/section}
@@ -42,7 +41,7 @@
_smarty_console.document.write("Smarty Debug Console |
");
_smarty_console.document.write("included templates & config files (load time in seconds): |
");
{section name=templates loop=$_debug_tpls}
- _smarty_console.document.write("{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} |
");
+ _smarty_console.document.write("{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} |
");
{sectionelse}
_smarty_console.document.write("no templates included |
");
{/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 .= '' . 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 .= '' . bin2hex($string[$x]) . ';';
}