Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

modifiercompiler.from_charset.php 755B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Smarty plugin
  4. *
  5. * @package Smarty
  6. * @subpackage PluginsModifierCompiler
  7. */
  8. /**
  9. * Smarty from_charset modifier plugin
  10. * Type: modifier
  11. * Name: from_charset
  12. * Purpose: convert character encoding from $charset to internal encoding
  13. *
  14. * @author Rodney Rehm
  15. *
  16. * @param array $params parameters
  17. *
  18. * @return string with compiled code
  19. */
  20. function smarty_modifiercompiler_from_charset($params)
  21. {
  22. if (!Smarty::$_MBSTRING) {
  23. // FIXME: (rodneyrehm) shouldn't this throw an error?
  24. return $params[ 0 ];
  25. }
  26. if (!isset($params[ 1 ])) {
  27. $params[ 1 ] = '"ISO-8859-1"';
  28. }
  29. return 'mb_convert_encoding(' . $params[ 0 ] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[ 1 ] . ')';
  30. }