- fixed dynamically declared variables inside the classes;

This commit is contained in:
Mykyta Synelnikov
2023-04-17 20:16:15 +03:00
parent 1a219ebb24
commit 034d9e8b43
22 changed files with 275 additions and 147 deletions
+17 -8
View File
@@ -13,16 +13,25 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
*/
class Validation {
/**
* @var string
*/
public $regex_safe = '/\A[\w\-\.]+\z/';
/**
* @var string
*/
public $regex_username_safe = '|[^a-z0-9 _.\-@]|i';
/**
* @var string
*/
public $regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
/**
* Validation constructor.
*/
function __construct() {
$this->regex_safe = '/\A[\w\-\.]+\z/';
$this->regex_username_safe = '|[^a-z0-9 _.\-@]|i';
$this->regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
public function __construct() {
add_filter( 'um_user_pre_updating_files_array', array( $this, 'validate_files' ), 10, 1 );
add_filter( 'um_before_save_filter_submitted', array( $this, 'validate_fields_values' ), 10, 2 );
}
@@ -91,7 +100,7 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
}
// Dropdown options source from callback function
if ( in_array( $fields[ $key ]['type'], array( 'select','multiselect' ) ) &&
if ( in_array( $fields[ $key ]['type'], array( 'select','multiselect' ) ) &&
isset( $fields[ $key ]['custom_dropdown_options_source'] ) &&
! empty( $fields[ $key ]['custom_dropdown_options_source'] ) &&
function_exists( $fields[ $key ]['custom_dropdown_options_source'] ) ) {
@@ -100,7 +109,7 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
$fields[ $key ]['options'] = array_keys( $arr_options );
}
}
// Unset changed value that doesn't match the option list
if ( in_array( $fields[ $key ]['type'], array( 'select' ) ) &&
! empty( $stripslashes ) && ! empty( $fields[ $key ]['options'] ) &&