library/smarty/libs/plugins/modifier.replace.php
changeset 46 f11c31f7fa3e
parent 45 a56e7f9a0463
child 47 03388ec805b4
equal deleted inserted replaced
45:a56e7f9a0463 46:f11c31f7fa3e
     1 <?php
       
     2 /**
       
     3  * Smarty plugin
       
     4  *
       
     5  * @package    Smarty
       
     6  * @subpackage PluginsModifier
       
     7  */
       
     8 
       
     9 /**
       
    10  * Smarty replace modifier plugin
       
    11  * Type:     modifier<br>
       
    12  * Name:     replace<br>
       
    13  * Purpose:  simple search/replace
       
    14  *
       
    15  * @link   http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
       
    16  * @author Monte Ohrt <monte at ohrt dot com>
       
    17  * @author Uwe Tews
       
    18  *
       
    19  * @param string $string input string
       
    20  * @param string $search text to search for
       
    21  * @param string $replace replacement text
       
    22  *
       
    23  * @return string
       
    24  */
       
    25 function smarty_modifier_replace($string, $search, $replace) {
       
    26     if (Smarty::$_MBSTRING) {
       
    27         require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');
       
    28 
       
    29         return smarty_mb_str_replace($search, $replace, $string);
       
    30     }
       
    31 
       
    32     return str_replace($search, $replace, $string);
       
    33 }