modifiercompiler.string_format.php 585 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Smarty plugin
  4. *
  5. * @package Smarty
  6. * @subpackage PluginsModifierCompiler
  7. */
  8. /**
  9. * Smarty string_format modifier plugin
  10. *
  11. * Type: modifier<br>
  12. * Name: string_format<br>
  13. * Purpose: format strings via sprintf
  14. *
  15. * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
  16. * @author Uwe Tews
  17. * @param array $params parameters
  18. * @return string with compiled code
  19. */
  20. function smarty_modifiercompiler_string_format($params, $compiler)
  21. {
  22. return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
  23. }
  24. ?>