From ab5d8d4e07bb3c8230d0285ef8902ef1979fce51 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 18 Oct 2018 02:39:34 +0200 Subject: Updating Smarty --- lib/smarty/plugins/modifier.replace.php | 34 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'lib/smarty/plugins/modifier.replace.php') diff --git a/lib/smarty/plugins/modifier.replace.php b/lib/smarty/plugins/modifier.replace.php index 4d71a6e..a98f5a4 100644 --- a/lib/smarty/plugins/modifier.replace.php +++ b/lib/smarty/plugins/modifier.replace.php @@ -1,33 +1,37 @@ - * Name: replace
+ * Type: modifier + * Name: replace * Purpose: simple search/replace - * - * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual) - * @author Monte Ohrt - * @author Uwe Tews + * + * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual) + * @author Monte Ohrt + * @author Uwe Tews + * * @param string $string input string * @param string $search text to search for * @param string $replace replacement text - * @return string + * + * @return string */ 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); -} - -?> \ No newline at end of file +} -- cgit v1.2.3