library/smarty/libs/plugins/modifier.spacify.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 spacify modifier plugin
       
    11  * Type:     modifier<br>
       
    12  * Name:     spacify<br>
       
    13  * Purpose:  add spaces between characters in a string
       
    14  *
       
    15  * @link   http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
       
    16  * @author Monte Ohrt <monte at ohrt dot com>
       
    17  *
       
    18  * @param string $string input string
       
    19  * @param string $spacify_char string to insert between characters.
       
    20  *
       
    21  * @return string
       
    22  */
       
    23 function smarty_modifier_spacify($string, $spacify_char = ' ') {
       
    24     // well… what about charsets besides latin and UTF-8?
       
    25     return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, -1, PREG_SPLIT_NO_EMPTY));
       
    26 }