URIScheme.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Validator for the components of a URI for a specific scheme
  4. */
  5. class HTMLPurifier_URIScheme
  6. {
  7. /**
  8. * Scheme's default port (integer)
  9. */
  10. public $default_port = null;
  11. /**
  12. * Whether or not URIs of this schem are locatable by a browser
  13. * http and ftp are accessible, while mailto and news are not.
  14. */
  15. public $browsable = false;
  16. /**
  17. * Whether or not the URI always uses <hier_part>, resolves edge cases
  18. * with making relative URIs absolute
  19. */
  20. public $hierarchical = false;
  21. /**
  22. * Validates the components of a URI
  23. * @note This implementation should be called by children if they define
  24. * a default port, as it does port processing.
  25. * @param $uri Instance of HTMLPurifier_URI
  26. * @param $config HTMLPurifier_Config object
  27. * @param $context HTMLPurifier_Context object
  28. * @return Bool success or failure
  29. */
  30. public function validate(&$uri, $config, $context) {
  31. if ($this->default_port == $uri->port) $uri->port = null;
  32. return true;
  33. }
  34. }
  35. // vim: et sw=4 sts=4