@@ -9,15 +9,15 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Fixed_Hidden_Input extends EE_Hidden_Input |
11 | 11 | { |
12 | - /** |
|
13 | - * Fixed Inputs are inputs that do NOT accept user input |
|
14 | - * therefore they will ALWAYS return the default value that was set upon their creation |
|
15 | - * and NO normalization or sanitization will occur because the request value is being ignored |
|
16 | - * |
|
17 | - * @param array $req_data |
|
18 | - * @return boolean whether or not there was an error |
|
19 | - */ |
|
20 | - protected function _normalize($req_data) |
|
21 | - { |
|
22 | - } |
|
12 | + /** |
|
13 | + * Fixed Inputs are inputs that do NOT accept user input |
|
14 | + * therefore they will ALWAYS return the default value that was set upon their creation |
|
15 | + * and NO normalization or sanitization will occur because the request value is being ignored |
|
16 | + * |
|
17 | + * @param array $req_data |
|
18 | + * @return boolean whether or not there was an error |
|
19 | + */ |
|
20 | + protected function _normalize($req_data) |
|
21 | + { |
|
22 | + } |
|
23 | 23 | } |
@@ -9,15 +9,15 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Credit_Card_Year_Input extends EE_Year_Input |
11 | 11 | { |
12 | - /** |
|
13 | - * @param array $input_settings |
|
14 | - * @param bool $four_digit_year |
|
15 | - * @param int $years_behind |
|
16 | - * @param int $years_ahead |
|
17 | - */ |
|
18 | - public function __construct($input_settings = array(), $four_digit_year = true, $years_behind = 0, $years_ahead = 15) |
|
19 | - { |
|
20 | - $this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal()); |
|
21 | - parent::__construct($input_settings, $four_digit_year, $years_behind, $years_ahead); |
|
22 | - } |
|
12 | + /** |
|
13 | + * @param array $input_settings |
|
14 | + * @param bool $four_digit_year |
|
15 | + * @param int $years_behind |
|
16 | + * @param int $years_ahead |
|
17 | + */ |
|
18 | + public function __construct($input_settings = array(), $four_digit_year = true, $years_behind = 0, $years_ahead = 15) |
|
19 | + { |
|
20 | + $this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal()); |
|
21 | + parent::__construct($input_settings, $four_digit_year, $years_behind, $years_ahead); |
|
22 | + } |
|
23 | 23 | } |
@@ -11,42 +11,42 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Button_Input extends EE_Form_Input_Base |
13 | 13 | { |
14 | - /** |
|
15 | - * @var string of HTML to put between the button tags |
|
16 | - */ |
|
17 | - protected $_button_content; |
|
18 | - /** |
|
19 | - * @param array $options |
|
20 | - */ |
|
21 | - public function __construct($options = array()) |
|
22 | - { |
|
23 | - if (empty($options['button_content'])) { |
|
24 | - $options['button_content'] = esc_html__('Button', 'event_espresso'); |
|
25 | - } |
|
26 | - $this->_set_display_strategy(new EE_Button_Display_Strategy()); |
|
27 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
28 | - $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
29 | - parent::__construct($options); |
|
30 | - } |
|
14 | + /** |
|
15 | + * @var string of HTML to put between the button tags |
|
16 | + */ |
|
17 | + protected $_button_content; |
|
18 | + /** |
|
19 | + * @param array $options |
|
20 | + */ |
|
21 | + public function __construct($options = array()) |
|
22 | + { |
|
23 | + if (empty($options['button_content'])) { |
|
24 | + $options['button_content'] = esc_html__('Button', 'event_espresso'); |
|
25 | + } |
|
26 | + $this->_set_display_strategy(new EE_Button_Display_Strategy()); |
|
27 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
28 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
29 | + parent::__construct($options); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * Sets the button content |
|
36 | - * @see EE_Button_Input::$_button_content |
|
37 | - * @param string $new_content |
|
38 | - */ |
|
39 | - public function set_button_content($new_content) |
|
40 | - { |
|
41 | - $this->_button_content = $new_content; |
|
42 | - } |
|
34 | + /** |
|
35 | + * Sets the button content |
|
36 | + * @see EE_Button_Input::$_button_content |
|
37 | + * @param string $new_content |
|
38 | + */ |
|
39 | + public function set_button_content($new_content) |
|
40 | + { |
|
41 | + $this->_button_content = $new_content; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Gets the button content |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function button_content() |
|
49 | - { |
|
50 | - return $this->_button_content; |
|
51 | - } |
|
44 | + /** |
|
45 | + * Gets the button content |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function button_content() |
|
49 | + { |
|
50 | + return $this->_button_content; |
|
51 | + } |
|
52 | 52 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | protected function getAttendeeStateValueForForm(EE_Attendee $attendee): string |
131 | 131 | { |
132 | 132 | // If the state input was removed, just return a blank string. |
133 | - if (! $this->has_subsection('state')) { |
|
133 | + if ( ! $this->has_subsection('state')) { |
|
134 | 134 | return ''; |
135 | 135 | } |
136 | 136 | $state_input = $this->get_input('state', false); |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | 'phone' => 'set_phone', |
180 | 180 | ]; |
181 | 181 | foreach ($fields_and_setters as $field => $setter) { |
182 | - if (! empty($data[ $field ]) && method_exists($attendee, $setter)) { |
|
183 | - $attendee->{$setter}($data[ $field ]); |
|
182 | + if ( ! empty($data[$field]) && method_exists($attendee, $setter)) { |
|
183 | + $attendee->{$setter}($data[$field]); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | return $attendee; |
@@ -13,229 +13,229 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form |
15 | 15 | { |
16 | - /** |
|
17 | - * |
|
18 | - * @param EE_Payment_Method $payment_method |
|
19 | - * @param array $options_array @see EE_Form_Section_Proper::__construct() |
|
20 | - * @throws EE_Error |
|
21 | - * @throws ReflectionException |
|
22 | - */ |
|
23 | - public function __construct(EE_Payment_Method $payment_method, $options_array = []) |
|
24 | - { |
|
25 | - $options_array['subsections'] = array_merge( |
|
26 | - [ |
|
27 | - 'first_name' => new EE_Text_Input( |
|
28 | - [ |
|
29 | - 'required' => true, |
|
30 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', |
|
31 | - 'html_label_text' => esc_html__('First Name', 'event_espresso'), |
|
32 | - ] |
|
33 | - ), |
|
34 | - 'last_name' => new EE_Text_Input( |
|
35 | - [ |
|
36 | - 'required' => true, |
|
37 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', |
|
38 | - 'html_label_text' => esc_html__('Last Name', 'event_espresso'), |
|
39 | - ] |
|
40 | - ), |
|
41 | - 'email' => new EE_Email_Input( |
|
42 | - [ |
|
43 | - 'required' => true, |
|
44 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', |
|
45 | - 'html_label_text' => esc_html__('Email', 'event_espresso'), |
|
46 | - ] |
|
47 | - ), |
|
48 | - 'address' => new EE_Text_Input( |
|
49 | - [ |
|
50 | - 'html_label_text' => esc_html__('Address', 'event_espresso'), |
|
51 | - 'required' => true, |
|
52 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-address', |
|
53 | - ] |
|
54 | - ), |
|
55 | - 'address2' => new EE_Text_Input( |
|
56 | - [ |
|
57 | - 'html_label_text' => esc_html__('Address 2', 'event_espresso'), |
|
58 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2', |
|
59 | - ] |
|
60 | - ), |
|
61 | - 'city' => new EE_Text_Input( |
|
62 | - [ |
|
63 | - 'required' => true, |
|
64 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', |
|
65 | - 'html_label_text' => esc_html__('City', 'event_espresso'), |
|
66 | - ] |
|
67 | - ), |
|
68 | - 'state' => apply_filters( |
|
69 | - 'FHEE__EE_Billing_Attendee_Info_Form__state_field', |
|
70 | - new EE_State_Select_Input( |
|
71 | - null, |
|
72 | - [ |
|
73 | - 'required' => true, |
|
74 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', |
|
75 | - 'html_label_text' => esc_html__('State', 'event_espresso'), |
|
76 | - ] |
|
77 | - ) |
|
78 | - ), |
|
79 | - 'country' => apply_filters( |
|
80 | - 'FHEE__EE_Billing_Attendee_Info_Form__country_field', |
|
81 | - new EE_Country_Select_Input( |
|
82 | - null, |
|
83 | - [ |
|
84 | - 'required' => true, |
|
85 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', |
|
86 | - 'html_label_text' => esc_html__('Country', 'event_espresso'), |
|
87 | - ] |
|
88 | - ) |
|
89 | - ), |
|
90 | - 'zip' => new EE_Text_Input( |
|
91 | - [ |
|
92 | - 'required' => true, |
|
93 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', |
|
94 | - 'html_label_text' => esc_html__('Zip', 'event_espresso'), |
|
95 | - ] |
|
96 | - ), |
|
97 | - 'phone' => new EE_Text_Input( |
|
98 | - [ |
|
99 | - 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', |
|
100 | - 'html_label_text' => esc_html__('Phone', 'event_espresso'), |
|
101 | - ] |
|
102 | - ), |
|
103 | - ], |
|
104 | - $options_array['subsections'] ?? [] |
|
105 | - ); |
|
16 | + /** |
|
17 | + * |
|
18 | + * @param EE_Payment_Method $payment_method |
|
19 | + * @param array $options_array @see EE_Form_Section_Proper::__construct() |
|
20 | + * @throws EE_Error |
|
21 | + * @throws ReflectionException |
|
22 | + */ |
|
23 | + public function __construct(EE_Payment_Method $payment_method, $options_array = []) |
|
24 | + { |
|
25 | + $options_array['subsections'] = array_merge( |
|
26 | + [ |
|
27 | + 'first_name' => new EE_Text_Input( |
|
28 | + [ |
|
29 | + 'required' => true, |
|
30 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', |
|
31 | + 'html_label_text' => esc_html__('First Name', 'event_espresso'), |
|
32 | + ] |
|
33 | + ), |
|
34 | + 'last_name' => new EE_Text_Input( |
|
35 | + [ |
|
36 | + 'required' => true, |
|
37 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', |
|
38 | + 'html_label_text' => esc_html__('Last Name', 'event_espresso'), |
|
39 | + ] |
|
40 | + ), |
|
41 | + 'email' => new EE_Email_Input( |
|
42 | + [ |
|
43 | + 'required' => true, |
|
44 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', |
|
45 | + 'html_label_text' => esc_html__('Email', 'event_espresso'), |
|
46 | + ] |
|
47 | + ), |
|
48 | + 'address' => new EE_Text_Input( |
|
49 | + [ |
|
50 | + 'html_label_text' => esc_html__('Address', 'event_espresso'), |
|
51 | + 'required' => true, |
|
52 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-address', |
|
53 | + ] |
|
54 | + ), |
|
55 | + 'address2' => new EE_Text_Input( |
|
56 | + [ |
|
57 | + 'html_label_text' => esc_html__('Address 2', 'event_espresso'), |
|
58 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2', |
|
59 | + ] |
|
60 | + ), |
|
61 | + 'city' => new EE_Text_Input( |
|
62 | + [ |
|
63 | + 'required' => true, |
|
64 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', |
|
65 | + 'html_label_text' => esc_html__('City', 'event_espresso'), |
|
66 | + ] |
|
67 | + ), |
|
68 | + 'state' => apply_filters( |
|
69 | + 'FHEE__EE_Billing_Attendee_Info_Form__state_field', |
|
70 | + new EE_State_Select_Input( |
|
71 | + null, |
|
72 | + [ |
|
73 | + 'required' => true, |
|
74 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', |
|
75 | + 'html_label_text' => esc_html__('State', 'event_espresso'), |
|
76 | + ] |
|
77 | + ) |
|
78 | + ), |
|
79 | + 'country' => apply_filters( |
|
80 | + 'FHEE__EE_Billing_Attendee_Info_Form__country_field', |
|
81 | + new EE_Country_Select_Input( |
|
82 | + null, |
|
83 | + [ |
|
84 | + 'required' => true, |
|
85 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', |
|
86 | + 'html_label_text' => esc_html__('Country', 'event_espresso'), |
|
87 | + ] |
|
88 | + ) |
|
89 | + ), |
|
90 | + 'zip' => new EE_Text_Input( |
|
91 | + [ |
|
92 | + 'required' => true, |
|
93 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', |
|
94 | + 'html_label_text' => esc_html__('Zip', 'event_espresso'), |
|
95 | + ] |
|
96 | + ), |
|
97 | + 'phone' => new EE_Text_Input( |
|
98 | + [ |
|
99 | + 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', |
|
100 | + 'html_label_text' => esc_html__('Phone', 'event_espresso'), |
|
101 | + ] |
|
102 | + ), |
|
103 | + ], |
|
104 | + $options_array['subsections'] ?? [] |
|
105 | + ); |
|
106 | 106 | |
107 | - parent::__construct($payment_method, $options_array); |
|
108 | - } |
|
107 | + parent::__construct($payment_method, $options_array); |
|
108 | + } |
|
109 | 109 | |
110 | 110 | |
111 | - /** |
|
112 | - * Sets the defaults for the billing form according to the attendee's details |
|
113 | - * |
|
114 | - * @param EE_Attendee $attendee |
|
115 | - * @throws EE_Error |
|
116 | - * @throws ReflectionException |
|
117 | - */ |
|
118 | - public function populate_from_attendee(EE_Attendee $attendee) |
|
119 | - { |
|
120 | - /** @var $attendee EE_Attendee */ |
|
121 | - $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee); |
|
122 | - $this->populate_defaults( |
|
123 | - apply_filters( |
|
124 | - 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
125 | - [ |
|
126 | - 'first_name' => $attendee->fname(), |
|
127 | - 'last_name' => $attendee->lname(), |
|
128 | - 'email' => $attendee->email(), |
|
129 | - 'address' => $attendee->address(), |
|
130 | - 'address2' => $attendee->address2(), |
|
131 | - 'city' => $attendee->city(), |
|
132 | - 'state' => $this->getAttendeeStateValueForForm($attendee), |
|
133 | - 'country' => $attendee->country_ID(), |
|
134 | - 'zip' => $attendee->zip(), |
|
135 | - 'phone' => $attendee->phone(), |
|
136 | - ], |
|
137 | - $attendee, |
|
138 | - $this |
|
139 | - ) |
|
140 | - ); |
|
141 | - } |
|
111 | + /** |
|
112 | + * Sets the defaults for the billing form according to the attendee's details |
|
113 | + * |
|
114 | + * @param EE_Attendee $attendee |
|
115 | + * @throws EE_Error |
|
116 | + * @throws ReflectionException |
|
117 | + */ |
|
118 | + public function populate_from_attendee(EE_Attendee $attendee) |
|
119 | + { |
|
120 | + /** @var $attendee EE_Attendee */ |
|
121 | + $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee); |
|
122 | + $this->populate_defaults( |
|
123 | + apply_filters( |
|
124 | + 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
125 | + [ |
|
126 | + 'first_name' => $attendee->fname(), |
|
127 | + 'last_name' => $attendee->lname(), |
|
128 | + 'email' => $attendee->email(), |
|
129 | + 'address' => $attendee->address(), |
|
130 | + 'address2' => $attendee->address2(), |
|
131 | + 'city' => $attendee->city(), |
|
132 | + 'state' => $this->getAttendeeStateValueForForm($attendee), |
|
133 | + 'country' => $attendee->country_ID(), |
|
134 | + 'zip' => $attendee->zip(), |
|
135 | + 'phone' => $attendee->phone(), |
|
136 | + ], |
|
137 | + $attendee, |
|
138 | + $this |
|
139 | + ) |
|
140 | + ); |
|
141 | + } |
|
142 | 142 | |
143 | 143 | |
144 | - /** |
|
145 | - * Gets the default value to use for the billing form's state value. |
|
146 | - * |
|
147 | - * @param EE_Attendee $attendee |
|
148 | - * @return string |
|
149 | - * @throws EE_Error |
|
150 | - * @throws ReflectionException |
|
151 | - * @since 4.10.0.p |
|
152 | - */ |
|
153 | - protected function getAttendeeStateValueForForm(EE_Attendee $attendee): string |
|
154 | - { |
|
155 | - // If the state input was removed, just return a blank string. |
|
156 | - if (! $this->has_subsection('state')) { |
|
157 | - return ''; |
|
158 | - } |
|
159 | - $state_input = $this->get_input('state', false); |
|
160 | - if ($state_input instanceof EE_State_Select_Input) { |
|
161 | - $state_field_to_use = $state_input->valueFieldName(); |
|
162 | - } else { |
|
163 | - $state_field_to_use = 'STA_ID'; |
|
164 | - } |
|
165 | - switch ($state_field_to_use) { |
|
166 | - case 'STA_abbrev': |
|
167 | - $state_value = $attendee->state_abbrev(); |
|
168 | - break; |
|
169 | - case 'STA_name': |
|
170 | - $state_value = $attendee->state_name(); |
|
171 | - break; |
|
172 | - default: |
|
173 | - $state_value = $attendee->state_ID(); |
|
174 | - } |
|
175 | - return $state_value; |
|
176 | - } |
|
144 | + /** |
|
145 | + * Gets the default value to use for the billing form's state value. |
|
146 | + * |
|
147 | + * @param EE_Attendee $attendee |
|
148 | + * @return string |
|
149 | + * @throws EE_Error |
|
150 | + * @throws ReflectionException |
|
151 | + * @since 4.10.0.p |
|
152 | + */ |
|
153 | + protected function getAttendeeStateValueForForm(EE_Attendee $attendee): string |
|
154 | + { |
|
155 | + // If the state input was removed, just return a blank string. |
|
156 | + if (! $this->has_subsection('state')) { |
|
157 | + return ''; |
|
158 | + } |
|
159 | + $state_input = $this->get_input('state', false); |
|
160 | + if ($state_input instanceof EE_State_Select_Input) { |
|
161 | + $state_field_to_use = $state_input->valueFieldName(); |
|
162 | + } else { |
|
163 | + $state_field_to_use = 'STA_ID'; |
|
164 | + } |
|
165 | + switch ($state_field_to_use) { |
|
166 | + case 'STA_abbrev': |
|
167 | + $state_value = $attendee->state_abbrev(); |
|
168 | + break; |
|
169 | + case 'STA_name': |
|
170 | + $state_value = $attendee->state_name(); |
|
171 | + break; |
|
172 | + default: |
|
173 | + $state_value = $attendee->state_ID(); |
|
174 | + } |
|
175 | + return $state_value; |
|
176 | + } |
|
177 | 177 | |
178 | 178 | |
179 | - /** |
|
180 | - * copy_billing_form_data_to_attendee |
|
181 | - * copies info from the billing form to the attendee's details |
|
182 | - * |
|
183 | - * @param EE_Attendee $attendee the attendee object to copy details to |
|
184 | - * @return EE_Attendee |
|
185 | - * @throws EE_Error |
|
186 | - */ |
|
187 | - public function copy_billing_form_data_to_attendee(EE_Attendee $attendee): EE_Attendee |
|
188 | - { |
|
189 | - // grab billing form data |
|
190 | - $data = $this->valid_data(); |
|
179 | + /** |
|
180 | + * copy_billing_form_data_to_attendee |
|
181 | + * copies info from the billing form to the attendee's details |
|
182 | + * |
|
183 | + * @param EE_Attendee $attendee the attendee object to copy details to |
|
184 | + * @return EE_Attendee |
|
185 | + * @throws EE_Error |
|
186 | + */ |
|
187 | + public function copy_billing_form_data_to_attendee(EE_Attendee $attendee): EE_Attendee |
|
188 | + { |
|
189 | + // grab billing form data |
|
190 | + $data = $this->valid_data(); |
|
191 | 191 | |
192 | - $fields_and_setters = [ |
|
193 | - 'first_name' => 'set_fname', |
|
194 | - 'last_name' => 'set_lname', |
|
195 | - 'email' => 'set_email', |
|
196 | - 'address' => 'set_address', |
|
197 | - 'address2' => 'set_address2', |
|
198 | - 'city' => 'set_city', |
|
199 | - 'state' => 'set_state', |
|
200 | - 'country' => 'set_country', |
|
201 | - 'zip' => 'set_zip', |
|
202 | - 'phone' => 'set_phone', |
|
203 | - ]; |
|
204 | - foreach ($fields_and_setters as $field => $setter) { |
|
205 | - if (! empty($data[ $field ]) && method_exists($attendee, $setter)) { |
|
206 | - $attendee->{$setter}($data[ $field ]); |
|
207 | - } |
|
208 | - } |
|
209 | - return $attendee; |
|
210 | - } |
|
192 | + $fields_and_setters = [ |
|
193 | + 'first_name' => 'set_fname', |
|
194 | + 'last_name' => 'set_lname', |
|
195 | + 'email' => 'set_email', |
|
196 | + 'address' => 'set_address', |
|
197 | + 'address2' => 'set_address2', |
|
198 | + 'city' => 'set_city', |
|
199 | + 'state' => 'set_state', |
|
200 | + 'country' => 'set_country', |
|
201 | + 'zip' => 'set_zip', |
|
202 | + 'phone' => 'set_phone', |
|
203 | + ]; |
|
204 | + foreach ($fields_and_setters as $field => $setter) { |
|
205 | + if (! empty($data[ $field ]) && method_exists($attendee, $setter)) { |
|
206 | + $attendee->{$setter}($data[ $field ]); |
|
207 | + } |
|
208 | + } |
|
209 | + return $attendee; |
|
210 | + } |
|
211 | 211 | |
212 | 212 | |
213 | - /** |
|
214 | - * create_attendee_from_billing_form_data |
|
215 | - * uses info from the billing form to create a new attendee |
|
216 | - * |
|
217 | - * @return EE_Attendee |
|
218 | - * @throws EE_Error |
|
219 | - * @throws ReflectionException |
|
220 | - */ |
|
221 | - public function create_attendee_from_billing_form_data() |
|
222 | - { |
|
223 | - // grab billing form data |
|
224 | - $data = $this->valid_data(); |
|
225 | - return EE_Attendee::new_instance( |
|
226 | - [ |
|
227 | - 'ATT_fname' => ! empty($data['first_name']) ? $data['first_name'] : '', |
|
228 | - 'ATT_lname' => ! empty($data['last_name']) ? $data['last_name'] : '', |
|
229 | - 'ATT_email' => ! empty($data['email']) ? $data['email'] : '', |
|
230 | - 'ATT_address' => ! empty($data['address']) ? $data['address'] : '', |
|
231 | - 'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '', |
|
232 | - 'ATT_city' => ! empty($data['city']) ? $data['city'] : '', |
|
233 | - 'STA_ID' => ! empty($data['state']) ? $data['state'] : '', |
|
234 | - 'CNT_ISO' => ! empty($data['country']) ? $data['country'] : '', |
|
235 | - 'ATT_zip' => ! empty($data['zip']) ? $data['zip'] : '', |
|
236 | - 'ATT_phone' => ! empty($data['phone']) ? $data['phone'] : '', |
|
237 | - ] |
|
238 | - ); |
|
239 | - } |
|
213 | + /** |
|
214 | + * create_attendee_from_billing_form_data |
|
215 | + * uses info from the billing form to create a new attendee |
|
216 | + * |
|
217 | + * @return EE_Attendee |
|
218 | + * @throws EE_Error |
|
219 | + * @throws ReflectionException |
|
220 | + */ |
|
221 | + public function create_attendee_from_billing_form_data() |
|
222 | + { |
|
223 | + // grab billing form data |
|
224 | + $data = $this->valid_data(); |
|
225 | + return EE_Attendee::new_instance( |
|
226 | + [ |
|
227 | + 'ATT_fname' => ! empty($data['first_name']) ? $data['first_name'] : '', |
|
228 | + 'ATT_lname' => ! empty($data['last_name']) ? $data['last_name'] : '', |
|
229 | + 'ATT_email' => ! empty($data['email']) ? $data['email'] : '', |
|
230 | + 'ATT_address' => ! empty($data['address']) ? $data['address'] : '', |
|
231 | + 'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '', |
|
232 | + 'ATT_city' => ! empty($data['city']) ? $data['city'] : '', |
|
233 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : '', |
|
234 | + 'CNT_ISO' => ! empty($data['country']) ? $data['country'] : '', |
|
235 | + 'ATT_zip' => ! empty($data['zip']) ? $data['zip'] : '', |
|
236 | + 'ATT_phone' => ! empty($data['phone']) ? $data['phone'] : '', |
|
237 | + ] |
|
238 | + ); |
|
239 | + } |
|
240 | 240 | } |
241 | 241 | // End of file EE_Billing_Attendee_Info_Form.form.php |
@@ -13,10 +13,10 @@ |
||
13 | 13 | */ |
14 | 14 | abstract class FormHtmlFilter |
15 | 15 | { |
16 | - /** |
|
17 | - * @param $html |
|
18 | - * @param EE_Form_Section_Validatable $form_section |
|
19 | - * @return string |
|
20 | - */ |
|
21 | - abstract public function filterHtml($html, EE_Form_Section_Validatable $form_section); |
|
16 | + /** |
|
17 | + * @param $html |
|
18 | + * @param EE_Form_Section_Validatable $form_section |
|
19 | + * @return string |
|
20 | + */ |
|
21 | + abstract public function filterHtml($html, EE_Form_Section_Validatable $form_section); |
|
22 | 22 | } |
@@ -18,45 +18,45 @@ |
||
18 | 18 | */ |
19 | 19 | class VsprintfFilter extends FormHtmlFilter |
20 | 20 | { |
21 | - /** |
|
22 | - * @var string $format |
|
23 | - */ |
|
24 | - protected $format = ''; |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * @var array $args |
|
29 | - */ |
|
30 | - protected $args = array(); |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * VsprintfFilter constructor. |
|
35 | - * |
|
36 | - * @param string $format |
|
37 | - * @param array $args |
|
38 | - */ |
|
39 | - public function __construct($format, array $args) |
|
40 | - { |
|
41 | - $this->format = $format; |
|
42 | - $this->args = $args; |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * @param $html |
|
48 | - * @param EE_Form_Section_Validatable $form_section |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function filterHtml($html, EE_Form_Section_Validatable $form_section) |
|
52 | - { |
|
53 | - $this->args[] = $html; |
|
54 | - if ($form_section instanceof EE_Form_Section_Proper) { |
|
55 | - $subsections = $form_section->subsections(); |
|
56 | - foreach ((array) $subsections as $subsection) { |
|
57 | - $this->args[] = $subsection->get_html(); |
|
58 | - } |
|
59 | - } |
|
60 | - return vsprintf($this->format, $this->args); |
|
61 | - } |
|
21 | + /** |
|
22 | + * @var string $format |
|
23 | + */ |
|
24 | + protected $format = ''; |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * @var array $args |
|
29 | + */ |
|
30 | + protected $args = array(); |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * VsprintfFilter constructor. |
|
35 | + * |
|
36 | + * @param string $format |
|
37 | + * @param array $args |
|
38 | + */ |
|
39 | + public function __construct($format, array $args) |
|
40 | + { |
|
41 | + $this->format = $format; |
|
42 | + $this->args = $args; |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * @param $html |
|
48 | + * @param EE_Form_Section_Validatable $form_section |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function filterHtml($html, EE_Form_Section_Validatable $form_section) |
|
52 | + { |
|
53 | + $this->args[] = $html; |
|
54 | + if ($form_section instanceof EE_Form_Section_Proper) { |
|
55 | + $subsections = $form_section->subsections(); |
|
56 | + foreach ((array) $subsections as $subsection) { |
|
57 | + $this->args[] = $subsection->get_html(); |
|
58 | + } |
|
59 | + } |
|
60 | + return vsprintf($this->format, $this->args); |
|
61 | + } |
|
62 | 62 | } |
@@ -9,59 +9,59 @@ |
||
9 | 9 | */ |
10 | 10 | abstract class EE_Normalization_Strategy_Base extends EE_Form_Input_Strategy_Base |
11 | 11 | { |
12 | - /** |
|
13 | - * Takes the sanitized value for the input and casts it into the correct PHP type. |
|
14 | - * Eg, turns it into an int, float, string, boolean, datetime, etc. The validation |
|
15 | - * strategy should be able to depend on the normalized value being of the correct type. |
|
16 | - * If the normalized value passes validation, the normalized value is what other code |
|
17 | - * will operate on. If the sanitized value cannot be normalized, this method should either |
|
18 | - * add a validation error onto the input, or wrangle the input into a format that can be normalized |
|
19 | - * (eg, for a date input, if the user enters "2014/100/100", you can either add an error stating |
|
20 | - * "hey! 2014/100/100 is not a valid date!", or simply convert it into a valid date like "2014/12/31". |
|
21 | - * For this case, I'd prefer the former. But there may be cases where you'd just rather correct it for them) |
|
22 | - * |
|
23 | - * @param string $value_to_normalize it should always be a string. If the input receives an array, then the |
|
24 | - * validation strategy should be called on array elements, not on the entire array |
|
25 | - * @return mixed the normalized value |
|
26 | - */ |
|
27 | - abstract public function normalize($value_to_normalize); |
|
12 | + /** |
|
13 | + * Takes the sanitized value for the input and casts it into the correct PHP type. |
|
14 | + * Eg, turns it into an int, float, string, boolean, datetime, etc. The validation |
|
15 | + * strategy should be able to depend on the normalized value being of the correct type. |
|
16 | + * If the normalized value passes validation, the normalized value is what other code |
|
17 | + * will operate on. If the sanitized value cannot be normalized, this method should either |
|
18 | + * add a validation error onto the input, or wrangle the input into a format that can be normalized |
|
19 | + * (eg, for a date input, if the user enters "2014/100/100", you can either add an error stating |
|
20 | + * "hey! 2014/100/100 is not a valid date!", or simply convert it into a valid date like "2014/12/31". |
|
21 | + * For this case, I'd prefer the former. But there may be cases where you'd just rather correct it for them) |
|
22 | + * |
|
23 | + * @param string $value_to_normalize it should always be a string. If the input receives an array, then the |
|
24 | + * validation strategy should be called on array elements, not on the entire array |
|
25 | + * @return mixed the normalized value |
|
26 | + */ |
|
27 | + abstract public function normalize($value_to_normalize); |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * Identical to normalize, except normalize_one() CANNOT be passed an array and |
|
33 | - * never returns an array. Useful if the normalization strategy converts between arrays |
|
34 | - * |
|
35 | - * @param string $individual_item_to_normalize |
|
36 | - * @return mixed |
|
37 | - */ |
|
38 | - public function normalize_one($individual_item_to_normalize) |
|
39 | - { |
|
40 | - return $this->normalize($individual_item_to_normalize); |
|
41 | - } |
|
31 | + /** |
|
32 | + * Identical to normalize, except normalize_one() CANNOT be passed an array and |
|
33 | + * never returns an array. Useful if the normalization strategy converts between arrays |
|
34 | + * |
|
35 | + * @param string $individual_item_to_normalize |
|
36 | + * @return mixed |
|
37 | + */ |
|
38 | + public function normalize_one($individual_item_to_normalize) |
|
39 | + { |
|
40 | + return $this->normalize($individual_item_to_normalize); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * Takes the normalized value (for an Yes_No_Input this could be TRUE or FALSE), and converts it into |
|
47 | - * the value you would use in the html form (for a Yes_No_Input this could be '1' or '0'). |
|
48 | - * |
|
49 | - * @param $normalized_value |
|
50 | - * @return array|string the 'raw' value as used in the form, usually a string or array of strings. |
|
51 | - */ |
|
52 | - abstract public function unnormalize($normalized_value); |
|
45 | + /** |
|
46 | + * Takes the normalized value (for an Yes_No_Input this could be TRUE or FALSE), and converts it into |
|
47 | + * the value you would use in the html form (for a Yes_No_Input this could be '1' or '0'). |
|
48 | + * |
|
49 | + * @param $normalized_value |
|
50 | + * @return array|string the 'raw' value as used in the form, usually a string or array of strings. |
|
51 | + */ |
|
52 | + abstract public function unnormalize($normalized_value); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Normally the same as unnormalize, except it CANNOT be passed an array and |
|
58 | - * ALWAYS returns a string |
|
59 | - * |
|
60 | - * @param mixed $individual_item_to_unnormalize NOT an array |
|
61 | - * @return string |
|
62 | - */ |
|
63 | - public function unnormalize_one($individual_item_to_unnormalize) |
|
64 | - { |
|
65 | - return $this->unnormalize($individual_item_to_unnormalize); |
|
66 | - } |
|
56 | + /** |
|
57 | + * Normally the same as unnormalize, except it CANNOT be passed an array and |
|
58 | + * ALWAYS returns a string |
|
59 | + * |
|
60 | + * @param mixed $individual_item_to_unnormalize NOT an array |
|
61 | + * @return string |
|
62 | + */ |
|
63 | + public function unnormalize_one($individual_item_to_unnormalize) |
|
64 | + { |
|
65 | + return $this->unnormalize($individual_item_to_unnormalize); |
|
66 | + } |
|
67 | 67 | } |
@@ -9,14 +9,14 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Credit_Card_Normalization extends EE_Text_Normalization |
11 | 11 | { |
12 | - /** |
|
13 | - * @param string $value_to_normalize |
|
14 | - * @return mixed |
|
15 | - */ |
|
16 | - public function normalize($value_to_normalize) |
|
17 | - { |
|
18 | - $normalized_by_parent = parent::normalize($value_to_normalize); |
|
19 | - // we want to make it consistent, so remove whitespace from cc number |
|
20 | - return preg_replace('/\s+/', '', $normalized_by_parent); |
|
21 | - } |
|
12 | + /** |
|
13 | + * @param string $value_to_normalize |
|
14 | + * @return mixed |
|
15 | + */ |
|
16 | + public function normalize($value_to_normalize) |
|
17 | + { |
|
18 | + $normalized_by_parent = parent::normalize($value_to_normalize); |
|
19 | + // we want to make it consistent, so remove whitespace from cc number |
|
20 | + return preg_replace('/\s+/', '', $normalized_by_parent); |
|
21 | + } |
|
22 | 22 | } |
@@ -13,27 +13,27 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Boolean_Normalization extends EE_Normalization_Strategy_Base |
15 | 15 | { |
16 | - /** |
|
17 | - * @param string | int | bool $value_to_normalize |
|
18 | - * @return boolean |
|
19 | - */ |
|
20 | - public function normalize($value_to_normalize) |
|
21 | - { |
|
22 | - return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN); |
|
23 | - } |
|
16 | + /** |
|
17 | + * @param string | int | bool $value_to_normalize |
|
18 | + * @return boolean |
|
19 | + */ |
|
20 | + public function normalize($value_to_normalize) |
|
21 | + { |
|
22 | + return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN); |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @param boolean $normalized_value |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - public function unnormalize($normalized_value) |
|
32 | - { |
|
33 | - if ($normalized_value) { |
|
34 | - return '1'; |
|
35 | - } else { |
|
36 | - return '0'; |
|
37 | - } |
|
38 | - } |
|
27 | + /** |
|
28 | + * @param boolean $normalized_value |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + public function unnormalize($normalized_value) |
|
32 | + { |
|
33 | + if ($normalized_value) { |
|
34 | + return '1'; |
|
35 | + } else { |
|
36 | + return '0'; |
|
37 | + } |
|
38 | + } |
|
39 | 39 | } |