diff options
author | emkael <emkael@tlen.pl> | 2016-10-11 14:01:29 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-10-11 14:01:29 +0200 |
commit | 51609351f2c4b5082b7e6f0744cd3811c325303f (patch) | |
tree | 739015e9ec69bc185ebe30db21369ae0b8b692ce /lib/smarty/plugins/modifier.replace.php | |
parent | 8d1b0dad63e3906efa9393ef01d08b77d83417b5 (diff) |
* initial template
Diffstat (limited to 'lib/smarty/plugins/modifier.replace.php')
-rw-r--r-- | lib/smarty/plugins/modifier.replace.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/smarty/plugins/modifier.replace.php b/lib/smarty/plugins/modifier.replace.php new file mode 100644 index 0000000..4d71a6e --- /dev/null +++ b/lib/smarty/plugins/modifier.replace.php @@ -0,0 +1,33 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage PluginsModifier + */ + +/** + * Smarty replace modifier plugin + * + * Type: modifier<br> + * Name: replace<br> + * 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 + * @param string $string input string + * @param string $search text to search for + * @param string $replace replacement text + * @return string + */ +function smarty_modifier_replace($string, $search, $replace) +{ + if (Smarty::$_MBSTRING) { + require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); + return smarty_mb_str_replace($search, $replace, $string); + } + + return str_replace($search, $replace, $string); +} + +?>
\ No newline at end of file |