| Server IP : 172.67.71.254 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/leapdubai/public_html/wp-content/plugins/kirki/includes/FormValidator/ |
Upload File : |
<?php
/**
* Validate
*
* @package kirki
*/
namespace Kirki\FormValidator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Validate {
public static function email( $email = '' ) {
return is_email( $email );
}
public static function number( $input ) {
return ! empty( $input ) && is_numeric( $input );
}
public static function tel( $input ) {
$tel_regex = '/^[0-9]{10}+$/';
return preg_match( $tel_regex, $input );
}
public static function date( $input ) {
$date_regex = '/^\d{4}-\d{2}-\d{2}$/';
return preg_match( $date_regex, $input );
}
public static function datetime( $input ) {
$datetime_regex = '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/';
return preg_match( $datetime_regex, $input );
}
public static function max_char( $input, $max_length ) {
return strlen( (string) $input ) <= (int) $max_length;
}
public static function min_char( $input, $min_length ) {
return strlen( (string) $input ) >= (int) $min_length;
}
public static function accepted_file_type( $file_type, $accepted_file_types ) {
// kirki supported media types for file input
$kirki_supported_media_types = KIRKI_SUPPORTED_MEDIA_TYPES_FOR_FILE_INPUT[ $accepted_file_types ];
// check if file type is in kirki supported media types
if ( ! empty( $kirki_supported_media_types ) && in_array( $file_type, $kirki_supported_media_types, true ) ) {
return true;
}
return false;
}
public static function max_file_size( $file_size, $max_file_size ) {
// convert file size to MB
$file_size = ! empty( $file_size ) ? (float) number_format( $file_size / 1048576, 2 ) : 2;
return $file_size <= (int) $max_file_size;
}
}