@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{ |
12 | 12 | |
13 | 13 | /** |
14 | - * @param null $validation_error_message |
|
15 | - */ |
|
14 | + * @param null $validation_error_message |
|
15 | + */ |
|
16 | 16 | public function __construct( $validation_error_message = NULL ) { |
17 | 17 | if( ! $validation_error_message ){ |
18 | 18 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
41 | - * @return array |
|
42 | - */ |
|
41 | + * @return array |
|
42 | + */ |
|
43 | 43 | function get_jquery_validation_rule_array(){ |
44 | 44 | return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) ); |
45 | 45 | } |
@@ -59,56 +59,56 @@ discard block |
||
59 | 59 | $atIndex = strrpos($email, "@"); |
60 | 60 | if (is_bool($atIndex) && !$atIndex) |
61 | 61 | { |
62 | - $isValid = false; |
|
62 | + $isValid = false; |
|
63 | 63 | } |
64 | 64 | else |
65 | 65 | { |
66 | - $domain = substr($email, $atIndex+1); |
|
67 | - $local = substr($email, 0, $atIndex); |
|
68 | - $localLen = strlen($local); |
|
69 | - $domainLen = strlen($domain); |
|
70 | - if ($localLen < 1 || $localLen > 64) |
|
71 | - { |
|
72 | - // local part length exceeded |
|
73 | - $isValid = false; |
|
74 | - } |
|
75 | - else if ($domainLen < 1 || $domainLen > 255) |
|
76 | - { |
|
77 | - // domain part length exceeded |
|
78 | - $isValid = false; |
|
79 | - } |
|
80 | - else if ($local[0] == '.' || $local[$localLen-1] == '.') |
|
81 | - { |
|
82 | - // local part starts or ends with '.' |
|
83 | - $isValid = false; |
|
84 | - } |
|
85 | - else if (preg_match('/\\.\\./', $local)) |
|
86 | - { |
|
87 | - // local part has two consecutive dots |
|
88 | - $isValid = false; |
|
89 | - } |
|
90 | - else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) |
|
91 | - { |
|
92 | - // character not valid in domain part |
|
93 | - $isValid = false; |
|
94 | - } |
|
95 | - else if (preg_match('/\\.\\./', $domain)) |
|
96 | - { |
|
97 | - // domain part has two consecutive dots |
|
98 | - $isValid = false; |
|
99 | - } |
|
100 | - else if |
|
66 | + $domain = substr($email, $atIndex+1); |
|
67 | + $local = substr($email, 0, $atIndex); |
|
68 | + $localLen = strlen($local); |
|
69 | + $domainLen = strlen($domain); |
|
70 | + if ($localLen < 1 || $localLen > 64) |
|
71 | + { |
|
72 | + // local part length exceeded |
|
73 | + $isValid = false; |
|
74 | + } |
|
75 | + else if ($domainLen < 1 || $domainLen > 255) |
|
76 | + { |
|
77 | + // domain part length exceeded |
|
78 | + $isValid = false; |
|
79 | + } |
|
80 | + else if ($local[0] == '.' || $local[$localLen-1] == '.') |
|
81 | + { |
|
82 | + // local part starts or ends with '.' |
|
83 | + $isValid = false; |
|
84 | + } |
|
85 | + else if (preg_match('/\\.\\./', $local)) |
|
86 | + { |
|
87 | + // local part has two consecutive dots |
|
88 | + $isValid = false; |
|
89 | + } |
|
90 | + else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) |
|
91 | + { |
|
92 | + // character not valid in domain part |
|
93 | + $isValid = false; |
|
94 | + } |
|
95 | + else if (preg_match('/\\.\\./', $domain)) |
|
96 | + { |
|
97 | + // domain part has two consecutive dots |
|
98 | + $isValid = false; |
|
99 | + } |
|
100 | + else if |
|
101 | 101 | (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', |
102 | - str_replace("\\\\","",$local))) |
|
103 | - { |
|
104 | - // character not valid in local part unless |
|
105 | - // local part is quoted |
|
106 | - if (!preg_match('/^"(\\\\"|[^"])+"$/', |
|
107 | - str_replace("\\\\","",$local))) |
|
108 | - { |
|
109 | - $isValid = false; |
|
110 | - } |
|
111 | - } |
|
102 | + str_replace("\\\\","",$local))) |
|
103 | + { |
|
104 | + // character not valid in local part unless |
|
105 | + // local part is quoted |
|
106 | + if (!preg_match('/^"(\\\\"|[^"])+"$/', |
|
107 | + str_replace("\\\\","",$local))) |
|
108 | + { |
|
109 | + $isValid = false; |
|
110 | + } |
|
111 | + } |
|
112 | 112 | //don't check the DNS records... just personal preference |
113 | 113 | // if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))) |
114 | 114 | // { |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{ |
|
11 | +class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param null $validation_error_message |
15 | 15 | */ |
16 | - public function __construct( $validation_error_message = NULL ) { |
|
17 | - if( ! $validation_error_message ){ |
|
16 | + public function __construct($validation_error_message = NULL) { |
|
17 | + if ( ! $validation_error_message) { |
|
18 | 18 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
19 | 19 | } |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * @throws \EE_Validation_Error |
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
33 | - if( $normalized_value && ! $this->_validate_email($normalized_value) ){ |
|
34 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
33 | + if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
34 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @return array |
42 | 42 | */ |
43 | - function get_jquery_validation_rule_array(){ |
|
44 | - return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) ); |
|
43 | + function get_jquery_validation_rule_array() { |
|
44 | + return array('email'=>true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | { |
58 | 58 | $isValid = true; |
59 | 59 | $atIndex = strrpos($email, "@"); |
60 | - if (is_bool($atIndex) && !$atIndex) |
|
60 | + if (is_bool($atIndex) && ! $atIndex) |
|
61 | 61 | { |
62 | 62 | $isValid = false; |
63 | 63 | } |
64 | 64 | else |
65 | 65 | { |
66 | - $domain = substr($email, $atIndex+1); |
|
66 | + $domain = substr($email, $atIndex + 1); |
|
67 | 67 | $local = substr($email, 0, $atIndex); |
68 | 68 | $localLen = strlen($local); |
69 | 69 | $domainLen = strlen($domain); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | // domain part length exceeded |
78 | 78 | $isValid = false; |
79 | 79 | } |
80 | - else if ($local[0] == '.' || $local[$localLen-1] == '.') |
|
80 | + else if ($local[0] == '.' || $local[$localLen - 1] == '.') |
|
81 | 81 | { |
82 | 82 | // local part starts or ends with '.' |
83 | 83 | $isValid = false; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | // local part has two consecutive dots |
88 | 88 | $isValid = false; |
89 | 89 | } |
90 | - else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) |
|
90 | + else if ( ! preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) |
|
91 | 91 | { |
92 | 92 | // character not valid in domain part |
93 | 93 | $isValid = false; |
@@ -97,14 +97,13 @@ discard block |
||
97 | 97 | // domain part has two consecutive dots |
98 | 98 | $isValid = false; |
99 | 99 | } |
100 | - else if |
|
101 | -(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', |
|
102 | - str_replace("\\\\","",$local))) |
|
100 | + else if ( ! preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', |
|
101 | + str_replace("\\\\", "", $local))) |
|
103 | 102 | { |
104 | 103 | // character not valid in local part unless |
105 | 104 | // local part is quoted |
106 | - if (!preg_match('/^"(\\\\"|[^"])+"$/', |
|
107 | - str_replace("\\\\","",$local))) |
|
105 | + if ( ! preg_match('/^"(\\\\"|[^"])+"$/', |
|
106 | + str_replace("\\\\", "", $local))) |
|
108 | 107 | { |
109 | 108 | $isValid = false; |
110 | 109 | } |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | if (is_bool($atIndex) && !$atIndex) |
61 | 61 | { |
62 | 62 | $isValid = false; |
63 | - } |
|
64 | - else |
|
63 | + } else |
|
65 | 64 | { |
66 | 65 | $domain = substr($email, $atIndex+1); |
67 | 66 | $local = substr($email, 0, $atIndex); |
@@ -71,33 +70,27 @@ discard block |
||
71 | 70 | { |
72 | 71 | // local part length exceeded |
73 | 72 | $isValid = false; |
74 | - } |
|
75 | - else if ($domainLen < 1 || $domainLen > 255) |
|
73 | + } else if ($domainLen < 1 || $domainLen > 255) |
|
76 | 74 | { |
77 | 75 | // domain part length exceeded |
78 | 76 | $isValid = false; |
79 | - } |
|
80 | - else if ($local[0] == '.' || $local[$localLen-1] == '.') |
|
77 | + } else if ($local[0] == '.' || $local[$localLen-1] == '.') |
|
81 | 78 | { |
82 | 79 | // local part starts or ends with '.' |
83 | 80 | $isValid = false; |
84 | - } |
|
85 | - else if (preg_match('/\\.\\./', $local)) |
|
81 | + } else if (preg_match('/\\.\\./', $local)) |
|
86 | 82 | { |
87 | 83 | // local part has two consecutive dots |
88 | 84 | $isValid = false; |
89 | - } |
|
90 | - else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) |
|
85 | + } else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) |
|
91 | 86 | { |
92 | 87 | // character not valid in domain part |
93 | 88 | $isValid = false; |
94 | - } |
|
95 | - else if (preg_match('/\\.\\./', $domain)) |
|
89 | + } else if (preg_match('/\\.\\./', $domain)) |
|
96 | 90 | { |
97 | 91 | // domain part has two consecutive dots |
98 | 92 | $isValid = false; |
99 | - } |
|
100 | - else if |
|
93 | + } else if |
|
101 | 94 | (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', |
102 | 95 | str_replace("\\\\","",$local))) |
103 | 96 | { |
@@ -19,20 +19,20 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function validate($normalized_value) { |
21 | 21 | parent::validate($normalized_value); |
22 | - if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){ |
|
22 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
23 | 23 | throw new EE_Error(sprintf(__("Cannot use Enum Validation Strategy with an input that doesn't have options", "event_espresso"))); |
24 | 24 | } |
25 | 25 | $enum_options = $this->_input->flat_options(); |
26 | - if( $normalized_value === TRUE){ |
|
26 | + if ($normalized_value === TRUE) { |
|
27 | 27 | $normalized_value = 1; |
28 | - }elseif( $normalized_value === FALSE){ |
|
28 | + }elseif ($normalized_value === FALSE) { |
|
29 | 29 | $normalized_value = 0; |
30 | 30 | } |
31 | - if( $normalized_value !== NULL && ! array_key_exists( $normalized_value, $enum_options )){ |
|
32 | - throw new EE_Validation_Error( $this->get_validation_error_message(), |
|
31 | + if ($normalized_value !== NULL && ! array_key_exists($normalized_value, $enum_options)) { |
|
32 | + throw new EE_Validation_Error($this->get_validation_error_message(), |
|
33 | 33 | 'invalid_enum_value' |
34 | 34 | ); |
35 | - }else{ |
|
35 | + } else { |
|
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | } |
@@ -42,15 +42,15 @@ discard block |
||
42 | 42 | * on the allowed options. |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - public function get_validation_error_message(){ |
|
45 | + public function get_validation_error_message() { |
|
46 | 46 | $parent_validation_error_message = parent::get_validation_error_message(); |
47 | - if( ! $parent_validation_error_message ) { |
|
47 | + if ( ! $parent_validation_error_message) { |
|
48 | 48 | $enum_options = $this->_input instanceof EE_Form_Input_With_Options_Base ? $this->_input->flat_options() : ''; |
49 | 49 | return sprintf( |
50 | 50 | __("This is not allowed option. Allowed options are %s.", "event_espresso"), |
51 | - implode( ', ', $enum_options ) |
|
51 | + implode(', ', $enum_options) |
|
52 | 52 | ); |
53 | - }else{ |
|
53 | + } else { |
|
54 | 54 | return $parent_validation_error_message; |
55 | 55 | } |
56 | 56 | } |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | $enum_options = $this->_input->flat_options(); |
26 | 26 | if( $normalized_value === TRUE){ |
27 | 27 | $normalized_value = 1; |
28 | - }elseif( $normalized_value === FALSE){ |
|
28 | + } elseif( $normalized_value === FALSE){ |
|
29 | 29 | $normalized_value = 0; |
30 | 30 | } |
31 | 31 | if( $normalized_value !== NULL && ! array_key_exists( $normalized_value, $enum_options )){ |
32 | 32 | throw new EE_Validation_Error( $this->get_validation_error_message(), |
33 | 33 | 'invalid_enum_value' |
34 | 34 | ); |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | __("This is not allowed option. Allowed options are %s.", "event_espresso"), |
51 | 51 | implode( ', ', $enum_options ) |
52 | 52 | ); |
53 | - }else{ |
|
53 | + } else{ |
|
54 | 54 | return $parent_validation_error_message; |
55 | 55 | } |
56 | 56 | } |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Float_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Float_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param null $validation_error_message |
15 | 15 | */ |
16 | - public function __construct( $validation_error_message = NULL ) { |
|
17 | - if( ! $validation_error_message ){ |
|
16 | + public function __construct($validation_error_message = NULL) { |
|
17 | + if ( ! $validation_error_message) { |
|
18 | 18 | $validation_error_message = sprintf(__("Only numeric characters, commas, periods, and spaces, please!", "event_espresso")); |
19 | 19 | } |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @return array |
38 | 38 | */ |
39 | - function get_jquery_validation_rule_array(){ |
|
40 | - return array('number'=>true, 'messages' => array( 'number' => $this->get_validation_error_message() ) ); |
|
39 | + function get_jquery_validation_rule_array() { |
|
40 | + return array('number'=>true, 'messages' => array('number' => $this->get_validation_error_message())); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 |
@@ -10,21 +10,21 @@ discard block |
||
10 | 10 | * @since 4.6 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
13 | +class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param null $validation_error_message |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = NULL ) { |
|
19 | - if ( ! $validation_error_message ) { |
|
18 | + public function __construct($validation_error_message = NULL) { |
|
19 | + if ( ! $validation_error_message) { |
|
20 | 20 | global $allowedposttags; |
21 | 21 | $validation_error_message = sprintf( |
22 | - __( 'Only the following HTML tags are allowed:%1$s%2$s', "event_espresso" ), |
|
22 | + __('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"), |
|
23 | 23 | '<br />', |
24 | - implode( ",", array_keys( $allowedposttags ) ) |
|
24 | + implode(",", array_keys($allowedposttags)) |
|
25 | 25 | ); |
26 | 26 | } |
27 | - parent::__construct( $validation_error_message ); |
|
27 | + parent::__construct($validation_error_message); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function validate($normalized_value) { |
37 | 37 | global $allowedposttags; |
38 | - parent::validate( $normalized_value ); |
|
39 | - $normalized_value_sans_tags = wp_kses( "$normalized_value", $allowedposttags ); |
|
40 | - if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) { |
|
41 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' ); |
|
38 | + parent::validate($normalized_value); |
|
39 | + $normalized_value_sans_tags = wp_kses("$normalized_value", $allowedposttags); |
|
40 | + if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) { |
|
41 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | * @subpackage Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php. |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Int_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
9 | +class EE_Int_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param null $validation_error_message |
13 | 13 | */ |
14 | - public function __construct( $validation_error_message = NULL ) { |
|
15 | - if( ! $validation_error_message ){ |
|
14 | + public function __construct($validation_error_message = NULL) { |
|
15 | + if ( ! $validation_error_message) { |
|
16 | 16 | $validation_error_message = __("Only digits are allowed.", "event_espresso"); |
17 | 17 | } |
18 | - parent::__construct( $validation_error_message ); |
|
18 | + parent::__construct($validation_error_message); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @return array |
34 | 34 | */ |
35 | - function get_jquery_validation_rule_array(){ |
|
36 | - return array('digits'=>true, 'messages' => array( 'digits' => $this->get_validation_error_message() ) ); |
|
35 | + function get_jquery_validation_rule_array() { |
|
36 | + return array('digits'=>true, 'messages' => array('digits' => $this->get_validation_error_message())); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Many_Valued_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
14 | +class EE_Many_Valued_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
15 | 15 | protected $_individual_item_validation_strategies = array(); |
16 | 16 | /** |
17 | 17 | * |
18 | 18 | * @param EE_Validation_Strategy_Base[] $individual_item_validation_strategies (or a single EE_Validation_Strategy_Base) |
19 | 19 | */ |
20 | 20 | public function __construct($individual_item_validation_strategies) { |
21 | - if( ! is_array($individual_item_validation_strategies)){ |
|
21 | + if ( ! is_array($individual_item_validation_strategies)) { |
|
22 | 22 | $individual_item_validation_strategies = array($individual_item_validation_strategies); |
23 | 23 | } |
24 | 24 | $this->_individual_item_validation_strategies = $individual_item_validation_strategies; |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | * @return boolean |
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
33 | - if( is_array($normalized_value)){ |
|
33 | + if (is_array($normalized_value)) { |
|
34 | 34 | $items_to_validate = $normalized_value; |
35 | - }else{ |
|
35 | + } else { |
|
36 | 36 | $items_to_validate = array($normalized_value); |
37 | 37 | } |
38 | - foreach($items_to_validate as $individual_item){ |
|
39 | - foreach($this->_individual_item_validation_strategies as $validation_strategy){ |
|
40 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
38 | + foreach ($items_to_validate as $individual_item) { |
|
39 | + foreach ($this->_individual_item_validation_strategies as $validation_strategy) { |
|
40 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
41 | 41 | $validation_strategy->validate($individual_item); |
42 | 42 | } |
43 | 43 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function _construct_finalize(\EE_Form_Input_Base $form_input) { |
52 | 52 | parent::_construct_finalize($form_input); |
53 | - foreach($this->_individual_item_validation_strategies as $item_validation_strategy){ |
|
54 | - if ( $item_validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
53 | + foreach ($this->_individual_item_validation_strategies as $item_validation_strategy) { |
|
54 | + if ($item_validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
55 | 55 | $item_validation_strategy->_construct_finalize($form_input); |
56 | 56 | } |
57 | 57 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | function validate($normalized_value) { |
33 | 33 | if( is_array($normalized_value)){ |
34 | 34 | $items_to_validate = $normalized_value; |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | $items_to_validate = array($normalized_value); |
37 | 37 | } |
38 | 38 | foreach($items_to_validate as $individual_item){ |
@@ -8,32 +8,32 @@ |
||
8 | 8 | * @subpackage Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php. |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_Min_Length_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Min_Length_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | protected $_min_length; |
14 | 14 | |
15 | - public function __construct( $validation_error_message = NULL, $min_length = 0 ) { |
|
15 | + public function __construct($validation_error_message = NULL, $min_length = 0) { |
|
16 | 16 | $this->_min_length = $min_length; |
17 | - parent::__construct( $validation_error_message ); |
|
17 | + parent::__construct($validation_error_message); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param $normalized_value |
22 | 22 | */ |
23 | 23 | public function validate($normalized_value) { |
24 | - if( $this->_min_length > 0 && |
|
24 | + if ($this->_min_length > 0 && |
|
25 | 25 | $normalized_value && |
26 | - is_string( $normalized_value ) && |
|
27 | - strlen( $normalized_value ) < $this->_min_length){ |
|
28 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'minlength' ); |
|
26 | + is_string($normalized_value) && |
|
27 | + strlen($normalized_value) < $this->_min_length) { |
|
28 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'minlength'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @return array |
34 | 34 | */ |
35 | - function get_jquery_validation_rule_array(){ |
|
36 | - return array( 'minlength'=> $this->_min_length, 'messages' => array( 'minlength' => $this->get_validation_error_message() ) ); |
|
35 | + function get_jquery_validation_rule_array() { |
|
36 | + return array('minlength'=> $this->_min_length, 'messages' => array('minlength' => $this->get_validation_error_message())); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | * @since 4.6 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Plaintext_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
13 | +class EE_Plaintext_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param null $validation_error_message |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = NULL ) { |
|
19 | - if( ! $validation_error_message ){ |
|
20 | - $validation_error_message = __( "HTML tags are not permitted in this field", "event_espresso" ); |
|
18 | + public function __construct($validation_error_message = NULL) { |
|
19 | + if ( ! $validation_error_message) { |
|
20 | + $validation_error_message = __("HTML tags are not permitted in this field", "event_espresso"); |
|
21 | 21 | } |
22 | - parent::__construct( $validation_error_message ); |
|
22 | + parent::__construct($validation_error_message); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * @throws \EE_Validation_Error |
28 | 28 | */ |
29 | 29 | public function validate($normalized_value) { |
30 | - $no_tags = wp_strip_all_tags( $normalized_value ); |
|
31 | - if( strlen( $no_tags ) < strlen( trim( $normalized_value ) ) ) { |
|
32 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'no_html_tags' ); |
|
30 | + $no_tags = wp_strip_all_tags($normalized_value); |
|
31 | + if (strlen($no_tags) < strlen(trim($normalized_value))) { |
|
32 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'no_html_tags'); |
|
33 | 33 | } |
34 | 34 | parent::validate($normalized_value); |
35 | 35 | } |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param null $validation_error_message |
15 | 15 | */ |
16 | - public function __construct( $validation_error_message = NULL ) { |
|
17 | - if( ! $validation_error_message ){ |
|
16 | + public function __construct($validation_error_message = NULL) { |
|
17 | + if ( ! $validation_error_message) { |
|
18 | 18 | $validation_error_message = __("This field is required.", "event_espresso"); |
19 | 19 | } |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @throws \EE_Validation_Error |
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
33 | - if( $normalized_value === '' || $normalized_value === NULL || $normalized_value === array()){ |
|
34 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
35 | - }else{ |
|
33 | + if ($normalized_value === '' || $normalized_value === NULL || $normalized_value === array()) { |
|
34 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
35 | + } else { |
|
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * @return array |
44 | 44 | */ |
45 | - function get_jquery_validation_rule_array(){ |
|
46 | - return array( 'required'=>true, 'messages' => array( 'required' => $this->get_validation_error_message() ) ); |
|
45 | + function get_jquery_validation_rule_array() { |
|
46 | + return array('required'=>true, 'messages' => array('required' => $this->get_validation_error_message())); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | function validate($normalized_value) { |
33 | 33 | if( $normalized_value === '' || $normalized_value === NULL || $normalized_value === array()){ |
34 | 34 | throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | } |