modifiercompiler.lower.php 794 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Smarty plugin
  4. * @package Smarty
  5. * @subpackage PluginsModifierCompiler
  6. */
  7. /**
  8. * Smarty lower modifier plugin
  9. *
  10. * Type: modifier<br>
  11. * Name: lower<br>
  12. * Purpose: convert string to lowercase
  13. *
  14. * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
  15. * @author Monte Ohrt <monte at ohrt dot com>
  16. * @author Uwe Tews
  17. * @param array $params parameters
  18. * @return string with compiled code
  19. */
  20. function smarty_modifiercompiler_lower($params, $compiler)
  21. {
  22. if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {
  23. return 'mb_strtolower(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET)' ;
  24. }
  25. // no MBString fallback
  26. return 'strtolower(' . $params[0] . ')';
  27. }
  28. ?>