mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
- bugfix mb_string support
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: strip<br>
|
* Name: strip<br>
|
||||||
* Purpose: Replace all repeated spaces, newlines, tabs
|
* Purpose: Replace all repeated spaces, newlines, tabs
|
||||||
* with a single space or supplied replacement string.<br>
|
* with a single space or supplied replacement string.<br>
|
||||||
* Example: {$var|strip} {$var|strip:" "}
|
* Example: {$var|strip} {$var|strip:" "}
|
||||||
* Date: September 25th, 2002
|
* Date: September 25th, 2002
|
||||||
*
|
*
|
||||||
@@ -27,7 +27,7 @@ function smarty_modifier_strip($text, $replace = ' ')
|
|||||||
{
|
{
|
||||||
$smarty = Smarty::instance();
|
$smarty = Smarty::instance();
|
||||||
if ($smarty->has_mb) {
|
if ($smarty->has_mb) {
|
||||||
return mb_ereg_replace('!\s+!', $replace, $text, 'p');
|
return mb_ereg_replace("\s+", $replace, $text, 'p');
|
||||||
} else {
|
} else {
|
||||||
return preg_replace('!\s+!', $replace, $text);
|
return preg_replace('!\s+!', $replace, $text);
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ function smarty_modifier_strip_tags($string, $replace_with_space = true)
|
|||||||
$smarty = Smarty::instance();
|
$smarty = Smarty::instance();
|
||||||
if ($replace_with_space) {
|
if ($replace_with_space) {
|
||||||
if ($smarty->has_mb) {
|
if ($smarty->has_mb) {
|
||||||
return mb_ereg_replace('!<[^>]*?>!', ' ', $string, 'p');
|
return mb_ereg_replace("<[^>]*?>", ' ', $string, 'p');
|
||||||
} else {
|
} else {
|
||||||
return preg_replace('!<[^>]*?>!', ' ', $string);
|
return preg_replace('!<[^>]*?>!', ' ', $string);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user