Url.php 414 B

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