@@ -2,62 +2,62 @@ |
||
2 | 2 | |
3 | 3 | class EE_Sample_Form extends EE_Form_Section_Proper |
4 | 4 | { |
5 | - public function __construct() |
|
6 | - { |
|
7 | - $this->_subsections = array( |
|
8 | - 'h1' => new EE_Form_Section_HTML('hello wordl'), |
|
9 | - 'name' => new EE_Text_Input(array('required' => true,'default' => 'your name here')), |
|
10 | - 'email' => new EE_Email_Input(array('required' => false)), |
|
11 | - 'shirt_size' => new EE_Select_Input(array('' => 'Please select...', 's' => esc_html__("Small", "event_espresso"),'m' => esc_html__("Medium", "event_espresso"),'l' => esc_html__("Large", "event_espresso")), array('required' => true,'default' => 's')), |
|
12 | - 'month_normal' => new EE_Month_Input(), |
|
13 | - 'month_leading_zero' => new EE_Month_Input(true), |
|
14 | - 'year_2' => new EE_Year_Input(false, 1, 1), |
|
15 | - 'year_4' => new EE_Year_Input(true, 0, 10, array('default' => '2017')), |
|
16 | - 'yes_no' => new EE_Yes_No_Input(array('html_label_text' => esc_html__("Yes or No", "event_espresso"))), |
|
17 | - 'credit_card' => new EE_Credit_Card_Input(), |
|
18 | - 'image_1' => new EE_Admin_File_Uploader_Input(), |
|
19 | - 'image_2' => new EE_Admin_File_Uploader_Input(), |
|
20 | - 'skillz' => new EE_Checkbox_Multi_Input(array('php' => 'PHP','mysql' => 'MYSQL'), array('default' => array('php'))), |
|
21 | - 'float' => new EE_Float_Input(), |
|
22 | - 'essay' => new EE_Text_Area_Input(), |
|
23 | - 'amenities' => new EE_Select_Multiple_Input( |
|
24 | - array( |
|
25 | - 'hottub' => 'Hot Tub', |
|
26 | - 'balcony' => "Balcony", |
|
27 | - 'skylight' => 'SkyLight', |
|
28 | - 'no_axe' => 'No Axe Murderers' |
|
29 | - ), |
|
30 | - array( |
|
31 | - 'default' => array( |
|
32 | - 'hottub', |
|
33 | - 'no_axe' ), |
|
34 | - ) |
|
35 | - ), |
|
36 | - 'payment_methods' => new EE_Select_Multi_Model_Input(EEM_Payment_Method::instance()->get_all()), |
|
37 | - ); |
|
38 | - $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
|
39 | - parent::__construct(); |
|
40 | - } |
|
5 | + public function __construct() |
|
6 | + { |
|
7 | + $this->_subsections = array( |
|
8 | + 'h1' => new EE_Form_Section_HTML('hello wordl'), |
|
9 | + 'name' => new EE_Text_Input(array('required' => true,'default' => 'your name here')), |
|
10 | + 'email' => new EE_Email_Input(array('required' => false)), |
|
11 | + 'shirt_size' => new EE_Select_Input(array('' => 'Please select...', 's' => esc_html__("Small", "event_espresso"),'m' => esc_html__("Medium", "event_espresso"),'l' => esc_html__("Large", "event_espresso")), array('required' => true,'default' => 's')), |
|
12 | + 'month_normal' => new EE_Month_Input(), |
|
13 | + 'month_leading_zero' => new EE_Month_Input(true), |
|
14 | + 'year_2' => new EE_Year_Input(false, 1, 1), |
|
15 | + 'year_4' => new EE_Year_Input(true, 0, 10, array('default' => '2017')), |
|
16 | + 'yes_no' => new EE_Yes_No_Input(array('html_label_text' => esc_html__("Yes or No", "event_espresso"))), |
|
17 | + 'credit_card' => new EE_Credit_Card_Input(), |
|
18 | + 'image_1' => new EE_Admin_File_Uploader_Input(), |
|
19 | + 'image_2' => new EE_Admin_File_Uploader_Input(), |
|
20 | + 'skillz' => new EE_Checkbox_Multi_Input(array('php' => 'PHP','mysql' => 'MYSQL'), array('default' => array('php'))), |
|
21 | + 'float' => new EE_Float_Input(), |
|
22 | + 'essay' => new EE_Text_Area_Input(), |
|
23 | + 'amenities' => new EE_Select_Multiple_Input( |
|
24 | + array( |
|
25 | + 'hottub' => 'Hot Tub', |
|
26 | + 'balcony' => "Balcony", |
|
27 | + 'skylight' => 'SkyLight', |
|
28 | + 'no_axe' => 'No Axe Murderers' |
|
29 | + ), |
|
30 | + array( |
|
31 | + 'default' => array( |
|
32 | + 'hottub', |
|
33 | + 'no_axe' ), |
|
34 | + ) |
|
35 | + ), |
|
36 | + 'payment_methods' => new EE_Select_Multi_Model_Input(EEM_Payment_Method::instance()->get_all()), |
|
37 | + ); |
|
38 | + $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
|
39 | + parent::__construct(); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Extra validation for the 'name' input. |
|
44 | - * @param EE_Text_Input $form_input |
|
45 | - */ |
|
46 | - public function _validate_name($form_input) |
|
47 | - { |
|
48 | - if ($form_input->raw_value() != 'Mike') { |
|
49 | - $form_input->add_validation_error(esc_html__("You are not mike. You must be brent or darren. Thats ok, I guess", 'event_espresso'), 'not-mike'); |
|
50 | - } |
|
51 | - } |
|
42 | + /** |
|
43 | + * Extra validation for the 'name' input. |
|
44 | + * @param EE_Text_Input $form_input |
|
45 | + */ |
|
46 | + public function _validate_name($form_input) |
|
47 | + { |
|
48 | + if ($form_input->raw_value() != 'Mike') { |
|
49 | + $form_input->add_validation_error(esc_html__("You are not mike. You must be brent or darren. Thats ok, I guess", 'event_espresso'), 'not-mike'); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - public function _validate() |
|
54 | - { |
|
55 | - parent::_validate(); |
|
56 | - if ( |
|
57 | - $this->_subsections['shirt_size']->normalized_value() == 's' |
|
58 | - && $this->_subsections['year_4']->normalized_value() < 2010 |
|
59 | - ) { |
|
60 | - $this->add_validation_error(esc_html__("If you want a small shirt, you should be born after 2010. Otherwise theyre just too big", 'event_espresso'), 'too-old'); |
|
61 | - } |
|
62 | - } |
|
53 | + public function _validate() |
|
54 | + { |
|
55 | + parent::_validate(); |
|
56 | + if ( |
|
57 | + $this->_subsections['shirt_size']->normalized_value() == 's' |
|
58 | + && $this->_subsections['year_4']->normalized_value() < 2010 |
|
59 | + ) { |
|
60 | + $this->add_validation_error(esc_html__("If you want a small shirt, you should be born after 2010. Otherwise theyre just too big", 'event_espresso'), 'too-old'); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | } |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | { |
7 | 7 | $this->_subsections = array( |
8 | 8 | 'h1' => new EE_Form_Section_HTML('hello wordl'), |
9 | - 'name' => new EE_Text_Input(array('required' => true,'default' => 'your name here')), |
|
9 | + 'name' => new EE_Text_Input(array('required' => true, 'default' => 'your name here')), |
|
10 | 10 | 'email' => new EE_Email_Input(array('required' => false)), |
11 | - 'shirt_size' => new EE_Select_Input(array('' => 'Please select...', 's' => esc_html__("Small", "event_espresso"),'m' => esc_html__("Medium", "event_espresso"),'l' => esc_html__("Large", "event_espresso")), array('required' => true,'default' => 's')), |
|
11 | + 'shirt_size' => new EE_Select_Input(array('' => 'Please select...', 's' => esc_html__("Small", "event_espresso"), 'm' => esc_html__("Medium", "event_espresso"), 'l' => esc_html__("Large", "event_espresso")), array('required' => true, 'default' => 's')), |
|
12 | 12 | 'month_normal' => new EE_Month_Input(), |
13 | 13 | 'month_leading_zero' => new EE_Month_Input(true), |
14 | 14 | 'year_2' => new EE_Year_Input(false, 1, 1), |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | 'credit_card' => new EE_Credit_Card_Input(), |
18 | 18 | 'image_1' => new EE_Admin_File_Uploader_Input(), |
19 | 19 | 'image_2' => new EE_Admin_File_Uploader_Input(), |
20 | - 'skillz' => new EE_Checkbox_Multi_Input(array('php' => 'PHP','mysql' => 'MYSQL'), array('default' => array('php'))), |
|
20 | + 'skillz' => new EE_Checkbox_Multi_Input(array('php' => 'PHP', 'mysql' => 'MYSQL'), array('default' => array('php'))), |
|
21 | 21 | 'float' => new EE_Float_Input(), |
22 | 22 | 'essay' => new EE_Text_Area_Input(), |
23 | 23 | 'amenities' => new EE_Select_Multiple_Input( |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $check_file_exists = false, |
40 | 40 | URLValidator $url_validator = null |
41 | 41 | ) { |
42 | - if (! $url_validator instanceof URLValidator) { |
|
42 | + if ( ! $url_validator instanceof URLValidator) { |
|
43 | 43 | $url_validator = LoaderFactory::getLoader()->getShared('EventEspresso\core\services\validators\URLValidator'); |
44 | 44 | } |
45 | 45 | $this->url_validator = $url_validator; |
46 | - if (! $validation_error_message) { |
|
46 | + if ( ! $validation_error_message) { |
|
47 | 47 | $validation_error_message = esc_html__("Please enter a valid URL. Eg https://eventespresso.com", "event_espresso"); |
48 | 48 | } |
49 | 49 | $this->check_file_exists = $check_file_exists; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function validate($normalized_value) |
63 | 63 | { |
64 | 64 | if ($normalized_value) { |
65 | - if (! $this->url_validator->isValid($normalized_value)) { |
|
65 | + if ( ! $this->url_validator->isValid($normalized_value)) { |
|
66 | 66 | throw new EE_Validation_Error($this->get_validation_error_message(), 'invalid_url'); |
67 | 67 | } elseif (apply_filters('FHEE__EE_URL_Validation_Strategy__validate__check_remote_file_exists', $this->check_file_exists, $this->_input)) { |
68 | 68 | if ( |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $normalized_value, |
71 | 71 | array( |
72 | 72 | 'sslverify' => false, |
73 | - 'limit_response_size' => 4095,// we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
73 | + 'limit_response_size' => 4095, // we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
74 | 74 | ) |
75 | 75 | ) |
76 | 76 | ) { |
@@ -87,6 +87,6 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function get_jquery_validation_rule_array() |
89 | 89 | { |
90 | - return array( 'validUrl' => true, 'messages' => array( 'validUrl' => $this->get_validation_error_message() ) ); |
|
90 | + return array('validUrl' => true, 'messages' => array('validUrl' => $this->get_validation_error_message())); |
|
91 | 91 | } |
92 | 92 | } |
@@ -15,79 +15,79 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_URL_Validation_Strategy extends EE_Validation_Strategy_Base |
17 | 17 | { |
18 | - /** |
|
19 | - * @var @boolean whether we should check if the file exists or not |
|
20 | - */ |
|
21 | - protected $check_file_exists; |
|
18 | + /** |
|
19 | + * @var @boolean whether we should check if the file exists or not |
|
20 | + */ |
|
21 | + protected $check_file_exists; |
|
22 | 22 | |
23 | - /** |
|
24 | - * @var URLValidator |
|
25 | - */ |
|
26 | - protected $url_validator; |
|
23 | + /** |
|
24 | + * @var URLValidator |
|
25 | + */ |
|
26 | + protected $url_validator; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @param null $validation_error_message |
|
30 | - * @param boolean $check_file_exists |
|
31 | - * @param URLValidator $url_validator |
|
32 | - * @throws InvalidArgumentException |
|
33 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
34 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
35 | - */ |
|
36 | - public function __construct( |
|
37 | - $validation_error_message = null, |
|
38 | - $check_file_exists = false, |
|
39 | - URLValidator $url_validator = null |
|
40 | - ) { |
|
41 | - if (! $url_validator instanceof URLValidator) { |
|
42 | - $url_validator = LoaderFactory::getLoader()->getShared('EventEspresso\core\services\validators\URLValidator'); |
|
43 | - } |
|
44 | - $this->url_validator = $url_validator; |
|
45 | - if (! $validation_error_message) { |
|
46 | - $validation_error_message = esc_html__("Please enter a valid URL. Eg https://eventespresso.com", "event_espresso"); |
|
47 | - } |
|
48 | - $this->check_file_exists = $check_file_exists; |
|
49 | - parent::__construct($validation_error_message); |
|
50 | - } |
|
28 | + /** |
|
29 | + * @param null $validation_error_message |
|
30 | + * @param boolean $check_file_exists |
|
31 | + * @param URLValidator $url_validator |
|
32 | + * @throws InvalidArgumentException |
|
33 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
34 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
35 | + */ |
|
36 | + public function __construct( |
|
37 | + $validation_error_message = null, |
|
38 | + $check_file_exists = false, |
|
39 | + URLValidator $url_validator = null |
|
40 | + ) { |
|
41 | + if (! $url_validator instanceof URLValidator) { |
|
42 | + $url_validator = LoaderFactory::getLoader()->getShared('EventEspresso\core\services\validators\URLValidator'); |
|
43 | + } |
|
44 | + $this->url_validator = $url_validator; |
|
45 | + if (! $validation_error_message) { |
|
46 | + $validation_error_message = esc_html__("Please enter a valid URL. Eg https://eventespresso.com", "event_espresso"); |
|
47 | + } |
|
48 | + $this->check_file_exists = $check_file_exists; |
|
49 | + parent::__construct($validation_error_message); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * just checks the field isn't blank |
|
56 | - * |
|
57 | - * @param $normalized_value |
|
58 | - * @return bool |
|
59 | - * @throws \EE_Validation_Error |
|
60 | - */ |
|
61 | - public function validate($normalized_value) |
|
62 | - { |
|
63 | - if ($normalized_value) { |
|
64 | - if (! $this->url_validator->isValid($normalized_value)) { |
|
65 | - throw new EE_Validation_Error($this->get_validation_error_message(), 'invalid_url'); |
|
66 | - } elseif (apply_filters('FHEE__EE_URL_Validation_Strategy__validate__check_remote_file_exists', $this->check_file_exists, $this->_input)) { |
|
67 | - if ( |
|
68 | - ! EEH_URL::remote_file_exists( |
|
69 | - $normalized_value, |
|
70 | - array( |
|
71 | - 'sslverify' => false, |
|
72 | - 'limit_response_size' => 4095,// we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
73 | - ) |
|
74 | - ) |
|
75 | - ) { |
|
76 | - throw new EE_Validation_Error( |
|
77 | - esc_html__("That URL seems to be broken. Please enter a valid URL", "event_espresso") |
|
78 | - ); |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
82 | - } |
|
54 | + /** |
|
55 | + * just checks the field isn't blank |
|
56 | + * |
|
57 | + * @param $normalized_value |
|
58 | + * @return bool |
|
59 | + * @throws \EE_Validation_Error |
|
60 | + */ |
|
61 | + public function validate($normalized_value) |
|
62 | + { |
|
63 | + if ($normalized_value) { |
|
64 | + if (! $this->url_validator->isValid($normalized_value)) { |
|
65 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'invalid_url'); |
|
66 | + } elseif (apply_filters('FHEE__EE_URL_Validation_Strategy__validate__check_remote_file_exists', $this->check_file_exists, $this->_input)) { |
|
67 | + if ( |
|
68 | + ! EEH_URL::remote_file_exists( |
|
69 | + $normalized_value, |
|
70 | + array( |
|
71 | + 'sslverify' => false, |
|
72 | + 'limit_response_size' => 4095,// we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
73 | + ) |
|
74 | + ) |
|
75 | + ) { |
|
76 | + throw new EE_Validation_Error( |
|
77 | + esc_html__("That URL seems to be broken. Please enter a valid URL", "event_espresso") |
|
78 | + ); |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @return array |
|
88 | - */ |
|
89 | - public function get_jquery_validation_rule_array() |
|
90 | - { |
|
91 | - return array( 'validUrl' => true, 'messages' => array( 'validUrl' => $this->get_validation_error_message() ) ); |
|
92 | - } |
|
86 | + /** |
|
87 | + * @return array |
|
88 | + */ |
|
89 | + public function get_jquery_validation_rule_array() |
|
90 | + { |
|
91 | + return array( 'validUrl' => true, 'messages' => array( 'validUrl' => $this->get_validation_error_message() ) ); |
|
92 | + } |
|
93 | 93 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function __construct($validation_error_message = null) |
17 | 17 | { |
18 | - if (! $validation_error_message) { |
|
18 | + if ( ! $validation_error_message) { |
|
19 | 19 | $validation_error_message = esc_html__("Only digits are allowed.", "event_espresso"); |
20 | 20 | } |
21 | 21 | parent::__construct($validation_error_message); |
@@ -9,41 +9,41 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Int_Validation_Strategy extends EE_Validation_Strategy_Base |
11 | 11 | { |
12 | - /** |
|
13 | - * @param null $validation_error_message |
|
14 | - */ |
|
15 | - public function __construct($validation_error_message = null) |
|
16 | - { |
|
17 | - if (! $validation_error_message) { |
|
18 | - $validation_error_message = esc_html__("Only digits are allowed.", "event_espresso"); |
|
19 | - } |
|
20 | - parent::__construct($validation_error_message); |
|
21 | - } |
|
12 | + /** |
|
13 | + * @param null $validation_error_message |
|
14 | + */ |
|
15 | + public function __construct($validation_error_message = null) |
|
16 | + { |
|
17 | + if (! $validation_error_message) { |
|
18 | + $validation_error_message = esc_html__("Only digits are allowed.", "event_espresso"); |
|
19 | + } |
|
20 | + parent::__construct($validation_error_message); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * @param $normalized_value |
|
27 | - */ |
|
28 | - public function validate($normalized_value) |
|
29 | - { |
|
30 | - // this should have already been detected by the normalization strategy |
|
31 | - } |
|
25 | + /** |
|
26 | + * @param $normalized_value |
|
27 | + */ |
|
28 | + public function validate($normalized_value) |
|
29 | + { |
|
30 | + // this should have already been detected by the normalization strategy |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * @return array |
|
37 | - */ |
|
38 | - public function get_jquery_validation_rule_array() |
|
39 | - { |
|
40 | - return array( |
|
41 | - 'number' => true, |
|
42 | - 'step' => 1, |
|
43 | - 'messages' => array( |
|
44 | - 'number' => $this->get_validation_error_message(), |
|
45 | - 'step' => $this->get_validation_error_message() |
|
46 | - ) |
|
47 | - ); |
|
48 | - } |
|
35 | + /** |
|
36 | + * @return array |
|
37 | + */ |
|
38 | + public function get_jquery_validation_rule_array() |
|
39 | + { |
|
40 | + return array( |
|
41 | + 'number' => true, |
|
42 | + 'step' => 1, |
|
43 | + 'messages' => array( |
|
44 | + 'number' => $this->get_validation_error_message(), |
|
45 | + 'step' => $this->get_validation_error_message() |
|
46 | + ) |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function __construct($validation_error_message = null) |
21 | 21 | { |
22 | - if (! $validation_error_message) { |
|
22 | + if ( ! $validation_error_message) { |
|
23 | 23 | $validation_error_message = sprintf( |
24 | 24 | esc_html__('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"), |
25 | 25 | '<br />', |
@@ -13,62 +13,62 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base |
15 | 15 | { |
16 | - /** |
|
17 | - * @param null $validation_error_message |
|
18 | - */ |
|
19 | - public function __construct($validation_error_message = null) |
|
20 | - { |
|
21 | - if (! $validation_error_message) { |
|
22 | - $validation_error_message = sprintf( |
|
23 | - esc_html__('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"), |
|
24 | - '<br />', |
|
25 | - $this->get_list_of_allowed_tags() |
|
26 | - ); |
|
27 | - } |
|
28 | - parent::__construct($validation_error_message); |
|
29 | - } |
|
16 | + /** |
|
17 | + * @param null $validation_error_message |
|
18 | + */ |
|
19 | + public function __construct($validation_error_message = null) |
|
20 | + { |
|
21 | + if (! $validation_error_message) { |
|
22 | + $validation_error_message = sprintf( |
|
23 | + esc_html__('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"), |
|
24 | + '<br />', |
|
25 | + $this->get_list_of_allowed_tags() |
|
26 | + ); |
|
27 | + } |
|
28 | + parent::__construct($validation_error_message); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * get_list_of_allowed_tags |
|
34 | - * |
|
35 | - * generates and returns a string that lists the top-level HTML tags that are allowable for this input |
|
36 | - * |
|
37 | - * @return string |
|
38 | - */ |
|
39 | - public function get_list_of_allowed_tags() |
|
40 | - { |
|
41 | - $tags_we_allow = $this->getAllowedTags(); |
|
42 | - ksort($tags_we_allow); |
|
43 | - return implode(', ', array_keys($tags_we_allow)); |
|
44 | - } |
|
32 | + /** |
|
33 | + * get_list_of_allowed_tags |
|
34 | + * |
|
35 | + * generates and returns a string that lists the top-level HTML tags that are allowable for this input |
|
36 | + * |
|
37 | + * @return string |
|
38 | + */ |
|
39 | + public function get_list_of_allowed_tags() |
|
40 | + { |
|
41 | + $tags_we_allow = $this->getAllowedTags(); |
|
42 | + ksort($tags_we_allow); |
|
43 | + return implode(', ', array_keys($tags_we_allow)); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * Returns an array whose keys are allowed tags and values are an array of allowed attributes |
|
49 | - * |
|
50 | - * @return array |
|
51 | - */ |
|
52 | - protected function getAllowedTags() |
|
53 | - { |
|
54 | - global $allowedposttags; |
|
55 | - return array_merge_recursive( |
|
56 | - $allowedposttags, |
|
57 | - EEH_HTML::get_simple_tags() |
|
58 | - ); |
|
59 | - } |
|
47 | + /** |
|
48 | + * Returns an array whose keys are allowed tags and values are an array of allowed attributes |
|
49 | + * |
|
50 | + * @return array |
|
51 | + */ |
|
52 | + protected function getAllowedTags() |
|
53 | + { |
|
54 | + global $allowedposttags; |
|
55 | + return array_merge_recursive( |
|
56 | + $allowedposttags, |
|
57 | + EEH_HTML::get_simple_tags() |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - /** |
|
63 | - * @param $normalized_value |
|
64 | - * @throws \EE_Validation_Error |
|
65 | - */ |
|
66 | - public function validate($normalized_value) |
|
67 | - { |
|
68 | - parent::validate($normalized_value); |
|
69 | - $normalized_value_sans_tags = wp_kses("$normalized_value", $this->getAllowedTags()); |
|
70 | - if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) { |
|
71 | - throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags'); |
|
72 | - } |
|
73 | - } |
|
62 | + /** |
|
63 | + * @param $normalized_value |
|
64 | + * @throws \EE_Validation_Error |
|
65 | + */ |
|
66 | + public function validate($normalized_value) |
|
67 | + { |
|
68 | + parent::validate($normalized_value); |
|
69 | + $normalized_value_sans_tags = wp_kses("$normalized_value", $this->getAllowedTags()); |
|
70 | + if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) { |
|
71 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags'); |
|
72 | + } |
|
73 | + } |
|
74 | 74 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function __construct($validation_error_message = null) |
21 | 21 | { |
22 | - if (! $validation_error_message) { |
|
22 | + if ( ! $validation_error_message) { |
|
23 | 23 | $validation_error_message = esc_html__("Please enter a valid credit card number", "event_espresso"); |
24 | 24 | } |
25 | 25 | parent::__construct( |
@@ -13,19 +13,19 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Credit_Card_Validation_Strategy extends EE_Text_Validation_Strategy |
15 | 15 | { |
16 | - /** |
|
17 | - * @param null $validation_error_message |
|
18 | - */ |
|
19 | - public function __construct($validation_error_message = null) |
|
20 | - { |
|
21 | - if (! $validation_error_message) { |
|
22 | - $validation_error_message = esc_html__("Please enter a valid credit card number", "event_espresso"); |
|
23 | - } |
|
24 | - parent::__construct( |
|
25 | - $validation_error_message, |
|
26 | - // @codingStandardsIgnoreStart |
|
27 | - '~^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|2[2-7][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$~' |
|
28 | - // @codingStandardsIgnoreEnd |
|
29 | - ); |
|
30 | - } |
|
16 | + /** |
|
17 | + * @param null $validation_error_message |
|
18 | + */ |
|
19 | + public function __construct($validation_error_message = null) |
|
20 | + { |
|
21 | + if (! $validation_error_message) { |
|
22 | + $validation_error_message = esc_html__("Please enter a valid credit card number", "event_espresso"); |
|
23 | + } |
|
24 | + parent::__construct( |
|
25 | + $validation_error_message, |
|
26 | + // @codingStandardsIgnoreStart |
|
27 | + '~^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|2[2-7][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$~' |
|
28 | + // @codingStandardsIgnoreEnd |
|
29 | + ); |
|
30 | + } |
|
31 | 31 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function validate($normalized_value) |
23 | 23 | { |
24 | 24 | parent::validate($normalized_value); |
25 | - if (! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
25 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
26 | 26 | throw new EE_Error(sprintf(esc_html__("Cannot use Enum Validation Strategy with an input that doesn't have options", "event_espresso"))); |
27 | 27 | } |
28 | 28 | $enum_options = $this->_input->flat_options(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function get_validation_error_message() |
50 | 50 | { |
51 | 51 | $parent_validation_error_message = parent::get_validation_error_message(); |
52 | - if (! $parent_validation_error_message) { |
|
52 | + if ( ! $parent_validation_error_message) { |
|
53 | 53 | $enum_options = $this->_input instanceof EE_Form_Input_With_Options_Base ? $this->_input->flat_options() : ''; |
54 | 54 | return sprintf( |
55 | 55 | esc_html__("This is not allowed option. Allowed options are %s.", "event_espresso"), |
@@ -11,51 +11,51 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Enum_Validation_Strategy extends EE_Validation_Strategy_Base |
13 | 13 | { |
14 | - /** |
|
15 | - * Check that the value is in the allowed list |
|
16 | - * @param $normalized_value |
|
17 | - * @throws EE_Error |
|
18 | - * @throws EE_Validation_Error |
|
19 | - * @return boolean |
|
20 | - */ |
|
21 | - public function validate($normalized_value) |
|
22 | - { |
|
23 | - parent::validate($normalized_value); |
|
24 | - if (! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
25 | - throw new EE_Error(sprintf(esc_html__("Cannot use Enum Validation Strategy with an input that doesn't have options", "event_espresso"))); |
|
26 | - } |
|
27 | - $enum_options = $this->_input->flat_options(); |
|
28 | - if ($normalized_value === true) { |
|
29 | - $normalized_value = 1; |
|
30 | - } elseif ($normalized_value === false) { |
|
31 | - $normalized_value = 0; |
|
32 | - } |
|
33 | - if ($normalized_value !== null && ! array_key_exists($normalized_value, $enum_options)) { |
|
34 | - throw new EE_Validation_Error( |
|
35 | - $this->get_validation_error_message(), |
|
36 | - 'invalid_enum_value' |
|
37 | - ); |
|
38 | - } else { |
|
39 | - return true; |
|
40 | - } |
|
41 | - } |
|
14 | + /** |
|
15 | + * Check that the value is in the allowed list |
|
16 | + * @param $normalized_value |
|
17 | + * @throws EE_Error |
|
18 | + * @throws EE_Validation_Error |
|
19 | + * @return boolean |
|
20 | + */ |
|
21 | + public function validate($normalized_value) |
|
22 | + { |
|
23 | + parent::validate($normalized_value); |
|
24 | + if (! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
25 | + throw new EE_Error(sprintf(esc_html__("Cannot use Enum Validation Strategy with an input that doesn't have options", "event_espresso"))); |
|
26 | + } |
|
27 | + $enum_options = $this->_input->flat_options(); |
|
28 | + if ($normalized_value === true) { |
|
29 | + $normalized_value = 1; |
|
30 | + } elseif ($normalized_value === false) { |
|
31 | + $normalized_value = 0; |
|
32 | + } |
|
33 | + if ($normalized_value !== null && ! array_key_exists($normalized_value, $enum_options)) { |
|
34 | + throw new EE_Validation_Error( |
|
35 | + $this->get_validation_error_message(), |
|
36 | + 'invalid_enum_value' |
|
37 | + ); |
|
38 | + } else { |
|
39 | + return true; |
|
40 | + } |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * If we are using the default validation error message, make it dynamic based |
|
45 | - * on the allowed options. |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function get_validation_error_message() |
|
49 | - { |
|
50 | - $parent_validation_error_message = parent::get_validation_error_message(); |
|
51 | - if (! $parent_validation_error_message) { |
|
52 | - $enum_options = $this->_input instanceof EE_Form_Input_With_Options_Base ? $this->_input->flat_options() : ''; |
|
53 | - return sprintf( |
|
54 | - esc_html__("This is not allowed option. Allowed options are %s.", "event_espresso"), |
|
55 | - implode(', ', $enum_options) |
|
56 | - ); |
|
57 | - } else { |
|
58 | - return $parent_validation_error_message; |
|
59 | - } |
|
60 | - } |
|
43 | + /** |
|
44 | + * If we are using the default validation error message, make it dynamic based |
|
45 | + * on the allowed options. |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function get_validation_error_message() |
|
49 | + { |
|
50 | + $parent_validation_error_message = parent::get_validation_error_message(); |
|
51 | + if (! $parent_validation_error_message) { |
|
52 | + $enum_options = $this->_input instanceof EE_Form_Input_With_Options_Base ? $this->_input->flat_options() : ''; |
|
53 | + return sprintf( |
|
54 | + esc_html__("This is not allowed option. Allowed options are %s.", "event_espresso"), |
|
55 | + implode(', ', $enum_options) |
|
56 | + ); |
|
57 | + } else { |
|
58 | + return $parent_validation_error_message; |
|
59 | + } |
|
60 | + } |
|
61 | 61 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function __construct($validation_error_message = null) |
21 | 21 | { |
22 | - if (! $validation_error_message) { |
|
22 | + if ( ! $validation_error_message) { |
|
23 | 23 | $validation_error_message = esc_html__("This field is required.", "event_espresso"); |
24 | 24 | } |
25 | 25 | parent::__construct($validation_error_message); |
@@ -11,54 +11,54 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base |
13 | 13 | { |
14 | - /** |
|
15 | - * @param string $validation_error_message |
|
16 | - */ |
|
17 | - public function __construct($validation_error_message = null) |
|
18 | - { |
|
19 | - if (! $validation_error_message) { |
|
20 | - $validation_error_message = esc_html__("This field is required.", "event_espresso"); |
|
21 | - } |
|
22 | - parent::__construct($validation_error_message); |
|
23 | - } |
|
14 | + /** |
|
15 | + * @param string $validation_error_message |
|
16 | + */ |
|
17 | + public function __construct($validation_error_message = null) |
|
18 | + { |
|
19 | + if (! $validation_error_message) { |
|
20 | + $validation_error_message = esc_html__("This field is required.", "event_espresso"); |
|
21 | + } |
|
22 | + parent::__construct($validation_error_message); |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * just checks the field isn't blank, provided the requirement conditions |
|
29 | - * indicate this input is still required |
|
30 | - * |
|
31 | - * @param $normalized_value |
|
32 | - * @return bool |
|
33 | - * @throws \EE_Error |
|
34 | - * @throws \EE_Validation_Error |
|
35 | - */ |
|
36 | - public function validate($normalized_value) |
|
37 | - { |
|
38 | - if ( |
|
39 | - $normalized_value === '' |
|
40 | - || $normalized_value === null |
|
41 | - || $normalized_value === array() |
|
42 | - ) { |
|
43 | - throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
44 | - } else { |
|
45 | - return true; |
|
46 | - } |
|
47 | - } |
|
27 | + /** |
|
28 | + * just checks the field isn't blank, provided the requirement conditions |
|
29 | + * indicate this input is still required |
|
30 | + * |
|
31 | + * @param $normalized_value |
|
32 | + * @return bool |
|
33 | + * @throws \EE_Error |
|
34 | + * @throws \EE_Validation_Error |
|
35 | + */ |
|
36 | + public function validate($normalized_value) |
|
37 | + { |
|
38 | + if ( |
|
39 | + $normalized_value === '' |
|
40 | + || $normalized_value === null |
|
41 | + || $normalized_value === array() |
|
42 | + ) { |
|
43 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
44 | + } else { |
|
45 | + return true; |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * @return array |
|
53 | - * @throws \EE_Error |
|
54 | - */ |
|
55 | - public function get_jquery_validation_rule_array() |
|
56 | - { |
|
57 | - return array( |
|
58 | - 'required' => true, |
|
59 | - 'messages' => array( |
|
60 | - 'required' => $this->get_validation_error_message() |
|
61 | - ) |
|
62 | - ); |
|
63 | - } |
|
51 | + /** |
|
52 | + * @return array |
|
53 | + * @throws \EE_Error |
|
54 | + */ |
|
55 | + public function get_jquery_validation_rule_array() |
|
56 | + { |
|
57 | + return array( |
|
58 | + 'required' => true, |
|
59 | + 'messages' => array( |
|
60 | + 'required' => $this->get_validation_error_message() |
|
61 | + ) |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct($validation_error_message = null, $model_name = '', $query_params = array(), $input_field_name = '') |
35 | 35 | { |
36 | - if (! EE_Registry::instance()->is_model_name($model_name)) { |
|
36 | + if ( ! EE_Registry::instance()->is_model_name($model_name)) { |
|
37 | 37 | throw new EE_Error(sprintf(esc_html__('You must provide a valid model object ', 'event_espresso'), $model_name)); |
38 | 38 | } |
39 | 39 | $this->_model = EE_Registry::instance()->load_model($model_name); |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | return true; |
60 | 60 | } |
61 | 61 | $combined_query_params = $this->get_query_params(); |
62 | - $combined_query_params[0][ $this->treat_input_as_field() ] = $normalized_value; |
|
63 | - if (! $this->get_model()->exists($combined_query_params)) { |
|
62 | + $combined_query_params[0][$this->treat_input_as_field()] = $normalized_value; |
|
63 | + if ( ! $this->get_model()->exists($combined_query_params)) { |
|
64 | 64 | throw new EE_Validation_Error($this->get_validation_error_message(), 'no_matching_model_object'); |
65 | 65 | } |
66 | 66 | } |
@@ -13,86 +13,86 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Model_Matching_Query_Validation_Strategy extends EE_Validation_Strategy_Base |
15 | 15 | { |
16 | - /** |
|
17 | - * |
|
18 | - * @var EEM_Base |
|
19 | - */ |
|
20 | - protected $_model; |
|
21 | - protected $_query_params; |
|
22 | - protected $_input_field_name; |
|
16 | + /** |
|
17 | + * |
|
18 | + * @var EEM_Base |
|
19 | + */ |
|
20 | + protected $_model; |
|
21 | + protected $_query_params; |
|
22 | + protected $_input_field_name; |
|
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @param string $validation_error_message |
|
28 | - * @param string $model_name name of an EEM_Base model |
|
29 | - * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
30 | - * @param string $input_field_name the input will be treated as this field's value |
|
31 | - * @throws \EE_Error |
|
32 | - */ |
|
33 | - public function __construct($validation_error_message = null, $model_name = '', $query_params = array(), $input_field_name = '') |
|
34 | - { |
|
35 | - if (! EE_Registry::instance()->is_model_name($model_name)) { |
|
36 | - throw new EE_Error(sprintf(esc_html__('You must provide a valid model object ', 'event_espresso'), $model_name)); |
|
37 | - } |
|
38 | - $this->_model = EE_Registry::instance()->load_model($model_name); |
|
39 | - $this->_query_params = $query_params; |
|
40 | - if (empty($input_field_name)) { |
|
41 | - $input_field_name = $this->_model->primary_key_name(); |
|
42 | - } |
|
43 | - $this->_input_field_name = $input_field_name; |
|
44 | - parent::__construct($validation_error_message); |
|
45 | - } |
|
26 | + /** |
|
27 | + * @param string $validation_error_message |
|
28 | + * @param string $model_name name of an EEM_Base model |
|
29 | + * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
30 | + * @param string $input_field_name the input will be treated as this field's value |
|
31 | + * @throws \EE_Error |
|
32 | + */ |
|
33 | + public function __construct($validation_error_message = null, $model_name = '', $query_params = array(), $input_field_name = '') |
|
34 | + { |
|
35 | + if (! EE_Registry::instance()->is_model_name($model_name)) { |
|
36 | + throw new EE_Error(sprintf(esc_html__('You must provide a valid model object ', 'event_espresso'), $model_name)); |
|
37 | + } |
|
38 | + $this->_model = EE_Registry::instance()->load_model($model_name); |
|
39 | + $this->_query_params = $query_params; |
|
40 | + if (empty($input_field_name)) { |
|
41 | + $input_field_name = $this->_model->primary_key_name(); |
|
42 | + } |
|
43 | + $this->_input_field_name = $input_field_name; |
|
44 | + parent::__construct($validation_error_message); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * @param $normalized_value |
|
51 | - * @return bool|void |
|
52 | - * @throws \EE_Error |
|
53 | - * @throws \EE_Validation_Error |
|
54 | - */ |
|
55 | - public function validate($normalized_value) |
|
56 | - { |
|
57 | - if (empty($normalized_value)) { |
|
58 | - return true; |
|
59 | - } |
|
60 | - $combined_query_params = $this->get_query_params(); |
|
61 | - $combined_query_params[0][ $this->treat_input_as_field() ] = $normalized_value; |
|
62 | - if (! $this->get_model()->exists($combined_query_params)) { |
|
63 | - throw new EE_Validation_Error($this->get_validation_error_message(), 'no_matching_model_object'); |
|
64 | - } |
|
65 | - } |
|
49 | + /** |
|
50 | + * @param $normalized_value |
|
51 | + * @return bool|void |
|
52 | + * @throws \EE_Error |
|
53 | + * @throws \EE_Validation_Error |
|
54 | + */ |
|
55 | + public function validate($normalized_value) |
|
56 | + { |
|
57 | + if (empty($normalized_value)) { |
|
58 | + return true; |
|
59 | + } |
|
60 | + $combined_query_params = $this->get_query_params(); |
|
61 | + $combined_query_params[0][ $this->treat_input_as_field() ] = $normalized_value; |
|
62 | + if (! $this->get_model()->exists($combined_query_params)) { |
|
63 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'no_matching_model_object'); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Gets the model used for querying |
|
69 | - * @return EEM_Base |
|
70 | - */ |
|
71 | - public function get_model() |
|
72 | - { |
|
73 | - return $this->_model; |
|
74 | - } |
|
67 | + /** |
|
68 | + * Gets the model used for querying |
|
69 | + * @return EEM_Base |
|
70 | + */ |
|
71 | + public function get_model() |
|
72 | + { |
|
73 | + return $this->_model; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Returns query params used for model query |
|
78 | - * @return array |
|
79 | - */ |
|
80 | - public function get_query_params() |
|
81 | - { |
|
82 | - return (array) $this->_query_params; |
|
83 | - } |
|
76 | + /** |
|
77 | + * Returns query params used for model query |
|
78 | + * @return array |
|
79 | + */ |
|
80 | + public function get_query_params() |
|
81 | + { |
|
82 | + return (array) $this->_query_params; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Gets the name of the field that will be used for lookup. |
|
87 | - * eg it could be "EVT_name", meaning that if there is a model object in |
|
88 | - * the database that has that event name, and matching the other query parameters |
|
89 | - * on this strategy, the input will pass validation server-side |
|
90 | - * @return string |
|
91 | - */ |
|
92 | - public function treat_input_as_field() |
|
93 | - { |
|
94 | - return $this->_input_field_name; |
|
95 | - } |
|
85 | + /** |
|
86 | + * Gets the name of the field that will be used for lookup. |
|
87 | + * eg it could be "EVT_name", meaning that if there is a model object in |
|
88 | + * the database that has that event name, and matching the other query parameters |
|
89 | + * on this strategy, the input will pass validation server-side |
|
90 | + * @return string |
|
91 | + */ |
|
92 | + public function treat_input_as_field() |
|
93 | + { |
|
94 | + return $this->_input_field_name; |
|
95 | + } |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // End of file EE_FUll_HTML_Validation_Strategy.strategy.php |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function __construct($validation_error_message = null) |
21 | 21 | { |
22 | - if (! $validation_error_message) { |
|
22 | + if ( ! $validation_error_message) { |
|
23 | 23 | $validation_error_message = esc_html__("HTML tags are not permitted in this field", "event_espresso"); |
24 | 24 | } |
25 | 25 | parent::__construct($validation_error_message); |
@@ -13,28 +13,28 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Plaintext_Validation_Strategy extends EE_Validation_Strategy_Base |
15 | 15 | { |
16 | - /** |
|
17 | - * @param null $validation_error_message |
|
18 | - */ |
|
19 | - public function __construct($validation_error_message = null) |
|
20 | - { |
|
21 | - if (! $validation_error_message) { |
|
22 | - $validation_error_message = esc_html__("HTML tags are not permitted in this field", "event_espresso"); |
|
23 | - } |
|
24 | - parent::__construct($validation_error_message); |
|
25 | - } |
|
16 | + /** |
|
17 | + * @param null $validation_error_message |
|
18 | + */ |
|
19 | + public function __construct($validation_error_message = null) |
|
20 | + { |
|
21 | + if (! $validation_error_message) { |
|
22 | + $validation_error_message = esc_html__("HTML tags are not permitted in this field", "event_espresso"); |
|
23 | + } |
|
24 | + parent::__construct($validation_error_message); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * @param string|null $normalized_value |
|
29 | - * @throws EE_Validation_Error |
|
30 | - */ |
|
31 | - public function validate($normalized_value = '') |
|
32 | - { |
|
33 | - $normalized_value = (string) $normalized_value; |
|
34 | - $no_tags = wp_strip_all_tags($normalized_value); |
|
35 | - if (strlen($no_tags) < strlen(trim($normalized_value))) { |
|
36 | - throw new EE_Validation_Error($this->get_validation_error_message(), 'no_html_tags'); |
|
37 | - } |
|
38 | - parent::validate($normalized_value); |
|
39 | - } |
|
27 | + /** |
|
28 | + * @param string|null $normalized_value |
|
29 | + * @throws EE_Validation_Error |
|
30 | + */ |
|
31 | + public function validate($normalized_value = '') |
|
32 | + { |
|
33 | + $normalized_value = (string) $normalized_value; |
|
34 | + $no_tags = wp_strip_all_tags($normalized_value); |
|
35 | + if (strlen($no_tags) < strlen(trim($normalized_value))) { |
|
36 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'no_html_tags'); |
|
37 | + } |
|
38 | + parent::validate($normalized_value); |
|
39 | + } |
|
40 | 40 | } |