@@ -19,227 +19,227 @@ |
||
19 | 19 | abstract class SequentialStepForm extends FormHandler implements SequentialStepFormInterface |
20 | 20 | { |
21 | 21 | |
22 | - const REDIRECT_TO_NEXT_STEP = 'redirect_to_next_step'; |
|
23 | - |
|
24 | - const REDIRECT_TO_CURRENT_STEP = 'redirect_to_current_step'; |
|
25 | - |
|
26 | - const REDIRECT_TO_PREV_STEP = 'redirect_to_prev_step'; |
|
27 | - |
|
28 | - const REDIRECT_TO_OTHER = 'redirect_to_other'; |
|
29 | - |
|
30 | - /** |
|
31 | - * numerical value used for sorting form steps |
|
32 | - * |
|
33 | - * @var int $order |
|
34 | - */ |
|
35 | - private $order = 1; |
|
36 | - |
|
37 | - /** |
|
38 | - * a final URL with all form related parameters added |
|
39 | - * that will be used to advance to the next step |
|
40 | - * |
|
41 | - * @var string $redirect_url |
|
42 | - */ |
|
43 | - private $redirect_url = ''; |
|
44 | - |
|
45 | - /** |
|
46 | - * URL params in key value pairs |
|
47 | - * |
|
48 | - * @var array $redirect_args |
|
49 | - */ |
|
50 | - private $redirect_args = array(); |
|
51 | - |
|
52 | - /** |
|
53 | - * Which step should be redirected to after form processing. |
|
54 | - * Usually after successfully processing this value would be REDIRECT_TO_NEXT_STEP |
|
55 | - * If a form is invalid and requires errors to be corrected, |
|
56 | - * then this value would be REDIRECT_TO_CURRENT_STEP so that form can be resubmitted |
|
57 | - * Some form handlers do not have a form that is displayable, |
|
58 | - * and only perform data processing, but if an error occurs, |
|
59 | - * then this value needs to be set to REDIRECT_TO_PREV_STEP |
|
60 | - * since the current step has no displayable content. |
|
61 | - * if the form is completely finished, and needs to redirect to somewhere |
|
62 | - * completely different, then this value will be REDIRECT_TO_OTHER |
|
63 | - * |
|
64 | - * @var string $redirect_to |
|
65 | - */ |
|
66 | - private $redirect_to = SequentialStepForm::REDIRECT_TO_CURRENT_STEP; |
|
67 | - |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * SequentialStepForm constructor |
|
72 | - * |
|
73 | - * @param int $order |
|
74 | - * @param string $form_name |
|
75 | - * @param string $admin_name |
|
76 | - * @param string $slug |
|
77 | - * @param string $form_action |
|
78 | - * @param string $form_config |
|
79 | - * @param EE_Registry $registry |
|
80 | - * @throws InvalidArgumentException |
|
81 | - * @throws InvalidDataTypeException |
|
82 | - * @throws DomainException |
|
83 | - */ |
|
84 | - public function __construct( |
|
85 | - $order, |
|
86 | - $form_name, |
|
87 | - $admin_name, |
|
88 | - $slug, |
|
89 | - $form_action = '', |
|
90 | - $form_config = 'add_form_tags_and_submit', |
|
91 | - EE_Registry $registry |
|
92 | - ) { |
|
93 | - $this->setOrder($order); |
|
94 | - parent::__construct($form_name, $admin_name, $slug, $form_action, $form_config, $registry); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * @return int |
|
101 | - */ |
|
102 | - public function order() |
|
103 | - { |
|
104 | - return $this->order; |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @param int $order |
|
111 | - * @throws InvalidArgumentException |
|
112 | - */ |
|
113 | - public function setOrder($order) |
|
114 | - { |
|
115 | - $order = absint($order); |
|
116 | - if (! $order > 0) { |
|
117 | - throw new InvalidArgumentException( |
|
118 | - esc_html__('The form order property must be a positive integer.', 'event_espresso') |
|
119 | - ); |
|
120 | - } |
|
121 | - $this->order = $order; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * @return string |
|
128 | - */ |
|
129 | - public function redirectUrl() |
|
130 | - { |
|
131 | - return ! empty($this->redirect_args) |
|
132 | - ? add_query_arg($this->redirect_args, $this->redirect_url) |
|
133 | - : $this->redirect_url; |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * @param string $redirect_url |
|
140 | - * @throws InvalidDataTypeException |
|
141 | - * @throws InvalidArgumentException |
|
142 | - */ |
|
143 | - public function setRedirectUrl($redirect_url) |
|
144 | - { |
|
145 | - if (! is_string($redirect_url)) { |
|
146 | - throw new InvalidDataTypeException('$redirect_url', $redirect_url, 'string'); |
|
147 | - } |
|
148 | - if (empty($redirect_url)) { |
|
149 | - throw new InvalidArgumentException( |
|
150 | - esc_html__('The redirect URL can not be an empty string.', 'event_espresso') |
|
151 | - ); |
|
152 | - } |
|
153 | - $this->redirect_url = $redirect_url; |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * @param array $redirect_args |
|
160 | - * @throws InvalidDataTypeException |
|
161 | - * @throws InvalidArgumentException |
|
162 | - */ |
|
163 | - public function addRedirectArgs($redirect_args = array()) |
|
164 | - { |
|
165 | - if (is_object($redirect_args)) { |
|
166 | - throw new InvalidDataTypeException( |
|
167 | - '$redirect_args', |
|
168 | - $redirect_args, |
|
169 | - 'anything other than an object was expected.' |
|
170 | - ); |
|
171 | - } |
|
172 | - if (empty($redirect_args)) { |
|
173 | - throw new InvalidArgumentException( |
|
174 | - esc_html__('The redirect argument can not be an empty array.', 'event_espresso') |
|
175 | - ); |
|
176 | - } |
|
177 | - $this->redirect_args = array_merge($this->redirect_args, (array) $redirect_args); |
|
178 | - } |
|
179 | - |
|
180 | - |
|
181 | - |
|
182 | - /** |
|
183 | - * @param array $redirect_arg_keys_to_remove |
|
184 | - * @throws InvalidDataTypeException |
|
185 | - * @throws InvalidArgumentException |
|
186 | - */ |
|
187 | - public function removeRedirectArgs($redirect_arg_keys_to_remove = array()) |
|
188 | - { |
|
189 | - if (is_object($redirect_arg_keys_to_remove)) { |
|
190 | - throw new InvalidDataTypeException( |
|
191 | - '$redirect_arg_keys_to_remove', |
|
192 | - $redirect_arg_keys_to_remove, |
|
193 | - 'anything other than an object was expected.' |
|
194 | - ); |
|
195 | - } |
|
196 | - if (empty($redirect_arg_keys_to_remove)) { |
|
197 | - throw new InvalidArgumentException( |
|
198 | - esc_html__('The $redirect_arg_keys_to_remove argument can not be an empty array.', 'event_espresso') |
|
199 | - ); |
|
200 | - } |
|
201 | - foreach ($redirect_arg_keys_to_remove as $redirect_arg_key) { |
|
202 | - unset($this->redirect_args[ $redirect_arg_key ]); |
|
203 | - } |
|
204 | - } |
|
205 | - |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * @return string |
|
210 | - */ |
|
211 | - public function redirectTo() |
|
212 | - { |
|
213 | - return $this->redirect_to; |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - |
|
218 | - /** |
|
219 | - * @param string $redirect_to |
|
220 | - * @throws InvalidDataTypeException |
|
221 | - */ |
|
222 | - public function setRedirectTo($redirect_to) |
|
223 | - { |
|
224 | - if (! in_array( |
|
225 | - $redirect_to, |
|
226 | - array( |
|
227 | - SequentialStepForm::REDIRECT_TO_NEXT_STEP, |
|
228 | - SequentialStepForm::REDIRECT_TO_CURRENT_STEP, |
|
229 | - SequentialStepForm::REDIRECT_TO_PREV_STEP, |
|
230 | - SequentialStepForm::REDIRECT_TO_OTHER, |
|
231 | - ), |
|
232 | - true |
|
233 | - ) |
|
234 | - ) { |
|
235 | - throw new InvalidDataTypeException( |
|
236 | - 'setRedirectTo()', |
|
237 | - $redirect_to, |
|
238 | - 'one of the SequentialStepForm class constants was expected.' |
|
239 | - ); |
|
240 | - } |
|
241 | - $this->redirect_to = $redirect_to; |
|
242 | - } |
|
22 | + const REDIRECT_TO_NEXT_STEP = 'redirect_to_next_step'; |
|
23 | + |
|
24 | + const REDIRECT_TO_CURRENT_STEP = 'redirect_to_current_step'; |
|
25 | + |
|
26 | + const REDIRECT_TO_PREV_STEP = 'redirect_to_prev_step'; |
|
27 | + |
|
28 | + const REDIRECT_TO_OTHER = 'redirect_to_other'; |
|
29 | + |
|
30 | + /** |
|
31 | + * numerical value used for sorting form steps |
|
32 | + * |
|
33 | + * @var int $order |
|
34 | + */ |
|
35 | + private $order = 1; |
|
36 | + |
|
37 | + /** |
|
38 | + * a final URL with all form related parameters added |
|
39 | + * that will be used to advance to the next step |
|
40 | + * |
|
41 | + * @var string $redirect_url |
|
42 | + */ |
|
43 | + private $redirect_url = ''; |
|
44 | + |
|
45 | + /** |
|
46 | + * URL params in key value pairs |
|
47 | + * |
|
48 | + * @var array $redirect_args |
|
49 | + */ |
|
50 | + private $redirect_args = array(); |
|
51 | + |
|
52 | + /** |
|
53 | + * Which step should be redirected to after form processing. |
|
54 | + * Usually after successfully processing this value would be REDIRECT_TO_NEXT_STEP |
|
55 | + * If a form is invalid and requires errors to be corrected, |
|
56 | + * then this value would be REDIRECT_TO_CURRENT_STEP so that form can be resubmitted |
|
57 | + * Some form handlers do not have a form that is displayable, |
|
58 | + * and only perform data processing, but if an error occurs, |
|
59 | + * then this value needs to be set to REDIRECT_TO_PREV_STEP |
|
60 | + * since the current step has no displayable content. |
|
61 | + * if the form is completely finished, and needs to redirect to somewhere |
|
62 | + * completely different, then this value will be REDIRECT_TO_OTHER |
|
63 | + * |
|
64 | + * @var string $redirect_to |
|
65 | + */ |
|
66 | + private $redirect_to = SequentialStepForm::REDIRECT_TO_CURRENT_STEP; |
|
67 | + |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * SequentialStepForm constructor |
|
72 | + * |
|
73 | + * @param int $order |
|
74 | + * @param string $form_name |
|
75 | + * @param string $admin_name |
|
76 | + * @param string $slug |
|
77 | + * @param string $form_action |
|
78 | + * @param string $form_config |
|
79 | + * @param EE_Registry $registry |
|
80 | + * @throws InvalidArgumentException |
|
81 | + * @throws InvalidDataTypeException |
|
82 | + * @throws DomainException |
|
83 | + */ |
|
84 | + public function __construct( |
|
85 | + $order, |
|
86 | + $form_name, |
|
87 | + $admin_name, |
|
88 | + $slug, |
|
89 | + $form_action = '', |
|
90 | + $form_config = 'add_form_tags_and_submit', |
|
91 | + EE_Registry $registry |
|
92 | + ) { |
|
93 | + $this->setOrder($order); |
|
94 | + parent::__construct($form_name, $admin_name, $slug, $form_action, $form_config, $registry); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * @return int |
|
101 | + */ |
|
102 | + public function order() |
|
103 | + { |
|
104 | + return $this->order; |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @param int $order |
|
111 | + * @throws InvalidArgumentException |
|
112 | + */ |
|
113 | + public function setOrder($order) |
|
114 | + { |
|
115 | + $order = absint($order); |
|
116 | + if (! $order > 0) { |
|
117 | + throw new InvalidArgumentException( |
|
118 | + esc_html__('The form order property must be a positive integer.', 'event_espresso') |
|
119 | + ); |
|
120 | + } |
|
121 | + $this->order = $order; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * @return string |
|
128 | + */ |
|
129 | + public function redirectUrl() |
|
130 | + { |
|
131 | + return ! empty($this->redirect_args) |
|
132 | + ? add_query_arg($this->redirect_args, $this->redirect_url) |
|
133 | + : $this->redirect_url; |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * @param string $redirect_url |
|
140 | + * @throws InvalidDataTypeException |
|
141 | + * @throws InvalidArgumentException |
|
142 | + */ |
|
143 | + public function setRedirectUrl($redirect_url) |
|
144 | + { |
|
145 | + if (! is_string($redirect_url)) { |
|
146 | + throw new InvalidDataTypeException('$redirect_url', $redirect_url, 'string'); |
|
147 | + } |
|
148 | + if (empty($redirect_url)) { |
|
149 | + throw new InvalidArgumentException( |
|
150 | + esc_html__('The redirect URL can not be an empty string.', 'event_espresso') |
|
151 | + ); |
|
152 | + } |
|
153 | + $this->redirect_url = $redirect_url; |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * @param array $redirect_args |
|
160 | + * @throws InvalidDataTypeException |
|
161 | + * @throws InvalidArgumentException |
|
162 | + */ |
|
163 | + public function addRedirectArgs($redirect_args = array()) |
|
164 | + { |
|
165 | + if (is_object($redirect_args)) { |
|
166 | + throw new InvalidDataTypeException( |
|
167 | + '$redirect_args', |
|
168 | + $redirect_args, |
|
169 | + 'anything other than an object was expected.' |
|
170 | + ); |
|
171 | + } |
|
172 | + if (empty($redirect_args)) { |
|
173 | + throw new InvalidArgumentException( |
|
174 | + esc_html__('The redirect argument can not be an empty array.', 'event_espresso') |
|
175 | + ); |
|
176 | + } |
|
177 | + $this->redirect_args = array_merge($this->redirect_args, (array) $redirect_args); |
|
178 | + } |
|
179 | + |
|
180 | + |
|
181 | + |
|
182 | + /** |
|
183 | + * @param array $redirect_arg_keys_to_remove |
|
184 | + * @throws InvalidDataTypeException |
|
185 | + * @throws InvalidArgumentException |
|
186 | + */ |
|
187 | + public function removeRedirectArgs($redirect_arg_keys_to_remove = array()) |
|
188 | + { |
|
189 | + if (is_object($redirect_arg_keys_to_remove)) { |
|
190 | + throw new InvalidDataTypeException( |
|
191 | + '$redirect_arg_keys_to_remove', |
|
192 | + $redirect_arg_keys_to_remove, |
|
193 | + 'anything other than an object was expected.' |
|
194 | + ); |
|
195 | + } |
|
196 | + if (empty($redirect_arg_keys_to_remove)) { |
|
197 | + throw new InvalidArgumentException( |
|
198 | + esc_html__('The $redirect_arg_keys_to_remove argument can not be an empty array.', 'event_espresso') |
|
199 | + ); |
|
200 | + } |
|
201 | + foreach ($redirect_arg_keys_to_remove as $redirect_arg_key) { |
|
202 | + unset($this->redirect_args[ $redirect_arg_key ]); |
|
203 | + } |
|
204 | + } |
|
205 | + |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * @return string |
|
210 | + */ |
|
211 | + public function redirectTo() |
|
212 | + { |
|
213 | + return $this->redirect_to; |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + |
|
218 | + /** |
|
219 | + * @param string $redirect_to |
|
220 | + * @throws InvalidDataTypeException |
|
221 | + */ |
|
222 | + public function setRedirectTo($redirect_to) |
|
223 | + { |
|
224 | + if (! in_array( |
|
225 | + $redirect_to, |
|
226 | + array( |
|
227 | + SequentialStepForm::REDIRECT_TO_NEXT_STEP, |
|
228 | + SequentialStepForm::REDIRECT_TO_CURRENT_STEP, |
|
229 | + SequentialStepForm::REDIRECT_TO_PREV_STEP, |
|
230 | + SequentialStepForm::REDIRECT_TO_OTHER, |
|
231 | + ), |
|
232 | + true |
|
233 | + ) |
|
234 | + ) { |
|
235 | + throw new InvalidDataTypeException( |
|
236 | + 'setRedirectTo()', |
|
237 | + $redirect_to, |
|
238 | + 'one of the SequentialStepForm class constants was expected.' |
|
239 | + ); |
|
240 | + } |
|
241 | + $this->redirect_to = $redirect_to; |
|
242 | + } |
|
243 | 243 | } |
244 | 244 | // End of file SequentialStepForm.php |
245 | 245 | // Location: /SequentialStepForm.php |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function setOrder($order) |
114 | 114 | { |
115 | 115 | $order = absint($order); |
116 | - if (! $order > 0) { |
|
116 | + if ( ! $order > 0) { |
|
117 | 117 | throw new InvalidArgumentException( |
118 | 118 | esc_html__('The form order property must be a positive integer.', 'event_espresso') |
119 | 119 | ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function setRedirectUrl($redirect_url) |
144 | 144 | { |
145 | - if (! is_string($redirect_url)) { |
|
145 | + if ( ! is_string($redirect_url)) { |
|
146 | 146 | throw new InvalidDataTypeException('$redirect_url', $redirect_url, 'string'); |
147 | 147 | } |
148 | 148 | if (empty($redirect_url)) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | ); |
200 | 200 | } |
201 | 201 | foreach ($redirect_arg_keys_to_remove as $redirect_arg_key) { |
202 | - unset($this->redirect_args[ $redirect_arg_key ]); |
|
202 | + unset($this->redirect_args[$redirect_arg_key]); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function setRedirectTo($redirect_to) |
223 | 223 | { |
224 | - if (! in_array( |
|
224 | + if ( ! in_array( |
|
225 | 225 | $redirect_to, |
226 | 226 | array( |
227 | 227 | SequentialStepForm::REDIRECT_TO_NEXT_STEP, |
@@ -9,49 +9,49 @@ |
||
9 | 9 | class EE_State_Select_Input extends EE_Select_Input |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param array $state_options |
|
14 | - * @param array $input_settings |
|
15 | - */ |
|
16 | - public function __construct($state_options, $input_settings = array()) |
|
17 | - { |
|
18 | - $state_options = apply_filters( |
|
19 | - 'FHEE__EE_State_Select_Input____construct__state_options', |
|
20 | - $this->get_state_answer_options($state_options), |
|
21 | - $this |
|
22 | - ); |
|
23 | - $input_settings['html_class'] = isset($input_settings['html_class']) |
|
24 | - ? $input_settings['html_class'] . ' ee-state-select-js' |
|
25 | - : 'ee-state-select-js'; |
|
26 | - parent::__construct($state_options, $input_settings); |
|
27 | - } |
|
12 | + /** |
|
13 | + * @param array $state_options |
|
14 | + * @param array $input_settings |
|
15 | + */ |
|
16 | + public function __construct($state_options, $input_settings = array()) |
|
17 | + { |
|
18 | + $state_options = apply_filters( |
|
19 | + 'FHEE__EE_State_Select_Input____construct__state_options', |
|
20 | + $this->get_state_answer_options($state_options), |
|
21 | + $this |
|
22 | + ); |
|
23 | + $input_settings['html_class'] = isset($input_settings['html_class']) |
|
24 | + ? $input_settings['html_class'] . ' ee-state-select-js' |
|
25 | + : 'ee-state-select-js'; |
|
26 | + parent::__construct($state_options, $input_settings); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * get_state_answer_options |
|
33 | - * |
|
34 | - * @param array $state_options |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function get_state_answer_options($state_options = null) |
|
38 | - { |
|
39 | - // if passed something that is NOT an array |
|
40 | - if (! is_array($state_options)) { |
|
41 | - // get possibly cached list of states |
|
42 | - $states = EEM_State::instance()->get_all_active_states(); |
|
43 | - if (! empty($states)) { |
|
44 | - // set the default |
|
45 | - $state_options[''][''] = ''; |
|
46 | - foreach ($states as $state) { |
|
47 | - if ($state instanceof EE_State) { |
|
48 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
49 | - } |
|
50 | - } |
|
51 | - } else { |
|
52 | - $state_options = array(); |
|
53 | - } |
|
54 | - } |
|
55 | - return $state_options; |
|
56 | - } |
|
31 | + /** |
|
32 | + * get_state_answer_options |
|
33 | + * |
|
34 | + * @param array $state_options |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function get_state_answer_options($state_options = null) |
|
38 | + { |
|
39 | + // if passed something that is NOT an array |
|
40 | + if (! is_array($state_options)) { |
|
41 | + // get possibly cached list of states |
|
42 | + $states = EEM_State::instance()->get_all_active_states(); |
|
43 | + if (! empty($states)) { |
|
44 | + // set the default |
|
45 | + $state_options[''][''] = ''; |
|
46 | + foreach ($states as $state) { |
|
47 | + if ($state instanceof EE_State) { |
|
48 | + $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
49 | + } |
|
50 | + } |
|
51 | + } else { |
|
52 | + $state_options = array(); |
|
53 | + } |
|
54 | + } |
|
55 | + return $state_options; |
|
56 | + } |
|
57 | 57 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this |
22 | 22 | ); |
23 | 23 | $input_settings['html_class'] = isset($input_settings['html_class']) |
24 | - ? $input_settings['html_class'] . ' ee-state-select-js' |
|
24 | + ? $input_settings['html_class'].' ee-state-select-js' |
|
25 | 25 | : 'ee-state-select-js'; |
26 | 26 | parent::__construct($state_options, $input_settings); |
27 | 27 | } |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | public function get_state_answer_options($state_options = null) |
38 | 38 | { |
39 | 39 | // if passed something that is NOT an array |
40 | - if (! is_array($state_options)) { |
|
40 | + if ( ! is_array($state_options)) { |
|
41 | 41 | // get possibly cached list of states |
42 | 42 | $states = EEM_State::instance()->get_all_active_states(); |
43 | - if (! empty($states)) { |
|
43 | + if ( ! empty($states)) { |
|
44 | 44 | // set the default |
45 | 45 | $state_options[''][''] = ''; |
46 | 46 | foreach ($states as $state) { |
47 | 47 | if ($state instanceof EE_State) { |
48 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
48 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | } else { |
@@ -12,68 +12,68 @@ |
||
12 | 12 | class EE_Checkbox_Dropdown_Selector_Input extends EE_Form_Input_With_Options_Base |
13 | 13 | { |
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 | - isset($input_settings['validation_error_message']) |
|
39 | - ? $input_settings['validation_error_message'] |
|
40 | - : null |
|
41 | - ), |
|
42 | - ) |
|
43 | - ) |
|
44 | - ); |
|
45 | - $this->_multiple_selections = true; |
|
46 | - parent::__construct($answer_options, $input_settings); |
|
47 | - } |
|
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 | + isset($input_settings['validation_error_message']) |
|
39 | + ? $input_settings['validation_error_message'] |
|
40 | + : null |
|
41 | + ), |
|
42 | + ) |
|
43 | + ) |
|
44 | + ); |
|
45 | + $this->_multiple_selections = true; |
|
46 | + parent::__construct($answer_options, $input_settings); |
|
47 | + } |
|
48 | 48 | |
49 | - /* |
|
49 | + /* |
|
50 | 50 | * Returns the text to display in the select button |
51 | 51 | */ |
52 | - public function select_button_text() |
|
53 | - { |
|
54 | - return $this->_select_button_text; |
|
55 | - } |
|
52 | + public function select_button_text() |
|
53 | + { |
|
54 | + return $this->_select_button_text; |
|
55 | + } |
|
56 | 56 | |
57 | - /* |
|
57 | + /* |
|
58 | 58 | * add css and js for iframes |
59 | 59 | */ |
60 | - protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy) |
|
61 | - { |
|
62 | - add_filter( |
|
63 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
64 | - array($display_strategy, 'iframe_css') |
|
65 | - ); |
|
66 | - add_filter( |
|
67 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
68 | - array($display_strategy, 'iframe_js') |
|
69 | - ); |
|
70 | - add_filter( |
|
71 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
72 | - array($display_strategy, 'iframe_css') |
|
73 | - ); |
|
74 | - add_filter( |
|
75 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
76 | - array($display_strategy, 'iframe_js') |
|
77 | - ); |
|
78 | - } |
|
60 | + protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy) |
|
61 | + { |
|
62 | + add_filter( |
|
63 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
64 | + array($display_strategy, 'iframe_css') |
|
65 | + ); |
|
66 | + add_filter( |
|
67 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
68 | + array($display_strategy, 'iframe_js') |
|
69 | + ); |
|
70 | + add_filter( |
|
71 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
72 | + array($display_strategy, 'iframe_css') |
|
73 | + ); |
|
74 | + add_filter( |
|
75 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
76 | + array($display_strategy, 'iframe_js') |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | } |
@@ -14,49 +14,49 @@ |
||
14 | 14 | class EE_Country_Select_Input extends EE_Select_Input |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param array $country_options |
|
19 | - * @param array $input_settings |
|
20 | - * @return EE_Country_Select_Input |
|
21 | - */ |
|
22 | - public function __construct($country_options = null, $input_settings = array()) |
|
23 | - { |
|
24 | - $country_options = apply_filters( |
|
25 | - 'FHEE__EE_Country_Select_Input____construct__country_options', |
|
26 | - $this->get_country_answer_options($country_options), |
|
27 | - $this |
|
28 | - ); |
|
29 | - $input_settings['html_class'] = isset($input_settings['html_class']) |
|
30 | - ? $input_settings['html_class'] . ' ee-country-select-js' |
|
31 | - : 'ee-country-select-js'; |
|
32 | - parent::__construct($country_options, $input_settings); |
|
33 | - } |
|
17 | + /** |
|
18 | + * @param array $country_options |
|
19 | + * @param array $input_settings |
|
20 | + * @return EE_Country_Select_Input |
|
21 | + */ |
|
22 | + public function __construct($country_options = null, $input_settings = array()) |
|
23 | + { |
|
24 | + $country_options = apply_filters( |
|
25 | + 'FHEE__EE_Country_Select_Input____construct__country_options', |
|
26 | + $this->get_country_answer_options($country_options), |
|
27 | + $this |
|
28 | + ); |
|
29 | + $input_settings['html_class'] = isset($input_settings['html_class']) |
|
30 | + ? $input_settings['html_class'] . ' ee-country-select-js' |
|
31 | + : 'ee-country-select-js'; |
|
32 | + parent::__construct($country_options, $input_settings); |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * get_country_answer_options |
|
39 | - * |
|
40 | - * @param array $country_options |
|
41 | - * @return array |
|
42 | - */ |
|
43 | - public function get_country_answer_options($country_options = null) |
|
44 | - { |
|
45 | - // if passed something that is NOT an array |
|
46 | - if (! is_array($country_options)) { |
|
47 | - // get possibly cached list of countries |
|
48 | - $countries = EEM_Country::instance()->get_all_active_countries(); |
|
49 | - if (! empty($countries)) { |
|
50 | - $country_options[''] = ''; |
|
51 | - foreach ($countries as $country) { |
|
52 | - if ($country instanceof EE_Country) { |
|
53 | - $country_options[ $country->ID() ] = $country->name(); |
|
54 | - } |
|
55 | - } |
|
56 | - } else { |
|
57 | - $country_options = array(); |
|
58 | - } |
|
59 | - } |
|
60 | - return $country_options; |
|
61 | - } |
|
37 | + /** |
|
38 | + * get_country_answer_options |
|
39 | + * |
|
40 | + * @param array $country_options |
|
41 | + * @return array |
|
42 | + */ |
|
43 | + public function get_country_answer_options($country_options = null) |
|
44 | + { |
|
45 | + // if passed something that is NOT an array |
|
46 | + if (! is_array($country_options)) { |
|
47 | + // get possibly cached list of countries |
|
48 | + $countries = EEM_Country::instance()->get_all_active_countries(); |
|
49 | + if (! empty($countries)) { |
|
50 | + $country_options[''] = ''; |
|
51 | + foreach ($countries as $country) { |
|
52 | + if ($country instanceof EE_Country) { |
|
53 | + $country_options[ $country->ID() ] = $country->name(); |
|
54 | + } |
|
55 | + } |
|
56 | + } else { |
|
57 | + $country_options = array(); |
|
58 | + } |
|
59 | + } |
|
60 | + return $country_options; |
|
61 | + } |
|
62 | 62 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $this |
28 | 28 | ); |
29 | 29 | $input_settings['html_class'] = isset($input_settings['html_class']) |
30 | - ? $input_settings['html_class'] . ' ee-country-select-js' |
|
30 | + ? $input_settings['html_class'].' ee-country-select-js' |
|
31 | 31 | : 'ee-country-select-js'; |
32 | 32 | parent::__construct($country_options, $input_settings); |
33 | 33 | } |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | public function get_country_answer_options($country_options = null) |
44 | 44 | { |
45 | 45 | // if passed something that is NOT an array |
46 | - if (! is_array($country_options)) { |
|
46 | + if ( ! is_array($country_options)) { |
|
47 | 47 | // get possibly cached list of countries |
48 | 48 | $countries = EEM_Country::instance()->get_all_active_countries(); |
49 | - if (! empty($countries)) { |
|
49 | + if ( ! empty($countries)) { |
|
50 | 50 | $country_options[''] = ''; |
51 | 51 | foreach ($countries as $country) { |
52 | 52 | if ($country instanceof EE_Country) { |
53 | - $country_options[ $country->ID() ] = $country->name(); |
|
53 | + $country_options[$country->ID()] = $country->name(); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } else { |
@@ -11,42 +11,42 @@ |
||
11 | 11 | class EE_Button_Input extends EE_Form_Input_Base |
12 | 12 | { |
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 | } |
@@ -11,17 +11,17 @@ |
||
11 | 11 | class EE_Submit_Input extends EE_Form_Input_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @param array $options |
|
16 | - */ |
|
17 | - public function __construct($options = array()) |
|
18 | - { |
|
19 | - if (empty($options['default'])) { |
|
20 | - $options['default'] = esc_html__('Submit', 'event_espresso'); |
|
21 | - } |
|
22 | - $this->_set_display_strategy(new EE_Submit_Input_Display_Strategy()); |
|
23 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
24 | - $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
25 | - parent::__construct($options); |
|
26 | - } |
|
14 | + /** |
|
15 | + * @param array $options |
|
16 | + */ |
|
17 | + public function __construct($options = array()) |
|
18 | + { |
|
19 | + if (empty($options['default'])) { |
|
20 | + $options['default'] = esc_html__('Submit', 'event_espresso'); |
|
21 | + } |
|
22 | + $this->_set_display_strategy(new EE_Submit_Input_Display_Strategy()); |
|
23 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
24 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
25 | + parent::__construct($options); |
|
26 | + } |
|
27 | 27 | } |
@@ -14,15 +14,15 @@ |
||
14 | 14 | class EE_Checkbox_Multi_Input extends EE_Form_Input_With_Options_Base |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param array $input_settings |
|
19 | - * @param array | EE_Question_Option[] $answer_options |
|
20 | - */ |
|
21 | - public function __construct($answer_options, $input_settings = array()) |
|
22 | - { |
|
23 | - $this->_set_display_strategy(new EE_Checkbox_Display_Strategy()); |
|
24 | - $this->_add_validation_strategy(new EE_Many_Valued_Validation_Strategy(array( new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : null) ))); |
|
25 | - $this->_multiple_selections = true; |
|
26 | - parent::__construct($answer_options, $input_settings); |
|
27 | - } |
|
17 | + /** |
|
18 | + * @param array $input_settings |
|
19 | + * @param array | EE_Question_Option[] $answer_options |
|
20 | + */ |
|
21 | + public function __construct($answer_options, $input_settings = array()) |
|
22 | + { |
|
23 | + $this->_set_display_strategy(new EE_Checkbox_Display_Strategy()); |
|
24 | + $this->_add_validation_strategy(new EE_Many_Valued_Validation_Strategy(array( new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : null) ))); |
|
25 | + $this->_multiple_selections = true; |
|
26 | + parent::__construct($answer_options, $input_settings); |
|
27 | + } |
|
28 | 28 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function __construct($answer_options, $input_settings = array()) |
22 | 22 | { |
23 | 23 | $this->_set_display_strategy(new EE_Checkbox_Display_Strategy()); |
24 | - $this->_add_validation_strategy(new EE_Many_Valued_Validation_Strategy(array( new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : null) ))); |
|
24 | + $this->_add_validation_strategy(new EE_Many_Valued_Validation_Strategy(array(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : null)))); |
|
25 | 25 | $this->_multiple_selections = true; |
26 | 26 | parent::__construct($answer_options, $input_settings); |
27 | 27 | } |
@@ -9,36 +9,36 @@ |
||
9 | 9 | class EE_Month_Input extends EE_Select_Input |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param bool $leading_zero |
|
14 | - * @param array $input_settings |
|
15 | - * @param bool $january_is_month_1 whether january should have value of 1; or it should be month 0 |
|
16 | - */ |
|
17 | - public function __construct($leading_zero = false, $input_settings = array(), $january_is_month_1 = true) |
|
18 | - { |
|
19 | - $key_begin_range = $january_is_month_1 ? 1 : 0; |
|
20 | - $key_range = range($key_begin_range, $key_begin_range + 11); |
|
21 | - if ($leading_zero) { |
|
22 | - array_walk($key_range, array( $this, '_zero_pad' )); |
|
23 | - } |
|
24 | - $value_range = range(1, 12); |
|
25 | - array_walk($value_range, array( $this, '_zero_pad' )); |
|
26 | - parent::__construct( |
|
27 | - array_combine( |
|
28 | - $key_range, |
|
29 | - $value_range |
|
30 | - ), |
|
31 | - $input_settings |
|
32 | - ); |
|
33 | - } |
|
12 | + /** |
|
13 | + * @param bool $leading_zero |
|
14 | + * @param array $input_settings |
|
15 | + * @param bool $january_is_month_1 whether january should have value of 1; or it should be month 0 |
|
16 | + */ |
|
17 | + public function __construct($leading_zero = false, $input_settings = array(), $january_is_month_1 = true) |
|
18 | + { |
|
19 | + $key_begin_range = $january_is_month_1 ? 1 : 0; |
|
20 | + $key_range = range($key_begin_range, $key_begin_range + 11); |
|
21 | + if ($leading_zero) { |
|
22 | + array_walk($key_range, array( $this, '_zero_pad' )); |
|
23 | + } |
|
24 | + $value_range = range(1, 12); |
|
25 | + array_walk($value_range, array( $this, '_zero_pad' )); |
|
26 | + parent::__construct( |
|
27 | + array_combine( |
|
28 | + $key_range, |
|
29 | + $value_range |
|
30 | + ), |
|
31 | + $input_settings |
|
32 | + ); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Changes int 1 to 01, etc. Useful with array_walk |
|
37 | - * @param int $input |
|
38 | - * @param mixed $key |
|
39 | - */ |
|
40 | - protected function _zero_pad(&$input, $key) |
|
41 | - { |
|
42 | - $input = str_pad($input, 2, '0', STR_PAD_LEFT); |
|
43 | - } |
|
35 | + /** |
|
36 | + * Changes int 1 to 01, etc. Useful with array_walk |
|
37 | + * @param int $input |
|
38 | + * @param mixed $key |
|
39 | + */ |
|
40 | + protected function _zero_pad(&$input, $key) |
|
41 | + { |
|
42 | + $input = str_pad($input, 2, '0', STR_PAD_LEFT); |
|
43 | + } |
|
44 | 44 | } |
@@ -19,10 +19,10 @@ |
||
19 | 19 | $key_begin_range = $january_is_month_1 ? 1 : 0; |
20 | 20 | $key_range = range($key_begin_range, $key_begin_range + 11); |
21 | 21 | if ($leading_zero) { |
22 | - array_walk($key_range, array( $this, '_zero_pad' )); |
|
22 | + array_walk($key_range, array($this, '_zero_pad')); |
|
23 | 23 | } |
24 | 24 | $value_range = range(1, 12); |
25 | - array_walk($value_range, array( $this, '_zero_pad' )); |
|
25 | + array_walk($value_range, array($this, '_zero_pad')); |
|
26 | 26 | parent::__construct( |
27 | 27 | array_combine( |
28 | 28 | $key_range, |
@@ -11,14 +11,14 @@ |
||
11 | 11 | class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @param array $input_settings |
|
16 | - */ |
|
17 | - public function __construct($input_settings = array()) |
|
18 | - { |
|
19 | - $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
|
20 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
21 | - $this->_add_validation_strategy(new EE_URL_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : null)); |
|
22 | - parent::__construct($input_settings); |
|
23 | - } |
|
14 | + /** |
|
15 | + * @param array $input_settings |
|
16 | + */ |
|
17 | + public function __construct($input_settings = array()) |
|
18 | + { |
|
19 | + $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
|
20 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
21 | + $this->_add_validation_strategy(new EE_URL_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : null)); |
|
22 | + parent::__construct($input_settings); |
|
23 | + } |
|
24 | 24 | } |