diff options
author | emkael <emkael@tlen.pl> | 2018-10-18 02:40:38 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-10-18 02:40:38 +0200 |
commit | eab8a101e7a3fcbb41e01a574985e06c5a3775de (patch) | |
tree | 60f201da5984b0c3638d10da02bba42b61aa3177 /lib/smarty3/plugins/modifier.replace.php | |
parent | 7f38be342c1495aeca418286c15c25c18ac9e142 (diff) |
Updating Smarty
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); } |