Extension.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2009 Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. abstract class Twig_Extension implements Twig_ExtensionInterface
  11. {
  12. /**
  13. * Initializes the runtime environment.
  14. *
  15. * This is where you can load some file that contains filter functions for instance.
  16. *
  17. * @param Twig_Environment $environment The current Twig_Environment instance
  18. */
  19. public function initRuntime(Twig_Environment $environment)
  20. {
  21. }
  22. /**
  23. * Returns the token parser instances to add to the existing list.
  24. *
  25. * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
  26. */
  27. public function getTokenParsers()
  28. {
  29. return array();
  30. }
  31. /**
  32. * Returns the node visitor instances to add to the existing list.
  33. *
  34. * @return array An array of Twig_NodeVisitorInterface instances
  35. */
  36. public function getNodeVisitors()
  37. {
  38. return array();
  39. }
  40. /**
  41. * Returns a list of filters to add to the existing list.
  42. *
  43. * @return array An array of filters
  44. */
  45. public function getFilters()
  46. {
  47. return array();
  48. }
  49. /**
  50. * Returns a list of tests to add to the existing list.
  51. *
  52. * @return array An array of tests
  53. */
  54. public function getTests()
  55. {
  56. return array();
  57. }
  58. /**
  59. * Returns a list of functions to add to the existing list.
  60. *
  61. * @return array An array of functions
  62. */
  63. public function getFunctions()
  64. {
  65. return array();
  66. }
  67. /**
  68. * Returns a list of operators to add to the existing list.
  69. *
  70. * @return array An array of operators
  71. */
  72. public function getOperators()
  73. {
  74. return array();
  75. }
  76. /**
  77. * Returns a list of global functions to add to the existing list.
  78. *
  79. * @return array An array of global functions
  80. */
  81. public function getGlobals()
  82. {
  83. return array();
  84. }
  85. }