summaryrefslogtreecommitdiff
path: root/lib/smarty/plugins/modifier.replace.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-10-18 02:39:34 +0200
committeremkael <emkael@tlen.pl>2018-10-18 02:39:42 +0200
commitab5d8d4e07bb3c8230d0285ef8902ef1979fce51 (patch)
tree0b955e585cb2fdbc7207392a5f2c97d610b6a5bc /lib/smarty/plugins/modifier.replace.php
parentc055ce2ab60c6582bad3e5babcb1d00384fde78a (diff)
Updating Smarty
Diffstat (limited to 'lib/smarty/plugins/modifier.replace.php')
-rw-r--r--lib/smarty/plugins/modifier.replace.php34
1 files changed, 19 insertions, 15 deletions
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 @@
<?php
/**
* Smarty plugin
- * @package Smarty
+ *
+ * @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)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @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
+}