You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

modifier.spacify.php 766B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Smarty plugin
  4. *
  5. * @package Smarty
  6. * @subpackage PluginsModifier
  7. */
  8. /**
  9. * Smarty spacify modifier plugin
  10. * Type: modifier<br>
  11. * Name: spacify<br>
  12. * Purpose: add spaces between characters in a string
  13. *
  14. * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
  15. * @author Monte Ohrt <monte at ohrt dot com>
  16. *
  17. * @param string $string input string
  18. * @param string $spacify_char string to insert between characters.
  19. *
  20. * @return string
  21. */
  22. function smarty_modifier_spacify($string, $spacify_char = ' ')
  23. {
  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. }