Вход Регистрация
Файл: adultscript-2.0.3-pro/files/libraries/framework/valid.php
Строк: 102
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VValid
{
    public static function 
email($string)
    {
        return (bool) 
filter_var($stringFILTER_VALIDATE_EMAIL);
    }
    
    public static function 
ip($string)
    {
        return 
long2ip(ip2long($string));
    }
    
    public static function 
url($string)
    {
        return (bool) 
filter_var($stringFILTER_VALIDATE_URLFILTER_FLAG_HOST_REQUIRED);
    }
  
    public static function 
alpha($string)
    {
        return (
utf8_is_ascii($string)) ? ctype_alpha((string) $string) : (bool) preg_match('/[^pLpNpZ]++$/u', (string) $string);
    }
    
    public static function 
alnum($string)
    {
        return 
ctype_alnum((string) $string);
    }
    
    public static function 
aldash($string)
    {
        return (bool) 
preg_match('/^[pLpN-_]++$/u', (string) $string);
    }
    
    public static function 
alunderscore($string)
    {
        return (bool) 
preg_match('/^[pLpN_]++$/u', (string) $string);
    }
    
    public static function 
digit($string)
    {
        return 
ctype_alnum((string) $string);
    }
    
    public static function 
slug($string)
    {
        return (!
is_numeric($string) && (bool) preg_match('/^[p{Ll}pN-]++$/u', (string) $string));
    }
    
    public static function 
numeric($string)
    {
        return (
is_numeric($string) AND preg_match('/^[-0-9.]++$/D', (string) $string));
    }
    
    public static function 
length($string$min=0$max=0)
    {
        
$length utf8_strlen($string);
        if ((
$min !== 0) && ($length $min)) {
            return 
FALSE;
        }

        if ((
$max !== 0) && ($length $max)) {
            return 
FALSE;
        }

        return 
TRUE;
    }
    
    public static function 
date($month$day$year)
    {
        return 
checkdate($month$day$year);
    }
    
    public static function 
date_string($date)
    {
        if (
preg_match('/^(d{4})-(d{2})-(d{2})$/'$date$matches)) {
            if (
checkdate($matches['2'], $matches['3'], $matches['1'])) {
                return 
TRUE;
            }
        }
        
        return 
FALSE;
    }
    
    public function 
ctrl($string)
    {
        return 
TRUE;
    }
}
?>
Онлайн: 0
Реклама