*
* @access private
*/
- function __uriRFC4151($uri)
+ static function __uriRFC4151($uri)
{
$datevalid = false;
if (preg_match(
*
* @access public
*/
- function number($number, $options = array())
+ static function number($number, $options = array())
{
$decimal = $dec_prec = $min = $max = null;
if (is_array($options)) {
*
* @access private
*/
- function __stringToUtf7($string)
+ static function __stringToUtf7($string)
{
$return = '';
$utf7 = array(
*
* @access private
*/
- function __emailRFC822(&$email, &$options)
+ static function __emailRFC822(&$email, &$options)
{
static $address = null;
static $uncomment = null;
*
* @return bool True if validating succeeds
*/
- function _fullTLDValidation($email, $options)
+ static function _fullTLDValidation($email, $options)
{
$validate = array();
if(!empty($options["VALIDATE_ITLD_EMAILS"])) array_push($validate, 'itld');
*
* @return true or false (Depending on if it validates or if it does not)
*/
- function executeFullEmailValidation($email, $arrayOfTLDs)
+ static function executeFullEmailValidation($email, $arrayOfTLDs)
{
$emailEnding = explode('.', $email);
$emailEnding = $emailEnding[count($emailEnding)-1];
*
* @access public
*/
- function email($email, $options = null)
+ static function email($email, $options = null)
{
static $dom_cache = array();
$check_domain = false;
if ($use_rfc822? Validate::__emailRFC822($email, $options) :
preg_match($regex, $email)) {
if ($check_domain && function_exists('checkdnsrr')) {
- $domain = preg_replace('/[^-a-z.0-9]/i', '', array_pop(explode('@', $email)));
+ $em = explode('@', $email);
+ $domain = preg_replace('/[^-a-z.0-9]/i', '', array_pop($em));
if (isset($dom_cache[$domain])) {
return $dom_cache[$domain];
*
* @access public
*/
- function string($string, $options)
+ static function string($string, $options)
{
$format = null;
$min_length = 0;
*
* @access public
*/
- function uri($url, $options = null)
+ static function uri($url, $options = null)
{
$strict = ';/?:@$,';
$domain_check = false;
*
* @access public
*/
- function date($date, $options)
+ public static function date($date, $options)
{
$max = false;
$min = false;
} else {
$date_len = strlen($format);
for ($i = 0; $i < $date_len; $i++) {
- $c = $format{$i};
+ $c = $format[$i];
if ($c == '%') {
- $next = $format{$i + 1};
+ $next = $format[$i + 1];
switch ($next) {
case 'j':
case 'd':
* @access private
* @return string
*/
- function _substr(&$date, $num, $opt = false)
+ static function _substr(&$date, $num, $opt = false)
{
if ($opt && strlen($date) >= $opt && preg_match('/^[0-9]{'.$opt.'}/', $date, $m)) {
$ret = $m[0];
return $ret;
}
- function _modf($val, $div)
+ static function _modf($val, $div)
{
if (function_exists('bcmod')) {
return bcmod($val, $div);
*
* @return int returns product of number digits with weights
*/
- function _multWeights($number, &$weights)
+ static function _multWeights($number, &$weights)
{
if (!is_array($weights)) {
return -1;
*
* @return int -1 calculated control number is returned
*/
- function _getControlNumber($number, &$weights, $modulo = 10, $subtract = 0, $allow_high = false)
+ static function _getControlNumber($number, &$weights, $modulo = 10, $subtract = 0, $allow_high = false)
{
// calc sum
$sum = Validate::_multWeights($number, $weights);
*
* @return bool true if valid, false if not
*/
- function _checkControlNumber($number, &$weights, $modulo = 10, $subtract = 0)
+ static function _checkControlNumber($number, &$weights, $modulo = 10, $subtract = 0)
{
if (strlen($number) < count($weights)) {
return false;
*
* @access public
*/
- function multiple(&$data, &$val_type, $remove = false)
+ static function multiple(&$data, &$val_type, $remove = false)
{
$keys = array_keys($data);
$valid = array();
*
* @return bool true if file exists
*/
- function _includePathFileExists($filename)
+ static function _includePathFileExists($filename)
{
$paths = explode(":", ini_get("include_path"));
$result = false;
-
- while ((!($result)) && (list($key,$val) = each($paths))) {
+ foreach($paths as $key => $val) {
$result = file_exists($val . "/" . $filename);
+ if ($result) {
+ return $return;
+ }
}
- return $result;
+ return false;
}
}