ACC SHELL
<?php
class TF_Validate_Phone extends Zend_Validate_Abstract
{
const NOT_PHONE_NUMBER = 'notPhoneNumber';
/**
* @var array
*/
protected $_messageTemplates = array(
self::NOT_PHONE_NUMBER => "'%value%' is not a phone number."
);
/**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value is a valid phone number
*
* @param string $value
* @return boolean
*/
public function isValid($value)
{
$arr = array();
$pattern = '^[ 0-9\.\+]{8,}$';
if(eregi($pattern, (string)$value, $arr)){
return true;
} else {
$this->_error(self::NOT_PHONE_NUMBER, $value);
return false;
}
}
}
ACC SHELL 2018