Url.php 442 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Abstract base class for QuickForm validation rules
  4. */
  5. require_once 'HTML/QuickForm/Rule.php';
  6. /**
  7. * Validate urls
  8. *
  9. */
  10. class HTML_QuickForm_Rule_Url extends HTML_QuickForm_Rule
  11. {
  12. /**
  13. * Validates url
  14. *
  15. * @param string $url
  16. * @return boolean Returns true if valid, false otherwise.
  17. */
  18. function validate($url)
  19. {
  20. return (bool) filter_var($url, FILTER_VALIDATE_URL);
  21. }
  22. }