PageRenderTime 57ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/code/ryzom/tools/server/admin/smarty/plugins/modifier.strip_tags.php

https://bitbucket.org/Krolock/ryzom-contribution
PHP | 31 lines | 9 code | 4 blank | 18 comment | 1 complexity | 943de33919643644e805424e84f444d9 MD5 | raw file
Possible License(s): AGPL-3.0, GPL-3.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Smarty plugin
  4. * @package Smarty
  5. * @subpackage plugins
  6. */
  7. /**
  8. * Smarty strip_tags modifier plugin
  9. *
  10. * Type: modifier<br>
  11. * Name: strip_tags<br>
  12. * Purpose: strip html tags from text
  13. * @link http://smarty.php.net/manual/en/language.modifier.strip.tags.php
  14. * strip_tags (Smarty online manual)
  15. * @param string
  16. * @param boolean
  17. * @return string
  18. */
  19. function smarty_modifier_strip_tags($string, $replace_with_space = true)
  20. {
  21. if ($replace_with_space)
  22. return preg_replace('!<[^>]*?>!', ' ', $string);
  23. else
  24. return strip_tags($string);
  25. }
  26. /* vim: set expandtab: */
  27. ?>