PhpFunctionsExtension.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * hold PhpMyAdmin\Twig\PhpFunctionsExtension class
  5. *
  6. * @package PhpMyAdmin\Twig
  7. */
  8. namespace PhpMyAdmin\Twig;
  9. use Twig\Extension\AbstractExtension;
  10. use Twig\TwigFunction;
  11. /**
  12. * Class PhpFunctionsExtension
  13. *
  14. * @package PhpMyAdmin\Twig
  15. */
  16. class PhpFunctionsExtension extends AbstractExtension
  17. {
  18. /**
  19. * Returns a list of functions to add to the existing list.
  20. *
  21. * @return TwigFunction[]
  22. */
  23. public function getFunctions()
  24. {
  25. return array(
  26. new TwigFunction('array_search', 'array_search'),
  27. new TwigFunction('bin2hex', 'bin2hex'),
  28. new TwigFunction('htmlentities', 'htmlentities'),
  29. new TwigFunction('md5', 'md5'),
  30. new TwigFunction('preg_quote', 'preg_quote'),
  31. new TwigFunction('preg_replace', 'preg_replace'),
  32. new TwigFunction('strpos', 'strpos'),
  33. new TwigFunction('strstr', 'strstr'),
  34. new TwigFunction('strtotime', 'strtotime'),
  35. );
  36. }
  37. }