@@ -9,15 +9,15 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Email_Input extends EE_Text_Input |
11 | 11 | { |
12 | - /** |
|
13 | - * @param array $input_settings |
|
14 | - */ |
|
15 | - public function __construct($input_settings = []) |
|
16 | - { |
|
17 | - $this->_add_validation_strategy( |
|
18 | - new EE_Email_Validation_Strategy($input_settings['validation_error_message'] ?? null) |
|
19 | - ); |
|
20 | - parent::__construct($input_settings, 'email'); |
|
21 | - $this->set_html_class($this->html_class() . ' email'); |
|
22 | - } |
|
12 | + /** |
|
13 | + * @param array $input_settings |
|
14 | + */ |
|
15 | + public function __construct($input_settings = []) |
|
16 | + { |
|
17 | + $this->_add_validation_strategy( |
|
18 | + new EE_Email_Validation_Strategy($input_settings['validation_error_message'] ?? null) |
|
19 | + ); |
|
20 | + parent::__construct($input_settings, 'email'); |
|
21 | + $this->set_html_class($this->html_class() . ' email'); |
|
22 | + } |
|
23 | 23 | } |
@@ -18,6 +18,6 @@ |
||
18 | 18 | new EE_Email_Validation_Strategy($input_settings['validation_error_message'] ?? null) |
19 | 19 | ); |
20 | 20 | parent::__construct($input_settings, 'email'); |
21 | - $this->set_html_class($this->html_class() . ' email'); |
|
21 | + $this->set_html_class($this->html_class().' email'); |
|
22 | 22 | } |
23 | 23 | } |
@@ -10,18 +10,18 @@ |
||
10 | 10 | */ |
11 | 11 | class EE_Credit_Card_Input extends EE_Form_Input_Base |
12 | 12 | { |
13 | - /** |
|
14 | - * @param array $input_settings |
|
15 | - */ |
|
16 | - public function __construct($input_settings = []) |
|
17 | - { |
|
18 | - $input_settings['required'] = $input_settings['required'] ?? true; |
|
19 | - $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
|
20 | - $this->_set_normalization_strategy(new EE_Credit_Card_Normalization()); |
|
21 | - $this->_add_validation_strategy( |
|
22 | - new EE_Credit_Card_Validation_Strategy($input_settings['validation_error_message'] ?? null) |
|
23 | - ); |
|
24 | - $this->set_sensitive_data_removal_strategy(new EE_Credit_Card_Sensitive_Data_Removal()); |
|
25 | - parent::__construct($input_settings); |
|
26 | - } |
|
13 | + /** |
|
14 | + * @param array $input_settings |
|
15 | + */ |
|
16 | + public function __construct($input_settings = []) |
|
17 | + { |
|
18 | + $input_settings['required'] = $input_settings['required'] ?? true; |
|
19 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
|
20 | + $this->_set_normalization_strategy(new EE_Credit_Card_Normalization()); |
|
21 | + $this->_add_validation_strategy( |
|
22 | + new EE_Credit_Card_Validation_Strategy($input_settings['validation_error_message'] ?? null) |
|
23 | + ); |
|
24 | + $this->set_sensitive_data_removal_strategy(new EE_Credit_Card_Sensitive_Data_Removal()); |
|
25 | + parent::__construct($input_settings); |
|
26 | + } |
|
27 | 27 | } |
@@ -12,62 +12,62 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Checkbox_Dropdown_Selector_Input extends EE_Form_Input_With_Options_Base |
14 | 14 | { |
15 | - /** |
|
16 | - * @var string text to display on the select button itself |
|
17 | - */ |
|
18 | - protected $_select_button_text; |
|
15 | + /** |
|
16 | + * @var string text to display on the select button itself |
|
17 | + */ |
|
18 | + protected $_select_button_text; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @param array $answer_options |
|
22 | - * @param array $input_settings |
|
23 | - */ |
|
24 | - public function __construct($answer_options, $input_settings = array()) |
|
25 | - { |
|
26 | - $this->_select_button_text = EEH_Array::is_set( |
|
27 | - $input_settings, |
|
28 | - 'select_button_text', |
|
29 | - esc_html__('Select', 'event_espresso') |
|
30 | - ); |
|
31 | - $display_strategy = new EE_Checkbox_Dropdown_Selector_Display_Strategy(); |
|
32 | - $this->_set_display_strategy($display_strategy); |
|
33 | - $this->load_iframe_assets($display_strategy); |
|
34 | - $this->_add_validation_strategy( |
|
35 | - new EE_Many_Valued_Validation_Strategy( |
|
36 | - array( |
|
37 | - new EE_Enum_Validation_Strategy( |
|
38 | - $input_settings['validation_error_message'] ?? null |
|
39 | - ), |
|
40 | - ) |
|
41 | - ) |
|
42 | - ); |
|
43 | - $this->_multiple_selections = true; |
|
44 | - parent::__construct($answer_options, $input_settings); |
|
45 | - } |
|
20 | + /** |
|
21 | + * @param array $answer_options |
|
22 | + * @param array $input_settings |
|
23 | + */ |
|
24 | + public function __construct($answer_options, $input_settings = array()) |
|
25 | + { |
|
26 | + $this->_select_button_text = EEH_Array::is_set( |
|
27 | + $input_settings, |
|
28 | + 'select_button_text', |
|
29 | + esc_html__('Select', 'event_espresso') |
|
30 | + ); |
|
31 | + $display_strategy = new EE_Checkbox_Dropdown_Selector_Display_Strategy(); |
|
32 | + $this->_set_display_strategy($display_strategy); |
|
33 | + $this->load_iframe_assets($display_strategy); |
|
34 | + $this->_add_validation_strategy( |
|
35 | + new EE_Many_Valued_Validation_Strategy( |
|
36 | + array( |
|
37 | + new EE_Enum_Validation_Strategy( |
|
38 | + $input_settings['validation_error_message'] ?? null |
|
39 | + ), |
|
40 | + ) |
|
41 | + ) |
|
42 | + ); |
|
43 | + $this->_multiple_selections = true; |
|
44 | + parent::__construct($answer_options, $input_settings); |
|
45 | + } |
|
46 | 46 | |
47 | - /* |
|
47 | + /* |
|
48 | 48 | * Returns the text to display in the select button |
49 | 49 | */ |
50 | - public function select_button_text() |
|
51 | - { |
|
52 | - return $this->_select_button_text; |
|
53 | - } |
|
50 | + public function select_button_text() |
|
51 | + { |
|
52 | + return $this->_select_button_text; |
|
53 | + } |
|
54 | 54 | |
55 | - /* |
|
55 | + /* |
|
56 | 56 | * add css and js for iframes |
57 | 57 | */ |
58 | - protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy) |
|
59 | - { |
|
60 | - add_filter( |
|
61 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
62 | - array($display_strategy, 'iframe_css') |
|
63 | - ); |
|
64 | - add_filter( |
|
65 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
66 | - array($display_strategy, 'iframe_js') |
|
67 | - ); |
|
68 | - add_filter( |
|
69 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
70 | - array($display_strategy, 'iframe_css') |
|
71 | - ); |
|
72 | - } |
|
58 | + protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy) |
|
59 | + { |
|
60 | + add_filter( |
|
61 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
62 | + array($display_strategy, 'iframe_css') |
|
63 | + ); |
|
64 | + add_filter( |
|
65 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
66 | + array($display_strategy, 'iframe_js') |
|
67 | + ); |
|
68 | + add_filter( |
|
69 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
70 | + array($display_strategy, 'iframe_css') |
|
71 | + ); |
|
72 | + } |
|
73 | 73 | } |
@@ -10,17 +10,17 @@ |
||
10 | 10 | */ |
11 | 11 | class EE_Email_Confirm_Input extends EE_Email_Input |
12 | 12 | { |
13 | - /** |
|
14 | - * @param array $input_settings |
|
15 | - */ |
|
16 | - public function __construct($input_settings = []) |
|
17 | - { |
|
18 | - $this->_add_validation_strategy( |
|
19 | - new EE_Equal_To_Validation_Strategy( |
|
20 | - $input_settings['validation_error_message'] ?? null, |
|
21 | - '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
22 | - ) |
|
23 | - ); |
|
24 | - parent::__construct($input_settings); |
|
25 | - } |
|
13 | + /** |
|
14 | + * @param array $input_settings |
|
15 | + */ |
|
16 | + public function __construct($input_settings = []) |
|
17 | + { |
|
18 | + $this->_add_validation_strategy( |
|
19 | + new EE_Equal_To_Validation_Strategy( |
|
20 | + $input_settings['validation_error_message'] ?? null, |
|
21 | + '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
22 | + ) |
|
23 | + ); |
|
24 | + parent::__construct($input_settings); |
|
25 | + } |
|
26 | 26 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $this->_add_validation_strategy( |
19 | 19 | new EE_Equal_To_Validation_Strategy( |
20 | 20 | $input_settings['validation_error_message'] ?? null, |
21 | - '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
21 | + '#'.str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
22 | 22 | ) |
23 | 23 | ); |
24 | 24 | parent::__construct($input_settings); |
@@ -9,23 +9,23 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Float_Input extends EE_Form_Input_Base |
11 | 11 | { |
12 | - /** |
|
13 | - * @param array $input_settings |
|
14 | - * @throws InvalidArgumentException |
|
15 | - */ |
|
16 | - public function __construct($input_settings = []) |
|
17 | - { |
|
18 | - $this->_set_display_strategy( |
|
19 | - new EE_Number_Input_Display_Strategy( |
|
20 | - $input_settings['min_value'] ?? null, |
|
21 | - $input_settings['max_value'] ?? null, |
|
22 | - $input_settings['step_value'] ?? null |
|
23 | - ) |
|
24 | - ); |
|
25 | - $this->_set_normalization_strategy(new EE_Float_Normalization()); |
|
26 | - $this->_add_validation_strategy( |
|
27 | - new EE_Float_Validation_Strategy($input_settings['validation_error_message'] ?? null) |
|
28 | - ); |
|
29 | - parent::__construct($input_settings); |
|
30 | - } |
|
12 | + /** |
|
13 | + * @param array $input_settings |
|
14 | + * @throws InvalidArgumentException |
|
15 | + */ |
|
16 | + public function __construct($input_settings = []) |
|
17 | + { |
|
18 | + $this->_set_display_strategy( |
|
19 | + new EE_Number_Input_Display_Strategy( |
|
20 | + $input_settings['min_value'] ?? null, |
|
21 | + $input_settings['max_value'] ?? null, |
|
22 | + $input_settings['step_value'] ?? null |
|
23 | + ) |
|
24 | + ); |
|
25 | + $this->_set_normalization_strategy(new EE_Float_Normalization()); |
|
26 | + $this->_add_validation_strategy( |
|
27 | + new EE_Float_Validation_Strategy($input_settings['validation_error_message'] ?? null) |
|
28 | + ); |
|
29 | + parent::__construct($input_settings); |
|
30 | + } |
|
31 | 31 | } |
@@ -13,13 +13,13 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_URL_Input extends EE_Text_Input |
15 | 15 | { |
16 | - /** |
|
17 | - * @param array $options |
|
18 | - */ |
|
19 | - public function __construct($options = array()) |
|
20 | - { |
|
21 | - $options['other_html_attributes'] = $options['other_html_attributes'] ?? 'placeholder="https://www.google.com"'; |
|
22 | - $this->_add_validation_strategy(new EE_URL_Validation_Strategy()); |
|
23 | - parent::__construct($options, 'url'); |
|
24 | - } |
|
16 | + /** |
|
17 | + * @param array $options |
|
18 | + */ |
|
19 | + public function __construct($options = array()) |
|
20 | + { |
|
21 | + $options['other_html_attributes'] = $options['other_html_attributes'] ?? 'placeholder="https://www.google.com"'; |
|
22 | + $this->_add_validation_strategy(new EE_URL_Validation_Strategy()); |
|
23 | + parent::__construct($options, 'url'); |
|
24 | + } |
|
25 | 25 | } |
@@ -9,29 +9,29 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Hidden_Input extends EE_Form_Input_Base |
11 | 11 | { |
12 | - /** |
|
13 | - * @param array $input_settings |
|
14 | - */ |
|
15 | - public function __construct($input_settings = []) |
|
16 | - { |
|
17 | - $this->_set_display_strategy(new EE_Hidden_Display_Strategy()); |
|
18 | - if ( |
|
19 | - isset($input_settings['normalization_strategy']) |
|
20 | - && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base |
|
21 | - ) { |
|
22 | - $this->_set_normalization_strategy($input_settings['normalization_strategy']); |
|
23 | - } else { |
|
24 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
25 | - } |
|
26 | - parent::__construct($input_settings); |
|
27 | - } |
|
12 | + /** |
|
13 | + * @param array $input_settings |
|
14 | + */ |
|
15 | + public function __construct($input_settings = []) |
|
16 | + { |
|
17 | + $this->_set_display_strategy(new EE_Hidden_Display_Strategy()); |
|
18 | + if ( |
|
19 | + isset($input_settings['normalization_strategy']) |
|
20 | + && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base |
|
21 | + ) { |
|
22 | + $this->_set_normalization_strategy($input_settings['normalization_strategy']); |
|
23 | + } else { |
|
24 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
25 | + } |
|
26 | + parent::__construct($input_settings); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return string |
|
32 | - */ |
|
33 | - public function get_html_for_label() |
|
34 | - { |
|
35 | - return ''; |
|
36 | - } |
|
30 | + /** |
|
31 | + * @return string |
|
32 | + */ |
|
33 | + public function get_html_for_label() |
|
34 | + { |
|
35 | + return ''; |
|
36 | + } |
|
37 | 37 | } |
@@ -12,22 +12,22 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $input_settings |
|
17 | - */ |
|
18 | - public function __construct($input_settings = []) |
|
19 | - { |
|
20 | - $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
|
21 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
22 | - $this->_add_validation_strategy( |
|
23 | - LoaderFactory::getLoader()->getNew( |
|
24 | - 'EE_URL_Validation_Strategy', |
|
25 | - [ |
|
26 | - $input_settings['validation_error_message'] ?? '', |
|
27 | - false, |
|
28 | - ] |
|
29 | - ) |
|
30 | - ); |
|
31 | - parent::__construct($input_settings); |
|
32 | - } |
|
15 | + /** |
|
16 | + * @param array $input_settings |
|
17 | + */ |
|
18 | + public function __construct($input_settings = []) |
|
19 | + { |
|
20 | + $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
|
21 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
22 | + $this->_add_validation_strategy( |
|
23 | + LoaderFactory::getLoader()->getNew( |
|
24 | + 'EE_URL_Validation_Strategy', |
|
25 | + [ |
|
26 | + $input_settings['validation_error_message'] ?? '', |
|
27 | + false, |
|
28 | + ] |
|
29 | + ) |
|
30 | + ); |
|
31 | + parent::__construct($input_settings); |
|
32 | + } |
|
33 | 33 | } |
@@ -14,17 +14,17 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_Phone_Input extends EE_Text_Input |
16 | 16 | { |
17 | - /** |
|
18 | - * @param array $options |
|
19 | - */ |
|
20 | - public function __construct($options = array()) |
|
21 | - { |
|
22 | - $this->_add_validation_strategy( |
|
23 | - new EE_Text_Validation_Strategy( |
|
24 | - esc_html__('Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso'), |
|
25 | - '~^(([\d]{10})|(^[\d]{3}-[\d]{3}-[\d]{4}))$~' |
|
26 | - ) |
|
27 | - ); |
|
28 | - parent::__construct($options, 'tel'); |
|
29 | - } |
|
17 | + /** |
|
18 | + * @param array $options |
|
19 | + */ |
|
20 | + public function __construct($options = array()) |
|
21 | + { |
|
22 | + $this->_add_validation_strategy( |
|
23 | + new EE_Text_Validation_Strategy( |
|
24 | + esc_html__('Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso'), |
|
25 | + '~^(([\d]{10})|(^[\d]{3}-[\d]{3}-[\d]{4}))$~' |
|
26 | + ) |
|
27 | + ); |
|
28 | + parent::__construct($options, 'tel'); |
|
29 | + } |
|
30 | 30 | } |