Automatically exported from code.google.com/p/planningalerts
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

32 righe
774 B

  1. <?php
  2. /**
  3. * Smarty shared plugin
  4. * @package Smarty
  5. * @subpackage plugins
  6. */
  7. /**
  8. * escape_special_chars common function
  9. *
  10. * Function: smarty_function_escape_special_chars<br>
  11. * Purpose: used by other smarty functions to escape
  12. * special chars except for already escaped ones
  13. * @author Monte Ohrt <monte at ohrt dot com>
  14. * @param string
  15. * @return string
  16. */
  17. function smarty_function_escape_special_chars($string)
  18. {
  19. if(!is_array($string)) {
  20. $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
  21. $string = htmlspecialchars($string);
  22. $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string);
  23. }
  24. return $string;
  25. }
  26. /* vim: set expandtab: */
  27. ?>