@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Select_Input |
4 | 4 | * |
@@ -10,22 +10,22 @@ discard block |
||
10 | 10 | * @since 4.6 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Select_Input extends EE_Form_Input_With_Options_Base{ |
|
13 | +class EE_Select_Input extends EE_Form_Input_With_Options_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param array $answer_options |
17 | 17 | * @param array $input_settings |
18 | 18 | */ |
19 | - public function __construct( $answer_options, $input_settings = array() ) { |
|
20 | - $this->_set_display_strategy( new EE_Select_Display_Strategy( $answer_options ) ); |
|
19 | + public function __construct($answer_options, $input_settings = array()) { |
|
20 | + $this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options)); |
|
21 | 21 | $this->_add_validation_strategy( |
22 | 22 | new EE_Enum_Validation_Strategy( |
23 | - isset( $input_settings['validation_error_message'] ) |
|
23 | + isset($input_settings['validation_error_message']) |
|
24 | 24 | ? $input_settings['validation_error_message'] |
25 | 25 | : null |
26 | 26 | ) |
27 | 27 | ); |
28 | - parent::__construct( $answer_options, $input_settings ); |
|
28 | + parent::__construct($answer_options, $input_settings); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -810,8 +810,7 @@ |
||
810 | 810 | * (If that doesn't exist, we also check for this subsection's name |
811 | 811 | * at the TOP LEVEL of the request data. Eg $_REQUEST['form_input_1'].) |
812 | 812 | * This function finds its value in the form. |
813 | - |
|
814 | -* |
|
813 | + * |
|
815 | 814 | *@param array $req_data |
816 | 815 | * @return mixed whatever the raw value of this form section is in the request data |
817 | 816 | * @throws \EE_Error |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->html_id() |
244 | 244 | ) |
245 | 245 | ); |
246 | - }else{ |
|
246 | + } else{ |
|
247 | 247 | return $this->_display_strategy; |
248 | 248 | } |
249 | 249 | } |
@@ -458,14 +458,14 @@ discard block |
||
458 | 458 | if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
459 | 459 | try{ |
460 | 460 | $validation_strategy->validate($this->normalized_value()); |
461 | - }catch(EE_Validation_Error $e){ |
|
461 | + } catch(EE_Validation_Error $e){ |
|
462 | 462 | $this->add_validation_error($e); |
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | 466 | if( $this->get_validation_errors()){ |
467 | 467 | return false; |
468 | - }else{ |
|
468 | + } else{ |
|
469 | 469 | return true; |
470 | 470 | } |
471 | 471 | } |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
829 | 829 | $name_parts = $matches[ 1 ]; |
830 | 830 | array_unshift($name_parts, $before_any_brackets); |
831 | - }else{ |
|
831 | + } else{ |
|
832 | 832 | $name_parts = array( $before_any_brackets ); |
833 | 833 | } |
834 | 834 | // now get the value for the input |
@@ -853,13 +853,13 @@ discard block |
||
853 | 853 | if( isset( $req_data[ $first_part_to_consider ] ) ){ |
854 | 854 | if( empty($html_name_parts ) ){ |
855 | 855 | return $req_data[ $first_part_to_consider ]; |
856 | - }else{ |
|
856 | + } else{ |
|
857 | 857 | return $this->_find_form_data_for_this_section_using_name_parts( |
858 | 858 | $html_name_parts, |
859 | 859 | $req_data[ $first_part_to_consider ] |
860 | 860 | ); |
861 | 861 | } |
862 | - }else{ |
|
862 | + } else{ |
|
863 | 863 | return NULL; |
864 | 864 | } |
865 | 865 | } |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | $checked_value = $this->find_form_data_for_this_section( $req_data ); |
881 | 881 | if( $checked_value !== null ){ |
882 | 882 | return TRUE; |
883 | - }else{ |
|
883 | + } else{ |
|
884 | 884 | return FALSE; |
885 | 885 | } |
886 | 886 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{ |
|
11 | +abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * the input's name attribute |
@@ -143,54 +143,54 @@ discard block |
||
143 | 143 | * @type EE_Validation_Strategy_Base[] $validation_strategies |
144 | 144 | * } |
145 | 145 | */ |
146 | - public function __construct( $input_args = array() ){ |
|
147 | - $input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this ); |
|
146 | + public function __construct($input_args = array()) { |
|
147 | + $input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this); |
|
148 | 148 | // the following properties must be cast as arrays |
149 | - if ( isset( $input_args['validation_strategies'] ) ) { |
|
150 | - foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) { |
|
151 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
152 | - $this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy; |
|
149 | + if (isset($input_args['validation_strategies'])) { |
|
150 | + foreach ((array) $input_args['validation_strategies'] as $validation_strategy) { |
|
151 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
152 | + $this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy; |
|
153 | 153 | } |
154 | 154 | } |
155 | - unset( $input_args['validation_strategies'] ); |
|
155 | + unset($input_args['validation_strategies']); |
|
156 | 156 | } |
157 | 157 | // loop thru incoming options |
158 | - foreach( $input_args as $key => $value ) { |
|
158 | + foreach ($input_args as $key => $value) { |
|
159 | 159 | // add underscore to $key to match property names |
160 | - $_key = '_' . $key; |
|
161 | - if ( property_exists( $this, $_key )) { |
|
160 | + $_key = '_'.$key; |
|
161 | + if (property_exists($this, $_key)) { |
|
162 | 162 | $this->{$_key} = $value; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | // ensure that "required" is set correctly |
166 | 166 | $this->set_required( |
167 | - $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) |
|
168 | - ? $input_args[ 'required_validation_error_message' ] |
|
167 | + $this->_required, isset($input_args['required_validation_error_message']) |
|
168 | + ? $input_args['required_validation_error_message'] |
|
169 | 169 | : null |
170 | 170 | ); |
171 | 171 | |
172 | 172 | //$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE; |
173 | 173 | |
174 | 174 | $this->_display_strategy->_construct_finalize($this); |
175 | - foreach( $this->_validation_strategies as $validation_strategy ){ |
|
175 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
176 | 176 | $validation_strategy->_construct_finalize($this); |
177 | 177 | } |
178 | 178 | |
179 | - if( ! $this->_normalization_strategy){ |
|
179 | + if ( ! $this->_normalization_strategy) { |
|
180 | 180 | $this->_normalization_strategy = new EE_Text_Normalization(); |
181 | 181 | } |
182 | 182 | $this->_normalization_strategy->_construct_finalize($this); |
183 | 183 | |
184 | 184 | //at least we can use the normalization strategy to populate the default |
185 | - if( isset( $input_args[ 'default' ] ) ) { |
|
186 | - $this->set_default( $input_args[ 'default' ] ); |
|
185 | + if (isset($input_args['default'])) { |
|
186 | + $this->set_default($input_args['default']); |
|
187 | 187 | } |
188 | 188 | |
189 | - if( ! $this->_sensitive_data_removal_strategy){ |
|
189 | + if ( ! $this->_sensitive_data_removal_strategy) { |
|
190 | 190 | $this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal(); |
191 | 191 | } |
192 | 192 | $this->_sensitive_data_removal_strategy->_construct_finalize($this); |
193 | - parent::__construct( $input_args ); |
|
193 | + parent::__construct($input_args); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | - protected function _set_default_html_name_if_empty(){ |
|
205 | - if( ! $this->_html_name){ |
|
204 | + protected function _set_default_html_name_if_empty() { |
|
205 | + if ( ! $this->_html_name) { |
|
206 | 206 | $this->_html_name = $this->name(); |
207 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){ |
|
208 | - $this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]"; |
|
207 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
208 | + $this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]"; |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | } |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function _construct_finalize($parent_form_section, $name) { |
221 | 221 | parent::_construct_finalize($parent_form_section, $name); |
222 | - if( $this->_html_label === null && $this->_html_label_text === null ){ |
|
223 | - $this->_html_label_text = ucwords( str_replace("_"," ",$name)); |
|
222 | + if ($this->_html_label === null && $this->_html_label_text === null) { |
|
223 | + $this->_html_label_text = ucwords(str_replace("_", " ", $name)); |
|
224 | 224 | } |
225 | - do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name ); |
|
225 | + do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | * @return EE_Display_Strategy_Base |
231 | 231 | * @throws EE_Error |
232 | 232 | */ |
233 | - protected function _get_display_strategy(){ |
|
233 | + protected function _get_display_strategy() { |
|
234 | 234 | $this->ensure_construct_finalized_called(); |
235 | - if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){ |
|
235 | + if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) { |
|
236 | 236 | throw new EE_Error( |
237 | 237 | sprintf( |
238 | 238 | __( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->html_id() |
244 | 244 | ) |
245 | 245 | ); |
246 | - }else{ |
|
246 | + } else { |
|
247 | 247 | return $this->_display_strategy; |
248 | 248 | } |
249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * Sets the display strategy. |
252 | 252 | * @param EE_Display_Strategy_Base $strategy |
253 | 253 | */ |
254 | - protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){ |
|
254 | + protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) { |
|
255 | 255 | $this->_display_strategy = $strategy; |
256 | 256 | } |
257 | 257 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * Sets the sanitization strategy |
260 | 260 | * @param EE_Normalization_Strategy_Base $strategy |
261 | 261 | */ |
262 | - protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){ |
|
262 | + protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) { |
|
263 | 263 | $this->_normalization_strategy = $strategy; |
264 | 264 | } |
265 | 265 | |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | * Gets the display strategy for this input |
286 | 286 | * @return EE_Display_Strategy_Base |
287 | 287 | */ |
288 | - public function get_display_strategy(){ |
|
288 | + public function get_display_strategy() { |
|
289 | 289 | return $this->_display_strategy; |
290 | 290 | } |
291 | 291 | /** |
292 | 292 | * Overwrites the display strategy |
293 | 293 | * @param EE_Display_Strategy_Base $display_strategy |
294 | 294 | */ |
295 | - public function set_display_strategy($display_strategy){ |
|
295 | + public function set_display_strategy($display_strategy) { |
|
296 | 296 | $this->_display_strategy = $display_strategy; |
297 | 297 | $this->_display_strategy->_construct_finalize($this); |
298 | 298 | } |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * Gets the normalization strategy set on this input |
301 | 301 | * @return EE_Normalization_Strategy_Base |
302 | 302 | */ |
303 | - public function get_normalization_strategy(){ |
|
303 | + public function get_normalization_strategy() { |
|
304 | 304 | return $this->_normalization_strategy; |
305 | 305 | } |
306 | 306 | /** |
307 | 307 | * Overwrites the normalization strategy |
308 | 308 | * @param EE_Normalization_Strategy_Base $normalization_strategy |
309 | 309 | */ |
310 | - public function set_normalization_strategy($normalization_strategy){ |
|
310 | + public function set_normalization_strategy($normalization_strategy) { |
|
311 | 311 | $this->_normalization_strategy = $normalization_strategy; |
312 | 312 | $this->_normalization_strategy->_construct_finalize($this); |
313 | 313 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * Returns all teh validation strategies which apply to this field, numerically indexed |
317 | 317 | * @return EE_Validation_Strategy_Base[] |
318 | 318 | */ |
319 | - public function get_validation_strategies(){ |
|
319 | + public function get_validation_strategies() { |
|
320 | 320 | return $this->_validation_strategies; |
321 | 321 | } |
322 | 322 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * @param EE_Validation_Strategy_Base $validation_strategy |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){ |
|
331 | - $validation_strategy->_construct_finalize( $this ); |
|
330 | + protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
331 | + $validation_strategy->_construct_finalize($this); |
|
332 | 332 | $this->_validation_strategies[] = $validation_strategy; |
333 | 333 | } |
334 | 334 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_Validation_Strategy_Base $validation_strategy |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) { |
|
343 | - $this->_add_validation_strategy( $validation_strategy ); |
|
342 | + public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
343 | + $this->_add_validation_strategy($validation_strategy); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -350,13 +350,13 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @param string $validation_strategy_classname |
352 | 352 | */ |
353 | - public function remove_validation_strategy( $validation_strategy_classname ) { |
|
354 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
355 | - if( |
|
353 | + public function remove_validation_strategy($validation_strategy_classname) { |
|
354 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
355 | + if ( |
|
356 | 356 | $validation_strategy instanceof $validation_strategy_classname |
357 | - || is_subclass_of( $validation_strategy, $validation_strategy_classname ) |
|
357 | + || is_subclass_of($validation_strategy, $validation_strategy_classname) |
|
358 | 358 | ) { |
359 | - unset( $this->_validation_strategies[ $key ] ); |
|
359 | + unset($this->_validation_strategies[$key]); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | } |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | * @param array $validation_strategy_classnames |
370 | 370 | * @return bool |
371 | 371 | */ |
372 | - public function has_validation_strategy( $validation_strategy_classnames ) { |
|
373 | - $validation_strategy_classnames = is_array( $validation_strategy_classnames ) |
|
372 | + public function has_validation_strategy($validation_strategy_classnames) { |
|
373 | + $validation_strategy_classnames = is_array($validation_strategy_classnames) |
|
374 | 374 | ? $validation_strategy_classnames |
375 | - : array( $validation_strategy_classnames ); |
|
376 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
377 | - if( in_array( $key, $validation_strategy_classnames ) ) { |
|
375 | + : array($validation_strategy_classnames); |
|
376 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
377 | + if (in_array($key, $validation_strategy_classnames)) { |
|
378 | 378 | return true; |
379 | 379 | } |
380 | 380 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * Gets the HTML |
388 | 388 | * @return string |
389 | 389 | */ |
390 | - public function get_html(){ |
|
390 | + public function get_html() { |
|
391 | 391 | return $this->_parent_section->get_html_for_input($this); |
392 | 392 | } |
393 | 393 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @return string |
402 | 402 | * @throws \EE_Error |
403 | 403 | */ |
404 | - public function get_html_for_input(){ |
|
404 | + public function get_html_for_input() { |
|
405 | 405 | |
406 | 406 | return $this->_get_display_strategy()->display(); |
407 | 407 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return string |
413 | 413 | */ |
414 | 414 | public function html_other_attributes() { |
415 | - return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : ''; |
|
415 | + return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : ''; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * @param string $html_other_attributes |
422 | 422 | */ |
423 | - public function set_html_other_attributes( $html_other_attributes ) { |
|
423 | + public function set_html_other_attributes($html_other_attributes) { |
|
424 | 424 | $this->_html_other_attributes = $html_other_attributes; |
425 | 425 | } |
426 | 426 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * according to the form section's layout strategy |
430 | 430 | * @return string |
431 | 431 | */ |
432 | - public function get_html_for_label(){ |
|
432 | + public function get_html_for_label() { |
|
433 | 433 | return $this->_parent_section->get_layout_strategy()->display_label($this); |
434 | 434 | } |
435 | 435 | /** |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * according to the form section's layout strategy |
438 | 438 | * @return string |
439 | 439 | */ |
440 | - public function get_html_for_errors(){ |
|
440 | + public function get_html_for_errors() { |
|
441 | 441 | return $this->_parent_section->get_layout_strategy()->display_errors($this); |
442 | 442 | } |
443 | 443 | /** |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * according to the form section's layout strategy |
446 | 446 | * @return string |
447 | 447 | */ |
448 | - public function get_html_for_help(){ |
|
448 | + public function get_html_for_help() { |
|
449 | 449 | return $this->_parent_section->get_layout_strategy()->display_help_text($this); |
450 | 450 | } |
451 | 451 | /** |
@@ -454,18 +454,18 @@ discard block |
||
454 | 454 | * @return boolean |
455 | 455 | */ |
456 | 456 | protected function _validate() { |
457 | - foreach($this->_validation_strategies as $validation_strategy){ |
|
458 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
459 | - try{ |
|
457 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
458 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
459 | + try { |
|
460 | 460 | $validation_strategy->validate($this->normalized_value()); |
461 | - }catch(EE_Validation_Error $e){ |
|
461 | + } catch (EE_Validation_Error $e) { |
|
462 | 462 | $this->add_validation_error($e); |
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | - if( $this->get_validation_errors()){ |
|
466 | + if ($this->get_validation_errors()) { |
|
467 | 467 | return false; |
468 | - }else{ |
|
468 | + } else { |
|
469 | 469 | return true; |
470 | 470 | } |
471 | 471 | } |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | * @param string $value |
480 | 480 | * @return null|string |
481 | 481 | */ |
482 | - private function _sanitize( $value ) { |
|
483 | - return $value !== null ? stripslashes( html_entity_decode( trim( $value ) ) ) : null; |
|
482 | + private function _sanitize($value) { |
|
483 | + return $value !== null ? stripslashes(html_entity_decode(trim($value))) : null; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -494,25 +494,25 @@ discard block |
||
494 | 494 | * @return boolean whether or not there was an error |
495 | 495 | * @throws \EE_Error |
496 | 496 | */ |
497 | - protected function _normalize( $req_data ) { |
|
497 | + protected function _normalize($req_data) { |
|
498 | 498 | //any existing validation errors don't apply so clear them |
499 | 499 | $this->_validation_errors = array(); |
500 | 500 | try { |
501 | - $raw_input = $this->find_form_data_for_this_section( $req_data ); |
|
501 | + $raw_input = $this->find_form_data_for_this_section($req_data); |
|
502 | 502 | //super simple sanitization for now |
503 | - if ( is_array( $raw_input )) { |
|
503 | + if (is_array($raw_input)) { |
|
504 | 504 | $raw_value = array(); |
505 | - foreach( $raw_input as $key => $value ) { |
|
506 | - $raw_value[ $key ] = $this->_sanitize( $value ); |
|
505 | + foreach ($raw_input as $key => $value) { |
|
506 | + $raw_value[$key] = $this->_sanitize($value); |
|
507 | 507 | } |
508 | - $this->_set_raw_value( $raw_value ); |
|
508 | + $this->_set_raw_value($raw_value); |
|
509 | 509 | } else { |
510 | - $this->_set_raw_value( $this->_sanitize( $raw_input ) ); |
|
510 | + $this->_set_raw_value($this->_sanitize($raw_input)); |
|
511 | 511 | } |
512 | 512 | //we want to mostly leave the input alone in case we need to re-display it to the user |
513 | - $this->_set_normalized_value( $this->_normalization_strategy->normalize( $this->raw_value() ) ); |
|
514 | - } catch ( EE_Validation_Error $e ) { |
|
515 | - $this->add_validation_error( $e ); |
|
513 | + $this->_set_normalized_value($this->_normalization_strategy->normalize($this->raw_value())); |
|
514 | + } catch (EE_Validation_Error $e) { |
|
515 | + $this->add_validation_error($e); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | /** |
522 | 522 | * @return string |
523 | 523 | */ |
524 | - public function html_name(){ |
|
524 | + public function html_name() { |
|
525 | 525 | $this->_set_default_html_name_if_empty(); |
526 | 526 | return $this->_html_name; |
527 | 527 | } |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | /** |
532 | 532 | * @return string |
533 | 533 | */ |
534 | - public function html_label_id(){ |
|
535 | - return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl'; |
|
534 | + public function html_label_id() { |
|
535 | + return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl'; |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | /** |
541 | 541 | * @return string |
542 | 542 | */ |
543 | - public function html_label_class(){ |
|
543 | + public function html_label_class() { |
|
544 | 544 | return $this->_html_label_class; |
545 | 545 | } |
546 | 546 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | /** |
550 | 550 | * @return string |
551 | 551 | */ |
552 | - public function html_label_style(){ |
|
552 | + public function html_label_style() { |
|
553 | 553 | return $this->_html_label_style; |
554 | 554 | } |
555 | 555 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | /** |
559 | 559 | * @return string |
560 | 560 | */ |
561 | - public function html_label_text(){ |
|
561 | + public function html_label_text() { |
|
562 | 562 | return $this->_html_label_text; |
563 | 563 | } |
564 | 564 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | /** |
568 | 568 | * @return string |
569 | 569 | */ |
570 | - public function html_help_text(){ |
|
570 | + public function html_help_text() { |
|
571 | 571 | return $this->_html_help_text; |
572 | 572 | } |
573 | 573 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | /** |
577 | 577 | * @return string |
578 | 578 | */ |
579 | - public function html_help_class(){ |
|
579 | + public function html_help_class() { |
|
580 | 580 | return $this->_html_help_class; |
581 | 581 | } |
582 | 582 | |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | /** |
586 | 586 | * @return string |
587 | 587 | */ |
588 | - public function html_help_style(){ |
|
588 | + public function html_help_style() { |
|
589 | 589 | return $this->_html_style; |
590 | 590 | } |
591 | 591 | /** |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * in which case, we would have stored the malicious content to our database. |
599 | 599 | * @return string |
600 | 600 | */ |
601 | - public function raw_value(){ |
|
601 | + public function raw_value() { |
|
602 | 602 | return $this->_raw_value; |
603 | 603 | } |
604 | 604 | /** |
@@ -606,15 +606,15 @@ discard block |
||
606 | 606 | * it escapes all html entities |
607 | 607 | * @return string |
608 | 608 | */ |
609 | - public function raw_value_in_form(){ |
|
610 | - return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8'); |
|
609 | + public function raw_value_in_form() { |
|
610 | + return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8'); |
|
611 | 611 | } |
612 | 612 | /** |
613 | 613 | * returns the value after it's been sanitized, and then converted into it's proper type |
614 | 614 | * in PHP. Eg, a string, an int, an array, |
615 | 615 | * @return mixed |
616 | 616 | */ |
617 | - public function normalized_value(){ |
|
617 | + public function normalized_value() { |
|
618 | 618 | return $this->_normalized_value; |
619 | 619 | } |
620 | 620 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * the best thing to display |
625 | 625 | * @return string |
626 | 626 | */ |
627 | - public function pretty_value(){ |
|
627 | + public function pretty_value() { |
|
628 | 628 | return $this->_normalized_value; |
629 | 629 | } |
630 | 630 | /** |
@@ -643,19 +643,19 @@ discard block |
||
643 | 643 | }</code> |
644 | 644 | * @return array |
645 | 645 | */ |
646 | - public function get_jquery_validation_rules(){ |
|
646 | + public function get_jquery_validation_rules() { |
|
647 | 647 | $jquery_validation_js = array(); |
648 | 648 | $jquery_validation_rules = array(); |
649 | - foreach($this->get_validation_strategies() as $validation_strategy){ |
|
649 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
650 | 650 | $jquery_validation_rules = array_replace_recursive( |
651 | 651 | $jquery_validation_rules, |
652 | 652 | $validation_strategy->get_jquery_validation_rule_array() |
653 | 653 | ); |
654 | 654 | } |
655 | 655 | |
656 | - if(! empty($jquery_validation_rules)){ |
|
657 | - foreach( $this->get_display_strategy()->get_html_input_ids( true ) as $html_id_with_pound_sign ) { |
|
658 | - $jquery_validation_js[ $html_id_with_pound_sign ] = $jquery_validation_rules; |
|
656 | + if ( ! empty($jquery_validation_rules)) { |
|
657 | + foreach ($this->get_display_strategy()->get_html_input_ids(true) as $html_id_with_pound_sign) { |
|
658 | + $jquery_validation_js[$html_id_with_pound_sign] = $jquery_validation_rules; |
|
659 | 659 | } |
660 | 660 | } |
661 | 661 | return $jquery_validation_js; |
@@ -667,16 +667,16 @@ discard block |
||
667 | 667 | * @param mixed $value |
668 | 668 | * @return void |
669 | 669 | */ |
670 | - public function set_default($value){ |
|
671 | - $this->_set_normalized_value( $value ); |
|
672 | - $this->_set_raw_value( $value ); |
|
670 | + public function set_default($value) { |
|
671 | + $this->_set_normalized_value($value); |
|
672 | + $this->_set_raw_value($value); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | /** |
676 | 676 | * Sets the normalized value on this input |
677 | 677 | * @param mixed $value |
678 | 678 | */ |
679 | - protected function _set_normalized_value( $value ) { |
|
679 | + protected function _set_normalized_value($value) { |
|
680 | 680 | $this->_normalized_value = $value; |
681 | 681 | } |
682 | 682 | |
@@ -684,8 +684,8 @@ discard block |
||
684 | 684 | * Sets the raw value on this input (ie, exactly as the user submitted it) |
685 | 685 | * @param mixed $value |
686 | 686 | */ |
687 | - protected function _set_raw_value( $value ) { |
|
688 | - $this->_raw_value = $this->_normalization_strategy->unnormalize( $value ); |
|
687 | + protected function _set_raw_value($value) { |
|
688 | + $this->_raw_value = $this->_normalization_strategy->unnormalize($value); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | /** |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | * @param string $label |
694 | 694 | * @return void |
695 | 695 | */ |
696 | - public function set_html_label_text($label){ |
|
696 | + public function set_html_label_text($label) { |
|
697 | 697 | $this->_html_label_text = $label; |
698 | 698 | } |
699 | 699 | |
@@ -707,13 +707,13 @@ discard block |
||
707 | 707 | * @param boolean $required boolean |
708 | 708 | * @param null $required_text |
709 | 709 | */ |
710 | - public function set_required($required = true, $required_text = NULL ){ |
|
711 | - $required = filter_var( $required, FILTER_VALIDATE_BOOLEAN ); |
|
710 | + public function set_required($required = true, $required_text = NULL) { |
|
711 | + $required = filter_var($required, FILTER_VALIDATE_BOOLEAN); |
|
712 | 712 | //whether $required is a string or a boolean, we want to add a required validation strategy |
713 | - if ( $required ) { |
|
714 | - $this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) ); |
|
713 | + if ($required) { |
|
714 | + $this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text)); |
|
715 | 715 | } else { |
716 | - $this->remove_validation_strategy( 'EE_Required_Validation_Strategy' ); |
|
716 | + $this->remove_validation_strategy('EE_Required_Validation_Strategy'); |
|
717 | 717 | } |
718 | 718 | $this->_required = $required; |
719 | 719 | } |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * Returns whether or not this field is required |
722 | 722 | * @return boolean |
723 | 723 | */ |
724 | - public function required(){ |
|
724 | + public function required() { |
|
725 | 725 | return $this->_required; |
726 | 726 | } |
727 | 727 | |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | /** |
731 | 731 | * @param string $required_css_class |
732 | 732 | */ |
733 | - public function set_required_css_class( $required_css_class ) { |
|
733 | + public function set_required_css_class($required_css_class) { |
|
734 | 734 | $this->_required_css_class = $required_css_class; |
735 | 735 | } |
736 | 736 | |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | * Sets the help text, in case |
750 | 750 | * @param string $text |
751 | 751 | */ |
752 | - public function set_html_help_text($text){ |
|
752 | + public function set_html_help_text($text) { |
|
753 | 753 | $this->_html_help_text = $text; |
754 | 754 | } |
755 | 755 | /** |
@@ -761,9 +761,9 @@ discard block |
||
761 | 761 | public function clean_sensitive_data() { |
762 | 762 | //if we do ANY kind of sensitive data removal on this, then just clear out the raw value |
763 | 763 | //if we need more logic than this we'll make a strategy for it |
764 | - if( $this->_sensitive_data_removal_strategy && |
|
765 | - ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){ |
|
766 | - $this->_set_raw_value( null ); |
|
764 | + if ($this->_sensitive_data_removal_strategy && |
|
765 | + ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) { |
|
766 | + $this->_set_raw_value(null); |
|
767 | 767 | } |
768 | 768 | //and clean the normalized value according to the appropriate strategy |
769 | 769 | $this->_set_normalized_value( |
@@ -780,10 +780,10 @@ discard block |
||
780 | 780 | * @param string $button_size |
781 | 781 | * @param string $other_attributes |
782 | 782 | */ |
783 | - public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) { |
|
783 | + public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') { |
|
784 | 784 | $button_css_attributes = 'button'; |
785 | 785 | $button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary'; |
786 | - switch ( $button_size ) { |
|
786 | + switch ($button_size) { |
|
787 | 787 | case 'xs' : |
788 | 788 | case 'extra-small' : |
789 | 789 | $button_css_attributes .= ' button-xs'; |
@@ -804,8 +804,8 @@ discard block |
||
804 | 804 | default : |
805 | 805 | $button_css_attributes .= ''; |
806 | 806 | } |
807 | - $this->_button_css_attributes .= ! empty( $other_attributes ) |
|
808 | - ? $button_css_attributes . ' ' . $other_attributes |
|
807 | + $this->_button_css_attributes .= ! empty($other_attributes) |
|
808 | + ? $button_css_attributes.' '.$other_attributes |
|
809 | 809 | : $button_css_attributes; |
810 | 810 | } |
811 | 811 | |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | * @return string |
816 | 816 | */ |
817 | 817 | public function button_css_attributes() { |
818 | - if ( empty( $this->_button_css_attributes )) { |
|
818 | + if (empty($this->_button_css_attributes)) { |
|
819 | 819 | $this->set_button_css_attributes(); |
820 | 820 | } |
821 | 821 | return $this->_button_css_attributes; |
@@ -837,26 +837,26 @@ discard block |
||
837 | 837 | * @return mixed whatever the raw value of this form section is in the request data |
838 | 838 | * @throws \EE_Error |
839 | 839 | */ |
840 | - public function find_form_data_for_this_section( $req_data ){ |
|
840 | + public function find_form_data_for_this_section($req_data) { |
|
841 | 841 | // break up the html name by "[]" |
842 | - if ( strpos( $this->html_name(), '[' ) !== FALSE ) { |
|
843 | - $before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') ); |
|
842 | + if (strpos($this->html_name(), '[') !== FALSE) { |
|
843 | + $before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '[')); |
|
844 | 844 | } else { |
845 | 845 | $before_any_brackets = $this->html_name(); |
846 | 846 | } |
847 | 847 | // grab all of the segments |
848 | - preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches); |
|
849 | - if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
|
850 | - $name_parts = $matches[ 1 ]; |
|
848 | + preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches); |
|
849 | + if (isset($matches[1]) && is_array($matches[1])) { |
|
850 | + $name_parts = $matches[1]; |
|
851 | 851 | array_unshift($name_parts, $before_any_brackets); |
852 | - }else{ |
|
853 | - $name_parts = array( $before_any_brackets ); |
|
852 | + } else { |
|
853 | + $name_parts = array($before_any_brackets); |
|
854 | 854 | } |
855 | 855 | // now get the value for the input |
856 | 856 | $value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data); |
857 | 857 | // check if this thing's name is at the TOP level of the request data |
858 | - if( $value === null && isset( $req_data[ $this->name() ] ) ){ |
|
859 | - $value = $req_data[ $this->name() ]; |
|
858 | + if ($value === null && isset($req_data[$this->name()])) { |
|
859 | + $value = $req_data[$this->name()]; |
|
860 | 860 | } |
861 | 861 | return $value; |
862 | 862 | } |
@@ -869,18 +869,18 @@ discard block |
||
869 | 869 | * @param array $req_data |
870 | 870 | * @return array | NULL |
871 | 871 | */ |
872 | - public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){ |
|
873 | - $first_part_to_consider = array_shift( $html_name_parts ); |
|
874 | - if( isset( $req_data[ $first_part_to_consider ] ) ){ |
|
875 | - if( empty($html_name_parts ) ){ |
|
876 | - return $req_data[ $first_part_to_consider ]; |
|
877 | - }else{ |
|
872 | + public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) { |
|
873 | + $first_part_to_consider = array_shift($html_name_parts); |
|
874 | + if (isset($req_data[$first_part_to_consider])) { |
|
875 | + if (empty($html_name_parts)) { |
|
876 | + return $req_data[$first_part_to_consider]; |
|
877 | + } else { |
|
878 | 878 | return $this->_find_form_data_for_this_section_using_name_parts( |
879 | 879 | $html_name_parts, |
880 | - $req_data[ $first_part_to_consider ] |
|
880 | + $req_data[$first_part_to_consider] |
|
881 | 881 | ); |
882 | 882 | } |
883 | - }else{ |
|
883 | + } else { |
|
884 | 884 | return NULL; |
885 | 885 | } |
886 | 886 | } |
@@ -894,14 +894,14 @@ discard block |
||
894 | 894 | * @return boolean |
895 | 895 | * @throws \EE_Error |
896 | 896 | */ |
897 | - public function form_data_present_in($req_data = NULL){ |
|
898 | - if( $req_data === NULL ){ |
|
897 | + public function form_data_present_in($req_data = NULL) { |
|
898 | + if ($req_data === NULL) { |
|
899 | 899 | $req_data = $_POST; |
900 | 900 | } |
901 | - $checked_value = $this->find_form_data_for_this_section( $req_data ); |
|
902 | - if( $checked_value !== null ){ |
|
901 | + $checked_value = $this->find_form_data_for_this_section($req_data); |
|
902 | + if ($checked_value !== null) { |
|
903 | 903 | return TRUE; |
904 | - }else{ |
|
904 | + } else { |
|
905 | 905 | return FALSE; |
906 | 906 | } |
907 | 907 | } |
@@ -912,8 +912,8 @@ discard block |
||
912 | 912 | * @param array $form_other_js_data |
913 | 913 | * @return array |
914 | 914 | */ |
915 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
916 | - $form_other_js_data = $this->get_other_js_data_from_strategies( $form_other_js_data ); |
|
915 | + public function get_other_js_data($form_other_js_data = array()) { |
|
916 | + $form_other_js_data = $this->get_other_js_data_from_strategies($form_other_js_data); |
|
917 | 917 | return $form_other_js_data; |
918 | 918 | } |
919 | 919 | |
@@ -926,10 +926,10 @@ discard block |
||
926 | 926 | * @param array $form_other_js_data |
927 | 927 | * @return array |
928 | 928 | */ |
929 | - public function get_other_js_data_from_strategies( $form_other_js_data = array() ) { |
|
930 | - $form_other_js_data = $this->get_display_strategy()->get_other_js_data( $form_other_js_data ); |
|
931 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
932 | - $form_other_js_data = $validation_strategy->get_other_js_data( $form_other_js_data ); |
|
929 | + public function get_other_js_data_from_strategies($form_other_js_data = array()) { |
|
930 | + $form_other_js_data = $this->get_display_strategy()->get_other_js_data($form_other_js_data); |
|
931 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
932 | + $form_other_js_data = $validation_strategy->get_other_js_data($form_other_js_data); |
|
933 | 933 | } |
934 | 934 | return $form_other_js_data; |
935 | 935 | } |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | * Override parent because we want to give our strategies an opportunity to enqueue some js and css |
939 | 939 | * @return void |
940 | 940 | */ |
941 | - public function enqueue_js(){ |
|
941 | + public function enqueue_js() { |
|
942 | 942 | //ask our display strategy and validation strategies if they have js to enqueue |
943 | 943 | $this->enqueue_js_from_strategies(); |
944 | 944 | } |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | */ |
950 | 950 | public function enqueue_js_from_strategies() { |
951 | 951 | $this->get_display_strategy()->enqueue_js(); |
952 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
952 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
953 | 953 | $validation_strategy->enqueue_js(); |
954 | 954 | } |
955 | 955 | } |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param string $validation_error_message |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = null ) { |
|
19 | - if( ! $validation_error_message ){ |
|
18 | + public function __construct($validation_error_message = null) { |
|
19 | + if ( ! $validation_error_message) { |
|
20 | 20 | $validation_error_message = __("This field is required.", "event_espresso"); |
21 | 21 | } |
22 | - parent::__construct( $validation_error_message ); |
|
22 | + parent::__construct($validation_error_message); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @throws \EE_Validation_Error |
35 | 35 | */ |
36 | 36 | public function validate($normalized_value) { |
37 | - if( |
|
37 | + if ( |
|
38 | 38 | $normalized_value === '' |
39 | 39 | || $normalized_value === null |
40 | 40 | || $normalized_value === array() |
41 | 41 | ) { |
42 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
43 | - }else{ |
|
42 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
43 | + } else { |
|
44 | 44 | return true; |
45 | 45 | } |
46 | 46 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return array |
52 | 52 | * @throws \EE_Error |
53 | 53 | */ |
54 | - public function get_jquery_validation_rule_array(){ |
|
54 | + public function get_jquery_validation_rule_array() { |
|
55 | 55 | return array( |
56 | 56 | 'required'=> true, |
57 | 57 | 'messages' => array( |
@@ -40,7 +40,7 @@ |
||
40 | 40 | || $normalized_value === array() |
41 | 41 | ) { |
42 | 42 | throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
43 | - }else{ |
|
43 | + } else{ |
|
44 | 44 | return true; |
45 | 45 | } |
46 | 46 | } |
@@ -41,8 +41,8 @@ |
||
41 | 41 | </div> |
42 | 42 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $clone_icon; ?> clickable"></span> |
43 | 43 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $trash_icon; ?> clickable"<?php echo $show_trash; ?>></span> |
44 | - <?php if ( $reg_list_url !== '' ) : ?> |
|
45 | - <a href="<?php echo $reg_list_url; ?>" title="<?php _e( 'View registrations for this datetime.', 'event_espresso' );?>" style="text-decoration: none;"> |
|
44 | + <?php if ($reg_list_url !== '') : ?> |
|
45 | + <a href="<?php echo $reg_list_url; ?>" title="<?php _e('View registrations for this datetime.', 'event_espresso'); ?>" style="text-decoration: none;"> |
|
46 | 46 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="dashicons dashicons-groups clickable"></span> |
47 | 47 | </a> |
48 | 48 | <?php endif; ?> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | /** |
32 | 32 | * REG_date |
33 | - */ |
|
33 | + */ |
|
34 | 34 | function column_REG_date(EE_Registration $item){ |
35 | 35 | |
36 | 36 | //Build row actions |
@@ -60,60 +60,60 @@ discard block |
||
60 | 60 | $remove_defaults = array('default_where_conditions' => 'none'); |
61 | 61 | $ticket = $item->ticket(); |
62 | 62 | $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
63 | - $EVT_ID = $item->event_ID(); |
|
64 | - $datetime_string = ''; |
|
65 | - foreach( $datetimes as $datetime ){ |
|
66 | - if ( |
|
67 | - EE_Registry::instance()->CAP->current_user_can( |
|
68 | - 'ee_read_checkin', |
|
69 | - 'espresso_registrations_registration_checkins', |
|
70 | - $item->ID() |
|
71 | - ) |
|
72 | - ) { |
|
73 | - // open "a" tag and "href" |
|
74 | - $datetime_string .= '<a href="'; |
|
75 | - // checkin URL |
|
76 | - $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
77 | - array( |
|
78 | - 'action' => 'event_registrations', |
|
79 | - 'event_id' => $EVT_ID, |
|
80 | - 'DTT_ID' => $datetime->ID(), |
|
81 | - ), |
|
82 | - REG_ADMIN_URL |
|
83 | - ); |
|
84 | - // close "href" |
|
85 | - $datetime_string .= '"'; |
|
86 | - // open "title" tag |
|
87 | - $datetime_string .= ' title="'; |
|
88 | - // link title text |
|
89 | - $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
90 | - // close "title" tag and end of "a" tag opening |
|
91 | - $datetime_string .= '">'; |
|
92 | - // link text |
|
93 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
94 | - // close "a" tag |
|
95 | - $datetime_string .= '</a>'; |
|
96 | - } else { |
|
97 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
98 | - } |
|
99 | - // add a "View Registrations" link that filters list by event AND datetime |
|
100 | - $datetime_string .= $this->row_actions( |
|
101 | - array( |
|
102 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | - array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
104 | - REG_ADMIN_URL |
|
105 | - ) . '" title="' . sprintf( |
|
106 | - esc_attr__( |
|
107 | - 'Filter this list to only show registrations for this datetime %s', |
|
108 | - 'event_espresso' |
|
109 | - ), |
|
110 | - $datetime->name() |
|
111 | - ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
112 | - ) |
|
113 | - ); |
|
63 | + $EVT_ID = $item->event_ID(); |
|
64 | + $datetime_string = ''; |
|
65 | + foreach( $datetimes as $datetime ){ |
|
66 | + if ( |
|
67 | + EE_Registry::instance()->CAP->current_user_can( |
|
68 | + 'ee_read_checkin', |
|
69 | + 'espresso_registrations_registration_checkins', |
|
70 | + $item->ID() |
|
71 | + ) |
|
72 | + ) { |
|
73 | + // open "a" tag and "href" |
|
74 | + $datetime_string .= '<a href="'; |
|
75 | + // checkin URL |
|
76 | + $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
77 | + array( |
|
78 | + 'action' => 'event_registrations', |
|
79 | + 'event_id' => $EVT_ID, |
|
80 | + 'DTT_ID' => $datetime->ID(), |
|
81 | + ), |
|
82 | + REG_ADMIN_URL |
|
83 | + ); |
|
84 | + // close "href" |
|
85 | + $datetime_string .= '"'; |
|
86 | + // open "title" tag |
|
87 | + $datetime_string .= ' title="'; |
|
88 | + // link title text |
|
89 | + $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
90 | + // close "title" tag and end of "a" tag opening |
|
91 | + $datetime_string .= '">'; |
|
92 | + // link text |
|
93 | + $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
94 | + // close "a" tag |
|
95 | + $datetime_string .= '</a>'; |
|
96 | + } else { |
|
97 | + $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
98 | + } |
|
99 | + // add a "View Registrations" link that filters list by event AND datetime |
|
100 | + $datetime_string .= $this->row_actions( |
|
101 | + array( |
|
102 | + 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | + array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
104 | + REG_ADMIN_URL |
|
105 | + ) . '" title="' . sprintf( |
|
106 | + esc_attr__( |
|
107 | + 'Filter this list to only show registrations for this datetime %s', |
|
108 | + 'event_espresso' |
|
109 | + ), |
|
110 | + $datetime->name() |
|
111 | + ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
112 | + ) |
|
113 | + ); |
|
114 | 114 | } |
115 | 115 | return $datetime_string; |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | 119 |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * REG_date |
33 | 33 | */ |
34 | - function column_REG_date(EE_Registration $item){ |
|
34 | + function column_REG_date(EE_Registration $item) { |
|
35 | 35 | |
36 | 36 | //Build row actions |
37 | 37 | $actions = array(); |
38 | 38 | |
39 | 39 | //Build row actions |
40 | - $check_in_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
41 | - $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID() ) ? ' |
|
42 | - <a href="'.$check_in_url.'" title="' . esc_attr__( 'The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso' ) . '">' . __( 'View Check-ins', 'event_espresso' ) . '</a>' : __( 'View Check-ins', 'event_espresso' ); |
|
40 | + $check_in_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
41 | + $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? ' |
|
42 | + <a href="'.$check_in_url.'" title="'.esc_attr__('The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso').'">'.__('View Check-ins', 'event_espresso').'</a>' : __('View Check-ins', 'event_espresso'); |
|
43 | 43 | |
44 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID() ), TXN_ADMIN_URL ); |
|
45 | - $REG_date = EE_Regisry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
44 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID()), TXN_ADMIN_URL); |
|
45 | + $REG_date = EE_Regisry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
46 | 46 | |
47 | - return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions) ); |
|
47 | + return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions)); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param \EE_Registration $item |
57 | 57 | * @return string |
58 | 58 | */ |
59 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
59 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
60 | 60 | $remove_defaults = array('default_where_conditions' => 'none'); |
61 | 61 | $ticket = $item->ticket(); |
62 | 62 | $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
63 | 63 | $EVT_ID = $item->event_ID(); |
64 | 64 | $datetime_string = ''; |
65 | - foreach( $datetimes as $datetime ){ |
|
65 | + foreach ($datetimes as $datetime) { |
|
66 | 66 | if ( |
67 | 67 | EE_Registry::instance()->CAP->current_user_can( |
68 | 68 | 'ee_read_checkin', |
@@ -86,29 +86,29 @@ discard block |
||
86 | 86 | // open "title" tag |
87 | 87 | $datetime_string .= ' title="'; |
88 | 88 | // link title text |
89 | - $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
89 | + $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso'); |
|
90 | 90 | // close "title" tag and end of "a" tag opening |
91 | 91 | $datetime_string .= '">'; |
92 | 92 | // link text |
93 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
93 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
94 | 94 | // close "a" tag |
95 | 95 | $datetime_string .= '</a>'; |
96 | 96 | } else { |
97 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
97 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
98 | 98 | } |
99 | 99 | // add a "View Registrations" link that filters list by event AND datetime |
100 | 100 | $datetime_string .= $this->row_actions( |
101 | 101 | array( |
102 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | - array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
102 | + 'event_datetime_filter' => '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
103 | + array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
|
104 | 104 | REG_ADMIN_URL |
105 | - ) . '" title="' . sprintf( |
|
105 | + ).'" title="'.sprintf( |
|
106 | 106 | esc_attr__( |
107 | 107 | 'Filter this list to only show registrations for this datetime %s', |
108 | 108 | 'event_espresso' |
109 | 109 | ), |
110 | 110 | $datetime->name() |
111 | - ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
111 | + ).'">'.__('View Registrations', 'event_espresso').'</a>' |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | * @since 4.6 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
13 | +class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param null $validation_error_message |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = NULL ) { |
|
19 | - if( ! $validation_error_message ){ |
|
18 | + public function __construct($validation_error_message = NULL) { |
|
19 | + if ( ! $validation_error_message) { |
|
20 | 20 | $allowedtags = $this->_get_allowed_tags(); |
21 | - $validation_error_message = sprintf( __( "Only simple HTML tags are allowed. Eg, %s", "event_espresso" ), implode( ",", array_keys( $allowedtags ) ) ); |
|
21 | + $validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags))); |
|
22 | 22 | } |
23 | - parent::__construct( $validation_error_message ); |
|
23 | + parent::__construct($validation_error_message); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function get_list_of_allowed_tags() { |
45 | 45 | $allowed_tags = $this->_get_allowed_tags(); |
46 | - ksort( $allowed_tags ); |
|
47 | - return implode( ', ', array_keys( $allowed_tags ) ); |
|
46 | + ksort($allowed_tags); |
|
47 | + return implode(', ', array_keys($allowed_tags)); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function validate($normalized_value) { |
57 | 57 | $allowedtags = $this->_get_allowed_tags(); |
58 | - parent::validate( $normalized_value ); |
|
59 | - $normalized_value_sans_tags = wp_kses( "$normalized_value",$allowedtags ); |
|
60 | - if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) { |
|
61 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' ); |
|
58 | + parent::validate($normalized_value); |
|
59 | + $normalized_value_sans_tags = wp_kses("$normalized_value", $allowedtags); |
|
60 | + if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) { |
|
61 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $gateway = $payment_method->type_obj()->get_gateway(); |
97 | 97 | if ( |
98 | 98 | $gateway instanceof EE_Offsite_Gateway |
99 | - && $gateway->handle_IPN_in_this_request( |
|
99 | + && $gateway->handle_IPN_in_this_request( |
|
100 | 100 | \EE_Registry::instance()->REQ->params(), |
101 | 101 | true |
102 | 102 | ) |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * EES_Espresso_Txn_Page |
4 | 4 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return void |
28 | 28 | */ |
29 | 29 | public static function set_hooks() { |
30 | - add_action( 'wp_loaded', array( 'EES_Espresso_Txn_Page', 'set_definitions' ), 2 ); |
|
30 | + add_action('wp_loaded', array('EES_Espresso_Txn_Page', 'set_definitions'), 2); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public static function set_definitions() { |
51 | - define( 'TXN_PAGE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
52 | - define( 'TXN_PAGE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
51 | + define('TXN_PAGE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
52 | + define('TXN_PAGE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | * @throws \Exception |
67 | 67 | * @throws \EE_Error |
68 | 68 | */ |
69 | - public function run( WP $WP ) { |
|
69 | + public function run(WP $WP) { |
|
70 | 70 | $this->_current_txn = null; |
71 | - if ( EE_Registry::instance()->REQ->is_set('e_reg_url_link' )){ |
|
71 | + if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
72 | 72 | /** @var EEM_Transaction $EEM_Transaction */ |
73 | - $EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' ); |
|
73 | + $EEM_Transaction = EE_Registry::instance()->load_model('Transaction'); |
|
74 | 74 | $this->_current_txn = $EEM_Transaction->get_transaction_from_reg_url_link(); |
75 | 75 | } |
76 | - if ( $this->_current_txn instanceof EE_Transaction ) { |
|
76 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
77 | 77 | $payment_method = null; |
78 | - $payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', null ); |
|
79 | - if( $payment_method_slug ) { |
|
80 | - $payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug ); |
|
78 | + $payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null); |
|
79 | + if ($payment_method_slug) { |
|
80 | + $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug); |
|
81 | 81 | } |
82 | 82 | |
83 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->is_off_site() ) { |
|
83 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) { |
|
84 | 84 | $gateway = $payment_method->type_obj()->get_gateway(); |
85 | 85 | if ( |
86 | 86 | $gateway instanceof EE_Offsite_Gateway |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | ) |
91 | 91 | ) { |
92 | 92 | /** @type EE_Payment_Processor $payment_processor */ |
93 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
94 | - $payment_processor->process_ipn( $_REQUEST, $this->_current_txn, $payment_method ); |
|
93 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
94 | + $payment_processor->process_ipn($_REQUEST, $this->_current_txn, $payment_method); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | //allow gateways to add a filter to stop rendering the page |
98 | - if( apply_filters( 'FHEE__EES_Espresso_Txn_Page__run__exit', FALSE ) ){ |
|
98 | + if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', FALSE)) { |
|
99 | 99 | exit; |
100 | 100 | } |
101 | 101 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @param array $attributes |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - public function process_shortcode( $attributes = array() ) { |
|
116 | - return __( 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso' ); |
|
115 | + public function process_shortcode($attributes = array()) { |
|
116 | + return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -14,31 +14,31 @@ discard block |
||
14 | 14 | * @author Mike Nelson |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{ |
|
17 | +class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * |
21 | 21 | * @param EE_Payment_Method $payment_method |
22 | 22 | * @param array $options_array @see EE_Form_Section_Proper::__construct() |
23 | 23 | */ |
24 | - public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
24 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
25 | 25 | $options_array['subsections'] = array_merge( |
26 | 26 | array( |
27 | - 'first_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ), |
|
28 | - 'last_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ), |
|
29 | - 'email' => new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ), |
|
30 | - 'address' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )), |
|
31 | - 'address2' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )), |
|
32 | - 'city' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ), |
|
33 | - 'state' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ), |
|
34 | - 'country' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ), |
|
35 | - 'zip' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ), |
|
36 | - 'phone' => new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )), |
|
27 | + 'first_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))), |
|
28 | + 'last_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))), |
|
29 | + 'email' => new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))), |
|
30 | + 'address' => new EE_Text_Input(array('html_label_text'=> __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')), |
|
31 | + 'address2' => new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')), |
|
32 | + 'city' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))), |
|
33 | + 'state' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))), |
|
34 | + 'country' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))), |
|
35 | + 'zip' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))), |
|
36 | + 'phone' => new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))), |
|
37 | 37 | ), |
38 | - isset( $options_array['subsections'] ) ? $options_array['subsections'] : array() |
|
38 | + isset($options_array['subsections']) ? $options_array['subsections'] : array() |
|
39 | 39 | ); |
40 | 40 | |
41 | - parent::__construct( $payment_method, $options_array ); |
|
41 | + parent::__construct($payment_method, $options_array); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * Sets the defaults for the billing form according to the attendee's details |
47 | 47 | * @param EE_Attendee $attendee |
48 | 48 | */ |
49 | - public function populate_from_attendee( $attendee ){ |
|
49 | + public function populate_from_attendee($attendee) { |
|
50 | 50 | $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee); |
51 | 51 | /** @var $attendee EE_Attendee */ |
52 | 52 | $this->populate_defaults( |
53 | - apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
53 | + apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
54 | 54 | array( |
55 | 55 | 'first_name'=>$attendee->fname(), |
56 | 56 | 'last_name'=>$attendee->lname(), |
@@ -78,48 +78,48 @@ discard block |
||
78 | 78 | * @param \EE_Attendee $attendee - the attendee object to copy details to |
79 | 79 | * @return \EE_Attendee |
80 | 80 | */ |
81 | - public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){ |
|
81 | + public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) { |
|
82 | 82 | // grab billing form data |
83 | 83 | $data = $this->valid_data(); |
84 | 84 | // copy first_name |
85 | - if ( ! empty( $data['first_name'] )) { |
|
86 | - $attendee->set_fname( $data['first_name'] ); |
|
85 | + if ( ! empty($data['first_name'])) { |
|
86 | + $attendee->set_fname($data['first_name']); |
|
87 | 87 | } |
88 | 88 | // copy last_name |
89 | - if ( ! empty( $data['last_name'] )) { |
|
90 | - $attendee->set_lname( $data['last_name'] ); |
|
89 | + if ( ! empty($data['last_name'])) { |
|
90 | + $attendee->set_lname($data['last_name']); |
|
91 | 91 | } |
92 | 92 | // copy email |
93 | - if ( ! empty( $data['email'] )) { |
|
94 | - $attendee->set_email( $data['email'] ); |
|
93 | + if ( ! empty($data['email'])) { |
|
94 | + $attendee->set_email($data['email']); |
|
95 | 95 | } |
96 | 96 | // copy address |
97 | - if ( ! empty( $data['address'] )) { |
|
98 | - $attendee->set_address( $data['address'] ); |
|
97 | + if ( ! empty($data['address'])) { |
|
98 | + $attendee->set_address($data['address']); |
|
99 | 99 | } |
100 | 100 | // copy address2 |
101 | - if ( ! empty( $data['address2'] )) { |
|
102 | - $attendee->set_address2( $data['address2'] ); |
|
101 | + if ( ! empty($data['address2'])) { |
|
102 | + $attendee->set_address2($data['address2']); |
|
103 | 103 | } |
104 | 104 | // copy city |
105 | - if ( ! empty( $data['city'] )) { |
|
106 | - $attendee->set_city( $data['city'] ); |
|
105 | + if ( ! empty($data['city'])) { |
|
106 | + $attendee->set_city($data['city']); |
|
107 | 107 | } |
108 | 108 | // copy state |
109 | - if ( ! empty( $data['state'] )) { |
|
110 | - $attendee->set_state( $data['state'] ); |
|
109 | + if ( ! empty($data['state'])) { |
|
110 | + $attendee->set_state($data['state']); |
|
111 | 111 | } |
112 | 112 | // copy country |
113 | - if ( ! empty( $data['country'] )) { |
|
114 | - $attendee->set_country( $data['country'] ); |
|
113 | + if ( ! empty($data['country'])) { |
|
114 | + $attendee->set_country($data['country']); |
|
115 | 115 | } |
116 | 116 | // copy zip |
117 | - if ( ! empty( $data['zip'] )) { |
|
118 | - $attendee->set_zip( $data['zip'] ); |
|
117 | + if ( ! empty($data['zip'])) { |
|
118 | + $attendee->set_zip($data['zip']); |
|
119 | 119 | } |
120 | 120 | // copy phone |
121 | - if ( ! empty( $data['phone'] )) { |
|
122 | - $attendee->set_phone( $data['phone'] ); |
|
121 | + if ( ! empty($data['phone'])) { |
|
122 | + $attendee->set_phone($data['phone']); |
|
123 | 123 | } |
124 | 124 | return $attendee; |
125 | 125 | } |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | * uses info from the billing form to create a new attendee |
131 | 131 | * @return \EE_Attendee |
132 | 132 | */ |
133 | - public function create_attendee_from_billing_form_data(){ |
|
133 | + public function create_attendee_from_billing_form_data() { |
|
134 | 134 | // grab billing form data |
135 | 135 | $data = $this->valid_data(); |
136 | - return EE_Attendee::new_instance( array( |
|
137 | - 'ATT_fname' => ! empty( $data['first_name'] ) ? $data['first_name'] : '', |
|
138 | - 'ATT_lname' => ! empty( $data['last_name'] ) ? $data['last_name'] : '', |
|
139 | - 'ATT_email' => ! empty( $data['email'] ) ? $data['email'] : '', |
|
140 | - 'ATT_address' => ! empty( $data['address'] ) ? $data['address'] : '', |
|
141 | - 'ATT_address2' => ! empty( $data['address2'] ) ? $data['address2'] : '', |
|
142 | - 'ATT_city' => ! empty( $data['city'] ) ? $data['city'] : '', |
|
143 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : '', |
|
144 | - 'CNT_ISO' => ! empty( $data['country'] ) ? $data['country'] : '', |
|
145 | - 'ATT_zip' => ! empty( $data['zip'] ) ? $data['zip'] : '', |
|
146 | - 'ATT_phone' => ! empty( $data['phone'] ) ? $data['phone'] : '', |
|
136 | + return EE_Attendee::new_instance(array( |
|
137 | + 'ATT_fname' => ! empty($data['first_name']) ? $data['first_name'] : '', |
|
138 | + 'ATT_lname' => ! empty($data['last_name']) ? $data['last_name'] : '', |
|
139 | + 'ATT_email' => ! empty($data['email']) ? $data['email'] : '', |
|
140 | + 'ATT_address' => ! empty($data['address']) ? $data['address'] : '', |
|
141 | + 'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '', |
|
142 | + 'ATT_city' => ! empty($data['city']) ? $data['city'] : '', |
|
143 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : '', |
|
144 | + 'CNT_ISO' => ! empty($data['country']) ? $data['country'] : '', |
|
145 | + 'ATT_zip' => ! empty($data['zip']) ? $data['zip'] : '', |
|
146 | + 'ATT_phone' => ! empty($data['phone']) ? $data['phone'] : '', |
|
147 | 147 | )); |
148 | 148 | } |
149 | 149 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Array describing conditions necessary to make the input required. |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @param string $validation_error_message |
25 | 25 | * @param array $requirement_conditions |
26 | 26 | */ |
27 | - public function __construct( $validation_error_message = null, $requirement_conditions = array() ) { |
|
28 | - if( ! $validation_error_message ){ |
|
27 | + public function __construct($validation_error_message = null, $requirement_conditions = array()) { |
|
28 | + if ( ! $validation_error_message) { |
|
29 | 29 | $validation_error_message = __("This field is required.", "event_espresso"); |
30 | 30 | } |
31 | - $this->set_requirement_conditions( $requirement_conditions ); |
|
32 | - parent::__construct( $validation_error_message ); |
|
31 | + $this->set_requirement_conditions($requirement_conditions); |
|
32 | + parent::__construct($validation_error_message); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @throws \EE_Validation_Error |
45 | 45 | */ |
46 | 46 | public function validate($normalized_value) { |
47 | - if( |
|
47 | + if ( |
|
48 | 48 | ( |
49 | 49 | $normalized_value === '' |
50 | 50 | || $normalized_value === null |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | ) |
53 | 53 | && $this->_input_is_required_server_side() |
54 | 54 | ) { |
55 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
56 | - }else{ |
|
55 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
56 | + } else { |
|
57 | 57 | return true; |
58 | 58 | } |
59 | 59 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return array |
65 | 65 | * @throws \EE_Error |
66 | 66 | */ |
67 | - public function get_jquery_validation_rule_array(){ |
|
67 | + public function get_jquery_validation_rule_array() { |
|
68 | 68 | return array( |
69 | 69 | 'required'=> $this->_get_jquery_requirement_value(), |
70 | 70 | 'messages' => array( |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param array $requirement_conditions |
84 | 84 | */ |
85 | - public function set_requirement_conditions( $requirement_conditions ) { |
|
85 | + public function set_requirement_conditions($requirement_conditions) { |
|
86 | 86 | $this->requirement_conditions = (array) $requirement_conditions; |
87 | 87 | } |
88 | 88 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | protected function _get_jquery_requirement_value() { |
109 | 109 | $requirement_value = ''; |
110 | 110 | $conditions = $this->get_requirement_conditions(); |
111 | - if( ! is_array( $conditions ) ){ |
|
111 | + if ( ! is_array($conditions)) { |
|
112 | 112 | EE_Error::throw_exception_if_debugging( |
113 | 113 | sprintf( |
114 | - __( 'Input requirement conditions must be an array. You provided %1$s', 'event_espresso' ), |
|
114 | + __('Input requirement conditions must be an array. You provided %1$s', 'event_espresso'), |
|
115 | 115 | $this->_input->name() |
116 | 116 | ), |
117 | 117 | __FILE__, |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | ); |
121 | 121 | return true; |
122 | 122 | } |
123 | - if( count( $conditions ) > 1 ) { |
|
123 | + if (count($conditions) > 1) { |
|
124 | 124 | EE_Error::throw_exception_if_debugging( |
125 | 125 | sprintf( |
126 | - __( 'Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso' ), |
|
126 | + __('Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso'), |
|
127 | 127 | $this->_input->name() |
128 | 128 | ), |
129 | 129 | __FILE__, |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | __LINE__ |
132 | 132 | ); |
133 | 133 | } |
134 | - foreach( $conditions as $input_path => $op_and_value ) { |
|
135 | - $input = $this->_input->find_section_from_path( $input_path ); |
|
136 | - if( ! $input instanceof EE_Form_Input_Base ) { |
|
134 | + foreach ($conditions as $input_path => $op_and_value) { |
|
135 | + $input = $this->_input->find_section_from_path($input_path); |
|
136 | + if ( ! $input instanceof EE_Form_Input_Base) { |
|
137 | 137 | EE_Error::throw_exception_if_debugging( |
138 | 138 | sprintf( |
139 | - __( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
139 | + __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
140 | 140 | $this->_input->name(), |
141 | 141 | $input_path |
142 | 142 | ), |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | ); |
147 | 147 | return false; |
148 | 148 | } |
149 | - list( $op, $value ) = $this->_validate_op_and_value( $op_and_value ); |
|
149 | + list($op, $value) = $this->_validate_op_and_value($op_and_value); |
|
150 | 150 | //ok now the jquery dependency expression depends on the input's display strategy. |
151 | - if( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy ) { |
|
151 | + if ( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) { |
|
152 | 152 | EE_Error::throw_exception_if_debugging( |
153 | 153 | sprintf( |
154 | - __( 'Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso' ), |
|
154 | + __('Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso'), |
|
155 | 155 | $input->name(), |
156 | - get_class( $input->get_display_strategy() ), |
|
156 | + get_class($input->get_display_strategy()), |
|
157 | 157 | $this->_input->name() |
158 | 158 | ), |
159 | 159 | __FILE__, |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | __LINE__ |
162 | 162 | ); |
163 | 163 | } |
164 | - $requirement_value = $input->html_id( true ) . ' option[value="' . $value . '"]:selected'; |
|
164 | + $requirement_value = $input->html_id(true).' option[value="'.$value.'"]:selected'; |
|
165 | 165 | } |
166 | 166 | return $requirement_value; |
167 | 167 | } |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | protected function _input_is_required_server_side() { |
180 | 180 | $meets_all_requirements = true; |
181 | 181 | $conditions = $this->get_requirement_conditions(); |
182 | - foreach( $conditions as $input_path => $op_and_value ) { |
|
183 | - $input = $this->_input->find_section_from_path( $input_path ); |
|
184 | - if( ! $input instanceof EE_Form_Input_Base ) { |
|
182 | + foreach ($conditions as $input_path => $op_and_value) { |
|
183 | + $input = $this->_input->find_section_from_path($input_path); |
|
184 | + if ( ! $input instanceof EE_Form_Input_Base) { |
|
185 | 185 | EE_Error::throw_exception_if_debugging( |
186 | 186 | sprintf( |
187 | - __( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
187 | + __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
188 | 188 | $this->_input->name(), |
189 | 189 | $input_path |
190 | 190 | ), |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | ); |
195 | 195 | return false; |
196 | 196 | } |
197 | - list( $op, $value ) = $this->_validate_op_and_value( $op_and_value ); |
|
198 | - switch( $op ) { |
|
197 | + list($op, $value) = $this->_validate_op_and_value($op_and_value); |
|
198 | + switch ($op) { |
|
199 | 199 | case '=': |
200 | 200 | default: |
201 | 201 | $meets_all_requirements = $input->normalized_value() === $value; |
202 | 202 | } |
203 | - if( ! $meets_all_requirements ) { |
|
203 | + if ( ! $meets_all_requirements) { |
|
204 | 204 | break; |
205 | 205 | } |
206 | 206 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * @return array |
218 | 218 | * @throws \EE_Error |
219 | 219 | */ |
220 | - protected function _validate_op_and_value( $op_and_value ) { |
|
221 | - if( ! isset( $op_and_value[ 0 ], $op_and_value[ 1 ] ) ) { |
|
220 | + protected function _validate_op_and_value($op_and_value) { |
|
221 | + if ( ! isset($op_and_value[0], $op_and_value[1])) { |
|
222 | 222 | EE_Error::throw_exception_if_debugging( |
223 | 223 | sprintf( |
224 | - __( 'Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso' ), |
|
224 | + __('Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso'), |
|
225 | 225 | $this->_input->name() |
226 | 226 | ), |
227 | 227 | __FILE__, |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | __LINE__ |
230 | 230 | ); |
231 | 231 | } |
232 | - $operator = $op_and_value[ 0 ]; |
|
233 | - $value = (string) $op_and_value[ 1 ]; |
|
234 | - if( $operator !== '=' ) { |
|
232 | + $operator = $op_and_value[0]; |
|
233 | + $value = (string) $op_and_value[1]; |
|
234 | + if ($operator !== '=') { |
|
235 | 235 | EE_Error::throw_exception_if_debugging( |
236 | 236 | sprintf( |
237 | - __( 'Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso' ), |
|
237 | + __('Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso'), |
|
238 | 238 | $this->_input->name() |
239 | 239 | ), |
240 | 240 | __FILE__, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | __LINE__ |
243 | 243 | ); |
244 | 244 | } |
245 | - return array( $operator, $value ); |
|
245 | + return array($operator, $value); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | && $this->_input_is_required_server_side() |
54 | 54 | ) { |
55 | 55 | throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
56 | - }else{ |
|
56 | + } else{ |
|
57 | 57 | return true; |
58 | 58 | } |
59 | 59 | } |