Automatically exported from code.google.com/p/planningalerts
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

modifier.strip.php 742 B

pirms 18 gadiem
123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Smarty plugin
  4. * @package Smarty
  5. * @subpackage plugins
  6. */
  7. /**
  8. * Smarty strip modifier plugin
  9. *
  10. * Type: modifier<br>
  11. * Name: strip<br>
  12. * Purpose: Replace all repeated spaces, newlines, tabs
  13. * with a single space or supplied replacement string.<br>
  14. * Example: {$var|strip} {$var|strip:"&nbsp;"}
  15. * Date: September 25th, 2002
  16. * @link http://smarty.php.net/manual/en/language.modifier.strip.php
  17. * strip (Smarty online manual)
  18. * @author Monte Ohrt <monte at ohrt dot com>
  19. * @version 1.0
  20. * @param string
  21. * @param string
  22. * @return string
  23. */
  24. function smarty_modifier_strip($text, $replace = ' ')
  25. {
  26. return preg_replace('!\s+!', $replace, $text);
  27. }
  28. /* vim: set expandtab: */
  29. ?>