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.

modifiercompiler.strip.php 813B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Smarty plugin
  4. *
  5. * @package Smarty
  6. * @subpackage PluginsModifierCompiler
  7. */
  8. /**
  9. * Smarty strip modifier plugin
  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;"}<br>
  15. * Date: September 25th, 2002
  16. *
  17. * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
  18. * @author Uwe Tews
  19. *
  20. * @param array $params parameters
  21. *
  22. * @return string with compiled code
  23. */
  24. function smarty_modifiercompiler_strip($params)
  25. {
  26. if (!isset($params[1])) {
  27. $params[1] = "' '";
  28. }
  29. return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
  30. }