diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Validate/Hex.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Validate/Hex.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,72 @@ + "Invalid type given. String expected", + self::NOT_HEX => "'%value%' has not only hexadecimal digit characters", + ); + + /** + * Defined by Zend_Validate_Interface + * + * Returns true if and only if $value contains only hexadecimal digit characters + * + * @param string $value + * @return boolean + */ + public function isValid($value) + { + if (!is_string($value) && !is_int($value)) { + $this->_error(self::INVALID); + return false; + } + + $this->_setValue($value); + if (!ctype_xdigit((string) $value)) { + $this->_error(self::NOT_HEX); + return false; + } + + return true; + } + +}