server/onyx/modules/templates/smarty/plugins/modifier.replace.php

33 lines
822 B
PHP
Raw Normal View History

2013-10-09 13:40:23 +00:00
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty replace modifier plugin
2013-10-09 17:08:38 +00:00
*
2013-10-09 13:40:23 +00:00
* Type: modifier<br>
* Name: replace<br>
* Purpose: simple search/replace
2013-10-09 17:08:38 +00:00
*
2013-10-09 13:40:23 +00:00
* @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
2013-10-09 17:08:38 +00:00
* @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews
2013-10-09 13:40:23 +00:00
* @param string $string input string
* @param string $search text to search for
* @param string $replace replacement text
2013-10-09 17:08:38 +00:00
* @return string
2013-10-09 13:40:23 +00:00
*/
function smarty_modifier_replace($string, $search, $replace)
{
if (Smarty::$_MBSTRING) {
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');
2013-10-09 17:08:38 +00:00
2013-10-09 13:40:23 +00:00
return smarty_mb_str_replace($search, $replace, $string);
}
2013-10-09 17:08:38 +00:00
return str_replace($search, $replace, $string);
}