Url.php 414 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * Abstract base class for QuickForm validation rules
  4. */
  5. /**
  6. * Validate urls
  7. *
  8. */
  9. class HTML_QuickForm_Rule_Url extends HTML_QuickForm_Rule
  10. {
  11. /**
  12. * Validates url
  13. *
  14. * @param string $url
  15. * @return boolean 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. }