diff options
Diffstat (limited to 'lib/smarty3/plugins/modifier.replace.php')
-rw-r--r-- | lib/smarty3/plugins/modifier.replace.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/smarty3/plugins/modifier.replace.php b/lib/smarty3/plugins/modifier.replace.php index aa5e857..a98f5a4 100644 --- a/lib/smarty3/plugins/modifier.replace.php +++ b/lib/smarty3/plugins/modifier.replace.php @@ -5,11 +5,10 @@ * @package Smarty * @subpackage PluginsModifier */ - /** * Smarty replace modifier plugin - * Type: modifier<br> - * Name: replace<br> + * Type: modifier + * Name: replace * Purpose: simple search/replace * * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual) @@ -24,11 +23,15 @@ */ function smarty_modifier_replace($string, $search, $replace) { + static $is_loaded = false; if (Smarty::$_MBSTRING) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); - + if (!$is_loaded) { + if (!is_callable('smarty_mb_str_replace')) { + include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'; + } + $is_loaded = true; + } return smarty_mb_str_replace($search, $replace, $string); } - return str_replace($search, $replace, $string); } |