Skip to content

Instantly share code, notes, and snippets.

@Nully
Created November 29, 2010 07:30
Show Gist options
  • Save Nully/719692 to your computer and use it in GitHub Desktop.
Save Nully/719692 to your computer and use it in GitHub Desktop.
URLValidator
<?php
class Nully_Validate_Uri extends Zend_Validate_Abstract {
const INVALID_URI = "%value% is invalid URI";
/**
* Checking for http including URI pattern.
*
* @uses Zend_Uri
* Zend_Uri::check method is checking URI scheme including pattern.
*/
public function isValid($value) {
$value = (string)$value;
$this->_setValue($value);
if(Zend_Uri::check($value)) {
$this->_error(self::INVALID_URI);
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment