Composite.php 727 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Composite strategy that runs multiple strategies on tokens.
  4. */
  5. abstract class HTMLPurifier_Strategy_Composite extends HTMLPurifier_Strategy
  6. {
  7. /**
  8. * List of strategies to run tokens through.
  9. * @type HTMLPurifier_Strategy[]
  10. */
  11. protected $strategies = array();
  12. /**
  13. * @param HTMLPurifier_Token[] $tokens
  14. * @param HTMLPurifier_Config $config
  15. * @param HTMLPurifier_Context $context
  16. * @return HTMLPurifier_Token[]
  17. */
  18. public function execute($tokens, $config, $context)
  19. {
  20. foreach ($this->strategies as $strategy) {
  21. $tokens = $strategy->execute($tokens, $config, $context);
  22. }
  23. return $tokens;
  24. }
  25. }
  26. // vim: et sw=4 sts=4