add validation functions class
This commit is contained in:
@@ -13,7 +13,7 @@ class Wiaas_Admin_Profile {
|
|||||||
|
|
||||||
$phone = $_POST['phone'];
|
$phone = $_POST['phone'];
|
||||||
|
|
||||||
if (!WC_Validation::is_phone($phone)){
|
if (!Wiaas_Validation_Functions::is_phone($phone)){
|
||||||
$errors->add('phone_error', __( '<strong>ERROR</strong>: Enter valid phone number.', 'crf' ));
|
$errors->add('phone_error', __( '<strong>ERROR</strong>: Enter valid phone number.', 'crf' ));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class Wiaas_REST_Customer_API {
|
|||||||
return wiaas_api_notice('ADD_PHONE_NUMBER', 'error', Wiaas_Customer::get_customer_info($customer_id));
|
return wiaas_api_notice('ADD_PHONE_NUMBER', 'error', Wiaas_Customer::get_customer_info($customer_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WC_Validation::is_phone($phone)){
|
if (!Wiaas_Validation_Functions::is_phone($phone)){
|
||||||
return wiaas_api_notice('INVALID_PHONE_NUMBER', 'error', Wiaas_Customer::get_customer_info($customer_id));
|
return wiaas_api_notice('INVALID_PHONE_NUMBER', 'error', Wiaas_Customer::get_customer_info($customer_id));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Wiaas_Validation_Functions
|
||||||
|
*/
|
||||||
|
class Wiaas_Validation_Functions {
|
||||||
|
|
||||||
|
public static function is_phone($phone){
|
||||||
|
return WC_Validation::is_phone($phone);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,6 +59,8 @@ include_once WIAAS_DIR . '/includes/class-wiass-templates.php';
|
|||||||
|
|
||||||
include_once WIAAS_DIR . '/includes/wiaas-class-measurement-units.php';
|
include_once WIAAS_DIR . '/includes/wiaas-class-measurement-units.php';
|
||||||
|
|
||||||
|
include_once WIAAS_DIR . '/includes/class-wiaas-validation-functions.php';
|
||||||
|
|
||||||
function wiaas_redirect_to_login() {
|
function wiaas_redirect_to_login() {
|
||||||
wp_safe_redirect(get_site_url('', 'wp-login.php'));
|
wp_safe_redirect(get_site_url('', 'wp-login.php'));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user