@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts). |
8 | 8 | * However, you may output the form (usually by calling get_html) anywhere you like. |
9 | 9 | */ |
10 | -class EE_Form_Section_Proper extends EE_Form_Section_Validatable{ |
|
10 | +class EE_Form_Section_Proper extends EE_Form_Section_Validatable { |
|
11 | 11 | |
12 | 12 | const SUBMITTED_FORM_DATA_SSN_KEY = 'submitted_form_data'; |
13 | 13 | |
@@ -71,49 +71,49 @@ discard block |
||
71 | 71 | * } @see EE_Form_Section_Validatable::__construct() |
72 | 72 | * @throws \EE_Error |
73 | 73 | */ |
74 | - public function __construct( $options_array = array() ){ |
|
75 | - $options_array = (array) apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this ); |
|
74 | + public function __construct($options_array = array()) { |
|
75 | + $options_array = (array) apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this); |
|
76 | 76 | //call parent first, as it may be setting the name |
77 | 77 | parent::__construct($options_array); |
78 | 78 | //if they've included subsections in the constructor, add them now |
79 | - if( isset( $options_array['include'] )){ |
|
79 | + if (isset($options_array['include'])) { |
|
80 | 80 | //we are going to make sure we ONLY have those subsections to include |
81 | 81 | //AND we are going to make sure they're in that specified order |
82 | 82 | $reordered_subsections = array(); |
83 | - foreach($options_array['include'] as $input_name){ |
|
84 | - if(isset($this->_subsections[$input_name])){ |
|
83 | + foreach ($options_array['include'] as $input_name) { |
|
84 | + if (isset($this->_subsections[$input_name])) { |
|
85 | 85 | $reordered_subsections[$input_name] = $this->_subsections[$input_name]; |
86 | 86 | } |
87 | 87 | } |
88 | 88 | $this->_subsections = $reordered_subsections; |
89 | 89 | } |
90 | - if(isset($options_array['exclude'])){ |
|
90 | + if (isset($options_array['exclude'])) { |
|
91 | 91 | $exclude = $options_array['exclude']; |
92 | 92 | $this->_subsections = array_diff_key($this->_subsections, array_flip($exclude)); |
93 | 93 | } |
94 | - if(isset($options_array['layout_strategy'])){ |
|
94 | + if (isset($options_array['layout_strategy'])) { |
|
95 | 95 | $this->_layout_strategy = $options_array['layout_strategy']; |
96 | 96 | } |
97 | - if( ! $this->_layout_strategy){ |
|
97 | + if ( ! $this->_layout_strategy) { |
|
98 | 98 | $this->_layout_strategy = is_admin() ? new EE_Admin_Two_Column_Layout() : new EE_Two_Column_Layout(); |
99 | 99 | } |
100 | 100 | $this->_layout_strategy->_construct_finalize($this); |
101 | 101 | |
102 | 102 | //ok so we are definitely going to want the forms JS, |
103 | 103 | //so enqueue it or remember to enqueue it during wp_enqueue_scripts |
104 | - if( did_action( 'wp_enqueue_scripts' ) |
|
105 | - || did_action( 'admin_enqueue_scripts' ) ) { |
|
104 | + if (did_action('wp_enqueue_scripts') |
|
105 | + || did_action('admin_enqueue_scripts')) { |
|
106 | 106 | //ok so they've constructed this object after when they should have. |
107 | 107 | //just enqueue the generic form scripts and initialize the form immediately in the JS |
108 | - \EE_Form_Section_Proper::wp_enqueue_scripts( true ); |
|
108 | + \EE_Form_Section_Proper::wp_enqueue_scripts(true); |
|
109 | 109 | } else { |
110 | - add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' )); |
|
111 | - add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' )); |
|
110 | + add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts')); |
|
111 | + add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts')); |
|
112 | 112 | } |
113 | - add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 ); |
|
113 | + add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1); |
|
114 | 114 | |
115 | - if( isset( $options_array[ 'name' ] ) ) { |
|
116 | - $this->_construct_finalize( null, $options_array[ 'name' ] ); |
|
115 | + if (isset($options_array['name'])) { |
|
116 | + $this->_construct_finalize(null, $options_array['name']); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -126,25 +126,25 @@ discard block |
||
126 | 126 | * @param string $name |
127 | 127 | * @throws \EE_Error |
128 | 128 | */ |
129 | - public function _construct_finalize( $parent_form_section, $name ) { |
|
129 | + public function _construct_finalize($parent_form_section, $name) { |
|
130 | 130 | parent::_construct_finalize($parent_form_section, $name); |
131 | 131 | $this->_set_default_name_if_empty(); |
132 | 132 | $this->_set_default_html_id_if_empty(); |
133 | - foreach( $this->_subsections as $subsection_name => $subsection ){ |
|
134 | - if ( $subsection instanceof EE_Form_Section_Base ) { |
|
135 | - $subsection->_construct_finalize( $this, $subsection_name ); |
|
133 | + foreach ($this->_subsections as $subsection_name => $subsection) { |
|
134 | + if ($subsection instanceof EE_Form_Section_Base) { |
|
135 | + $subsection->_construct_finalize($this, $subsection_name); |
|
136 | 136 | } else { |
137 | 137 | throw new EE_Error( |
138 | 138 | sprintf( |
139 | - __( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ), |
|
139 | + __('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'), |
|
140 | 140 | $subsection_name, |
141 | 141 | get_class($this), |
142 | - $subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' ) |
|
142 | + $subsection ? get_class($subsection) : __('NULL', 'event_espresso') |
|
143 | 143 | ) |
144 | 144 | ); |
145 | 145 | } |
146 | 146 | } |
147 | - do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name ); |
|
147 | + do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * Gets the layout strategy for this form section |
154 | 154 | * @return EE_Form_Section_Layout_Base |
155 | 155 | */ |
156 | - public function get_layout_strategy(){ |
|
156 | + public function get_layout_strategy() { |
|
157 | 157 | return $this->_layout_strategy; |
158 | 158 | } |
159 | 159 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param EE_Form_Input_Base $input |
166 | 166 | * @return string |
167 | 167 | */ |
168 | - public function get_html_for_input($input){ |
|
168 | + public function get_html_for_input($input) { |
|
169 | 169 | return $this->_layout_strategy->layout_input($input); |
170 | 170 | } |
171 | 171 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param null $form_data |
179 | 179 | * @return boolean |
180 | 180 | */ |
181 | - public function was_submitted($form_data = NULL){ |
|
181 | + public function was_submitted($form_data = NULL) { |
|
182 | 182 | return $this->form_data_present_in($form_data); |
183 | 183 | } |
184 | 184 | |
@@ -203,21 +203,21 @@ discard block |
||
203 | 203 | * (eg you validated the data then stored it in the DB) |
204 | 204 | * you may want to skip this step. |
205 | 205 | */ |
206 | - public function receive_form_submission( $req_data = null, $validate = true ){ |
|
207 | - $req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate ); |
|
208 | - if( $req_data === null ){ |
|
209 | - $req_data = array_merge( $_GET, $_POST ); |
|
206 | + public function receive_form_submission($req_data = null, $validate = true) { |
|
207 | + $req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate); |
|
208 | + if ($req_data === null) { |
|
209 | + $req_data = array_merge($_GET, $_POST); |
|
210 | 210 | } |
211 | - $req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this ); |
|
212 | - $this->_normalize( $req_data ); |
|
213 | - if( $validate ){ |
|
211 | + $req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this); |
|
212 | + $this->_normalize($req_data); |
|
213 | + if ($validate) { |
|
214 | 214 | $this->_validate(); |
215 | 215 | //if it's invalid, we're going to want to re-display so remember what they submitted |
216 | - if ( ! $this->is_valid() ) { |
|
216 | + if ( ! $this->is_valid()) { |
|
217 | 217 | $this->store_submitted_form_data_in_session(); |
218 | 218 | } |
219 | 219 | } |
220 | - do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate ); |
|
220 | + do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | protected function store_submitted_form_data_in_session() { |
232 | 232 | return EE_Registry::instance()->SSN->set_session_data( |
233 | 233 | array( |
234 | - \EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values( true ) |
|
234 | + \EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values(true) |
|
235 | 235 | ) |
236 | 236 | ); |
237 | 237 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | protected function get_submitted_form_data_from_session() { |
248 | 248 | $session = EE_Registry::instance()->SSN; |
249 | - if( $session instanceof EE_Session ) { |
|
249 | + if ($session instanceof EE_Session) { |
|
250 | 250 | return $session->get_session_data( |
251 | 251 | \EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY |
252 | 252 | ); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | protected function flush_submitted_form_data_from_session() { |
266 | 266 | return EE_Registry::instance()->SSN->reset_data( |
267 | - array( \EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY ) |
|
267 | + array(\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY) |
|
268 | 268 | ); |
269 | 269 | } |
270 | 270 | |
@@ -280,12 +280,12 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public function populate_from_session() { |
282 | 282 | $form_data_in_session = $this->get_submitted_form_data_from_session(); |
283 | - if ( empty( $form_data_in_session ) ) { |
|
283 | + if (empty($form_data_in_session)) { |
|
284 | 284 | return false; |
285 | 285 | } |
286 | - $this->receive_form_submission( $form_data_in_session ); |
|
286 | + $this->receive_form_submission($form_data_in_session); |
|
287 | 287 | $this->flush_submitted_form_data_from_session(); |
288 | - if ( $this->form_data_present_in( $form_data_in_session ) ) { |
|
288 | + if ($this->form_data_present_in($form_data_in_session)) { |
|
289 | 289 | return true; |
290 | 290 | } else { |
291 | 291 | return false; |
@@ -302,12 +302,12 @@ discard block |
||
302 | 302 | * the value being an array formatted in teh same way |
303 | 303 | * @param array $default_data |
304 | 304 | */ |
305 | - public function populate_defaults($default_data){ |
|
306 | - foreach($this->subsections() as $subsection_name => $subsection){ |
|
307 | - if(isset($default_data[$subsection_name])){ |
|
308 | - if($subsection instanceof EE_Form_Input_Base){ |
|
305 | + public function populate_defaults($default_data) { |
|
306 | + foreach ($this->subsections() as $subsection_name => $subsection) { |
|
307 | + if (isset($default_data[$subsection_name])) { |
|
308 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
309 | 309 | $subsection->set_default($default_data[$subsection_name]); |
310 | - }elseif($subsection instanceof EE_Form_Section_Proper){ |
|
310 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
311 | 311 | $subsection->populate_defaults($default_data[$subsection_name]); |
312 | 312 | } |
313 | 313 | } |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | * @param string $name |
323 | 323 | * @return boolean |
324 | 324 | */ |
325 | - public function subsection_exists( $name ){ |
|
326 | - return isset( $this->_subsections[ $name ] ) ? true : false; |
|
325 | + public function subsection_exists($name) { |
|
326 | + return isset($this->_subsections[$name]) ? true : false; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | * @return EE_Form_Section_Base |
342 | 342 | * @throws \EE_Error |
343 | 343 | */ |
344 | - public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){ |
|
345 | - if( $require_construction_to_be_finalized ){ |
|
344 | + public function get_subsection($name, $require_construction_to_be_finalized = TRUE) { |
|
345 | + if ($require_construction_to_be_finalized) { |
|
346 | 346 | $this->ensure_construct_finalized_called(); |
347 | 347 | } |
348 | - return $this->subsection_exists( $name ) ? $this->_subsections[$name] : NULL; |
|
348 | + return $this->subsection_exists($name) ? $this->_subsections[$name] : NULL; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | * Gets all the validatable subsections of this form section |
355 | 355 | * @return EE_Form_Section_Validatable[] |
356 | 356 | */ |
357 | - public function get_validatable_subsections(){ |
|
357 | + public function get_validatable_subsections() { |
|
358 | 358 | $validatable_subsections = array(); |
359 | - foreach($this->subsections() as $name=>$obj){ |
|
360 | - if($obj instanceof EE_Form_Section_Validatable){ |
|
359 | + foreach ($this->subsections() as $name=>$obj) { |
|
360 | + if ($obj instanceof EE_Form_Section_Validatable) { |
|
361 | 361 | $validatable_subsections[$name] = $obj; |
362 | 362 | } |
363 | 363 | } |
@@ -377,9 +377,9 @@ discard block |
||
377 | 377 | * @return EE_Form_Input_Base |
378 | 378 | * @throws EE_Error |
379 | 379 | */ |
380 | - public function get_input($name, $require_construction_to_be_finalized = TRUE ){ |
|
380 | + public function get_input($name, $require_construction_to_be_finalized = TRUE) { |
|
381 | 381 | $subsection = $this->get_subsection($name, $require_construction_to_be_finalized); |
382 | - if( ! $subsection instanceof EE_Form_Input_Base){ |
|
382 | + if ( ! $subsection instanceof EE_Form_Input_Base) { |
|
383 | 383 | throw new EE_Error( |
384 | 384 | sprintf( |
385 | 385 | __( |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | 'event_espresso' |
388 | 388 | ), |
389 | 389 | $name, |
390 | - get_class( $this ), |
|
391 | - $subsection ? get_class( $subsection ) : __( "NULL", 'event_espresso' ) |
|
390 | + get_class($this), |
|
391 | + $subsection ? get_class($subsection) : __("NULL", 'event_espresso') |
|
392 | 392 | ) |
393 | 393 | ); |
394 | 394 | } |
@@ -408,14 +408,14 @@ discard block |
||
408 | 408 | * @return EE_Form_Section_Proper |
409 | 409 | * @throws EE_Error |
410 | 410 | */ |
411 | - public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){ |
|
412 | - $subsection = $this->get_subsection( $name, $require_construction_to_be_finalized ); |
|
413 | - if( ! $subsection instanceof EE_Form_Section_Proper){ |
|
411 | + public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) { |
|
412 | + $subsection = $this->get_subsection($name, $require_construction_to_be_finalized); |
|
413 | + if ( ! $subsection instanceof EE_Form_Section_Proper) { |
|
414 | 414 | throw new EE_Error( |
415 | 415 | sprintf( |
416 | - __( "Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso' ), |
|
416 | + __("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), |
|
417 | 417 | $name, |
418 | - get_class( $this ) |
|
418 | + get_class($this) |
|
419 | 419 | ) |
420 | 420 | ); |
421 | 421 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @return mixed depending on the input's type and its normalization strategy |
433 | 433 | * @throws \EE_Error |
434 | 434 | */ |
435 | - public function get_input_value($name){ |
|
435 | + public function get_input_value($name) { |
|
436 | 436 | $input = $this->get_input($name); |
437 | 437 | return $input->normalized_value(); |
438 | 438 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @return boolean |
446 | 446 | */ |
447 | 447 | public function is_valid() { |
448 | - if( ! $this->has_received_submission()){ |
|
448 | + if ( ! $this->has_received_submission()) { |
|
449 | 449 | throw new EE_Error( |
450 | 450 | sprintf( |
451 | 451 | __( |
@@ -455,16 +455,16 @@ discard block |
||
455 | 455 | ) |
456 | 456 | ); |
457 | 457 | } |
458 | - if( ! parent::is_valid() ) { |
|
458 | + if ( ! parent::is_valid()) { |
|
459 | 459 | return false; |
460 | 460 | } |
461 | 461 | // ok so no general errors to this entire form section. |
462 | 462 | // so let's check the subsections, but only set errors if that hasn't been done yet |
463 | 463 | $set_submission_errors = $this->submission_error_message() === '' ? true : false; |
464 | - foreach( $this->get_validatable_subsections() as $subsection ){ |
|
465 | - if( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '' ){ |
|
466 | - if ( $set_submission_errors ) { |
|
467 | - $this->set_submission_error_message( $subsection->get_validation_error_string() ); |
|
464 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
465 | + if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '') { |
|
466 | + if ($set_submission_errors) { |
|
467 | + $this->set_submission_error_message($subsection->get_validation_error_string()); |
|
468 | 468 | } |
469 | 469 | return false; |
470 | 470 | } |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | * gets teh default name of this form section if none is specified |
479 | 479 | * @return string |
480 | 480 | */ |
481 | - protected function _set_default_name_if_empty(){ |
|
482 | - if( ! $this->_name ){ |
|
481 | + protected function _set_default_name_if_empty() { |
|
482 | + if ( ! $this->_name) { |
|
483 | 483 | $classname = get_class($this); |
484 | 484 | $default_name = str_replace("EE_", "", $classname); |
485 | - $this->_name = $default_name; |
|
485 | + $this->_name = $default_name; |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | * and get_html when you are about to display the form. |
499 | 499 | * @throws \EE_Error |
500 | 500 | */ |
501 | - public function get_html_and_js(){ |
|
501 | + public function get_html_and_js() { |
|
502 | 502 | //no doing_it_wrong yet because we ourselves are still doing it wrong... |
503 | 503 | //and theoretically this CAN be used properly, provided its used during "wp_enqueue_scripts" |
504 | 504 | $this->enqueue_js(); |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | * @param bool $display_previously_submitted_data |
514 | 514 | * @return string |
515 | 515 | */ |
516 | - public function get_html( $display_previously_submitted_data = true ){ |
|
516 | + public function get_html($display_previously_submitted_data = true) { |
|
517 | 517 | $this->ensure_construct_finalized_called(); |
518 | - if ( $display_previously_submitted_data ) { |
|
518 | + if ($display_previously_submitted_data) { |
|
519 | 519 | $this->populate_from_session(); |
520 | 520 | } |
521 | 521 | return $this->_layout_strategy->layout_form(); |
@@ -529,9 +529,9 @@ discard block |
||
529 | 529 | * @return string |
530 | 530 | * @throws \EE_Error |
531 | 531 | */ |
532 | - public function enqueue_js(){ |
|
532 | + public function enqueue_js() { |
|
533 | 533 | $this->_enqueue_and_localize_form_js(); |
534 | - foreach( $this->subsections() as $subsection ) { |
|
534 | + foreach ($this->subsections() as $subsection) { |
|
535 | 535 | $subsection->enqueue_js(); |
536 | 536 | } |
537 | 537 | } |
@@ -550,19 +550,19 @@ discard block |
||
550 | 550 | * to be triggered automatically or not |
551 | 551 | * @return void |
552 | 552 | */ |
553 | - public static function wp_enqueue_scripts( $init_form_validation_automatically = true ){ |
|
554 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
553 | + public static function wp_enqueue_scripts($init_form_validation_automatically = true) { |
|
554 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
555 | 555 | wp_register_script( |
556 | 556 | 'ee_form_section_validation', |
557 | - EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', |
|
558 | - array( 'jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods' ), |
|
557 | + EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', |
|
558 | + array('jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods'), |
|
559 | 559 | EVENT_ESPRESSO_VERSION, |
560 | 560 | true |
561 | 561 | ); |
562 | 562 | wp_localize_script( |
563 | 563 | 'ee_form_section_validation', |
564 | 564 | 'ee_form_section_validation_init', |
565 | - array( 'init' => $init_form_validation_automatically ? true : false ) |
|
565 | + array('init' => $init_form_validation_automatically ? true : false) |
|
566 | 566 | ); |
567 | 567 | } |
568 | 568 | |
@@ -573,14 +573,14 @@ discard block |
||
573 | 573 | * |
574 | 574 | * @throws \EE_Error |
575 | 575 | */ |
576 | - public function _enqueue_and_localize_form_js(){ |
|
576 | + public function _enqueue_and_localize_form_js() { |
|
577 | 577 | $this->ensure_construct_finalized_called(); |
578 | 578 | //actually, we don't want to localize just yet. There may be other forms on the page. |
579 | 579 | //so we need to add our form section data to a static variable accessible by all form sections |
580 | 580 | //and localize it just before the footer |
581 | 581 | $this->localize_validation_rules(); |
582 | - add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 ); |
|
583 | - add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) ); |
|
582 | + add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2); |
|
583 | + add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms')); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | |
@@ -592,12 +592,12 @@ discard block |
||
592 | 592 | * @return void |
593 | 593 | * @throws \EE_Error |
594 | 594 | */ |
595 | - public function localize_validation_rules( $return_for_subsection = FALSE ){ |
|
595 | + public function localize_validation_rules($return_for_subsection = FALSE) { |
|
596 | 596 | // we only want to localize vars ONCE for the entire form, |
597 | 597 | // so if the form section doesn't have a parent, then it must be the top dog |
598 | - if ( $return_for_subsection || ! $this->parent_section() ) { |
|
599 | - EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array( |
|
600 | - 'form_section_id'=> $this->html_id( TRUE ), |
|
598 | + if ($return_for_subsection || ! $this->parent_section()) { |
|
599 | + EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array( |
|
600 | + 'form_section_id'=> $this->html_id(TRUE), |
|
601 | 601 | 'validation_rules'=> $this->get_jquery_validation_rules(), |
602 | 602 | 'other_data' => $this->get_other_js_data(), |
603 | 603 | 'errors'=> $this->subsection_validation_errors_by_html_name() |
@@ -613,9 +613,9 @@ discard block |
||
613 | 613 | * @param array $form_other_js_data |
614 | 614 | * @return array |
615 | 615 | */ |
616 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
617 | - foreach( $this->subsections() as $subsection ) { |
|
618 | - $form_other_js_data = $subsection->get_other_js_data( $form_other_js_data ); |
|
616 | + public function get_other_js_data($form_other_js_data = array()) { |
|
617 | + foreach ($this->subsections() as $subsection) { |
|
618 | + $form_other_js_data = $subsection->get_other_js_data($form_other_js_data); |
|
619 | 619 | } |
620 | 620 | return $form_other_js_data; |
621 | 621 | } |
@@ -626,12 +626,12 @@ discard block |
||
626 | 626 | * Keys are their form names, and values are the inputs themselves |
627 | 627 | * @return EE_Form_Input_Base |
628 | 628 | */ |
629 | - public function inputs_in_subsections(){ |
|
629 | + public function inputs_in_subsections() { |
|
630 | 630 | $inputs = array(); |
631 | - foreach($this->subsections() as $subsection){ |
|
632 | - if( $subsection instanceof EE_Form_Input_Base ){ |
|
633 | - $inputs[ $subsection->html_name() ] = $subsection; |
|
634 | - }elseif($subsection instanceof EE_Form_Section_Proper ){ |
|
631 | + foreach ($this->subsections() as $subsection) { |
|
632 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
633 | + $inputs[$subsection->html_name()] = $subsection; |
|
634 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
635 | 635 | $inputs += $subsection->inputs_in_subsections(); |
636 | 636 | } |
637 | 637 | } |
@@ -644,12 +644,12 @@ discard block |
||
644 | 644 | * and values are a string of all their validation errors |
645 | 645 | * @return string[] |
646 | 646 | */ |
647 | - public function subsection_validation_errors_by_html_name(){ |
|
647 | + public function subsection_validation_errors_by_html_name() { |
|
648 | 648 | $inputs = $this->inputs(); |
649 | 649 | $errors = array(); |
650 | - foreach( $inputs as $form_input ){ |
|
651 | - if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){ |
|
652 | - $errors[ $form_input->html_name() ] = $form_input->get_validation_error_string(); |
|
650 | + foreach ($inputs as $form_input) { |
|
651 | + if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) { |
|
652 | + $errors[$form_input->html_name()] = $form_input->get_validation_error_string(); |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | return $errors; |
@@ -661,15 +661,15 @@ discard block |
||
661 | 661 | * passes all the form data required by the JS to the JS, and enqueues the few required JS files. |
662 | 662 | * Should be setup by each form during the _enqueues_and_localize_form_js |
663 | 663 | */ |
664 | - public static function localize_script_for_all_forms(){ |
|
664 | + public static function localize_script_for_all_forms() { |
|
665 | 665 | //allow inputs and stuff to hook in their JS and stuff here |
666 | - do_action( 'AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin' ); |
|
666 | + do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin'); |
|
667 | 667 | EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages(); |
668 | - $email_validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level ) |
|
668 | + $email_validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
|
669 | 669 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
670 | 670 | : 'wp_default'; |
671 | 671 | EE_Form_Section_Proper::$_js_localization['email_validation_level'] = $email_validation_level; |
672 | - wp_enqueue_script( 'ee_form_section_validation' ); |
|
672 | + wp_enqueue_script('ee_form_section_validation'); |
|
673 | 673 | wp_localize_script( |
674 | 674 | 'ee_form_section_validation', |
675 | 675 | 'ee_form_section_vars', |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | /** |
683 | 683 | * ensure_scripts_localized |
684 | 684 | */ |
685 | - public function ensure_scripts_localized(){ |
|
686 | - if ( ! EE_Form_Section_Proper::$_scripts_localized ) { |
|
685 | + public function ensure_scripts_localized() { |
|
686 | + if ( ! EE_Form_Section_Proper::$_scripts_localized) { |
|
687 | 687 | $this->_enqueue_and_localize_form_js(); |
688 | 688 | } |
689 | 689 | } |
@@ -695,10 +695,10 @@ discard block |
||
695 | 695 | * is that the key here should be the same as the custom validation rule put in the JS file |
696 | 696 | * @return array keys are custom validation rules, and values are internationalized strings |
697 | 697 | */ |
698 | - private static function _get_localized_error_messages(){ |
|
698 | + private static function _get_localized_error_messages() { |
|
699 | 699 | return array( |
700 | 700 | 'validUrl'=> __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"), |
701 | - 'regex' => __( 'Please check your input', 'event_espresso' ), |
|
701 | + 'regex' => __('Please check your input', 'event_espresso'), |
|
702 | 702 | ); |
703 | 703 | } |
704 | 704 | |
@@ -728,9 +728,9 @@ discard block |
||
728 | 728 | * |
729 | 729 | * @return array |
730 | 730 | */ |
731 | - public function get_jquery_validation_rules(){ |
|
731 | + public function get_jquery_validation_rules() { |
|
732 | 732 | $jquery_validation_rules = array(); |
733 | - foreach($this->get_validatable_subsections() as $subsection){ |
|
733 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
734 | 734 | $jquery_validation_rules = array_merge( |
735 | 735 | $jquery_validation_rules, |
736 | 736 | $subsection->get_jquery_validation_rules() |
@@ -747,14 +747,14 @@ discard block |
||
747 | 747 | * @param array $req_data like $_POST |
748 | 748 | * @return void |
749 | 749 | */ |
750 | - protected function _normalize( $req_data ) { |
|
750 | + protected function _normalize($req_data) { |
|
751 | 751 | $this->_received_submission = true; |
752 | 752 | $this->_validation_errors = array(); |
753 | - foreach ( $this->get_validatable_subsections() as $subsection ) { |
|
753 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
754 | 754 | try { |
755 | - $subsection->_normalize( $req_data ); |
|
756 | - } catch ( EE_Validation_Error $e ) { |
|
757 | - $subsection->add_validation_error( $e ); |
|
755 | + $subsection->_normalize($req_data); |
|
756 | + } catch (EE_Validation_Error $e) { |
|
757 | + $subsection->add_validation_error($e); |
|
758 | 758 | } |
759 | 759 | } |
760 | 760 | } |
@@ -771,9 +771,9 @@ discard block |
||
771 | 771 | * calling parent::_validate() first. |
772 | 772 | */ |
773 | 773 | protected function _validate() { |
774 | - foreach($this->get_validatable_subsections() as $subsection_name => $subsection){ |
|
775 | - if(method_exists($this,'_validate_'.$subsection_name)){ |
|
776 | - call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection)); |
|
774 | + foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) { |
|
775 | + if (method_exists($this, '_validate_'.$subsection_name)) { |
|
776 | + call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection)); |
|
777 | 777 | } |
778 | 778 | $subsection->_validate(); |
779 | 779 | } |
@@ -785,13 +785,13 @@ discard block |
||
785 | 785 | * Gets all the validated inputs for the form section |
786 | 786 | * @return array |
787 | 787 | */ |
788 | - public function valid_data(){ |
|
788 | + public function valid_data() { |
|
789 | 789 | $inputs = array(); |
790 | - foreach( $this->subsections() as $subsection_name =>$subsection ){ |
|
791 | - if ( $subsection instanceof EE_Form_Section_Proper ) { |
|
792 | - $inputs[ $subsection_name ] = $subsection->valid_data(); |
|
793 | - } else if ( $subsection instanceof EE_Form_Input_Base ){ |
|
794 | - $inputs[ $subsection_name ] = $subsection->normalized_value(); |
|
790 | + foreach ($this->subsections() as $subsection_name =>$subsection) { |
|
791 | + if ($subsection instanceof EE_Form_Section_Proper) { |
|
792 | + $inputs[$subsection_name] = $subsection->valid_data(); |
|
793 | + } else if ($subsection instanceof EE_Form_Input_Base) { |
|
794 | + $inputs[$subsection_name] = $subsection->normalized_value(); |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | return $inputs; |
@@ -803,11 +803,11 @@ discard block |
||
803 | 803 | * Gets all the inputs on this form section |
804 | 804 | * @return EE_Form_Input_Base[] |
805 | 805 | */ |
806 | - public function inputs(){ |
|
806 | + public function inputs() { |
|
807 | 807 | $inputs = array(); |
808 | - foreach( $this->subsections() as $subsection_name =>$subsection ){ |
|
809 | - if ( $subsection instanceof EE_Form_Input_Base ){ |
|
810 | - $inputs[ $subsection_name ] = $subsection; |
|
808 | + foreach ($this->subsections() as $subsection_name =>$subsection) { |
|
809 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
810 | + $inputs[$subsection_name] = $subsection; |
|
811 | 811 | } |
812 | 812 | } |
813 | 813 | return $inputs; |
@@ -819,10 +819,10 @@ discard block |
||
819 | 819 | * Gets all the subsections which are a proper form |
820 | 820 | * @return EE_Form_Section_Proper[] |
821 | 821 | */ |
822 | - public function subforms(){ |
|
822 | + public function subforms() { |
|
823 | 823 | $form_sections = array(); |
824 | - foreach($this->subsections() as $name=>$obj){ |
|
825 | - if($obj instanceof EE_Form_Section_Proper){ |
|
824 | + foreach ($this->subsections() as $name=>$obj) { |
|
825 | + if ($obj instanceof EE_Form_Section_Proper) { |
|
826 | 826 | $form_sections[$name] = $obj; |
827 | 827 | } |
828 | 828 | } |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | * if you only want form inputs or proper form sections. |
838 | 838 | * @return EE_Form_Section_Proper[] |
839 | 839 | */ |
840 | - public function subsections(){ |
|
840 | + public function subsections() { |
|
841 | 841 | $this->ensure_construct_finalized_called(); |
842 | 842 | return $this->_subsections; |
843 | 843 | } |
@@ -859,8 +859,8 @@ discard block |
||
859 | 859 | * where keys are always subsection names and values are either |
860 | 860 | * the input's normalized value, or an array like the top-level array |
861 | 861 | */ |
862 | - public function input_values( $include_subform_inputs = false, $flatten = false ){ |
|
863 | - return $this->_input_values( false, $include_subform_inputs, $flatten ); |
|
862 | + public function input_values($include_subform_inputs = false, $flatten = false) { |
|
863 | + return $this->_input_values(false, $include_subform_inputs, $flatten); |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | /** |
@@ -880,8 +880,8 @@ discard block |
||
880 | 880 | * where keys are always subsection names and values are either |
881 | 881 | * the input's normalized value, or an array like the top-level array |
882 | 882 | */ |
883 | - public function input_pretty_values( $include_subform_inputs = false, $flatten = false ){ |
|
884 | - return $this->_input_values( true, $include_subform_inputs, $flatten ); |
|
883 | + public function input_pretty_values($include_subform_inputs = false, $flatten = false) { |
|
884 | + return $this->_input_values(true, $include_subform_inputs, $flatten); |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | /** |
@@ -899,19 +899,19 @@ discard block |
||
899 | 899 | * where keys are always subsection names and values are either |
900 | 900 | * the input's normalized value, or an array like the top-level array |
901 | 901 | */ |
902 | - public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) { |
|
902 | + public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) { |
|
903 | 903 | $input_values = array(); |
904 | - foreach( $this->subsections() as $subsection_name => $subsection ) { |
|
905 | - if( $subsection instanceof EE_Form_Input_Base ) { |
|
906 | - $input_values[ $subsection_name ] = $pretty |
|
904 | + foreach ($this->subsections() as $subsection_name => $subsection) { |
|
905 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
906 | + $input_values[$subsection_name] = $pretty |
|
907 | 907 | ? $subsection->pretty_value() |
908 | 908 | : $subsection->normalized_value(); |
909 | - } else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) { |
|
910 | - $subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten ); |
|
911 | - if( $flatten ) { |
|
912 | - $input_values = array_merge( $input_values, $subform_input_values ); |
|
909 | + } else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) { |
|
910 | + $subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten); |
|
911 | + if ($flatten) { |
|
912 | + $input_values = array_merge($input_values, $subform_input_values); |
|
913 | 913 | } else { |
914 | - $input_values[ $subsection_name ] = $subform_input_values; |
|
914 | + $input_values[$subsection_name] = $subform_input_values; |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 | } |
@@ -932,23 +932,23 @@ discard block |
||
932 | 932 | * where keys are always subsection names and values are either |
933 | 933 | * the input's normalized value, or an array like the top-level array |
934 | 934 | */ |
935 | - public function submitted_values( $include_subforms = false ) { |
|
935 | + public function submitted_values($include_subforms = false) { |
|
936 | 936 | $submitted_values = array(); |
937 | - foreach( $this->subsections() as $subsection ) { |
|
938 | - if( $subsection instanceof EE_Form_Input_Base ) { |
|
937 | + foreach ($this->subsections() as $subsection) { |
|
938 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
939 | 939 | // is this input part of an array of inputs? |
940 | - if ( strpos( $subsection->html_name(), '[' ) !== false ) { |
|
940 | + if (strpos($subsection->html_name(), '[') !== false) { |
|
941 | 941 | $full_input_name = \EEH_Array::convert_array_values_to_keys( |
942 | - explode( '[', str_replace( ']', '', $subsection->html_name() ) ), |
|
942 | + explode('[', str_replace(']', '', $subsection->html_name())), |
|
943 | 943 | $subsection->raw_value() |
944 | 944 | ); |
945 | - $submitted_values = array_replace_recursive( $submitted_values, $full_input_name ); |
|
945 | + $submitted_values = array_replace_recursive($submitted_values, $full_input_name); |
|
946 | 946 | } else { |
947 | - $submitted_values[ $subsection->html_name() ] = $subsection->raw_value(); |
|
947 | + $submitted_values[$subsection->html_name()] = $subsection->raw_value(); |
|
948 | 948 | } |
949 | - } else if( $subsection instanceof EE_Form_Section_Proper && $include_subforms ) { |
|
950 | - $subform_input_values = $subsection->submitted_values( $include_subforms ); |
|
951 | - $submitted_values = array_replace_recursive( $submitted_values, $subform_input_values ); |
|
949 | + } else if ($subsection instanceof EE_Form_Section_Proper && $include_subforms) { |
|
950 | + $subform_input_values = $subsection->submitted_values($include_subforms); |
|
951 | + $submitted_values = array_replace_recursive($submitted_values, $subform_input_values); |
|
952 | 952 | } |
953 | 953 | } |
954 | 954 | return $submitted_values; |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | * @return boolean |
964 | 964 | * @throws \EE_Error |
965 | 965 | */ |
966 | - public function has_received_submission(){ |
|
966 | + public function has_received_submission() { |
|
967 | 967 | $this->ensure_construct_finalized_called(); |
968 | 968 | return $this->_received_submission; |
969 | 969 | } |
@@ -976,8 +976,8 @@ discard block |
||
976 | 976 | * @param array $inputs_to_exclude values are the input names |
977 | 977 | * @return void |
978 | 978 | */ |
979 | - public function exclude($inputs_to_exclude = array()){ |
|
980 | - foreach($inputs_to_exclude as $input_to_exclude_name){ |
|
979 | + public function exclude($inputs_to_exclude = array()) { |
|
980 | + foreach ($inputs_to_exclude as $input_to_exclude_name) { |
|
981 | 981 | unset($this->_subsections[$input_to_exclude_name]); |
982 | 982 | } |
983 | 983 | } |
@@ -988,8 +988,8 @@ discard block |
||
988 | 988 | * @param array $inputs_to_hide |
989 | 989 | * @throws \EE_Error |
990 | 990 | */ |
991 | - public function hide($inputs_to_hide= array()){ |
|
992 | - foreach($inputs_to_hide as $input_to_hide){ |
|
991 | + public function hide($inputs_to_hide = array()) { |
|
992 | + foreach ($inputs_to_hide as $input_to_hide) { |
|
993 | 993 | $input = $this->get_input($input_to_hide); |
994 | 994 | |
995 | 995 | $input->set_display_strategy(new EE_Hidden_Display_Strategy()); |
@@ -1019,21 +1019,21 @@ discard block |
||
1019 | 1019 | * @return void |
1020 | 1020 | * @throws \EE_Error |
1021 | 1021 | */ |
1022 | - public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){ |
|
1023 | - foreach( $new_subsections as $subsection_name => $subsection ){ |
|
1024 | - if( ! $subsection instanceof EE_Form_Section_Base ){ |
|
1022 | + public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) { |
|
1023 | + foreach ($new_subsections as $subsection_name => $subsection) { |
|
1024 | + if ( ! $subsection instanceof EE_Form_Section_Base) { |
|
1025 | 1025 | EE_Error::add_error( |
1026 | 1026 | sprintf( |
1027 | 1027 | __( |
1028 | 1028 | "Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", |
1029 | 1029 | "event_espresso" |
1030 | 1030 | ), |
1031 | - get_class( $subsection ), |
|
1031 | + get_class($subsection), |
|
1032 | 1032 | $subsection_name, |
1033 | 1033 | $this->name() |
1034 | 1034 | ) |
1035 | 1035 | ); |
1036 | - unset( $new_subsections[ $subsection_name ] ); |
|
1036 | + unset($new_subsections[$subsection_name]); |
|
1037 | 1037 | } |
1038 | 1038 | } |
1039 | 1039 | $this->_subsections = EEH_Array::insert_into_array( |
@@ -1044,8 +1044,8 @@ discard block |
||
1044 | 1044 | ); |
1045 | 1045 | |
1046 | 1046 | |
1047 | - if( $this->_construction_finalized ){ |
|
1048 | - foreach($this->_subsections as $name => $subsection){ |
|
1047 | + if ($this->_construction_finalized) { |
|
1048 | + foreach ($this->_subsections as $name => $subsection) { |
|
1049 | 1049 | $subsection->_construct_finalize($this, $name); |
1050 | 1050 | } |
1051 | 1051 | } |
@@ -1056,8 +1056,8 @@ discard block |
||
1056 | 1056 | /** |
1057 | 1057 | * Just gets all validatable subsections to clean their sensitive data |
1058 | 1058 | */ |
1059 | - public function clean_sensitive_data(){ |
|
1060 | - foreach($this->get_validatable_subsections() as $subsection){ |
|
1059 | + public function clean_sensitive_data() { |
|
1060 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
1061 | 1061 | $subsection->clean_sensitive_data(); |
1062 | 1062 | } |
1063 | 1063 | } |
@@ -1067,10 +1067,10 @@ discard block |
||
1067 | 1067 | /** |
1068 | 1068 | * @param string $form_submission_error_message |
1069 | 1069 | */ |
1070 | - public function set_submission_error_message( $form_submission_error_message = '' ) { |
|
1071 | - $this->_form_submission_error_message .= ! empty( $form_submission_error_message ) |
|
1070 | + public function set_submission_error_message($form_submission_error_message = '') { |
|
1071 | + $this->_form_submission_error_message .= ! empty($form_submission_error_message) |
|
1072 | 1072 | ? $form_submission_error_message |
1073 | - : __( 'Form submission failed due to errors', 'event_espresso' ); |
|
1073 | + : __('Form submission failed due to errors', 'event_espresso'); |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | |
@@ -1087,10 +1087,10 @@ discard block |
||
1087 | 1087 | /** |
1088 | 1088 | * @param string $form_submission_success_message |
1089 | 1089 | */ |
1090 | - public function set_submission_success_message( $form_submission_success_message ) { |
|
1091 | - $this->_form_submission_success_message .= ! empty( $form_submission_success_message ) |
|
1090 | + public function set_submission_success_message($form_submission_success_message) { |
|
1091 | + $this->_form_submission_success_message .= ! empty($form_submission_success_message) |
|
1092 | 1092 | ? $form_submission_success_message |
1093 | - : __( 'Form submitted successfully', 'event_espresso' ); |
|
1093 | + : __('Form submitted successfully', 'event_espresso'); |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | |
@@ -1113,10 +1113,10 @@ discard block |
||
1113 | 1113 | * @return string |
1114 | 1114 | * @throws \EE_Error |
1115 | 1115 | */ |
1116 | - public function html_name_prefix(){ |
|
1117 | - if( $this->parent_section() instanceof EE_Form_Section_Proper ){ |
|
1118 | - return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']'; |
|
1119 | - }else{ |
|
1116 | + public function html_name_prefix() { |
|
1117 | + if ($this->parent_section() instanceof EE_Form_Section_Proper) { |
|
1118 | + return $this->parent_section()->html_name_prefix().'['.$this->name().']'; |
|
1119 | + } else { |
|
1120 | 1120 | return $this->name(); |
1121 | 1121 | } |
1122 | 1122 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | * @return string |
1132 | 1132 | * @throws \EE_Error |
1133 | 1133 | */ |
1134 | - public function name(){ |
|
1134 | + public function name() { |
|
1135 | 1135 | $this->ensure_construct_finalized_called(); |
1136 | 1136 | return parent::name(); |
1137 | 1137 | } |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | * @return EE_Form_Section_Proper |
1143 | 1143 | * @throws \EE_Error |
1144 | 1144 | */ |
1145 | - public function parent_section(){ |
|
1145 | + public function parent_section() { |
|
1146 | 1146 | $this->ensure_construct_finalized_called(); |
1147 | 1147 | return parent::parent_section(); |
1148 | 1148 | } |
@@ -1155,9 +1155,9 @@ discard block |
||
1155 | 1155 | * @return void |
1156 | 1156 | * @throws \EE_Error |
1157 | 1157 | */ |
1158 | - public function ensure_construct_finalized_called(){ |
|
1159 | - if( ! $this->_construction_finalized ){ |
|
1160 | - $this->_construct_finalize($this->_parent_section, $this->_name ); |
|
1158 | + public function ensure_construct_finalized_called() { |
|
1159 | + if ( ! $this->_construction_finalized) { |
|
1160 | + $this->_construct_finalize($this->_parent_section, $this->_name); |
|
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 | |
@@ -1169,17 +1169,17 @@ discard block |
||
1169 | 1169 | * @param array $req_data |
1170 | 1170 | * @return boolean |
1171 | 1171 | */ |
1172 | - public function form_data_present_in( $req_data = NULL ) { |
|
1173 | - if( $req_data === NULL){ |
|
1172 | + public function form_data_present_in($req_data = NULL) { |
|
1173 | + if ($req_data === NULL) { |
|
1174 | 1174 | $req_data = $_POST; |
1175 | 1175 | } |
1176 | - foreach( $this->subsections() as $subsection ) { |
|
1177 | - if($subsection instanceof EE_Form_Input_Base ) { |
|
1178 | - if( $subsection->form_data_present_in( $req_data ) ) { |
|
1176 | + foreach ($this->subsections() as $subsection) { |
|
1177 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
1178 | + if ($subsection->form_data_present_in($req_data)) { |
|
1179 | 1179 | return TRUE; |
1180 | 1180 | } |
1181 | - }elseif( $subsection instanceof EE_Form_Section_Proper ) { |
|
1182 | - if( $subsection->form_data_present_in( $req_data ) ) { |
|
1181 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
1182 | + if ($subsection->form_data_present_in($req_data)) { |
|
1183 | 1183 | return TRUE; |
1184 | 1184 | } |
1185 | 1185 | } |
@@ -1196,14 +1196,14 @@ discard block |
||
1196 | 1196 | */ |
1197 | 1197 | public function get_validation_errors_accumulated() { |
1198 | 1198 | $validation_errors = $this->get_validation_errors(); |
1199 | - foreach($this->get_validatable_subsections() as $subsection ) { |
|
1200 | - if( $subsection instanceof EE_Form_Section_Proper ) { |
|
1199 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
1200 | + if ($subsection instanceof EE_Form_Section_Proper) { |
|
1201 | 1201 | $validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated(); |
1202 | 1202 | } else { |
1203 | - $validation_errors_on_this_subsection = $subsection->get_validation_errors(); |
|
1203 | + $validation_errors_on_this_subsection = $subsection->get_validation_errors(); |
|
1204 | 1204 | } |
1205 | - if( $validation_errors_on_this_subsection ){ |
|
1206 | - $validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection ); |
|
1205 | + if ($validation_errors_on_this_subsection) { |
|
1206 | + $validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection); |
|
1207 | 1207 | } |
1208 | 1208 | } |
1209 | 1209 | return $validation_errors; |
@@ -1225,24 +1225,24 @@ discard block |
||
1225 | 1225 | * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false |
1226 | 1226 | * @return EE_Form_Section_Base |
1227 | 1227 | */ |
1228 | - public function find_section_from_path( $form_section_path ) { |
|
1228 | + public function find_section_from_path($form_section_path) { |
|
1229 | 1229 | //check if we can find the input from purely going straight up the tree |
1230 | - $input = parent::find_section_from_path( $form_section_path ); |
|
1231 | - if( $input instanceof EE_Form_Section_Base ) { |
|
1230 | + $input = parent::find_section_from_path($form_section_path); |
|
1231 | + if ($input instanceof EE_Form_Section_Base) { |
|
1232 | 1232 | return $input; |
1233 | 1233 | } |
1234 | 1234 | |
1235 | - $next_slash_pos = strpos( $form_section_path, '/' ); |
|
1236 | - if( $next_slash_pos !== false ) { |
|
1237 | - $child_section_name = substr( $form_section_path, 0, $next_slash_pos ); |
|
1238 | - $subpath = substr( $form_section_path, $next_slash_pos + 1 ); |
|
1235 | + $next_slash_pos = strpos($form_section_path, '/'); |
|
1236 | + if ($next_slash_pos !== false) { |
|
1237 | + $child_section_name = substr($form_section_path, 0, $next_slash_pos); |
|
1238 | + $subpath = substr($form_section_path, $next_slash_pos + 1); |
|
1239 | 1239 | } else { |
1240 | 1240 | $child_section_name = $form_section_path; |
1241 | 1241 | $subpath = ''; |
1242 | 1242 | } |
1243 | - $child_section = $this->get_subsection( $child_section_name ); |
|
1244 | - if ( $child_section instanceof EE_Form_Section_Base ) { |
|
1245 | - return $child_section->find_section_from_path( $subpath ); |
|
1243 | + $child_section = $this->get_subsection($child_section_name); |
|
1244 | + if ($child_section instanceof EE_Form_Section_Base) { |
|
1245 | + return $child_section->find_section_from_path($subpath); |
|
1246 | 1246 | } else { |
1247 | 1247 | return null; |
1248 | 1248 | } |
@@ -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 | } |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | public function _construct_finalize($parent_form_section, $name) { |
221 | 221 | parent::_construct_finalize($parent_form_section, $name); |
222 | 222 | $this->_set_default_html_name_if_empty(); |
223 | - if( $this->_html_label === null && $this->_html_label_text === null ){ |
|
224 | - $this->_html_label_text = ucwords( str_replace("_"," ",$name)); |
|
223 | + if ($this->_html_label === null && $this->_html_label_text === null) { |
|
224 | + $this->_html_label_text = ucwords(str_replace("_", " ", $name)); |
|
225 | 225 | } |
226 | - do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name ); |
|
226 | + do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @return EE_Display_Strategy_Base |
232 | 232 | * @throws EE_Error |
233 | 233 | */ |
234 | - protected function _get_display_strategy(){ |
|
235 | - if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){ |
|
234 | + protected function _get_display_strategy() { |
|
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 | return $this->_get_display_strategy()->display(); |
406 | 406 | } |
407 | 407 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @return string |
412 | 412 | */ |
413 | 413 | public function html_other_attributes() { |
414 | - return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : ''; |
|
414 | + return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : ''; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | /** |
420 | 420 | * @param string $html_other_attributes |
421 | 421 | */ |
422 | - public function set_html_other_attributes( $html_other_attributes ) { |
|
422 | + public function set_html_other_attributes($html_other_attributes) { |
|
423 | 423 | $this->_html_other_attributes = $html_other_attributes; |
424 | 424 | } |
425 | 425 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * according to the form section's layout strategy |
429 | 429 | * @return string |
430 | 430 | */ |
431 | - public function get_html_for_label(){ |
|
431 | + public function get_html_for_label() { |
|
432 | 432 | return $this->_parent_section->get_layout_strategy()->display_label($this); |
433 | 433 | } |
434 | 434 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * according to the form section's layout strategy |
437 | 437 | * @return string |
438 | 438 | */ |
439 | - public function get_html_for_errors(){ |
|
439 | + public function get_html_for_errors() { |
|
440 | 440 | return $this->_parent_section->get_layout_strategy()->display_errors($this); |
441 | 441 | } |
442 | 442 | /** |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * according to the form section's layout strategy |
445 | 445 | * @return string |
446 | 446 | */ |
447 | - public function get_html_for_help(){ |
|
447 | + public function get_html_for_help() { |
|
448 | 448 | return $this->_parent_section->get_layout_strategy()->display_help_text($this); |
449 | 449 | } |
450 | 450 | /** |
@@ -453,18 +453,18 @@ discard block |
||
453 | 453 | * @return boolean |
454 | 454 | */ |
455 | 455 | protected function _validate() { |
456 | - foreach($this->_validation_strategies as $validation_strategy){ |
|
457 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
458 | - try{ |
|
456 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
457 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
458 | + try { |
|
459 | 459 | $validation_strategy->validate($this->normalized_value()); |
460 | - }catch(EE_Validation_Error $e){ |
|
460 | + } catch (EE_Validation_Error $e) { |
|
461 | 461 | $this->add_validation_error($e); |
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
465 | - if( $this->get_validation_errors()){ |
|
465 | + if ($this->get_validation_errors()) { |
|
466 | 466 | return false; |
467 | - }else{ |
|
467 | + } else { |
|
468 | 468 | return true; |
469 | 469 | } |
470 | 470 | } |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @param string $value |
479 | 479 | * @return null|string |
480 | 480 | */ |
481 | - private function _sanitize( $value ) { |
|
482 | - return $value !== null ? stripslashes( html_entity_decode( trim( $value ) ) ) : null; |
|
481 | + private function _sanitize($value) { |
|
482 | + return $value !== null ? stripslashes(html_entity_decode(trim($value))) : null; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -493,25 +493,25 @@ discard block |
||
493 | 493 | * @return boolean whether or not there was an error |
494 | 494 | * @throws \EE_Error |
495 | 495 | */ |
496 | - protected function _normalize( $req_data ) { |
|
496 | + protected function _normalize($req_data) { |
|
497 | 497 | //any existing validation errors don't apply so clear them |
498 | 498 | $this->_validation_errors = array(); |
499 | 499 | try { |
500 | - $raw_input = $this->find_form_data_for_this_section( $req_data ); |
|
500 | + $raw_input = $this->find_form_data_for_this_section($req_data); |
|
501 | 501 | //super simple sanitization for now |
502 | - if ( is_array( $raw_input )) { |
|
502 | + if (is_array($raw_input)) { |
|
503 | 503 | $raw_value = array(); |
504 | - foreach( $raw_input as $key => $value ) { |
|
505 | - $raw_value[ $key ] = $this->_sanitize( $value ); |
|
504 | + foreach ($raw_input as $key => $value) { |
|
505 | + $raw_value[$key] = $this->_sanitize($value); |
|
506 | 506 | } |
507 | - $this->_set_raw_value( $raw_value ); |
|
507 | + $this->_set_raw_value($raw_value); |
|
508 | 508 | } else { |
509 | - $this->_set_raw_value( $this->_sanitize( $raw_input ) ); |
|
509 | + $this->_set_raw_value($this->_sanitize($raw_input)); |
|
510 | 510 | } |
511 | 511 | //we want to mostly leave the input alone in case we need to re-display it to the user |
512 | - $this->_set_normalized_value( $this->_normalization_strategy->normalize( $this->raw_value() ) ); |
|
513 | - } catch ( EE_Validation_Error $e ) { |
|
514 | - $this->add_validation_error( $e ); |
|
512 | + $this->_set_normalized_value($this->_normalization_strategy->normalize($this->raw_value())); |
|
513 | + } catch (EE_Validation_Error $e) { |
|
514 | + $this->add_validation_error($e); |
|
515 | 515 | } |
516 | 516 | } |
517 | 517 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | /** |
521 | 521 | * @return string |
522 | 522 | */ |
523 | - public function html_name(){ |
|
523 | + public function html_name() { |
|
524 | 524 | return $this->_html_name; |
525 | 525 | } |
526 | 526 | |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | /** |
530 | 530 | * @return string |
531 | 531 | */ |
532 | - public function html_label_id(){ |
|
533 | - return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl'; |
|
532 | + public function html_label_id() { |
|
533 | + return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl'; |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | /** |
539 | 539 | * @return string |
540 | 540 | */ |
541 | - public function html_label_class(){ |
|
541 | + public function html_label_class() { |
|
542 | 542 | return $this->_html_label_class; |
543 | 543 | } |
544 | 544 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * @return string |
549 | 549 | */ |
550 | - public function html_label_style(){ |
|
550 | + public function html_label_style() { |
|
551 | 551 | return $this->_html_label_style; |
552 | 552 | } |
553 | 553 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | /** |
557 | 557 | * @return string |
558 | 558 | */ |
559 | - public function html_label_text(){ |
|
559 | + public function html_label_text() { |
|
560 | 560 | return $this->_html_label_text; |
561 | 561 | } |
562 | 562 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * @return string |
567 | 567 | */ |
568 | - public function html_help_text(){ |
|
568 | + public function html_help_text() { |
|
569 | 569 | return $this->_html_help_text; |
570 | 570 | } |
571 | 571 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | /** |
575 | 575 | * @return string |
576 | 576 | */ |
577 | - public function html_help_class(){ |
|
577 | + public function html_help_class() { |
|
578 | 578 | return $this->_html_help_class; |
579 | 579 | } |
580 | 580 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | /** |
584 | 584 | * @return string |
585 | 585 | */ |
586 | - public function html_help_style(){ |
|
586 | + public function html_help_style() { |
|
587 | 587 | return $this->_html_style; |
588 | 588 | } |
589 | 589 | /** |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | * in which case, we would have stored the malicious content to our database. |
597 | 597 | * @return string |
598 | 598 | */ |
599 | - public function raw_value(){ |
|
599 | + public function raw_value() { |
|
600 | 600 | return $this->_raw_value; |
601 | 601 | } |
602 | 602 | /** |
@@ -604,15 +604,15 @@ discard block |
||
604 | 604 | * it escapes all html entities |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - public function raw_value_in_form(){ |
|
608 | - return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8'); |
|
607 | + public function raw_value_in_form() { |
|
608 | + return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8'); |
|
609 | 609 | } |
610 | 610 | /** |
611 | 611 | * returns the value after it's been sanitized, and then converted into it's proper type |
612 | 612 | * in PHP. Eg, a string, an int, an array, |
613 | 613 | * @return mixed |
614 | 614 | */ |
615 | - public function normalized_value(){ |
|
615 | + public function normalized_value() { |
|
616 | 616 | return $this->_normalized_value; |
617 | 617 | } |
618 | 618 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * the best thing to display |
623 | 623 | * @return string |
624 | 624 | */ |
625 | - public function pretty_value(){ |
|
625 | + public function pretty_value() { |
|
626 | 626 | return $this->_normalized_value; |
627 | 627 | } |
628 | 628 | /** |
@@ -641,19 +641,19 @@ discard block |
||
641 | 641 | }</code> |
642 | 642 | * @return array |
643 | 643 | */ |
644 | - public function get_jquery_validation_rules(){ |
|
644 | + public function get_jquery_validation_rules() { |
|
645 | 645 | $jquery_validation_js = array(); |
646 | 646 | $jquery_validation_rules = array(); |
647 | - foreach($this->get_validation_strategies() as $validation_strategy){ |
|
647 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
648 | 648 | $jquery_validation_rules = array_replace_recursive( |
649 | 649 | $jquery_validation_rules, |
650 | 650 | $validation_strategy->get_jquery_validation_rule_array() |
651 | 651 | ); |
652 | 652 | } |
653 | 653 | |
654 | - if(! empty($jquery_validation_rules)){ |
|
655 | - foreach( $this->get_display_strategy()->get_html_input_ids( true ) as $html_id_with_pound_sign ) { |
|
656 | - $jquery_validation_js[ $html_id_with_pound_sign ] = $jquery_validation_rules; |
|
654 | + if ( ! empty($jquery_validation_rules)) { |
|
655 | + foreach ($this->get_display_strategy()->get_html_input_ids(true) as $html_id_with_pound_sign) { |
|
656 | + $jquery_validation_js[$html_id_with_pound_sign] = $jquery_validation_rules; |
|
657 | 657 | } |
658 | 658 | } |
659 | 659 | return $jquery_validation_js; |
@@ -665,16 +665,16 @@ discard block |
||
665 | 665 | * @param mixed $value |
666 | 666 | * @return void |
667 | 667 | */ |
668 | - public function set_default($value){ |
|
669 | - $this->_set_normalized_value( $value ); |
|
670 | - $this->_set_raw_value( $value ); |
|
668 | + public function set_default($value) { |
|
669 | + $this->_set_normalized_value($value); |
|
670 | + $this->_set_raw_value($value); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | /** |
674 | 674 | * Sets the normalized value on this input |
675 | 675 | * @param mixed $value |
676 | 676 | */ |
677 | - protected function _set_normalized_value( $value ) { |
|
677 | + protected function _set_normalized_value($value) { |
|
678 | 678 | $this->_normalized_value = $value; |
679 | 679 | } |
680 | 680 | |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | * Sets the raw value on this input (ie, exactly as the user submitted it) |
683 | 683 | * @param mixed $value |
684 | 684 | */ |
685 | - protected function _set_raw_value( $value ) { |
|
686 | - $this->_raw_value = $this->_normalization_strategy->unnormalize( $value ); |
|
685 | + protected function _set_raw_value($value) { |
|
686 | + $this->_raw_value = $this->_normalization_strategy->unnormalize($value); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | /** |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * @param string $label |
692 | 692 | * @return void |
693 | 693 | */ |
694 | - public function set_html_label_text($label){ |
|
694 | + public function set_html_label_text($label) { |
|
695 | 695 | $this->_html_label_text = $label; |
696 | 696 | } |
697 | 697 | |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | * @param boolean $required boolean |
706 | 706 | * @param null $required_text |
707 | 707 | */ |
708 | - public function set_required($required = true, $required_text = NULL ){ |
|
709 | - $required = filter_var( $required, FILTER_VALIDATE_BOOLEAN ); |
|
708 | + public function set_required($required = true, $required_text = NULL) { |
|
709 | + $required = filter_var($required, FILTER_VALIDATE_BOOLEAN); |
|
710 | 710 | //whether $required is a string or a boolean, we want to add a required validation strategy |
711 | - if ( $required ) { |
|
712 | - $this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) ); |
|
711 | + if ($required) { |
|
712 | + $this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text)); |
|
713 | 713 | } else { |
714 | - $this->remove_validation_strategy( 'EE_Required_Validation_Strategy' ); |
|
714 | + $this->remove_validation_strategy('EE_Required_Validation_Strategy'); |
|
715 | 715 | } |
716 | 716 | $this->_required = $required; |
717 | 717 | } |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | * Returns whether or not this field is required |
720 | 720 | * @return boolean |
721 | 721 | */ |
722 | - public function required(){ |
|
722 | + public function required() { |
|
723 | 723 | return $this->_required; |
724 | 724 | } |
725 | 725 | |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | /** |
729 | 729 | * @param string $required_css_class |
730 | 730 | */ |
731 | - public function set_required_css_class( $required_css_class ) { |
|
731 | + public function set_required_css_class($required_css_class) { |
|
732 | 732 | $this->_required_css_class = $required_css_class; |
733 | 733 | } |
734 | 734 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * Sets the help text, in case |
748 | 748 | * @param string $text |
749 | 749 | */ |
750 | - public function set_html_help_text($text){ |
|
750 | + public function set_html_help_text($text) { |
|
751 | 751 | $this->_html_help_text = $text; |
752 | 752 | } |
753 | 753 | /** |
@@ -759,9 +759,9 @@ discard block |
||
759 | 759 | public function clean_sensitive_data() { |
760 | 760 | //if we do ANY kind of sensitive data removal on this, then just clear out the raw value |
761 | 761 | //if we need more logic than this we'll make a strategy for it |
762 | - if( $this->_sensitive_data_removal_strategy && |
|
763 | - ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){ |
|
764 | - $this->_set_raw_value( null ); |
|
762 | + if ($this->_sensitive_data_removal_strategy && |
|
763 | + ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) { |
|
764 | + $this->_set_raw_value(null); |
|
765 | 765 | } |
766 | 766 | //and clean the normalized value according to the appropriate strategy |
767 | 767 | $this->_set_normalized_value( |
@@ -778,10 +778,10 @@ discard block |
||
778 | 778 | * @param string $button_size |
779 | 779 | * @param string $other_attributes |
780 | 780 | */ |
781 | - public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) { |
|
781 | + public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') { |
|
782 | 782 | $button_css_attributes = 'button'; |
783 | 783 | $button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary'; |
784 | - switch ( $button_size ) { |
|
784 | + switch ($button_size) { |
|
785 | 785 | case 'xs' : |
786 | 786 | case 'extra-small' : |
787 | 787 | $button_css_attributes .= ' button-xs'; |
@@ -802,8 +802,8 @@ discard block |
||
802 | 802 | default : |
803 | 803 | $button_css_attributes .= ''; |
804 | 804 | } |
805 | - $this->_button_css_attributes .= ! empty( $other_attributes ) |
|
806 | - ? $button_css_attributes . ' ' . $other_attributes |
|
805 | + $this->_button_css_attributes .= ! empty($other_attributes) |
|
806 | + ? $button_css_attributes.' '.$other_attributes |
|
807 | 807 | : $button_css_attributes; |
808 | 808 | } |
809 | 809 | |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * @return string |
814 | 814 | */ |
815 | 815 | public function button_css_attributes() { |
816 | - if ( empty( $this->_button_css_attributes )) { |
|
816 | + if (empty($this->_button_css_attributes)) { |
|
817 | 817 | $this->set_button_css_attributes(); |
818 | 818 | } |
819 | 819 | return $this->_button_css_attributes; |
@@ -835,26 +835,26 @@ discard block |
||
835 | 835 | * @return mixed whatever the raw value of this form section is in the request data |
836 | 836 | * @throws \EE_Error |
837 | 837 | */ |
838 | - public function find_form_data_for_this_section( $req_data ){ |
|
838 | + public function find_form_data_for_this_section($req_data) { |
|
839 | 839 | // break up the html name by "[]" |
840 | - if ( strpos( $this->html_name(), '[' ) !== FALSE ) { |
|
841 | - $before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') ); |
|
840 | + if (strpos($this->html_name(), '[') !== FALSE) { |
|
841 | + $before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '[')); |
|
842 | 842 | } else { |
843 | 843 | $before_any_brackets = $this->html_name(); |
844 | 844 | } |
845 | 845 | // grab all of the segments |
846 | - preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches); |
|
847 | - if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
|
848 | - $name_parts = $matches[ 1 ]; |
|
846 | + preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches); |
|
847 | + if (isset($matches[1]) && is_array($matches[1])) { |
|
848 | + $name_parts = $matches[1]; |
|
849 | 849 | array_unshift($name_parts, $before_any_brackets); |
850 | - }else{ |
|
851 | - $name_parts = array( $before_any_brackets ); |
|
850 | + } else { |
|
851 | + $name_parts = array($before_any_brackets); |
|
852 | 852 | } |
853 | 853 | // now get the value for the input |
854 | 854 | $value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data); |
855 | 855 | // check if this thing's name is at the TOP level of the request data |
856 | - if( $value === null && isset( $req_data[ $this->name() ] ) ){ |
|
857 | - $value = $req_data[ $this->name() ]; |
|
856 | + if ($value === null && isset($req_data[$this->name()])) { |
|
857 | + $value = $req_data[$this->name()]; |
|
858 | 858 | } |
859 | 859 | return $value; |
860 | 860 | } |
@@ -867,18 +867,18 @@ discard block |
||
867 | 867 | * @param array $req_data |
868 | 868 | * @return array | NULL |
869 | 869 | */ |
870 | - public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){ |
|
871 | - $first_part_to_consider = array_shift( $html_name_parts ); |
|
872 | - if( isset( $req_data[ $first_part_to_consider ] ) ){ |
|
873 | - if( empty($html_name_parts ) ){ |
|
874 | - return $req_data[ $first_part_to_consider ]; |
|
875 | - }else{ |
|
870 | + public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) { |
|
871 | + $first_part_to_consider = array_shift($html_name_parts); |
|
872 | + if (isset($req_data[$first_part_to_consider])) { |
|
873 | + if (empty($html_name_parts)) { |
|
874 | + return $req_data[$first_part_to_consider]; |
|
875 | + } else { |
|
876 | 876 | return $this->_find_form_data_for_this_section_using_name_parts( |
877 | 877 | $html_name_parts, |
878 | - $req_data[ $first_part_to_consider ] |
|
878 | + $req_data[$first_part_to_consider] |
|
879 | 879 | ); |
880 | 880 | } |
881 | - }else{ |
|
881 | + } else { |
|
882 | 882 | return NULL; |
883 | 883 | } |
884 | 884 | } |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | * @return boolean |
893 | 893 | * @throws \EE_Error |
894 | 894 | */ |
895 | - public function form_data_present_in($req_data = NULL){ |
|
896 | - if( $req_data === NULL ){ |
|
895 | + public function form_data_present_in($req_data = NULL) { |
|
896 | + if ($req_data === NULL) { |
|
897 | 897 | $req_data = $_POST; |
898 | 898 | } |
899 | - $checked_value = $this->find_form_data_for_this_section( $req_data ); |
|
900 | - if( $checked_value !== null ){ |
|
899 | + $checked_value = $this->find_form_data_for_this_section($req_data); |
|
900 | + if ($checked_value !== null) { |
|
901 | 901 | return TRUE; |
902 | - }else{ |
|
902 | + } else { |
|
903 | 903 | return FALSE; |
904 | 904 | } |
905 | 905 | } |
@@ -910,8 +910,8 @@ discard block |
||
910 | 910 | * @param array $form_other_js_data |
911 | 911 | * @return array |
912 | 912 | */ |
913 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
914 | - $form_other_js_data = $this->get_other_js_data_from_strategies( $form_other_js_data ); |
|
913 | + public function get_other_js_data($form_other_js_data = array()) { |
|
914 | + $form_other_js_data = $this->get_other_js_data_from_strategies($form_other_js_data); |
|
915 | 915 | return $form_other_js_data; |
916 | 916 | } |
917 | 917 | |
@@ -924,10 +924,10 @@ discard block |
||
924 | 924 | * @param array $form_other_js_data |
925 | 925 | * @return array |
926 | 926 | */ |
927 | - public function get_other_js_data_from_strategies( $form_other_js_data = array() ) { |
|
928 | - $form_other_js_data = $this->get_display_strategy()->get_other_js_data( $form_other_js_data ); |
|
929 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
930 | - $form_other_js_data = $validation_strategy->get_other_js_data( $form_other_js_data ); |
|
927 | + public function get_other_js_data_from_strategies($form_other_js_data = array()) { |
|
928 | + $form_other_js_data = $this->get_display_strategy()->get_other_js_data($form_other_js_data); |
|
929 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
930 | + $form_other_js_data = $validation_strategy->get_other_js_data($form_other_js_data); |
|
931 | 931 | } |
932 | 932 | return $form_other_js_data; |
933 | 933 | } |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | * Override parent because we want to give our strategies an opportunity to enqueue some js and css |
937 | 937 | * @return void |
938 | 938 | */ |
939 | - public function enqueue_js(){ |
|
939 | + public function enqueue_js() { |
|
940 | 940 | //ask our display strategy and validation strategies if they have js to enqueue |
941 | 941 | $this->enqueue_js_from_strategies(); |
942 | 942 | } |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | */ |
948 | 948 | public function enqueue_js_from_strategies() { |
949 | 949 | $this->get_display_strategy()->enqueue_js(); |
950 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
950 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
951 | 951 | $validation_strategy->enqueue_js(); |
952 | 952 | } |
953 | 953 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | protected function _setup_data() { |
29 | - $this->_data = $this->_get_messages( $this->_per_page, $this->_view ); |
|
30 | - $this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true ); |
|
29 | + $this->_data = $this->_get_messages($this->_per_page, $this->_view); |
|
30 | + $this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,32 +35,32 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function _set_properties() { |
37 | 37 | $this->_wp_list_args = array( |
38 | - 'singular' => __( 'Message', 'event_espresso' ), |
|
39 | - 'plural' => __( 'Messages', 'event_espresso' ), |
|
38 | + 'singular' => __('Message', 'event_espresso'), |
|
39 | + 'plural' => __('Messages', 'event_espresso'), |
|
40 | 40 | 'ajax' => true, |
41 | 41 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
42 | 42 | ); |
43 | 43 | |
44 | 44 | $this->_columns = array( |
45 | 45 | 'cb' => '<input type="checkbox" />', |
46 | - 'to' => __( 'To', 'event_espresso' ), |
|
47 | - 'from' => __( 'From', 'event_espresso' ), |
|
48 | - 'messenger' => __( 'Messenger', 'event_espresso' ), |
|
49 | - 'message_type' => __( 'Message Type', 'event_espresso' ), |
|
50 | - 'context' => __( 'Context', 'event_espresso' ), |
|
51 | - 'modified' => __( 'Modified', 'event_espresso' ), |
|
52 | - 'action' => __( 'Actions', 'event_espresso' ), |
|
53 | - 'msg_id' => __( 'ID', 'event_espresso' ), |
|
46 | + 'to' => __('To', 'event_espresso'), |
|
47 | + 'from' => __('From', 'event_espresso'), |
|
48 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
49 | + 'message_type' => __('Message Type', 'event_espresso'), |
|
50 | + 'context' => __('Context', 'event_espresso'), |
|
51 | + 'modified' => __('Modified', 'event_espresso'), |
|
52 | + 'action' => __('Actions', 'event_espresso'), |
|
53 | + 'msg_id' => __('ID', 'event_espresso'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | $this->_sortable_columns = array( |
57 | - 'modified' => array( 'MSG_modified' => true ), |
|
58 | - 'message_type' => array( 'MSG_message_type' => false ), |
|
59 | - 'messenger' => array( 'MSG_messenger' => false ), |
|
60 | - 'to' => array( 'MSG_to' => false ), |
|
61 | - 'from' => array( 'MSG_from' => false ), |
|
62 | - 'context' => array( 'MSG_context' => false ), |
|
63 | - 'msg_id' => array( 'MSG_ID', false ), |
|
57 | + 'modified' => array('MSG_modified' => true), |
|
58 | + 'message_type' => array('MSG_message_type' => false), |
|
59 | + 'messenger' => array('MSG_messenger' => false), |
|
60 | + 'to' => array('MSG_to' => false), |
|
61 | + 'from' => array('MSG_from' => false), |
|
62 | + 'context' => array('MSG_context' => false), |
|
63 | + 'msg_id' => array('MSG_ID', false), |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->_primary_column = 'to'; |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @param object $item the current item |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - protected function _get_row_class( $item ) { |
|
82 | - $class = parent::_get_row_class( $item ); |
|
81 | + protected function _get_row_class($item) { |
|
82 | + $class = parent::_get_row_class($item); |
|
83 | 83 | //add status class |
84 | - $class .= ' ee-status-strip msg-status-' . $item->STS_ID(); |
|
85 | - if ( $this->_has_checkbox_column ) { |
|
84 | + $class .= ' ee-status-strip msg-status-'.$item->STS_ID(); |
|
85 | + if ($this->_has_checkbox_column) { |
|
86 | 86 | $class .= ' has-checkbox-column'; |
87 | 87 | } |
88 | 88 | return $class; |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | ); |
111 | 111 | |
112 | 112 | //set filters to select inputs if they aren't empty |
113 | - foreach ( $select_inputs as $select_input ) { |
|
114 | - if ( $select_input ) { |
|
113 | + foreach ($select_inputs as $select_input) { |
|
114 | + if ($select_input) { |
|
115 | 115 | $filters[] = $select_input; |
116 | 116 | } |
117 | 117 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | protected function _add_view_counts() { |
124 | - foreach ( $this->_views as $view => $args ) { |
|
125 | - $this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true ); |
|
124 | + foreach ($this->_views as $view => $args) { |
|
125 | + $this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @return string checkbox |
134 | 134 | * @throws \EE_Error |
135 | 135 | */ |
136 | - public function column_cb( $message ) { |
|
137 | - return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() ); |
|
136 | + public function column_cb($message) { |
|
137 | + return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID()); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return string |
145 | 145 | * @throws \EE_Error |
146 | 146 | */ |
147 | - public function column_msg_id( EE_Message $message ) { |
|
147 | + public function column_msg_id(EE_Message $message) { |
|
148 | 148 | return $message->ID(); |
149 | 149 | } |
150 | 150 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @return string The recipient of the message |
156 | 156 | * @throws \EE_Error |
157 | 157 | */ |
158 | - public function column_to( EE_Message $message ) { |
|
159 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
158 | + public function column_to(EE_Message $message) { |
|
159 | + EE_Registry::instance()->load_helper('URL'); |
|
160 | 160 | $actions = array(); |
161 | 161 | $actions['delete'] = '<a href="' |
162 | 162 | . EEH_URL::add_query_args_and_nonce( |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | 'action' => 'delete_ee_message', |
166 | 166 | 'MSG_ID' => $message->ID() |
167 | 167 | ), |
168 | - admin_url( 'admin.php' ) |
|
168 | + admin_url('admin.php') |
|
169 | 169 | ) |
170 | - . '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
171 | - return esc_html( $message->to() ) . $this->row_actions( $actions ); |
|
170 | + . '">'.__('Delete', 'event_espresso').'</a>'; |
|
171 | + return esc_html($message->to()).$this->row_actions($actions); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | * @param EE_Message $message |
177 | 177 | * @return string The sender of the message |
178 | 178 | */ |
179 | - public function column_from( EE_Message $message ) { |
|
180 | - return esc_html( $message->from() ); |
|
179 | + public function column_from(EE_Message $message) { |
|
180 | + return esc_html($message->from()); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param EE_Message $message |
187 | 187 | * @return string The messenger used to send the message. |
188 | 188 | */ |
189 | - public function column_messenger( EE_Message $message ) { |
|
190 | - return ucwords( $message->messenger_label() ); |
|
189 | + public function column_messenger(EE_Message $message) { |
|
190 | + return ucwords($message->messenger_label()); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | * @param EE_Message $message |
196 | 196 | * @return string The message type used to generate the message. |
197 | 197 | */ |
198 | - public function column_message_type( EE_Message $message ) { |
|
199 | - return ucwords( $message->message_type_label() ); |
|
198 | + public function column_message_type(EE_Message $message) { |
|
199 | + return ucwords($message->message_type_label()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param EE_Message $message |
205 | 205 | * @return string The context the message was generated for. |
206 | 206 | */ |
207 | - public function column_context( EE_Message $message ) { |
|
207 | + public function column_context(EE_Message $message) { |
|
208 | 208 | return $message->context_label(); |
209 | 209 | } |
210 | 210 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param EE_Message $message |
214 | 214 | * @return string The timestamp when this message was last modified. |
215 | 215 | */ |
216 | - public function column_modified( EE_Message $message ) { |
|
216 | + public function column_modified(EE_Message $message) { |
|
217 | 217 | return $message->modified(); |
218 | 218 | } |
219 | 219 | |
@@ -222,36 +222,36 @@ discard block |
||
222 | 222 | * @param EE_Message $message |
223 | 223 | * @return string Actions that can be done on the current message. |
224 | 224 | */ |
225 | - public function column_action( EE_Message $message ) { |
|
226 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
225 | + public function column_action(EE_Message $message) { |
|
226 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
227 | 227 | $action_links = array( |
228 | - 'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ), |
|
229 | - 'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ), |
|
230 | - 'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ), |
|
231 | - 'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ), |
|
232 | - 'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ), |
|
233 | - 'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ), |
|
228 | + 'view' => EEH_MSG_Template::get_message_action_link('view', $message), |
|
229 | + 'error' => EEH_MSG_Template::get_message_action_link('error', $message), |
|
230 | + 'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message), |
|
231 | + 'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message), |
|
232 | + 'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message), |
|
233 | + 'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message), |
|
234 | 234 | ); |
235 | 235 | $content = ''; |
236 | - switch ( $message->STS_ID() ) { |
|
236 | + switch ($message->STS_ID()) { |
|
237 | 237 | case EEM_Message::status_sent : |
238 | - $content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction']; |
|
238 | + $content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction']; |
|
239 | 239 | break; |
240 | 240 | case EEM_Message::status_resend : |
241 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
241 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
242 | 242 | break; |
243 | 243 | case EEM_Message::status_retry : |
244 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction']; |
|
244 | + $content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction']; |
|
245 | 245 | break; |
246 | 246 | case EEM_Message::status_failed : |
247 | 247 | case EEM_Message::status_debug_only : |
248 | - $content = $action_links['error'] . $action_links['view_transaction']; |
|
248 | + $content = $action_links['error'].$action_links['view_transaction']; |
|
249 | 249 | break; |
250 | 250 | case EEM_Message::status_idle : |
251 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
251 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
252 | 252 | break; |
253 | 253 | case EEM_Message::status_incomplete; |
254 | - $content = $action_links['generate_now'] . $action_links['view_transaction']; |
|
254 | + $content = $action_links['generate_now'].$action_links['view_transaction']; |
|
255 | 255 | break; |
256 | 256 | } |
257 | 257 | return $content; |
@@ -269,54 +269,54 @@ discard block |
||
269 | 269 | * @return int | EE_Message[] |
270 | 270 | * @throws \EE_Error |
271 | 271 | */ |
272 | - protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) { |
|
272 | + protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) { |
|
273 | 273 | |
274 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
274 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
275 | 275 | ? $this->_req_data['paged'] |
276 | 276 | : 1; |
277 | 277 | |
278 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
278 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
279 | 279 | ? $this->_req_data['perpage'] |
280 | 280 | : $perpage; |
281 | 281 | |
282 | - $offset = ( $current_page - 1 ) * $per_page; |
|
283 | - $limit = $all || $count ? null : array( $offset, $per_page ); |
|
282 | + $offset = ($current_page - 1) * $per_page; |
|
283 | + $limit = $all || $count ? null : array($offset, $per_page); |
|
284 | 284 | $query_params = array( |
285 | - 'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ], |
|
286 | - 'order' => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ], |
|
285 | + 'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'], |
|
286 | + 'order' => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'], |
|
287 | 287 | 'limit' => $limit, |
288 | 288 | ); |
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Any filters coming in from other routes? |
292 | 292 | */ |
293 | - if ( isset( $this->_req_data['filterby'] ) ) { |
|
294 | - $query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() ); |
|
295 | - if ( ! $count ) { |
|
293 | + if (isset($this->_req_data['filterby'])) { |
|
294 | + $query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params()); |
|
295 | + if ( ! $count) { |
|
296 | 296 | $query_params['group_by'] = 'MSG_ID'; |
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | 300 | //view conditionals |
301 | - if ( $view !== 'all' && $count && $all ) { |
|
301 | + if ($view !== 'all' && $count && $all) { |
|
302 | 302 | $query_params[0]['AND*view_conditional'] = array( |
303 | - 'STS_ID' => strtoupper( $view ), |
|
303 | + 'STS_ID' => strtoupper($view), |
|
304 | 304 | ); |
305 | 305 | } |
306 | 306 | |
307 | - if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) { |
|
307 | + if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') { |
|
308 | 308 | $query_params[0]['AND*view_conditional'] = array( |
309 | - 'STS_ID' => strtoupper( $this->_req_data['status'] ), |
|
309 | + 'STS_ID' => strtoupper($this->_req_data['status']), |
|
310 | 310 | ); |
311 | 311 | } |
312 | 312 | |
313 | - if ( ! $all && ! empty( $this->_req_data['s'] ) ) { |
|
314 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
313 | + if ( ! $all && ! empty($this->_req_data['s'])) { |
|
314 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
315 | 315 | $query_params[0]['OR'] = array( |
316 | - 'MSG_to' => array( 'LIKE', $search_string ), |
|
317 | - 'MSG_from' => array( 'LIKE', $search_string ), |
|
318 | - 'MSG_subject' => array( 'LIKE', $search_string ), |
|
319 | - 'MSG_content' => array( 'LIKE', $search_string ), |
|
316 | + 'MSG_to' => array('LIKE', $search_string), |
|
317 | + 'MSG_from' => array('LIKE', $search_string), |
|
318 | + 'MSG_subject' => array('LIKE', $search_string), |
|
319 | + 'MSG_content' => array('LIKE', $search_string), |
|
320 | 320 | ); |
321 | 321 | } |
322 | 322 | |
@@ -324,16 +324,16 @@ discard block |
||
324 | 324 | //the messages system is in debug mode. |
325 | 325 | //Note: for backward compat with previous iterations, this is necessary because there may be EEM_Message::status_debug_only |
326 | 326 | //messages in the database. |
327 | - if ( ! EEM_Message::debug() ) { |
|
327 | + if ( ! EEM_Message::debug()) { |
|
328 | 328 | $query_params[0]['AND*debug_only_conditional'] = array( |
329 | - 'STS_ID' => array( '!=', EEM_Message::status_debug_only ) |
|
329 | + 'STS_ID' => array('!=', EEM_Message::status_debug_only) |
|
330 | 330 | ); |
331 | 331 | } |
332 | 332 | |
333 | 333 | //account for filters |
334 | 334 | if ( |
335 | 335 | ! $all |
336 | - && isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
336 | + && isset($this->_req_data['ee_messenger_filter_by']) |
|
337 | 337 | && $this->_req_data['ee_messenger_filter_by'] !== 'none_selected' |
338 | 338 | ) { |
339 | 339 | $query_params[0]['AND*messenger_filter'] = array( |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | } |
343 | 343 | if ( |
344 | 344 | ! $all |
345 | - && ! empty( $this->_req_data['ee_message_type_filter_by'] ) |
|
345 | + && ! empty($this->_req_data['ee_message_type_filter_by']) |
|
346 | 346 | && $this->_req_data['ee_message_type_filter_by'] !== 'none_selected' |
347 | 347 | ) { |
348 | 348 | $query_params[0]['AND*message_type_filter'] = array( |
@@ -352,17 +352,17 @@ discard block |
||
352 | 352 | |
353 | 353 | if ( |
354 | 354 | ! $all |
355 | - && ! empty( $this->_req_data['ee_context_filter_by'] ) |
|
355 | + && ! empty($this->_req_data['ee_context_filter_by']) |
|
356 | 356 | && $this->_req_data['ee_context_filter_by'] !== 'none_selected' |
357 | 357 | ) { |
358 | 358 | $query_params[0]['AND*context_filter'] = array( |
359 | - 'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) ) |
|
359 | + 'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])) |
|
360 | 360 | ); |
361 | 361 | } |
362 | 362 | |
363 | 363 | return $count |
364 | - ? EEM_Message::instance()->count( $query_params, null, true ) |
|
365 | - : EEM_Message::instance()->get_all( $query_params ); |
|
364 | + ? EEM_Message::instance()->count($query_params, null, true) |
|
365 | + : EEM_Message::instance()->get_all($query_params); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -372,15 +372,15 @@ discard block |
||
372 | 372 | */ |
373 | 373 | protected function _get_messengers_dropdown_filter() { |
374 | 374 | $messenger_options = array(); |
375 | - $active_messages_grouped_by_messenger = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) ); |
|
375 | + $active_messages_grouped_by_messenger = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger')); |
|
376 | 376 | |
377 | 377 | //setup array of messenger options |
378 | - foreach ( $active_messages_grouped_by_messenger as $active_message ) { |
|
379 | - if ( $active_message instanceof EE_Message ) { |
|
380 | - $messenger_options[ $active_message->messenger() ] = ucwords( $active_message->messenger_label() ); |
|
378 | + foreach ($active_messages_grouped_by_messenger as $active_message) { |
|
379 | + if ($active_message instanceof EE_Message) { |
|
380 | + $messenger_options[$active_message->messenger()] = ucwords($active_message->messenger_label()); |
|
381 | 381 | } |
382 | 382 | } |
383 | - return $this->get_admin_page()->get_messengers_select_input( $messenger_options ); |
|
383 | + return $this->get_admin_page()->get_messengers_select_input($messenger_options); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -391,15 +391,15 @@ discard block |
||
391 | 391 | */ |
392 | 392 | protected function _get_message_types_dropdown_filter() { |
393 | 393 | $message_type_options = array(); |
394 | - $active_messages_grouped_by_message_type = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) ); |
|
394 | + $active_messages_grouped_by_message_type = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type')); |
|
395 | 395 | |
396 | 396 | //setup array of message type options |
397 | - foreach ( $active_messages_grouped_by_message_type as $active_message ) { |
|
398 | - if ( $active_message instanceof EE_Message ) { |
|
399 | - $message_type_options[ $active_message->message_type() ] = ucwords( $active_message->message_type_label() ); |
|
397 | + foreach ($active_messages_grouped_by_message_type as $active_message) { |
|
398 | + if ($active_message instanceof EE_Message) { |
|
399 | + $message_type_options[$active_message->message_type()] = ucwords($active_message->message_type_label()); |
|
400 | 400 | } |
401 | 401 | } |
402 | - return $this->get_admin_page()->get_message_types_select_input( $message_type_options ); |
|
402 | + return $this->get_admin_page()->get_message_types_select_input($message_type_options); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -409,21 +409,21 @@ discard block |
||
409 | 409 | */ |
410 | 410 | protected function _get_contexts_for_message_types_dropdown_filter() { |
411 | 411 | $context_options = array(); |
412 | - $active_messages_grouped_by_context = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) ); |
|
412 | + $active_messages_grouped_by_context = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context')); |
|
413 | 413 | |
414 | 414 | //setup array of context options |
415 | - foreach ( $active_messages_grouped_by_context as $active_message ) { |
|
416 | - if ( $active_message instanceof EE_Message ) { |
|
415 | + foreach ($active_messages_grouped_by_context as $active_message) { |
|
416 | + if ($active_message instanceof EE_Message) { |
|
417 | 417 | $message_type = $active_message->message_type_object(); |
418 | - if ( $message_type instanceof EE_message_type ) { |
|
419 | - foreach ( $message_type->get_contexts() as $context => $context_details ) { |
|
420 | - if ( isset( $context_details['label'] ) ) { |
|
421 | - $context_options[ $context ] = $context_details['label']; |
|
418 | + if ($message_type instanceof EE_message_type) { |
|
419 | + foreach ($message_type->get_contexts() as $context => $context_details) { |
|
420 | + if (isset($context_details['label'])) { |
|
421 | + $context_options[$context] = $context_details['label']; |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | } |
425 | 425 | } |
426 | 426 | } |
427 | - return $this->get_admin_page()->get_contexts_for_message_types_select_input( $context_options ); |
|
427 | + return $this->get_admin_page()->get_contexts_for_message_types_select_input($context_options); |
|
428 | 428 | } |
429 | 429 | } //end EE_Message_List_Table class |
430 | 430 | \ No newline at end of file |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @throws EE_Error |
28 | 28 | * @access protected |
29 | 29 | */ |
30 | - public function __construct( $data = array() ) { |
|
30 | + public function __construct($data = array()) { |
|
31 | 31 | |
32 | 32 | //validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
33 | - $ctc_chk = reset( $data ); |
|
34 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
35 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
33 | + $ctc_chk = reset($data); |
|
34 | + if ( ! $ctc_chk instanceof EE_Attendee) |
|
35 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
|
36 | 36 | |
37 | - parent::__construct( $data ); |
|
37 | + parent::__construct($data); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | * @param array $attendees |
44 | 44 | * @return array |
45 | 45 | */ |
46 | - public static function convert_data_for_persistent_storage( $attendees ) { |
|
46 | + public static function convert_data_for_persistent_storage($attendees) { |
|
47 | 47 | $attendee_ids = array_filter( |
48 | 48 | array_map( |
49 | - function( $attendee ) { |
|
50 | - if ( $attendee instanceof EE_Attendee ) { |
|
49 | + function($attendee) { |
|
50 | + if ($attendee instanceof EE_Attendee) { |
|
51 | 51 | return $attendee->ID(); |
52 | 52 | } |
53 | 53 | return false; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @param array $attendee_ids |
67 | 67 | * @return EE_Attendee[] |
68 | 68 | */ |
69 | - public static function convert_data_from_persistent_storage( $attendee_ids ) { |
|
69 | + public static function convert_data_from_persistent_storage($attendee_ids) { |
|
70 | 70 | $attendee_ids = (array) $attendee_ids; |
71 | 71 | $attendees = EEM_Attendee::instance()->get_all( |
72 | 72 | array( |
73 | - array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
73 | + array('ATT_ID' => array('IN', $attendee_ids)) |
|
74 | 74 | ) |
75 | 75 | ); |
76 | 76 | return $attendees; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $this->payment = NULL; |
100 | 100 | $this->billing = array(); |
101 | 101 | $this->reg_objs = array(); |
102 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
102 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
103 | 103 | $this->total_ticket_count = 0; |
104 | 104 | $this->primary_attendee_data = array( |
105 | 105 | 'registration_id' => 0, |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'primary_reg_obj' => NULL |
110 | 110 | ); |
111 | 111 | |
112 | - foreach ( $this->_data as $contact ) { |
|
112 | + foreach ($this->_data as $contact) { |
|
113 | 113 | $id = $contact->ID(); |
114 | 114 | $reg = $contact->get_first_related('Registration'); |
115 | 115 | $this->attendees[$id]['att_obj'] = $contact; |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * This prepares data for message types that send messages for multiple contacts and handles |
@@ -31,8 +33,9 @@ discard block |
||
31 | 33 | |
32 | 34 | //validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
33 | 35 | $ctc_chk = reset( $data ); |
34 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
35 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
36 | + if ( ! $ctc_chk instanceof EE_Attendee ) { |
|
37 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
38 | + } |
|
36 | 39 | |
37 | 40 | parent::__construct( $data ); |
38 | 41 | } |
@@ -277,17 +277,17 @@ |
||
277 | 277 | //if we know who the attendee is, and this is a billing form |
278 | 278 | //that uses attendee info, populate it |
279 | 279 | if ( |
280 | - apply_filters( |
|
281 | - 'FHEE__populate_billing_form_fields_from_attendee', |
|
282 | - ( |
|
283 | - $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
284 | - && $transaction instanceof EE_Transaction |
|
285 | - && $transaction->primary_registration() instanceof EE_Registration |
|
286 | - && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
287 | - ), |
|
288 | - $this->_billing_form, |
|
289 | - $transaction |
|
290 | - ) |
|
280 | + apply_filters( |
|
281 | + 'FHEE__populate_billing_form_fields_from_attendee', |
|
282 | + ( |
|
283 | + $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
284 | + && $transaction instanceof EE_Transaction |
|
285 | + && $transaction->primary_registration() instanceof EE_Registration |
|
286 | + && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
287 | + ), |
|
288 | + $this->_billing_form, |
|
289 | + $transaction |
|
290 | + ) |
|
291 | 291 | ){ |
292 | 292 | $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
293 | 293 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,54 +407,54 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // filter to allow global setting of display_code |
448 | - $display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code ); |
|
448 | + $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code); |
|
449 | 449 | |
450 | 450 | // add currency code ? |
451 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
451 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
452 | 452 | } |
453 | 453 | // filter results |
454 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
454 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
455 | 455 | } |
456 | 456 | // clean up vars |
457 | - unset( $mny ); |
|
457 | + unset($mny); |
|
458 | 458 | // return formatted currency amount |
459 | 459 | return $amount_formatted; |
460 | 460 | } |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
470 | 470 | * @return string The localized label for the status id. |
471 | 471 | */ |
472 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
472 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
473 | 473 | /** @type EEM_Status $EEM_Status */ |
474 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
475 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
476 | - return $status[ $status_id ]; |
|
474 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
475 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
476 | + return $status[$status_id]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -488,21 +488,21 @@ discard block |
||
488 | 488 | * @param string $title |
489 | 489 | * @return string the html output for the button |
490 | 490 | */ |
491 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) { |
|
491 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') { |
|
492 | 492 | $icon_html = ''; |
493 | - if ( ! empty( $icon ) ) { |
|
494 | - $dashicons = preg_split( "(ee-icon |dashicons )", $icon ); |
|
495 | - $dashicons = array_filter( $dashicons ); |
|
496 | - $count = count( $dashicons ); |
|
493 | + if ( ! empty($icon)) { |
|
494 | + $dashicons = preg_split("(ee-icon |dashicons )", $icon); |
|
495 | + $dashicons = array_filter($dashicons); |
|
496 | + $count = count($dashicons); |
|
497 | 497 | $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : ''; |
498 | - foreach ( $dashicons as $dashicon ) { |
|
499 | - $type = strpos( $dashicon, 'ee-icon' ) !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | - $icon_html .= '<span class="' . $type . $dashicon . '"></span>'; |
|
498 | + foreach ($dashicons as $dashicon) { |
|
499 | + $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | + $icon_html .= '<span class="'.$type.$dashicon.'"></span>'; |
|
501 | 501 | } |
502 | 502 | $icon_html .= $count > 1 ? '</span>' : ''; |
503 | 503 | } |
504 | - $label = ! empty( $icon ) ? $icon_html . $label : $label; |
|
505 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>'; |
|
504 | + $label = ! empty($icon) ? $icon_html.$label : $label; |
|
505 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>'; |
|
506 | 506 | return $button; |
507 | 507 | } |
508 | 508 | |
@@ -519,21 +519,21 @@ discard block |
||
519 | 519 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
520 | 520 | * @return string generated link |
521 | 521 | */ |
522 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
522 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
523 | 523 | |
524 | - if ( ! $page ) |
|
525 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
524 | + if ( ! $page) |
|
525 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
526 | 526 | |
527 | - if ( ! $action ) |
|
528 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
527 | + if ( ! $action) |
|
528 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
529 | 529 | |
530 | 530 | $action = empty($action) ? 'default' : $action; |
531 | 531 | |
532 | 532 | |
533 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
534 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | - $help_text = !$help_text ? '' : $help_text; |
|
536 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
533 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
534 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | + $help_text = ! $help_text ? '' : $help_text; |
|
536 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param EE_Help_Tour |
546 | 546 | * @return string html |
547 | 547 | */ |
548 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
548 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
549 | 549 | $id = $tour->get_slug(); |
550 | 550 | $stops = $tour->get_stops(); |
551 | 551 | |
552 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
552 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
553 | 553 | |
554 | - foreach ( $stops as $stop ) { |
|
555 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
556 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
554 | + foreach ($stops as $stop) { |
|
555 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
556 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
557 | 557 | |
558 | 558 | //if container is set to modal then let's make sure we set the options accordingly |
559 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
559 | + if (empty($data_id) && empty($data_class)) { |
|
560 | 560 | $stop['options']['modal'] = true; |
561 | 561 | $stop['options']['expose'] = true; |
562 | 562 | } |
563 | 563 | |
564 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
565 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
564 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
565 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
566 | 566 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
567 | 567 | |
568 | 568 | //options |
569 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
569 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
570 | 570 | $options = ' data-options="'; |
571 | - foreach ( $stop['options'] as $option => $value ) { |
|
572 | - $options .= $option . ':' . $value . ';'; |
|
571 | + foreach ($stop['options'] as $option => $value) { |
|
572 | + $options .= $option.':'.$value.';'; |
|
573 | 573 | } |
574 | 574 | $options .= '"'; |
575 | 575 | } else { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | //let's put all together |
580 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
580 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | $content .= '</ol>'; |
@@ -598,31 +598,31 @@ discard block |
||
598 | 598 | * @throws EE_Error |
599 | 599 | * @return string html structure for status. |
600 | 600 | */ |
601 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
602 | - if ( !is_array( $status_array ) ) |
|
603 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
601 | + public static function status_legend($status_array, $active_status = '') { |
|
602 | + if ( ! is_array($status_array)) |
|
603 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
604 | 604 | |
605 | 605 | $setup_array = array(); |
606 | - foreach ( $status_array as $item => $status ) { |
|
606 | + foreach ($status_array as $item => $status) { |
|
607 | 607 | $setup_array[$item] = array( |
608 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
609 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
608 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
609 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
610 | 610 | 'status' => $status |
611 | 611 | ); |
612 | 612 | } |
613 | 613 | |
614 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
615 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
616 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
617 | - foreach ( $setup_array as $item => $details ) { |
|
614 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
615 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
616 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
617 | + foreach ($setup_array as $item => $details) { |
|
618 | 618 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
619 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
620 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
621 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
622 | - $content .= '</dt>' . "\n"; |
|
619 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
620 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
621 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
622 | + $content .= '</dt>'."\n"; |
|
623 | 623 | } |
624 | - $content .= '</dl>' . "\n"; |
|
625 | - $content .= '</div>' . "\n"; |
|
624 | + $content .= '</dl>'."\n"; |
|
625 | + $content .= '</div>'."\n"; |
|
626 | 626 | return $content; |
627 | 627 | } |
628 | 628 | |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * @return string |
636 | 636 | */ |
637 | 637 | public static function layout_array_as_table($data) { |
638 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
639 | - $data = (array)$data; |
|
638 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
639 | + $data = (array) $data; |
|
640 | 640 | } |
641 | 641 | ob_start(); |
642 | 642 | if (is_array($data)) { |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <td> |
652 | - <?php echo $data_key;?> |
|
652 | + <?php echo $data_key; ?> |
|
653 | 653 | </td> |
654 | 654 | <td> |
655 | - <?php echo self::layout_array_as_table($data_values);?> |
|
655 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
656 | 656 | </td> |
657 | 657 | </tr> |
658 | 658 | <?php |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | <ul> |
667 | 667 | <?php |
668 | 668 | foreach ($data as $datum) { |
669 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
669 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
670 | 670 | }?> |
671 | 671 | </ul> |
672 | 672 | <?php |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
700 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
699 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
700 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * ) |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
724 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
725 | 725 | $page_links = array(); |
726 | 726 | $disable_first = $disable_last = ''; |
727 | 727 | $total_items = (int) $total_items; |
728 | 728 | $per_page = (int) $per_page; |
729 | 729 | $current = (int) $current; |
730 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
730 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
731 | 731 | |
732 | 732 | //filter items_label |
733 | 733 | $items_label = apply_filters( |
@@ -735,68 +735,68 @@ discard block |
||
735 | 735 | $items_label |
736 | 736 | ); |
737 | 737 | |
738 | - if ( empty( $items_label ) |
|
739 | - || ! is_array( $items_label ) |
|
740 | - || ! isset( $items_label['single'] ) |
|
741 | - || ! isset( $items_label['plural'] ) ) { |
|
738 | + if (empty($items_label) |
|
739 | + || ! is_array($items_label) |
|
740 | + || ! isset($items_label['single']) |
|
741 | + || ! isset($items_label['plural'])) { |
|
742 | 742 | $items_label = array( |
743 | - 'single' => __( '1 item', 'event_espresso' ), |
|
744 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
743 | + 'single' => __('1 item', 'event_espresso'), |
|
744 | + 'plural' => __('%s items', 'event_espresso') |
|
745 | 745 | ); |
746 | 746 | } else { |
747 | 747 | $items_label = array( |
748 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
749 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
748 | + 'single' => '1 '.esc_html($items_label['single']), |
|
749 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
750 | 750 | ); |
751 | 751 | } |
752 | 752 | |
753 | - $total_pages = ceil( $total_items / $per_page ); |
|
753 | + $total_pages = ceil($total_items / $per_page); |
|
754 | 754 | |
755 | - if ( $total_pages <= 1 ) |
|
755 | + if ($total_pages <= 1) |
|
756 | 756 | return ''; |
757 | 757 | |
758 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
758 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
759 | 759 | |
760 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
760 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
761 | 761 | |
762 | - if ( $current === 1 ) { |
|
762 | + if ($current === 1) { |
|
763 | 763 | $disable_first = ' disabled'; |
764 | 764 | } |
765 | - if ( $current == $total_pages ) { |
|
765 | + if ($current == $total_pages) { |
|
766 | 766 | $disable_last = ' disabled'; |
767 | 767 | } |
768 | 768 | |
769 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | - 'first-page' . $disable_first, |
|
771 | - esc_attr__( 'Go to the first page' ), |
|
772 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
769 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | + 'first-page'.$disable_first, |
|
771 | + esc_attr__('Go to the first page'), |
|
772 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
773 | 773 | '«' |
774 | 774 | ); |
775 | 775 | |
776 | 776 | $page_links[] = sprintf( |
777 | 777 | '<a class="%s" title="%s" href="%s">%s</a>', |
778 | - 'prev-page' . $disable_first, |
|
779 | - esc_attr__( 'Go to the previous page' ), |
|
780 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
778 | + 'prev-page'.$disable_first, |
|
779 | + esc_attr__('Go to the previous page'), |
|
780 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
781 | 781 | '‹' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( ! $show_num_field ) { |
|
784 | + if ( ! $show_num_field) { |
|
785 | 785 | $html_current_page = $current; |
786 | 786 | } else { |
787 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | - esc_attr__( 'Current page' ), |
|
787 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | + esc_attr__('Current page'), |
|
789 | 789 | $current, |
790 | - strlen( $total_pages ) |
|
790 | + strlen($total_pages) |
|
791 | 791 | ); |
792 | 792 | } |
793 | 793 | |
794 | 794 | $html_total_pages = sprintf( |
795 | 795 | '<span class="total-pages">%s</span>', |
796 | - number_format_i18n( $total_pages ) |
|
796 | + number_format_i18n($total_pages) |
|
797 | 797 | ); |
798 | 798 | $page_links[] = sprintf( |
799 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
799 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
800 | 800 | $html_current_page, |
801 | 801 | $html_total_pages, |
802 | 802 | '<span class="paging-input">', |
@@ -805,29 +805,29 @@ discard block |
||
805 | 805 | |
806 | 806 | $page_links[] = sprintf( |
807 | 807 | '<a class="%s" title="%s" href="%s">%s</a>', |
808 | - 'next-page' . $disable_last, |
|
809 | - esc_attr__( 'Go to the next page' ), |
|
810 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
808 | + 'next-page'.$disable_last, |
|
809 | + esc_attr__('Go to the next page'), |
|
810 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
811 | 811 | '›' |
812 | 812 | ); |
813 | 813 | |
814 | 814 | $page_links[] = sprintf( |
815 | 815 | '<a class="%s" title="%s" href="%s">%s</a>', |
816 | - 'last-page' . $disable_last, |
|
817 | - esc_attr__( 'Go to the last page' ), |
|
818 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
816 | + 'last-page'.$disable_last, |
|
817 | + esc_attr__('Go to the last page'), |
|
818 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
819 | 819 | '»' |
820 | 820 | ); |
821 | 821 | |
822 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
822 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
823 | 823 | // set page class |
824 | - if ( $total_pages ) { |
|
824 | + if ($total_pages) { |
|
825 | 825 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
826 | 826 | } else { |
827 | 827 | $page_class = ' no-pages'; |
828 | 828 | } |
829 | 829 | |
830 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
830 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * @param string $wrap_id |
838 | 838 | * @return string |
839 | 839 | */ |
840 | - public static function powered_by_event_espresso( $wrap_class = '', $wrap_id = '' ) { |
|
841 | - $admin = is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
840 | + public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '') { |
|
841 | + $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX); |
|
842 | 842 | if ( |
843 | 843 | ! $admin && |
844 | 844 | ! apply_filters( |
@@ -849,17 +849,17 @@ discard block |
||
849 | 849 | return ''; |
850 | 850 | } |
851 | 851 | $tag = $admin ? 'span' : 'div'; |
852 | - $attributes = ! empty( $wrap_id ) ? " id=\"{$wrap_id}\"" : ''; |
|
852 | + $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : ''; |
|
853 | 853 | $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class; |
854 | - $attributes .= ! empty( $wrap_class ) |
|
854 | + $attributes .= ! empty($wrap_class) |
|
855 | 855 | ? " class=\"{$wrap_class} powered-by-event-espresso-credit\"" |
856 | 856 | : ' class="powered-by-event-espresso-credit"'; |
857 | - $powered_by = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso' ); |
|
857 | + $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso'); |
|
858 | 858 | $url = add_query_arg( |
859 | - array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id() ), |
|
859 | + array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id()), |
|
860 | 860 | 'https://eventespresso.com/' |
861 | 861 | ); |
862 | - $url = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso__url', $url ); |
|
862 | + $url = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url); |
|
863 | 863 | return (string) apply_filters( |
864 | 864 | 'FHEE__EEH_Template__powered_by_event_espresso__html', |
865 | 865 | sprintf( |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
892 | 892 | |
893 | 893 | |
894 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
894 | +if ( ! function_exists('espresso_pagination')) { |
|
895 | 895 | /** |
896 | 896 | * espresso_pagination |
897 | 897 | * |
@@ -903,21 +903,21 @@ discard block |
||
903 | 903 | $big = 999999999; // need an unlikely integer |
904 | 904 | $pagination = paginate_links( |
905 | 905 | array( |
906 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
906 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
907 | 907 | 'format' => '?paged=%#%', |
908 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
908 | + 'current' => max(1, get_query_var('paged')), |
|
909 | 909 | 'total' => $wp_query->max_num_pages, |
910 | 910 | 'show_all' => true, |
911 | 911 | 'end_size' => 10, |
912 | 912 | 'mid_size' => 6, |
913 | 913 | 'prev_next' => true, |
914 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
915 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
914 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
915 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
916 | 916 | 'type' => 'plain', |
917 | 917 | 'add_args' => false, |
918 | 918 | 'add_fragment' => '' |
919 | 919 | ) |
920 | 920 | ); |
921 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
921 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | */ |
44 | 44 | |
45 | -if ( function_exists( 'espresso_version' ) ) { |
|
45 | +if (function_exists('espresso_version')) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | function espresso_duplicate_plugin_error() { |
52 | 52 | ?> |
53 | 53 | <div class="error"> |
54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
55 | 55 | </div> |
56 | 56 | <?php |
57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
58 | 58 | } |
59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
@@ -67,102 +67,102 @@ discard block |
||
67 | 67 | * @return string |
68 | 68 | */ |
69 | 69 | function espresso_version() { |
70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.17.rc.004' ); |
|
70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.17.rc.004'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // define versions |
74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
156 | - define( 'EE_DEBUG', false ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | + define('EE_DEBUG', false); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * espresso_plugin_activation |
160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
161 | 161 | */ |
162 | 162 | function espresso_plugin_activation() { |
163 | - update_option( 'ee_espresso_activation', true ); |
|
163 | + update_option('ee_espresso_activation', true); |
|
164 | 164 | } |
165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // } |
177 | 177 | // |
178 | 178 | } |
179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function espresso_load_error_handling() { |
188 | 188 | // load debugging tools |
189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
191 | 191 | EEH_Debug_Tools::instance(); |
192 | 192 | } |
193 | 193 | // load error handling |
194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
196 | 196 | } else { |
197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | * @param string $full_path_to_file |
209 | 209 | * @throws EE_Error |
210 | 210 | */ |
211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
212 | 212 | static $error_handling_loaded = false; |
213 | - if ( ! $error_handling_loaded ) { |
|
213 | + if ( ! $error_handling_loaded) { |
|
214 | 214 | espresso_load_error_handling(); |
215 | 215 | $error_handling_loaded = true; |
216 | 216 | } |
217 | - if ( is_readable( $full_path_to_file ) ) { |
|
218 | - require_once( $full_path_to_file ); |
|
217 | + if (is_readable($full_path_to_file)) { |
|
218 | + require_once($full_path_to_file); |
|
219 | 219 | } else { |
220 | - throw new EE_Error ( sprintf( |
|
221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
220 | + throw new EE_Error(sprintf( |
|
221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
222 | 222 | $classname |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
230 | 230 | new EE_Bootstrap(); |
231 | 231 | |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
239 | 239 | /** |
240 | 240 | * deactivate_plugin |
241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
248 | + if ( ! function_exists('deactivate_plugins')) { |
|
249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
250 | 250 | } |
251 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
252 | - deactivate_plugins( $plugin_basename ); |
|
251 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
252 | + deactivate_plugins($plugin_basename); |
|
253 | 253 | } |
254 | 254 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * finds and sets the EE_Event object for use throughout class |
226 | 226 | * |
227 | 227 | * @access public |
228 | - * @param mixed $event |
|
228 | + * @param EE_Event|null $event |
|
229 | 229 | * @return bool |
230 | 230 | */ |
231 | 231 | protected static function set_event( $event = null ) { |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * |
615 | 615 | * @access public |
616 | 616 | * @access public |
617 | - * @return string |
|
617 | + * @return false|null |
|
618 | 618 | */ |
619 | 619 | public static function cancel_ticket_selections() { |
620 | 620 | // check nonce |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | * process_ticket_selections |
681 | 681 | * |
682 | 682 | * @access public |
683 | - * @return array|boolean |
|
683 | + * @return boolean|null |
|
684 | 684 | */ |
685 | 685 | public function process_ticket_selections() { |
686 | 686 | do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | * |
861 | 861 | * @access private |
862 | 862 | * @param int $id |
863 | - * @return array|FALSE |
|
863 | + * @return string |
|
864 | 864 | */ |
865 | 865 | private static function _validate_post_data( $id = 0 ) { |
866 | 866 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class EED_Ticket_Selector extends EED_Module { |
10 | 10 | |
11 | - const debug = false; // true false |
|
11 | + const debug = false; // true false |
|
12 | 12 | |
13 | - /** |
|
13 | + /** |
|
14 | 14 | * event that ticket selector is being generated for |
15 | 15 | * |
16 | 16 | * @access protected |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | protected static $_event; |
20 | 20 | |
21 | 21 | /** |
22 | - * array of datetimes and the spaces available for them |
|
23 | - * |
|
24 | - * @access private |
|
25 | - * @var array |
|
26 | - */ |
|
22 | + * array of datetimes and the spaces available for them |
|
23 | + * |
|
24 | + * @access private |
|
25 | + * @var array |
|
26 | + */ |
|
27 | 27 | private static $_available_spaces = array(); |
28 | 28 | |
29 | 29 | /** |
30 | - * max attendees that can register for event at one time |
|
31 | - * |
|
32 | - * @access private |
|
33 | - * @var int |
|
34 | - */ |
|
30 | + * max attendees that can register for event at one time |
|
31 | + * |
|
32 | + * @access private |
|
33 | + * @var int |
|
34 | + */ |
|
35 | 35 | private static $_max_atndz = EE_INF; |
36 | 36 | |
37 | 37 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | return $permalink_string; |
201 | 201 | } |
202 | 202 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
203 | - . __( 'Embed', 'event_espresso' ) |
|
204 | - . '</a> '; |
|
203 | + . __( 'Embed', 'event_espresso' ) |
|
204 | + . '</a> '; |
|
205 | 205 | $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
206 | 206 | $iframe_string = esc_html( |
207 | 207 | '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @throws \EE_Error |
423 | 423 | */ |
424 | 424 | public static function display_ticket_selector_submit() { |
425 | - $html = ''; |
|
425 | + $html = ''; |
|
426 | 426 | if ( ! is_admin() ) { |
427 | 427 | // standard TS displayed with submit button, ie: "Register Now" |
428 | 428 | if ( |
@@ -483,14 +483,14 @@ discard block |
||
483 | 483 | $html .= \EED_Ticket_Selector::display_register_now_button(); |
484 | 484 | } |
485 | 485 | // no submit or view details button, and no additional content |
486 | - $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
|
486 | + $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
|
487 | 487 | } |
488 | - if ( ! is_archive()) { |
|
489 | - $html .= \EEH_Template::powered_by_event_espresso(); |
|
490 | - } |
|
491 | - } |
|
488 | + if ( ! is_archive()) { |
|
489 | + $html .= \EEH_Template::powered_by_event_espresso(); |
|
490 | + } |
|
491 | + } |
|
492 | 492 | return $html; |
493 | - } |
|
493 | + } |
|
494 | 494 | |
495 | 495 | |
496 | 496 | |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | * @return array|boolean |
684 | 684 | */ |
685 | 685 | public function process_ticket_selections() { |
686 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
686 | + do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
687 | 687 | // do we have an event id? |
688 | 688 | if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
689 | 689 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
@@ -793,10 +793,10 @@ discard block |
||
793 | 793 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd ) ) { |
794 | 794 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added ) ) { |
795 | 795 | do_action( |
796 | - 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', |
|
797 | - EE_Registry::instance()->CART, |
|
798 | - $this |
|
799 | - ); |
|
796 | + 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', |
|
797 | + EE_Registry::instance()->CART, |
|
798 | + $this |
|
799 | + ); |
|
800 | 800 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
801 | 801 | EE_Registry::instance()->CART->save_cart( FALSE ); |
802 | 802 | EE_Registry::instance()->SSN->update(); |
@@ -809,20 +809,20 @@ discard block |
||
809 | 809 | |
810 | 810 | EE_Error::get_notices( false, true ); |
811 | 811 | wp_safe_redirect( |
812 | - apply_filters( |
|
813 | - 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', |
|
814 | - EE_Registry::instance()->CFG->core->reg_page_url() |
|
815 | - ) |
|
816 | - ); |
|
812 | + apply_filters( |
|
813 | + 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', |
|
814 | + EE_Registry::instance()->CFG->core->reg_page_url() |
|
815 | + ) |
|
816 | + ); |
|
817 | 817 | exit(); |
818 | 818 | |
819 | 819 | } else { |
820 | 820 | if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention') ) { |
821 | 821 | // nothing added to cart |
822 | 822 | EE_Error::add_attention( |
823 | - __( 'No tickets were added for the event.', 'event_espresso' ), |
|
824 | - __FILE__, __FUNCTION__, __LINE__ |
|
825 | - ); |
|
823 | + __( 'No tickets were added for the event.', 'event_espresso' ), |
|
824 | + __FILE__, __FUNCTION__, __LINE__ |
|
825 | + ); |
|
826 | 826 | } |
827 | 827 | } |
828 | 828 | } else { |
@@ -986,13 +986,13 @@ discard block |
||
986 | 986 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
987 | 987 | // get the number of spaces left for this datetime ticket |
988 | 988 | $available_spaces = self::_ticket_datetime_availability( $ticket ); |
989 | - if (self::debug) { |
|
990 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()"; |
|
991 | - echo "<br /> . ticket->ID(): " . $ticket->ID(); |
|
992 | - echo "<br /> . requested qty: " . $qty; |
|
993 | - echo "<br /> . available_spaces: " . $available_spaces; |
|
994 | - } |
|
995 | - // compare available spaces against the number of tickets being purchased |
|
989 | + if (self::debug) { |
|
990 | + echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()"; |
|
991 | + echo "<br /> . ticket->ID(): " . $ticket->ID(); |
|
992 | + echo "<br /> . requested qty: " . $qty; |
|
993 | + echo "<br /> . available_spaces: " . $available_spaces; |
|
994 | + } |
|
995 | + // compare available spaces against the number of tickets being purchased |
|
996 | 996 | if ( $available_spaces >= $qty ) { |
997 | 997 | // allow addons to prevent a ticket from being added to cart |
998 | 998 | if ( |
@@ -1183,11 +1183,11 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | |
1185 | 1185 | /** |
1186 | - * load js |
|
1187 | - * |
|
1188 | - * @access public |
|
1189 | - * @return void |
|
1190 | - */ |
|
1186 | + * load js |
|
1187 | + * |
|
1188 | + * @access public |
|
1189 | + * @return void |
|
1190 | + */ |
|
1191 | 1191 | public static function load_tckt_slctr_assets() { |
1192 | 1192 | // add some style |
1193 | 1193 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -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 | * Ticket Selector class |
4 | 4 | * |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class EED_Ticket_Selector extends EED_Module { |
10 | 10 | |
11 | - const debug = false; // true false |
|
11 | + const debug = false; // true false |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * event that ticket selector is being generated for |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | * @return EED_Ticket_Selector |
50 | 50 | */ |
51 | 51 | public static function instance() { |
52 | - return parent::get_instance( __CLASS__ ); |
|
52 | + return parent::get_instance(__CLASS__); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | - protected function set_config(){ |
|
58 | - $this->set_config_section( 'template_settings' ); |
|
59 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
60 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
57 | + protected function set_config() { |
|
58 | + $this->set_config_section('template_settings'); |
|
59 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
60 | + $this->set_config_name('EED_Ticket_Selector'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function set_hooks() { |
74 | 74 | // routing |
75 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
76 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
77 | - EE_Config::register_route( 'cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections' ); |
|
78 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
79 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
80 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
75 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
76 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
77 | + EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections'); |
|
78 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
79 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
80 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * @return void |
90 | 90 | */ |
91 | 91 | public static function set_hooks_admin() { |
92 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
92 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
93 | 93 | //add button for iframe code to event editor. |
94 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
95 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
94 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
95 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | * @return void |
105 | 105 | */ |
106 | 106 | public static function set_definitions() { |
107 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
108 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
107 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
108 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
109 | 109 | |
110 | 110 | //if config is not set, initialize |
111 | 111 | //If config is not set, set it. |
112 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
112 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
113 | 113 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
114 | 114 | } |
115 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
115 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param WP $WP |
124 | 124 | * @return void |
125 | 125 | */ |
126 | - public function run( $WP ) {} |
|
126 | + public function run($WP) {} |
|
127 | 127 | |
128 | 128 | |
129 | 129 | |
@@ -137,23 +137,23 @@ discard block |
||
137 | 137 | public function ticket_selector_iframe() { |
138 | 138 | self::$_in_iframe = true; |
139 | 139 | /** @type EEM_Event $EEM_Event */ |
140 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
140 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
141 | 141 | $event = $EEM_Event->get_one_by_ID( |
142 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
142 | + EE_Registry::instance()->REQ->get('event', 0) |
|
143 | 143 | ); |
144 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
145 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
144 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
145 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
146 | 146 | $template_args['css'] = apply_filters( |
147 | 147 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
148 | 148 | array( |
149 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
150 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
151 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
152 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
149 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
150 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
151 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
152 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
153 | 153 | ) |
154 | 154 | ); |
155 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
156 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = esc_html__( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
155 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
156 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = esc_html__('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
157 | 157 | $template_args['eei18n'] = apply_filters( |
158 | 158 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
159 | 159 | EE_Registry::localize_i18n_js_strings() |
@@ -161,18 +161,18 @@ discard block |
||
161 | 161 | $template_args['js'] = apply_filters( |
162 | 162 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
163 | 163 | array( |
164 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
165 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
166 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
164 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
165 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
166 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
167 | 167 | ) |
168 | 168 | ); |
169 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
170 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
169 | + $template_args['notices'] = EEH_Template::display_template( |
|
170 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
171 | 171 | array(), |
172 | 172 | true |
173 | 173 | ); |
174 | 174 | EEH_Template::display_template( |
175 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
175 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
176 | 176 | $template_args |
177 | 177 | ); |
178 | 178 | exit; |
@@ -191,25 +191,25 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @return string The new html string for the permalink area. |
193 | 193 | */ |
194 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
194 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
195 | 195 | //make sure this is ONLY when editing and the event id has been set. |
196 | - if ( ! empty( $id ) ) { |
|
197 | - $post = get_post( $id ); |
|
196 | + if ( ! empty($id)) { |
|
197 | + $post = get_post($id); |
|
198 | 198 | //if NOT event then let's get out. |
199 | - if ( $post->post_type !== 'espresso_events' ) { |
|
199 | + if ($post->post_type !== 'espresso_events') { |
|
200 | 200 | return $permalink_string; |
201 | 201 | } |
202 | 202 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
203 | - . __( 'Embed', 'event_espresso' ) |
|
203 | + . __('Embed', 'event_espresso') |
|
204 | 204 | . '</a> '; |
205 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
205 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
206 | 206 | $iframe_string = esc_html( |
207 | - '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
|
207 | + '<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>' |
|
208 | 208 | ); |
209 | 209 | $permalink_string .= ' |
210 | 210 | <div id="js-ts-iframe" style="display:none"> |
211 | 211 | <div style="width:100%; height: 500px;"> |
212 | - ' . $iframe_string . ' |
|
212 | + ' . $iframe_string.' |
|
213 | 213 | </div> |
214 | 214 | </div>'; |
215 | 215 | } |
@@ -228,22 +228,22 @@ discard block |
||
228 | 228 | * @param mixed $event |
229 | 229 | * @return bool |
230 | 230 | */ |
231 | - protected static function set_event( $event = null ) { |
|
232 | - if( $event === null ) { |
|
231 | + protected static function set_event($event = null) { |
|
232 | + if ($event === null) { |
|
233 | 233 | global $post; |
234 | 234 | $event = $post; |
235 | 235 | } |
236 | - if ( $event instanceof EE_Event ) { |
|
236 | + if ($event instanceof EE_Event) { |
|
237 | 237 | self::$_event = $event; |
238 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
238 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
239 | 239 | self::$_event = $event->EE_Event; |
240 | - } else if ( $event instanceof WP_Post && $event->post_type === 'espresso_events' ) { |
|
241 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
240 | + } else if ($event instanceof WP_Post && $event->post_type === 'espresso_events') { |
|
241 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
242 | 242 | self::$_event = $event->EE_Event; |
243 | 243 | } else { |
244 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
245 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
246 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
244 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
245 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
246 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
247 | 247 | return false; |
248 | 248 | } |
249 | 249 | return true; |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | * @return string |
261 | 261 | * @throws \EE_Error |
262 | 262 | */ |
263 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
263 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
264 | 264 | // reset filter for displaying submit button |
265 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
265 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
266 | 266 | // poke and prod incoming event till it tells us what it is |
267 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
267 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | && ( |
276 | 276 | ! self::$_event->display_ticket_selector() |
277 | 277 | || $view_details |
278 | - || post_password_required( $event_post ) |
|
278 | + || post_password_required($event_post) |
|
279 | 279 | || ( |
280 | 280 | $_event_active_status !== EE_Datetime::active |
281 | 281 | && $_event_active_status !== EE_Datetime::upcoming |
@@ -293,34 +293,34 @@ discard block |
||
293 | 293 | $template_args = array(); |
294 | 294 | $template_args['event_status'] = $_event_active_status; |
295 | 295 | |
296 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
297 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
296 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
297 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
298 | 298 | |
299 | 299 | $template_args['EVT_ID'] = self::$_event->ID(); |
300 | 300 | $template_args['event'] = self::$_event; |
301 | 301 | |
302 | 302 | // is the event expired ? |
303 | 303 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
304 | - if ( $template_args['event_is_expired'] ) { |
|
305 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
304 | + if ($template_args['event_is_expired']) { |
|
305 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | $ticket_query_args = array( |
309 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
310 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
309 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
310 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
311 | 311 | ); |
312 | 312 | |
313 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
313 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
314 | 314 | //use the correct applicable time query depending on what version of core is being run. |
315 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
316 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
315 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
316 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | // get all tickets for this event ordered by the datetime |
320 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
320 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
321 | 321 | |
322 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
323 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
322 | + if (count($template_args['tickets']) < 1) { |
|
323 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
@@ -329,41 +329,41 @@ discard block |
||
329 | 329 | self::$_event->additional_limit() |
330 | 330 | ); |
331 | 331 | $template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz; |
332 | - if ( $template_args['max_atndz'] < 1 ) { |
|
333 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
334 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
335 | - $sales_closed_msg .= sprintf( |
|
336 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
332 | + if ($template_args['max_atndz'] < 1) { |
|
333 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
334 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
335 | + $sales_closed_msg .= sprintf( |
|
336 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
337 | 337 | '<div class="ee-attention" style="text-align: left;"><b>', |
338 | 338 | '</b><br />', |
339 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
339 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
340 | 340 | '</a></span></div>' |
341 | 341 | ); |
342 | 342 | } |
343 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
343 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
344 | 344 | } |
345 | 345 | |
346 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
347 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
346 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
347 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
348 | 348 | |
349 | 349 | // redirecting to another site for registration ?? |
350 | 350 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
351 | 351 | // if not redirecting to another site for registration |
352 | - if ( ! $external_url ) { |
|
352 | + if ( ! $external_url) { |
|
353 | 353 | // then display the ticket selector |
354 | - $ticket_selector = EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
354 | + $ticket_selector = EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
355 | 355 | } else { |
356 | 356 | // if not we still need to trigger the display of the submit button |
357 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
357 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
358 | 358 | //display notice to admin that registration is external |
359 | - $ticket_selector = ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
359 | + $ticket_selector = ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
360 | 360 | } |
361 | 361 | // now set up the form (but not for the admin) |
362 | 362 | $ticket_selector = ! is_admin() |
363 | 363 | ? EED_Ticket_Selector::ticket_selector_form_open( |
364 | 364 | self::$_event->ID(), |
365 | 365 | $external_url |
366 | - ) . $ticket_selector |
|
366 | + ).$ticket_selector |
|
367 | 367 | : $ticket_selector; |
368 | 368 | // submit button and form close tag |
369 | 369 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -383,31 +383,31 @@ discard block |
||
383 | 383 | * @param string $external_url |
384 | 384 | * @return string |
385 | 385 | */ |
386 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
386 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
387 | 387 | // if redirecting, we don't need any anything else |
388 | - if ( $external_url ) { |
|
389 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
390 | - $query_args = (array) EEH_URL::get_query_string( $external_url ); |
|
391 | - foreach ( $query_args as $query_arg => $value ) { |
|
388 | + if ($external_url) { |
|
389 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
390 | + $query_args = (array) EEH_URL::get_query_string($external_url); |
|
391 | + foreach ($query_args as $query_arg => $value) { |
|
392 | 392 | $html .= ' |
393 | - <input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
393 | + <input type="hidden" name="' . $query_arg.'" value="'.$value.'">'; |
|
394 | 394 | } |
395 | 395 | return $html; |
396 | 396 | } |
397 | 397 | // if there is no submit button, then don't start building a form |
398 | 398 | // because the "View Details" button will build its own form |
399 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) { |
|
399 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
|
400 | 400 | return ''; |
401 | 401 | } |
402 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
403 | - if ( ! $checkout_url ) { |
|
404 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
402 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
403 | + if ( ! $checkout_url) { |
|
404 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
405 | 405 | } |
406 | 406 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
407 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
408 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce_' . $ID, TRUE, FALSE ); |
|
407 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
408 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce_'.$ID, TRUE, FALSE); |
|
409 | 409 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
410 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
410 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
411 | 411 | return $html; |
412 | 412 | } |
413 | 413 | |
@@ -423,14 +423,14 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public static function display_ticket_selector_submit() { |
425 | 425 | $html = ''; |
426 | - if ( ! is_admin() ) { |
|
426 | + if ( ! is_admin()) { |
|
427 | 427 | // standard TS displayed with submit button, ie: "Register Now" |
428 | 428 | if ( |
429 | - apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) |
|
429 | + apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false) |
|
430 | 430 | ) { |
431 | 431 | $html .= \EED_Ticket_Selector::display_register_now_button(); |
432 | 432 | $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
433 | - $html .= '<br/>' . \EED_Ticket_Selector::ticket_selector_form_close(); |
|
433 | + $html .= '<br/>'.\EED_Ticket_Selector::ticket_selector_form_close(); |
|
434 | 434 | } else if ( |
435 | 435 | // a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1) |
436 | 436 | EED_Ticket_Selector::$_max_atndz === 1 |
@@ -452,34 +452,34 @@ discard block |
||
452 | 452 | ), |
453 | 453 | EED_Ticket_Selector::$_event |
454 | 454 | ); |
455 | - if ( apply_filters( |
|
455 | + if (apply_filters( |
|
456 | 456 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button', |
457 | 457 | false, |
458 | 458 | EED_Ticket_Selector::$_event |
459 | - ) ) { |
|
459 | + )) { |
|
460 | 460 | $html .= \EED_Ticket_Selector::display_register_now_button(); |
461 | 461 | } |
462 | 462 | // sold out DWMTS event, no TS, no submit or view details button, but has additional content |
463 | 463 | $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
464 | 464 | } else if ( |
465 | 465 | EED_Ticket_Selector::$_max_atndz === 1 |
466 | - && apply_filters( 'FHEE__EE_Ticket_Selector__hide_ticket_selector', false ) |
|
466 | + && apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false) |
|
467 | 467 | && ! is_single() |
468 | 468 | ) { |
469 | 469 | // this is a "Dude Where's my Ticket Selector?" (DWMTS) type event, |
470 | 470 | // but no tickets are available, so display event's "View Details" button. |
471 | 471 | // it is being viewed via somewhere other than a single post |
472 | - $html .= EED_Ticket_Selector::display_view_details_btn( true ); |
|
473 | - } else if ( is_archive() ) { |
|
472 | + $html .= EED_Ticket_Selector::display_view_details_btn(true); |
|
473 | + } else if (is_archive()) { |
|
474 | 474 | // event list, no tickets available so display event's "View Details" button |
475 | 475 | $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
476 | 476 | $html .= EED_Ticket_Selector::display_view_details_btn(); |
477 | 477 | } else { |
478 | - if ( apply_filters( |
|
478 | + if (apply_filters( |
|
479 | 479 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button', |
480 | 480 | false, |
481 | 481 | EED_Ticket_Selector::$_event |
482 | - ) ) { |
|
482 | + )) { |
|
483 | 483 | $html .= \EED_Ticket_Selector::display_register_now_button(); |
484 | 484 | } |
485 | 485 | // no submit or view details button, and no additional content |
@@ -545,14 +545,14 @@ discard block |
||
545 | 545 | public static function display_register_now_button( ) { |
546 | 546 | $btn_text = apply_filters( |
547 | 547 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
548 | - __( 'Register Now', 'event_espresso' ), |
|
548 | + __('Register Now', 'event_espresso'), |
|
549 | 549 | EED_Ticket_Selector::$_event |
550 | 550 | ); |
551 | 551 | $external_url = EED_Ticket_Selector::$_event->external_url(); |
552 | - $html = '<input id="ticket-selector-submit-' . EED_Ticket_Selector::$_event->ID() . '-btn"'; |
|
552 | + $html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"'; |
|
553 | 553 | $html .= ' class="ticket-selector-submit-btn '; |
554 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
555 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
554 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
555 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
556 | 556 | $html .= apply_filters( |
557 | 557 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
558 | 558 | '', |
@@ -574,10 +574,10 @@ discard block |
||
574 | 574 | * @return string |
575 | 575 | * @throws \EE_Error |
576 | 576 | */ |
577 | - public static function display_view_details_btn( $DWMTS = false) { |
|
578 | - if ( ! self::$_event->get_permalink() ) { |
|
577 | + public static function display_view_details_btn($DWMTS = false) { |
|
578 | + if ( ! self::$_event->get_permalink()) { |
|
579 | 579 | EE_Error::add_error( |
580 | - __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), |
|
580 | + __('The URL for the Event Details page could not be retrieved.', 'event_espresso'), |
|
581 | 581 | __FILE__, __FUNCTION__, __LINE__ |
582 | 582 | ); |
583 | 583 | } |
@@ -590,12 +590,12 @@ discard block |
||
590 | 590 | $view_details_btn .= '">'; |
591 | 591 | $btn_text = apply_filters( |
592 | 592 | 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', |
593 | - __( 'View Details', 'event_espresso' ), |
|
593 | + __('View Details', 'event_espresso'), |
|
594 | 594 | self::$_event |
595 | 595 | ); |
596 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
597 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
598 | - if ( $DWMTS ) { |
|
596 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
597 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
598 | + if ($DWMTS) { |
|
599 | 599 | $view_details_btn .= \EED_Ticket_Selector::ticket_selector_form_close(); |
600 | 600 | $view_details_btn .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
601 | 601 | $view_details_btn .= '<br/>'; |
@@ -618,19 +618,19 @@ discard block |
||
618 | 618 | */ |
619 | 619 | public static function cancel_ticket_selections() { |
620 | 620 | // check nonce |
621 | - if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'cancel_ticket_selections_nonce' ) ) { |
|
621 | + if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('cancel_ticket_selections_nonce')) { |
|
622 | 622 | return false; |
623 | 623 | } |
624 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__ ); |
|
625 | - if ( EE_Registry::instance()->REQ->is_set( 'event_id' ) ) { |
|
624 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
625 | + if (EE_Registry::instance()->REQ->is_set('event_id')) { |
|
626 | 626 | wp_safe_redirect( |
627 | 627 | EEH_Event_View::event_link_url( |
628 | - EE_Registry::instance()->REQ->get( 'event_id' ) |
|
628 | + EE_Registry::instance()->REQ->get('event_id') |
|
629 | 629 | ) |
630 | 630 | ); |
631 | 631 | } else { |
632 | 632 | wp_safe_redirect( |
633 | - site_url( '/' . EE_Registry::instance()->CFG->core->event_cpt_slug . '/' ) |
|
633 | + site_url('/'.EE_Registry::instance()->CFG->core->event_cpt_slug.'/') |
|
634 | 634 | ); |
635 | 635 | } |
636 | 636 | die(); |
@@ -645,15 +645,15 @@ discard block |
||
645 | 645 | * @param string $nonce_name |
646 | 646 | * @return bool |
647 | 647 | */ |
648 | - public static function process_ticket_selector_nonce( $nonce_name ) { |
|
648 | + public static function process_ticket_selector_nonce($nonce_name) { |
|
649 | 649 | if ( |
650 | 650 | ! is_admin() |
651 | 651 | && ( |
652 | - ! EE_Registry::instance()->REQ->is_set( $nonce_name ) |
|
652 | + ! EE_Registry::instance()->REQ->is_set($nonce_name) |
|
653 | 653 | || |
654 | 654 | ! wp_verify_nonce( |
655 | - EE_Registry::instance()->REQ->get( $nonce_name ), |
|
656 | - str_replace( '_nonce', '', $nonce_name ) |
|
655 | + EE_Registry::instance()->REQ->get($nonce_name), |
|
656 | + str_replace('_nonce', '', $nonce_name) |
|
657 | 657 | ) |
658 | 658 | ) |
659 | 659 | ) { |
@@ -683,9 +683,9 @@ discard block |
||
683 | 683 | * @return array|boolean |
684 | 684 | */ |
685 | 685 | public function process_ticket_selections() { |
686 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
686 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
687 | 687 | // do we have an event id? |
688 | - if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
688 | + if ( ! EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
689 | 689 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
690 | 690 | EE_Error::add_error( |
691 | 691 | sprintf( |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | ); |
702 | 702 | } |
703 | 703 | //if event id is valid |
704 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ) ); |
|
704 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
705 | 705 | // check nonce |
706 | 706 | if ( |
707 | 707 | ! is_admin() |
708 | 708 | && ( |
709 | - ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce_' . $id ) |
|
710 | - || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce_' . $id ), 'process_ticket_selections' ) |
|
709 | + ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce_'.$id) |
|
710 | + || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce_'.$id), 'process_ticket_selections') |
|
711 | 711 | ) |
712 | 712 | ) { |
713 | 713 | EE_Error::add_error( |
714 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
714 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
715 | 715 | __FILE__, __FUNCTION__, __LINE__ |
716 | 716 | ); |
717 | 717 | return FALSE; |
@@ -723,16 +723,16 @@ discard block |
||
723 | 723 | ); |
724 | 724 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
725 | 725 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
726 | - EE_Registry::instance()->load_core( 'Session' ); |
|
726 | + EE_Registry::instance()->load_core('Session'); |
|
727 | 727 | // unless otherwise requested, clear the session |
728 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
729 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
728 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
729 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
730 | 730 | } |
731 | 731 | //d( EE_Registry::instance()->SSN ); |
732 | 732 | |
733 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
733 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
734 | 734 | // validate/sanitize data |
735 | - $valid = self::_validate_post_data( $id ); |
|
735 | + $valid = self::_validate_post_data($id); |
|
736 | 736 | |
737 | 737 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
738 | 738 | //EEH_Debug_Tools::printr( $valid, '$valid', __FILE__, __LINE__ ); |
@@ -740,42 +740,42 @@ discard block |
||
740 | 740 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
741 | 741 | |
742 | 742 | //check total tickets ordered vs max number of attendees that can register |
743 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
743 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
744 | 744 | |
745 | 745 | // ordering too many tickets !!! |
746 | 746 | $total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso'); |
747 | - $limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] ); |
|
747 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
748 | 748 | // dev only message |
749 | 749 | $max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso'); |
750 | - $limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] ); |
|
751 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
750 | + $limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']); |
|
751 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
752 | 752 | } else { |
753 | 753 | |
754 | 754 | // all data appears to be valid |
755 | 755 | $tckts_slctd = false; |
756 | 756 | $tickets_added = 0; |
757 | - $valid = apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid ); |
|
758 | - if ( $valid[ 'total_tickets' ] >0 ) { |
|
757 | + $valid = apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid); |
|
758 | + if ($valid['total_tickets'] > 0) { |
|
759 | 759 | // load cart |
760 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
760 | + EE_Registry::instance()->load_core('Cart'); |
|
761 | 761 | |
762 | 762 | // cycle thru the number of data rows sent from the event listing |
763 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
763 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
764 | 764 | // does this row actually contain a ticket quantity? |
765 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
765 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
766 | 766 | // YES we have a ticket quantity |
767 | 767 | $tckts_slctd = true; |
768 | 768 | // d( $valid['ticket_obj'][$x] ); |
769 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
769 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
770 | 770 | // then add ticket to cart |
771 | - $tickets_added += self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
772 | - if ( EE_Error::has_error() ) { |
|
771 | + $tickets_added += self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
772 | + if (EE_Error::has_error()) { |
|
773 | 773 | break; |
774 | 774 | } |
775 | 775 | } else { |
776 | 776 | // nothing added to cart retrieved |
777 | 777 | EE_Error::add_error( |
778 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
778 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
779 | 779 | __FILE__, __FUNCTION__, __LINE__ |
780 | 780 | ); |
781 | 781 | } |
@@ -790,24 +790,24 @@ discard block |
||
790 | 790 | //d( EE_Registry::instance()->CART ); |
791 | 791 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
792 | 792 | |
793 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd ) ) { |
|
794 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added ) ) { |
|
793 | + if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd)) { |
|
794 | + if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) { |
|
795 | 795 | do_action( |
796 | 796 | 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', |
797 | 797 | EE_Registry::instance()->CART, |
798 | 798 | $this |
799 | 799 | ); |
800 | 800 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
801 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
801 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
802 | 802 | EE_Registry::instance()->SSN->update(); |
803 | 803 | //d( EE_Registry::instance()->CART ); |
804 | 804 | // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
805 | 805 | // just return TRUE for registrations being made from admin |
806 | - if ( is_admin() ) { |
|
806 | + if (is_admin()) { |
|
807 | 807 | return TRUE; |
808 | 808 | } |
809 | 809 | |
810 | - EE_Error::get_notices( false, true ); |
|
810 | + EE_Error::get_notices(false, true); |
|
811 | 811 | wp_safe_redirect( |
812 | 812 | apply_filters( |
813 | 813 | 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', |
@@ -817,32 +817,32 @@ discard block |
||
817 | 817 | exit(); |
818 | 818 | |
819 | 819 | } else { |
820 | - if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention') ) { |
|
820 | + if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) { |
|
821 | 821 | // nothing added to cart |
822 | 822 | EE_Error::add_attention( |
823 | - __( 'No tickets were added for the event.', 'event_espresso' ), |
|
823 | + __('No tickets were added for the event.', 'event_espresso'), |
|
824 | 824 | __FILE__, __FUNCTION__, __LINE__ |
825 | 825 | ); |
826 | 826 | } |
827 | 827 | } |
828 | 828 | } else { |
829 | 829 | // no ticket quantities were selected |
830 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
830 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
831 | 831 | } |
832 | 832 | } |
833 | 833 | |
834 | 834 | // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
835 | 835 | // at this point, just return if registration is being made from admin |
836 | - if ( is_admin() ) { |
|
836 | + if (is_admin()) { |
|
837 | 837 | return FALSE; |
838 | 838 | } |
839 | - if ( $valid['return_url'] ) { |
|
840 | - EE_Error::get_notices( FALSE, TRUE ); |
|
841 | - wp_safe_redirect( $valid['return_url'] ); |
|
839 | + if ($valid['return_url']) { |
|
840 | + EE_Error::get_notices(FALSE, TRUE); |
|
841 | + wp_safe_redirect($valid['return_url']); |
|
842 | 842 | exit(); |
843 | - } elseif ( isset( $event_to_add['id'] )) { |
|
844 | - EE_Error::get_notices( FALSE, TRUE ); |
|
845 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
843 | + } elseif (isset($event_to_add['id'])) { |
|
844 | + EE_Error::get_notices(FALSE, TRUE); |
|
845 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
846 | 846 | exit(); |
847 | 847 | } else { |
848 | 848 | echo EE_Error::get_notices(); |
@@ -862,13 +862,13 @@ discard block |
||
862 | 862 | * @param int $id |
863 | 863 | * @return array|FALSE |
864 | 864 | */ |
865 | - private static function _validate_post_data( $id = 0 ) { |
|
866 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
865 | + private static function _validate_post_data($id = 0) { |
|
866 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
867 | 867 | |
868 | 868 | // d( $_POST ); |
869 | - if ( ! $id ) { |
|
869 | + if ( ! $id) { |
|
870 | 870 | EE_Error::add_error( |
871 | - __( 'The event id provided was not valid.', 'event_espresso' ), |
|
871 | + __('The event id provided was not valid.', 'event_espresso'), |
|
872 | 872 | __FILE__, |
873 | 873 | __FUNCTION__, |
874 | 874 | __LINE__ |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | // grab valid id |
881 | 881 | $valid_data['id'] = $id; |
882 | 882 | // grab and sanitize return-url |
883 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
883 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
884 | 884 | // array of other form names |
885 | 885 | $inputs_to_clean = array( |
886 | 886 | 'event_id' => 'tkt-slctr-event-id', |
@@ -893,22 +893,22 @@ discard block |
||
893 | 893 | // let's track the total number of tickets ordered.' |
894 | 894 | $valid_data['total_tickets'] = 0; |
895 | 895 | // cycle through $inputs_to_clean array |
896 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
896 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
897 | 897 | // check for POST data |
898 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
898 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
899 | 899 | // grab value |
900 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
900 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
901 | 901 | switch ($what) { |
902 | 902 | |
903 | 903 | // integers |
904 | 904 | case 'event_id': |
905 | - $valid_data[$what] = absint( $input_value ); |
|
905 | + $valid_data[$what] = absint($input_value); |
|
906 | 906 | // get event via the event id we put in the form |
907 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
907 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
908 | 908 | break; |
909 | 909 | case 'rows': |
910 | 910 | case 'max_atndz': |
911 | - $valid_data[$what] = absint( $input_value ); |
|
911 | + $valid_data[$what] = absint($input_value); |
|
912 | 912 | break; |
913 | 913 | |
914 | 914 | // arrays of integers |
@@ -916,27 +916,27 @@ discard block |
||
916 | 916 | /** @var array $row_qty */ |
917 | 917 | $row_qty = $input_value; |
918 | 918 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
919 | - if( ! is_array( $row_qty )) { |
|
919 | + if ( ! is_array($row_qty)) { |
|
920 | 920 | // get number of rows |
921 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
921 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
922 | 922 | // d( $rows ); |
923 | 923 | // explode ints by the dash |
924 | - $row_qty = explode( '-', $row_qty ); |
|
925 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
926 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
927 | - $row_qty = array( $row => $qty ); |
|
924 | + $row_qty = explode('-', $row_qty); |
|
925 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
926 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
927 | + $row_qty = array($row => $qty); |
|
928 | 928 | // d( $row_qty ); |
929 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
930 | - if ( ! isset( $row_qty[$x] )) { |
|
929 | + for ($x = 1; $x <= $rows; $x++) { |
|
930 | + if ( ! isset($row_qty[$x])) { |
|
931 | 931 | $row_qty[$x] = 0; |
932 | 932 | } |
933 | 933 | } |
934 | 934 | } |
935 | - ksort( $row_qty ); |
|
935 | + ksort($row_qty); |
|
936 | 936 | // d( $row_qty ); |
937 | 937 | // cycle thru values |
938 | - foreach ( $row_qty as $qty ) { |
|
939 | - $qty = absint( $qty ); |
|
938 | + foreach ($row_qty as $qty) { |
|
939 | + $qty = absint($qty); |
|
940 | 940 | // sanitize as integers |
941 | 941 | $valid_data[$what][] = $qty; |
942 | 942 | $valid_data['total_tickets'] += $qty; |
@@ -947,19 +947,19 @@ discard block |
||
947 | 947 | case 'ticket_id': |
948 | 948 | $value_array = array(); |
949 | 949 | // cycle thru values |
950 | - foreach ( (array) $input_value as $key => $value ) { |
|
950 | + foreach ((array) $input_value as $key => $value) { |
|
951 | 951 | // allow only numbers, letters, spaces, commas and dashes |
952 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
952 | + $value_array[$key] = wp_strip_all_tags($value); |
|
953 | 953 | // get ticket via the ticket id we put in the form |
954 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
955 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
954 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
955 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
956 | 956 | } |
957 | - $valid_data[ $what ] = $value_array; |
|
957 | + $valid_data[$what] = $value_array; |
|
958 | 958 | break; |
959 | 959 | |
960 | 960 | case 'return_url' : |
961 | 961 | // grab and sanitize return-url |
962 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
962 | + $valid_data[$what] = esc_url_raw($input_value); |
|
963 | 963 | break; |
964 | 964 | |
965 | 965 | } // end switch $what |
@@ -982,18 +982,18 @@ discard block |
||
982 | 982 | * @return int quantity of tickets added |
983 | 983 | * @throws \EE_Error |
984 | 984 | */ |
985 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
986 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
985 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
986 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
987 | 987 | // get the number of spaces left for this datetime ticket |
988 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
988 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
989 | 989 | if (self::debug) { |
990 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()"; |
|
991 | - echo "<br /> . ticket->ID(): " . $ticket->ID(); |
|
992 | - echo "<br /> . requested qty: " . $qty; |
|
993 | - echo "<br /> . available_spaces: " . $available_spaces; |
|
990 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."()"; |
|
991 | + echo "<br /> . ticket->ID(): ".$ticket->ID(); |
|
992 | + echo "<br /> . requested qty: ".$qty; |
|
993 | + echo "<br /> . available_spaces: ".$available_spaces; |
|
994 | 994 | } |
995 | 995 | // compare available spaces against the number of tickets being purchased |
996 | - if ( $available_spaces >= $qty ) { |
|
996 | + if ($available_spaces >= $qty) { |
|
997 | 997 | // allow addons to prevent a ticket from being added to cart |
998 | 998 | if ( |
999 | 999 | ! apply_filters( |
@@ -1006,10 +1006,10 @@ discard block |
||
1006 | 1006 | ) { |
1007 | 1007 | return 0; |
1008 | 1008 | } |
1009 | - $qty = apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket ); |
|
1009 | + $qty = apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket); |
|
1010 | 1010 | // add event to cart |
1011 | - if( $qty && EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
1012 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
1011 | + if ($qty && EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
1012 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
1013 | 1013 | return $qty; |
1014 | 1014 | } else { |
1015 | 1015 | return 0; |
@@ -1017,9 +1017,9 @@ discard block |
||
1017 | 1017 | } else { |
1018 | 1018 | // tickets can not be purchased but let's find the exact number left |
1019 | 1019 | // for the last ticket selected PRIOR to subtracting tickets |
1020 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
1020 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
1021 | 1021 | // greedy greedy greedy eh? |
1022 | - if ( $available_spaces > 0 ) { |
|
1022 | + if ($available_spaces > 0) { |
|
1023 | 1023 | if ( |
1024 | 1024 | apply_filters( |
1025 | 1025 | 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error', |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | $available_spaces |
1030 | 1030 | ) |
1031 | 1031 | ) { |
1032 | - EED_Ticket_Selector::_display_availability_error( $available_spaces ); |
|
1032 | + EED_Ticket_Selector::_display_availability_error($available_spaces); |
|
1033 | 1033 | } |
1034 | 1034 | } else { |
1035 | 1035 | EE_Error::add_error( |
@@ -1054,10 +1054,10 @@ discard block |
||
1054 | 1054 | * @access private |
1055 | 1055 | * @param int $available_spaces |
1056 | 1056 | */ |
1057 | - private static function _display_availability_error( $available_spaces = 1 ) { |
|
1057 | + private static function _display_availability_error($available_spaces = 1) { |
|
1058 | 1058 | // add error messaging - we're using the _n function that will generate |
1059 | 1059 | // the appropriate singular or plural message based on the number of $available_spaces |
1060 | - if ( EE_Registry::instance()->CART->all_ticket_quantity_count() ) { |
|
1060 | + if (EE_Registry::instance()->CART->all_ticket_quantity_count()) { |
|
1061 | 1061 | $msg = sprintf( |
1062 | 1062 | _n( |
1063 | 1063 | 'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.', |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | '<br />' |
1081 | 1081 | ); |
1082 | 1082 | } |
1083 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1083 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | |
@@ -1096,22 +1096,22 @@ discard block |
||
1096 | 1096 | * @return int |
1097 | 1097 | * @throws \EE_Error |
1098 | 1098 | */ |
1099 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
1099 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
1100 | 1100 | // if the $_available_spaces array has not been set up yet... |
1101 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
1102 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
1101 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
1102 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
1103 | 1103 | } |
1104 | 1104 | $available_spaces = $ticket->qty() - $ticket->sold(); |
1105 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
1105 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
1106 | 1106 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
1107 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
1107 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
1108 | 1108 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
1109 | - if ( $get_original_ticket_spaces ) { |
|
1109 | + if ($get_original_ticket_spaces) { |
|
1110 | 1110 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
1111 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
1111 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
1112 | 1112 | } else { |
1113 | 1113 | // we want the updated ticket availability as stored in the "datetimes" array |
1114 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
1114 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
1115 | 1115 | } |
1116 | 1116 | } |
1117 | 1117 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | * @return void |
1129 | 1129 | * @throws \EE_Error |
1130 | 1130 | */ |
1131 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
1131 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
1132 | 1132 | // first, get all of the datetimes that are available to this ticket |
1133 | 1133 | $datetimes = $ticket->get_many_related( |
1134 | 1134 | 'Datetime', |
@@ -1136,23 +1136,23 @@ discard block |
||
1136 | 1136 | array( |
1137 | 1137 | 'DTT_EVT_end' => array( |
1138 | 1138 | '>=', |
1139 | - EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ), |
|
1139 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
1140 | 1140 | ), |
1141 | 1141 | ), |
1142 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), |
|
1142 | + 'order_by' => array('DTT_EVT_start' => 'ASC'), |
|
1143 | 1143 | ) |
1144 | 1144 | ); |
1145 | - if ( ! empty( $datetimes )) { |
|
1145 | + if ( ! empty($datetimes)) { |
|
1146 | 1146 | // now loop thru all of the datetimes |
1147 | - foreach ( $datetimes as $datetime ) { |
|
1148 | - if ( $datetime instanceof EE_Datetime ) { |
|
1147 | + foreach ($datetimes as $datetime) { |
|
1148 | + if ($datetime instanceof EE_Datetime) { |
|
1149 | 1149 | // the number of spaces available for the datetime without considering individual ticket quantities |
1150 | 1150 | $spaces_remaining = $datetime->spaces_remaining(); |
1151 | 1151 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
1152 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
1152 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
1153 | 1153 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
1154 | 1154 | // else just take the datetime spaces remaining, and assign to the datetimes array |
1155 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
1155 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
1156 | 1156 | } |
1157 | 1157 | } |
1158 | 1158 | } |
@@ -1168,12 +1168,12 @@ discard block |
||
1168 | 1168 | * @param int $qty |
1169 | 1169 | * @return void |
1170 | 1170 | */ |
1171 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
1172 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
1171 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
1172 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
1173 | 1173 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
1174 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
1174 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
1175 | 1175 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
1176 | - self::$_available_spaces['datetimes'][ $DTD_ID ] -= $qty; |
|
1176 | + self::$_available_spaces['datetimes'][$DTD_ID] -= $qty; |
|
1177 | 1177 | } |
1178 | 1178 | } |
1179 | 1179 | } |
@@ -1190,8 +1190,8 @@ discard block |
||
1190 | 1190 | */ |
1191 | 1191 | public static function load_tckt_slctr_assets() { |
1192 | 1192 | // add some style |
1193 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
1194 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
1193 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
1194 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
1195 | 1195 | wp_enqueue_style('ticket_selector'); |
1196 | 1196 | // make it dance |
1197 | 1197 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -1205,9 +1205,9 @@ discard block |
||
1205 | 1205 | |
1206 | 1206 | public static function load_tckt_slctr_assets_admin() { |
1207 | 1207 | //iframe button js on admin event editor page |
1208 | - if ( EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit' ) { |
|
1209 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
1210 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
1208 | + if (EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit') { |
|
1209 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1210 | + wp_enqueue_script('ticket_selector_embed'); |
|
1211 | 1211 | } |
1212 | 1212 | } |
1213 | 1213 |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | $ticket_details_css_id = apply_filters( |
132 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
133 | - "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
|
134 | - ); |
|
132 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
133 | + "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
|
134 | + ); |
|
135 | 135 | ?> |
136 | 136 | <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
137 | 137 | <?php |
@@ -532,13 +532,13 @@ discard block |
||
532 | 532 | <th scope="col" class="ee-ticket-selector-ticket-qty-th cntr"> |
533 | 533 | <?php |
534 | 534 | /** |
535 | - * Filters the text printed for the header of the quantity column in the ticket selector table |
|
536 | - * |
|
537 | - * @since 4.7.2 |
|
538 | - * |
|
539 | - * @param string 'Qty' The translatable text to display in the table header for the Quantity of tickets |
|
540 | - * @param int $EVT_ID The Event ID |
|
541 | - */ |
|
535 | + * Filters the text printed for the header of the quantity column in the ticket selector table |
|
536 | + * |
|
537 | + * @since 4.7.2 |
|
538 | + * |
|
539 | + * @param string 'Qty' The translatable text to display in the table header for the Quantity of tickets |
|
540 | + * @param int $EVT_ID The Event ID |
|
541 | + */ |
|
542 | 542 | echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty', 'event_espresso' ), $EVT_ID ) ); |
543 | 543 | ?> |
544 | 544 | </th> |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | |
12 | 12 | $row = 1; |
13 | 13 | $max = 1; |
14 | -$ticket_count = count( $tickets ); |
|
14 | +$ticket_count = count($tickets); |
|
15 | 15 | $ticket_status_display = ''; |
16 | -if ( ! $ticket_count ) { |
|
16 | +if ( ! $ticket_count) { |
|
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $required_ticket_sold_out = FALSE; |
21 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
21 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
22 | 22 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
23 | 23 | : new EE_Ticket_Selector_Config(); |
24 | 24 | |
25 | -$tax_settings = isset ( EE_Registry::instance()->CFG->tax_settings ) |
|
25 | +$tax_settings = isset (EE_Registry::instance()->CFG->tax_settings) |
|
26 | 26 | ? EE_Registry::instance()->CFG->tax_settings |
27 | 27 | : new EE_Tax_Config(); |
28 | 28 | |
@@ -31,22 +31,22 @@ discard block |
||
31 | 31 | |
32 | 32 | ob_start(); |
33 | 33 | |
34 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
35 | - if ( $ticket instanceof EE_Ticket ) { |
|
34 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
35 | + if ($ticket instanceof EE_Ticket) { |
|
36 | 36 | $cols = 2; |
37 | 37 | $max = $ticket->max(); |
38 | 38 | $min = 0; |
39 | 39 | $remaining = $ticket->remaining(); |
40 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
40 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
41 | 41 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
42 | - $max = min( $remaining, $max_atndz ); |
|
42 | + $max = min($remaining, $max_atndz); |
|
43 | 43 | // but... we also want to restrict the number of tickets by the ticket max setting, |
44 | 44 | // however, the max still can't be higher than what was just set above |
45 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
45 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
46 | 46 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
47 | 47 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
48 | 48 | // and if the ticket is required, then make sure that min qty is at least 1 |
49 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
49 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
50 | 50 | } else { |
51 | 51 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
52 | 52 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -58,42 +58,42 @@ discard block |
||
58 | 58 | $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets; |
59 | 59 | $ticket_bundle = FALSE; |
60 | 60 | // for ticket bundles, set min and max qty the same |
61 | - if ( $ticket->min() !== 0 && $ticket->min() === $ticket->max() ) { |
|
61 | + if ($ticket->min() !== 0 && $ticket->min() === $ticket->max()) { |
|
62 | 62 | $ticket_price *= $ticket->min(); |
63 | 63 | $ticket_bundle = TRUE; |
64 | 64 | } |
65 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
65 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
66 | 66 | $is_remaining = $remaining > 0 ? true : false; |
67 | 67 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
68 | 68 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
69 | - $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status( false, $is_remaining ); |
|
69 | + $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(false, $is_remaining); |
|
70 | 70 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
71 | 71 | // check ticket status |
72 | - switch ( $tkt_status ) { |
|
72 | + switch ($tkt_status) { |
|
73 | 73 | // sold_out |
74 | 74 | case EE_Ticket::sold_out : |
75 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE, $is_remaining ) . '</span>'; |
|
75 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE, $is_remaining).'</span>'; |
|
76 | 76 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
77 | 77 | break; |
78 | 78 | // expired |
79 | 79 | case EE_Ticket::expired : |
80 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
80 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
81 | 81 | $status_class = 'ticket-sales-expired lt-grey-text'; |
82 | 82 | break; |
83 | 83 | // archived |
84 | 84 | case EE_Ticket::archived : |
85 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
85 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
86 | 86 | $status_class = 'archived-ticket hidden'; |
87 | 87 | break; |
88 | 88 | // pending |
89 | 89 | case EE_Ticket::pending : |
90 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
90 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
91 | 91 | $status_class = 'ticket-pending'; |
92 | 92 | break; |
93 | 93 | // onsale |
94 | 94 | case EE_Ticket::onsale : |
95 | 95 | default : |
96 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
96 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
97 | 97 | $status_class = 'ticket-on-sale'; |
98 | 98 | break; |
99 | 99 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
134 | 134 | ); |
135 | 135 | ?> |
136 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
136 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
137 | 137 | <?php |
138 | 138 | /** |
139 | 139 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -145,24 +145,24 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @var string|bool |
147 | 147 | */ |
148 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
148 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
149 | 149 | echo $new_row_cells_content; |
150 | 150 | echo '</tr>'; |
151 | 151 | continue; |
152 | 152 | } |
153 | 153 | ?> |
154 | 154 | <td class="tckt-slctr-tbl-td-name"> |
155 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
156 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
157 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
158 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
155 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
156 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
157 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
158 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
159 | 159 | </a> |
160 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
161 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
160 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
161 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
162 | 162 | </a> |
163 | 163 | <?php endif; //end show details check ?> |
164 | - <?php if ( $ticket->required() ) { ?> |
|
165 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
164 | + <?php if ($ticket->required()) { ?> |
|
165 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
166 | 166 | <?php } ?> |
167 | 167 | <?php |
168 | 168 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | </td> |
179 | 179 | <?php |
180 | 180 | if ( |
181 | - apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) |
|
181 | + apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE) |
|
182 | 182 | ) { ?> |
183 | 183 | <td class="tckt-slctr-tbl-td-price jst-rght"><?php |
184 | - echo EEH_Template::format_currency( $ticket_price ); |
|
184 | + echo EEH_Template::format_currency($ticket_price); |
|
185 | 185 | echo $ticket->taxable() ? '<span class="taxable-tickets-asterisk grey-text">*</span>' : ''; |
186 | 186 | ?> <span class="smaller-text no-bold"><?php |
187 | - if ( $ticket_bundle ) { |
|
188 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
187 | + if ($ticket_bundle) { |
|
188 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
189 | 189 | } else { |
190 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
190 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
191 | 191 | }?></span> </td> |
192 | 192 | <?php $cols++; ?> |
193 | 193 | <?php } ?> |
@@ -195,28 +195,28 @@ discard block |
||
195 | 195 | <?php |
196 | 196 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
197 | 197 | $ticket_status_display = ''; |
198 | - if ( $max_atndz === 0 ) { |
|
198 | + if ($max_atndz === 0) { |
|
199 | 199 | // registration is CLOSED because admin set max attendees to ZERO |
200 | - $ticket_status_display = '<span class="sold-out">' . apply_filters( |
|
200 | + $ticket_status_display = '<span class="sold-out">'.apply_filters( |
|
201 | 201 | 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
202 | - __( 'Closed', 'event_espresso' ) |
|
203 | - ) . '</span>'; |
|
204 | - } else if ( $tkt_status === EE_Ticket::sold_out || $remaining === 0 ) { |
|
202 | + __('Closed', 'event_espresso') |
|
203 | + ).'</span>'; |
|
204 | + } else if ($tkt_status === EE_Ticket::sold_out || $remaining === 0) { |
|
205 | 205 | // SOLD OUT - no tickets remaining |
206 | - $ticket_status_display = '<span class="sold-out">' . apply_filters( |
|
206 | + $ticket_status_display = '<span class="sold-out">'.apply_filters( |
|
207 | 207 | 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
208 | - __( 'Sold Out', 'event_espresso' ) |
|
209 | - ) . '</span>'; |
|
210 | - } else if ( $tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived ) { |
|
208 | + __('Sold Out', 'event_espresso') |
|
209 | + ).'</span>'; |
|
210 | + } else if ($tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived) { |
|
211 | 211 | // expired or archived ticket |
212 | 212 | $ticket_status_display = $ticket_status; |
213 | - } else if ( $tkt_status === EE_Ticket::pending ) { |
|
213 | + } else if ($tkt_status === EE_Ticket::pending) { |
|
214 | 214 | // ticket not on sale yet |
215 | 215 | $ticket_status_display = '<span class="ticket-pending-pg"> |
216 | 216 | <span class="ticket-pending">' |
217 | 217 | . apply_filters( |
218 | 218 | 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
219 | - __( 'Goes On Sale', 'event_espresso' ) |
|
219 | + __('Goes On Sale', 'event_espresso') |
|
220 | 220 | ) |
221 | 221 | . '</span><br/> |
222 | 222 | <span class="small-text">' |
@@ -229,36 +229,36 @@ discard block |
||
229 | 229 | ) |
230 | 230 | . '</span> |
231 | 231 | </span>'; |
232 | - } else if ( $ticket->min() > $remaining ) { |
|
232 | + } else if ($ticket->min() > $remaining) { |
|
233 | 233 | // min qty purchasable is less than tickets available |
234 | 234 | $ticket_status_display = ' |
235 | 235 | <div class="archived-ticket-pg"> |
236 | 236 | <span class="archived-ticket small-text">' |
237 | - . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )) |
|
237 | + . apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')) |
|
238 | 238 | . '</span><br/> |
239 | 239 | </div>'; |
240 | - } else if ( $max_atndz === 1 ) { |
|
240 | + } else if ($max_atndz === 1) { |
|
241 | 241 | // only ONE attendee is allowed to register at a time |
242 | 242 | // display submit button since we have tickets available |
243 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
243 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
244 | 244 | ?> |
245 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
245 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
246 | 246 | <?php |
247 | 247 | $hidden_input_qty = FALSE; |
248 | 248 | |
249 | - } else if ( $max > 0 ) { |
|
249 | + } else if ($max > 0) { |
|
250 | 250 | // display submit button since we have tickets available |
251 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
251 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
252 | 252 | ?> |
253 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
253 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
254 | 254 | <?php |
255 | 255 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
256 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
256 | + if ( ! $ticket->required() && $min !== 0) { |
|
257 | 257 | ?> |
258 | 258 | <option value="0"> 0 </option> |
259 | 259 | <?php } |
260 | 260 | // offer ticket quantities from the min to the max |
261 | - for ( $i = $min; $i <= $max; $i++) { |
|
261 | + for ($i = $min; $i <= $max; $i++) { |
|
262 | 262 | ?> |
263 | 263 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
264 | 264 | <?php } ?> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | echo $ticket_status_display; |
271 | 271 | // depending on group reg we need to change the format for qty |
272 | - if ( $hidden_input_qty ) { |
|
272 | + if ($hidden_input_qty) { |
|
273 | 273 | ?> |
274 | 274 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
275 | 275 | <?php |
@@ -279,33 +279,33 @@ discard block |
||
279 | 279 | |
280 | 280 | </td> |
281 | 281 | </tr> |
282 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
283 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
282 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
283 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
284 | 284 | <td class="tckt-slctr-tkt-details-td" colspan="<?php echo $cols; ?>" > |
285 | 285 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
286 | 286 | |
287 | 287 | <section class="tckt-slctr-tkt-details-sctn"> |
288 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
288 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
289 | 289 | <p><?php echo $ticket->description(); ?></p> |
290 | 290 | |
291 | - <?php if ( $ticket_price !== 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) ) { ?> |
|
291 | + <?php if ($ticket_price !== 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
292 | 292 | <section class="tckt-slctr-tkt-price-sctn"> |
293 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
293 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
294 | 294 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
295 | 295 | <table class="tckt-slctr-tkt-details-tbl"> |
296 | 296 | <thead> |
297 | 297 | <tr> |
298 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
299 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
300 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
298 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
299 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
300 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
301 | 301 | </tr> |
302 | 302 | </thead> |
303 | 303 | <tbody> |
304 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
304 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
305 | 305 | <tr> |
306 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
307 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
308 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
306 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
307 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
308 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
309 | 309 | </tr> |
310 | 310 | <?php |
311 | 311 | $running_total = $ticket->base_price()->amount(); |
@@ -313,44 +313,44 @@ discard block |
||
313 | 313 | $running_total = 0; |
314 | 314 | } |
315 | 315 | // now add price modifiers |
316 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
316 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
317 | 317 | <tr> |
318 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
319 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
320 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
318 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
319 | + <?php if ($price_mod->is_percent()) { ?> |
|
320 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
321 | 321 | <?php |
322 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
322 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
323 | 323 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
324 | 324 | ?> |
325 | 325 | <?php } else { ?> |
326 | 326 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
327 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
327 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
328 | 328 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
329 | 329 | <?php } ?> |
330 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
330 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
331 | 331 | <?php $running_total += $new_sub_total; ?> |
332 | 332 | </tr> |
333 | 333 | <?php } ?> |
334 | - <?php if ( $ticket->taxable() ) { ?> |
|
334 | + <?php if ($ticket->taxable()) { ?> |
|
335 | 335 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
336 | 336 | <tr> |
337 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
338 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
337 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
338 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
339 | 339 | </tr> |
340 | 340 | |
341 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
341 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
342 | 342 | <tr> |
343 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
344 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
345 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
346 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
343 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
344 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
345 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
346 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
347 | 347 | <?php $running_total += $tax_amount; ?> |
348 | 348 | </tr> |
349 | 349 | <?php } ?> |
350 | 350 | <?php } ?> |
351 | 351 | <tr> |
352 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
353 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
352 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
353 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
354 | 354 | </tr> |
355 | 355 | </tbody> |
356 | 356 | </table> |
@@ -360,106 +360,106 @@ discard block |
||
360 | 360 | <?php } ?> |
361 | 361 | |
362 | 362 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
363 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
364 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
365 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
366 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
363 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
364 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
365 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
366 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
367 | 367 | </section> |
368 | 368 | <br/> |
369 | 369 | |
370 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
370 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
371 | 371 | |
372 | - <?php if ( $ticket->min() && $ticket->max() ) { ?> |
|
372 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
373 | 373 | <section class="tckt-slctr-tkt-quantities-sctn"> |
374 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
375 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
376 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
377 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
374 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
375 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
376 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
377 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
378 | 378 | <?php //$max = min( $max, $max_atndz );?> |
379 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
379 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
380 | 380 | </section> |
381 | 381 | <br/> |
382 | 382 | <?php } ?> |
383 | 383 | |
384 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
384 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
385 | 385 | <section class="tckt-slctr-tkt-uses-sctn"> |
386 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
386 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
387 | 387 | <span class="drk-grey-text small-text no-bold"> - <?php |
388 | 388 | echo apply_filters( |
389 | 389 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
390 | 390 | sprintf( |
391 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
391 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
392 | 392 | '<br/>', |
393 | 393 | '<strong>', |
394 | 394 | '</strong>' |
395 | 395 | ) |
396 | 396 | ); |
397 | 397 | ?></span><br/> |
398 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
398 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
399 | 399 | </section> |
400 | 400 | <?php } ?> |
401 | 401 | |
402 | 402 | <?php |
403 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
403 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
404 | 404 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
405 | - if ( ! empty( $datetimes )) { ?> |
|
405 | + if ( ! empty($datetimes)) { ?> |
|
406 | 406 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
407 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
408 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
407 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
408 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
409 | 409 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
410 | 410 | <table class="tckt-slctr-tkt-details-tbl"> |
411 | 411 | <thead> |
412 | 412 | <tr> |
413 | 413 | <th class="tckt-slctr-tkt-details-date-th"> |
414 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
414 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
415 | 415 | </th> |
416 | 416 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
417 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
417 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
418 | 418 | </th> |
419 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
419 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
420 | 420 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
421 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
421 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
422 | 422 | </th> |
423 | 423 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
424 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
424 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
425 | 425 | </th> |
426 | 426 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
427 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
427 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
428 | 428 | </th> |
429 | 429 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
430 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
430 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
431 | 431 | </th> |
432 | 432 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
433 | 433 | </tr> |
434 | 434 | </thead> |
435 | 435 | <tbody> |
436 | 436 | <?php |
437 | - foreach ( $datetimes as $datetime ) { |
|
438 | - if ( $datetime instanceof EE_Datetime ) { |
|
437 | + foreach ($datetimes as $datetime) { |
|
438 | + if ($datetime instanceof EE_Datetime) { |
|
439 | 439 | ?> |
440 | 440 | |
441 | 441 | <tr> |
442 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
442 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
443 | 443 | <?php $datetime_name = $datetime->name(); ?> |
444 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
445 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
444 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
445 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
446 | 446 | </td> |
447 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
448 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
447 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
448 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
449 | 449 | </td> |
450 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
451 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
450 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
451 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
452 | 452 | <?php echo $ticket->sold(); ?> |
453 | 453 | </td> |
454 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
455 | - <?php echo $remaining === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $remaining; ?> |
|
454 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
455 | + <?php echo $remaining === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $remaining; ?> |
|
456 | 456 | </td> |
457 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
457 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
458 | 458 | <?php echo $datetime->sold(); ?> |
459 | 459 | </td> |
460 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
461 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
462 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
460 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
461 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
462 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
463 | 463 | </td> |
464 | 464 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
465 | 465 | </tr> |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | </div> |
478 | 478 | </td> |
479 | 479 | </tr> |
480 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
480 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
481 | 481 | <?php |
482 | 482 | $row++; |
483 | 483 | } |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | $ticket_row_html = ob_get_clean(); |
487 | 487 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
488 | 488 | $hide_ticket_selector = $ticket_count === 1 && $max_atndz === 1 && $ticket->is_free() ? true : false; |
489 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
490 | -remove_all_filters( 'FHEE__EE_Ticket_Selector__hide_ticket_selector' ); |
|
489 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
490 | +remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector'); |
|
491 | 491 | // EEH_Debug_Tools::printr( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ), 'display submit', __FILE__, __LINE__ ); |
492 | 492 | // EEH_Debug_Tools::printr( (string) $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
493 | 493 | // EEH_Debug_Tools::printr( (string) $max, '$max', __FILE__, __LINE__ ); |
@@ -501,20 +501,20 @@ discard block |
||
501 | 501 | * @param string '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to |
502 | 502 | * @param int $EVT_ID The Event ID |
503 | 503 | */ |
504 | -$anchor_id = apply_filters( 'FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-' . $EVT_ID, $EVT_ID ); |
|
505 | -if ( ! $hide_ticket_selector ) { |
|
504 | +$anchor_id = apply_filters('FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-'.$EVT_ID, $EVT_ID); |
|
505 | +if ( ! $hide_ticket_selector) { |
|
506 | 506 | ?> |
507 | 507 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
508 | 508 | |
509 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
509 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
510 | 510 | |
511 | 511 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
512 | 512 | <thead> |
513 | 513 | <tr> |
514 | 514 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
515 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
515 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
516 | 516 | </th> |
517 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) ) { ?> |
|
517 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
518 | 518 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
519 | 519 | <?php |
520 | 520 | /** |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param string 'Price' The translatable text to display in the table header for price |
526 | 526 | * @param int $EVT_ID The Event ID |
527 | 527 | */ |
528 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
528 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
529 | 529 | ?> |
530 | 530 | </th> |
531 | 531 | <?php } ?> |
@@ -539,77 +539,77 @@ discard block |
||
539 | 539 | * @param string 'Qty' The translatable text to display in the table header for the Quantity of tickets |
540 | 540 | * @param int $EVT_ID The Event ID |
541 | 541 | */ |
542 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty', 'event_espresso' ), $EVT_ID ) ); |
|
542 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty', 'event_espresso'), $EVT_ID)); |
|
543 | 543 | ?> |
544 | 544 | </th> |
545 | 545 | </tr> |
546 | 546 | </thead> |
547 | 547 | <tbody> |
548 | - <?php echo $ticket_row_html;?> |
|
548 | + <?php echo $ticket_row_html; ?> |
|
549 | 549 | </tbody> |
550 | 550 | </table> |
551 | 551 | <?php |
552 | - if ( $taxable_tickets && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', true ) ) { |
|
553 | - if ( $tax_settings->prices_displayed_including_taxes ) { |
|
554 | - $ticket_price_includes_taxes = __( '* price includes taxes', 'event_espresso' ); |
|
552 | + if ($taxable_tickets && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
553 | + if ($tax_settings->prices_displayed_including_taxes) { |
|
554 | + $ticket_price_includes_taxes = __('* price includes taxes', 'event_espresso'); |
|
555 | 555 | } else { |
556 | - $ticket_price_includes_taxes = __( '* price does not include taxes', 'event_espresso' ); |
|
556 | + $ticket_price_includes_taxes = __('* price does not include taxes', 'event_espresso'); |
|
557 | 557 | } |
558 | - echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">' . $ticket_price_includes_taxes . '</p>'; |
|
558 | + echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">'.$ticket_price_includes_taxes.'</p>'; |
|
559 | 559 | } |
560 | 560 | ?> |
561 | 561 | |
562 | 562 | <input type="hidden" name="noheader" value="true" /> |
563 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>" /> |
|
563 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>" /> |
|
564 | 564 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
565 | 565 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
566 | 566 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
567 | 567 | |
568 | 568 | <?php |
569 | -if ( $max_atndz > 0 ) { |
|
569 | +if ($max_atndz > 0) { |
|
570 | 570 | echo apply_filters( |
571 | 571 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
572 | 572 | '' |
573 | 573 | ); |
574 | 574 | } |
575 | -if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) { |
|
576 | - add_filter( 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true' ); |
|
575 | +if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
|
576 | + add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true'); |
|
577 | 577 | } |
578 | -do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
578 | +do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
579 | 579 | ?> |
580 | 580 | |
581 | 581 | <?php |
582 | -} else if ( isset( $TKT_ID ) ) { |
|
583 | - add_filter( 'FHEE__EE_Ticket_Selector__hide_ticket_selector', '__return_true' ); |
|
582 | +} else if (isset($TKT_ID)) { |
|
583 | + add_filter('FHEE__EE_Ticket_Selector__hide_ticket_selector', '__return_true'); |
|
584 | 584 | ?> |
585 | 585 | |
586 | 586 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
587 | 587 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
588 | 588 | <input type="hidden" name="noheader" value="true"/> |
589 | -<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>"/> |
|
589 | +<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>"/> |
|
590 | 590 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>"/> |
591 | 591 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
592 | 592 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
593 | 593 | <?php |
594 | - if ( $ticket instanceof EE_Ticket ) { |
|
595 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
594 | + if ($ticket instanceof EE_Ticket) { |
|
595 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
596 | 596 | $ticket_description = $ticket->description(); |
597 | - $ticket_description .= ! empty( $ticket_description ) |
|
598 | - ? '<br />' . $ticket_status_display |
|
597 | + $ticket_description .= ! empty($ticket_description) |
|
598 | + ? '<br />'.$ticket_status_display |
|
599 | 599 | : $ticket_status_display; |
600 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
600 | + if ( ! strpos($ticket_description, '<div')) { |
|
601 | 601 | $ticket_description = "<p>{$ticket_description}</p>"; |
602 | 602 | } |
603 | 603 | ?> |
604 | 604 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
605 | 605 | <div class="no-tkt-slctr-ticket-content-dv"> |
606 | 606 | <h5><?php echo $ticket->name(); ?></h5> |
607 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
607 | + <?php if ( ! empty($ticket_description)) { ?> |
|
608 | 608 | <?php echo $ticket_description; ?> |
609 | 609 | <?php } ?> |
610 | 610 | </div> |
611 | 611 | <?php |
612 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
612 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | ?> |