From eab8a101e7a3fcbb41e01a574985e06c5a3775de Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 18 Oct 2018 02:40:38 +0200 Subject: Updating Smarty --- lib/smarty3/plugins/modifier.replace.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/smarty3/plugins/modifier.replace.php') 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
- * 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) @@ -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); } -- cgit v1.2.3