@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_Transaction class |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @return EE_Transaction |
35 | 35 | * @throws \EE_Error |
36 | 36 | */ |
37 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
38 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
37 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
38 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
39 | 39 | $txn = $has_object |
40 | 40 | ? $has_object |
41 | - : new self( $props_n_values, false, $timezone, $date_formats ); |
|
42 | - if ( ! $has_object ) { |
|
43 | - $txn->set_old_txn_status( $txn->status_ID() ); |
|
41 | + : new self($props_n_values, false, $timezone, $date_formats); |
|
42 | + if ( ! $has_object) { |
|
43 | + $txn->set_old_txn_status($txn->status_ID()); |
|
44 | 44 | } |
45 | 45 | return $txn; |
46 | 46 | } |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @return EE_Transaction |
55 | 55 | * @throws \EE_Error |
56 | 56 | */ |
57 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
58 | - $txn = new self( $props_n_values, TRUE, $timezone ); |
|
59 | - $txn->set_old_txn_status( $txn->status_ID() ); |
|
57 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
58 | + $txn = new self($props_n_values, TRUE, $timezone); |
|
59 | + $txn->set_old_txn_status($txn->status_ID()); |
|
60 | 60 | return $txn; |
61 | 61 | } |
62 | 62 | |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function lock() { |
75 | 75 | // attempt to set lock, but if that fails... |
76 | - if ( ! $this->add_extra_meta( 'lock', time(), true ) ) { |
|
76 | + if ( ! $this->add_extra_meta('lock', time(), true)) { |
|
77 | 77 | // then attempt to remove the lock in case it is expired |
78 | - if ( $this->_remove_expired_lock() ) { |
|
78 | + if ($this->_remove_expired_lock()) { |
|
79 | 79 | // if removal was successful, then try setting lock again |
80 | 80 | $this->lock(); |
81 | 81 | } else { |
82 | 82 | // but if the lock can not be removed, then throw an exception |
83 | 83 | throw new EE_Error( |
84 | 84 | sprintf( |
85 | - __( 'Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso' ), |
|
85 | + __('Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso'), |
|
86 | 86 | $this->ID() |
87 | 87 | ) |
88 | 88 | ); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @throws \EE_Error |
102 | 102 | */ |
103 | 103 | public function unlock() { |
104 | - return $this->delete_extra_meta( 'lock' ); |
|
104 | + return $this->delete_extra_meta('lock'); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function is_locked() { |
124 | 124 | // if TXN is not locked, then return false immediately |
125 | - if ( ! $this->_get_lock() ) { |
|
125 | + if ( ! $this->_get_lock()) { |
|
126 | 126 | return false; |
127 | 127 | } |
128 | 128 | // if not, then let's try and remove the lock in case it's expired... |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @throws \EE_Error |
144 | 144 | */ |
145 | 145 | protected function _get_lock() { |
146 | - return (int)$this->get_extra_meta( 'lock', true, 0 ); |
|
146 | + return (int) $this->get_extra_meta('lock', true, 0); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | protected function _remove_expired_lock() { |
160 | 160 | $locked = $this->_get_lock(); |
161 | - if ( $locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked ) { |
|
161 | + if ($locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked) { |
|
162 | 162 | return $this->unlock(); |
163 | 163 | } |
164 | 164 | return 0; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param float $total total value of transaction |
174 | 174 | * @throws \EE_Error |
175 | 175 | */ |
176 | - public function set_total( $total = 0.00 ) { |
|
177 | - $this->set( 'TXN_total', (float)$total ); |
|
176 | + public function set_total($total = 0.00) { |
|
177 | + $this->set('TXN_total', (float) $total); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param float $total_paid total amount paid to date (sum of all payments) |
187 | 187 | * @throws \EE_Error |
188 | 188 | */ |
189 | - public function set_paid( $total_paid = 0.00 ) { |
|
190 | - $this->set( 'TXN_paid', (float)$total_paid ); |
|
189 | + public function set_paid($total_paid = 0.00) { |
|
190 | + $this->set('TXN_paid', (float) $total_paid); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | * @param string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set |
200 | 200 | * @throws \EE_Error |
201 | 201 | */ |
202 | - public function set_status( $status = '' ) { |
|
203 | - $this->set( 'STS_ID', $status ); |
|
202 | + public function set_status($status = '') { |
|
203 | + $this->set('STS_ID', $status); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | * @param string $hash_salt required for some payment gateways |
213 | 213 | * @throws \EE_Error |
214 | 214 | */ |
215 | - public function set_hash_salt( $hash_salt = '' ) { |
|
216 | - $this->set( 'TXN_hash_salt', $hash_salt ); |
|
215 | + public function set_hash_salt($hash_salt = '') { |
|
216 | + $this->set('TXN_hash_salt', $hash_salt); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | * @param array $txn_reg_steps |
225 | 225 | * @throws \EE_Error |
226 | 226 | */ |
227 | - public function set_reg_steps( array $txn_reg_steps ) { |
|
228 | - $this->set( 'TXN_reg_steps', $txn_reg_steps ); |
|
227 | + public function set_reg_steps(array $txn_reg_steps) { |
|
228 | + $this->set('TXN_reg_steps', $txn_reg_steps); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | 239 | public function reg_steps() { |
240 | - $TXN_reg_steps = $this->get( 'TXN_reg_steps' ); |
|
241 | - return is_array( $TXN_reg_steps ) ? (array)$TXN_reg_steps : array(); |
|
240 | + $TXN_reg_steps = $this->get('TXN_reg_steps'); |
|
241 | + return is_array($TXN_reg_steps) ? (array) $TXN_reg_steps : array(); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @throws \EE_Error |
249 | 249 | */ |
250 | 250 | public function pretty_total() { |
251 | - return $this->get_pretty( 'TXN_total' ); |
|
251 | + return $this->get_pretty('TXN_total'); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @throws \EE_Error |
261 | 261 | */ |
262 | 262 | public function pretty_paid() { |
263 | - return $this->get_pretty( 'TXN_paid' ); |
|
263 | + return $this->get_pretty('TXN_paid'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @throws \EE_Error |
274 | 274 | */ |
275 | 275 | public function remaining() { |
276 | - return (float)( $this->total() - $this->paid() ); |
|
276 | + return (float) ($this->total() - $this->paid()); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @throws \EE_Error |
287 | 287 | */ |
288 | 288 | public function total() { |
289 | - return (float)$this->get( 'TXN_total' ); |
|
289 | + return (float) $this->get('TXN_total'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @throws \EE_Error |
300 | 300 | */ |
301 | 301 | public function paid() { |
302 | - return (float)$this->get( 'TXN_paid' ); |
|
302 | + return (float) $this->get('TXN_paid'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | * @throws \EE_Error |
312 | 312 | */ |
313 | 313 | public function get_cart_session() { |
314 | - $session_data = (array)$this->get( 'TXN_session_data' ); |
|
315 | - return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart |
|
316 | - ? $session_data[ 'cart' ] |
|
314 | + $session_data = (array) $this->get('TXN_session_data'); |
|
315 | + return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart |
|
316 | + ? $session_data['cart'] |
|
317 | 317 | : null; |
318 | 318 | } |
319 | 319 | |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | * @throws \EE_Error |
327 | 327 | */ |
328 | 328 | public function session_data() { |
329 | - $session_data = $this->get( 'TXN_session_data' ); |
|
330 | - if ( empty( $session_data ) ) { |
|
329 | + $session_data = $this->get('TXN_session_data'); |
|
330 | + if (empty($session_data)) { |
|
331 | 331 | $session_data = array( |
332 | 332 | 'id' => null, |
333 | 333 | 'user_id' => null, |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | * @param EE_Session|array $session_data |
351 | 351 | * @throws \EE_Error |
352 | 352 | */ |
353 | - public function set_txn_session_data( $session_data ) { |
|
354 | - if ( $session_data instanceof EE_Session ) { |
|
355 | - $this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE )); |
|
353 | + public function set_txn_session_data($session_data) { |
|
354 | + if ($session_data instanceof EE_Session) { |
|
355 | + $this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE)); |
|
356 | 356 | } else { |
357 | - $this->set( 'TXN_session_data', $session_data ); |
|
357 | + $this->set('TXN_session_data', $session_data); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * @throws \EE_Error |
368 | 368 | */ |
369 | 369 | public function hash_salt_() { |
370 | - return $this->get( 'TXN_hash_salt' ); |
|
370 | + return $this->get('TXN_hash_salt'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | * @return string | int |
388 | 388 | * @throws \EE_Error |
389 | 389 | */ |
390 | - public function datetime( $format = FALSE, $gmt = FALSE ) { |
|
391 | - if ( $format ) { |
|
392 | - return $this->get_pretty( 'TXN_timestamp' ); |
|
393 | - } else if ( $gmt ) { |
|
394 | - return $this->get_raw( 'TXN_timestamp' ); |
|
390 | + public function datetime($format = FALSE, $gmt = FALSE) { |
|
391 | + if ($format) { |
|
392 | + return $this->get_pretty('TXN_timestamp'); |
|
393 | + } else if ($gmt) { |
|
394 | + return $this->get_raw('TXN_timestamp'); |
|
395 | 395 | } else { |
396 | - return $this->get( 'TXN_timestamp' ); |
|
396 | + return $this->get('TXN_timestamp'); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | * @return EE_Registration[] |
408 | 408 | * @throws \EE_Error |
409 | 409 | */ |
410 | - public function registrations( $query_params = array(), $get_cached = FALSE ) { |
|
411 | - $query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) |
|
410 | + public function registrations($query_params = array(), $get_cached = FALSE) { |
|
411 | + $query_params = (empty($query_params) || ! is_array($query_params)) |
|
412 | 412 | ? array( |
413 | 413 | 'order_by' => array( |
414 | 414 | 'Event.EVT_name' => 'ASC', |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | ) |
419 | 419 | : $query_params; |
420 | 420 | $query_params = $get_cached ? array() : $query_params; |
421 | - return $this->get_many_related( 'Registration', $query_params ); |
|
421 | + return $this->get_many_related('Registration', $query_params); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @throws \EE_Error |
432 | 432 | */ |
433 | 433 | public function attendees() { |
434 | - return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
|
434 | + return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID()))); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | * @return EE_Payment[] |
444 | 444 | * @throws \EE_Error |
445 | 445 | */ |
446 | - public function payments( $query_params = array() ) { |
|
447 | - return $this->get_many_related( 'Payment', $query_params ); |
|
446 | + public function payments($query_params = array()) { |
|
447 | + return $this->get_many_related('Payment', $query_params); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | * @throws \EE_Error |
457 | 457 | */ |
458 | 458 | public function approved_payments() { |
459 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
460 | - return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) ); |
|
459 | + EE_Registry::instance()->load_model('Payment'); |
|
460 | + return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC'))); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | * @return string |
470 | 470 | * @throws \EE_Error |
471 | 471 | */ |
472 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
473 | - echo $this->pretty_status( $show_icons ); |
|
472 | + public function e_pretty_status($show_icons = FALSE) { |
|
473 | + echo $this->pretty_status($show_icons); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | |
@@ -482,10 +482,10 @@ discard block |
||
482 | 482 | * @return string |
483 | 483 | * @throws \EE_Error |
484 | 484 | */ |
485 | - public function pretty_status( $show_icons = FALSE ) { |
|
486 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
485 | + public function pretty_status($show_icons = FALSE) { |
|
486 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
487 | 487 | $icon = ''; |
488 | - switch ( $this->status_ID() ) { |
|
488 | + switch ($this->status_ID()) { |
|
489 | 489 | case EEM_Transaction::complete_status_code: |
490 | 490 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
491 | 491 | break; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : ''; |
503 | 503 | break; |
504 | 504 | } |
505 | - return $icon . $status[ $this->status_ID() ]; |
|
505 | + return $icon.$status[$this->status_ID()]; |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @throws \EE_Error |
515 | 515 | */ |
516 | 516 | public function status_ID() { |
517 | - return $this->get( 'STS_ID' ); |
|
517 | + return $this->get('STS_ID'); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | * @throws \EE_Error |
527 | 527 | */ |
528 | 528 | public function is_free() { |
529 | - return EEH_Money::compare_floats( $this->get( 'TXN_total' ), 0, '==' ); |
|
529 | + return EEH_Money::compare_floats($this->get('TXN_total'), 0, '=='); |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | |
@@ -606,12 +606,12 @@ discard block |
||
606 | 606 | * @return string |
607 | 607 | * @throws \EE_Error |
608 | 608 | */ |
609 | - public function invoice_url( $type = 'html' ) { |
|
609 | + public function invoice_url($type = 'html') { |
|
610 | 610 | $REG = $this->primary_registration(); |
611 | - if ( ! $REG instanceof EE_Registration ) { |
|
611 | + if ( ! $REG instanceof EE_Registration) { |
|
612 | 612 | return ''; |
613 | 613 | } |
614 | - return $REG->invoice_url( $type ); |
|
614 | + return $REG->invoice_url($type); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | * @throws \EE_Error |
624 | 624 | */ |
625 | 625 | public function primary_registration() { |
626 | - return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) ); |
|
626 | + return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -635,12 +635,12 @@ discard block |
||
635 | 635 | * @return string |
636 | 636 | * @throws \EE_Error |
637 | 637 | */ |
638 | - public function receipt_url( $type = 'html' ) { |
|
638 | + public function receipt_url($type = 'html') { |
|
639 | 639 | $REG = $this->primary_registration(); |
640 | - if ( ! $REG instanceof EE_Registration ) { |
|
640 | + if ( ! $REG instanceof EE_Registration) { |
|
641 | 641 | return ''; |
642 | 642 | } |
643 | - return $REG->receipt_url( $type ); |
|
643 | + return $REG->receipt_url($type); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | * @throws \EE_Error |
666 | 666 | */ |
667 | 667 | public function gateway_response_on_transaction() { |
668 | - $payment = $this->get_first_related( 'Payment' ); |
|
668 | + $payment = $this->get_first_related('Payment'); |
|
669 | 669 | return $payment instanceof EE_Payment ? $payment->gateway_response() : ''; |
670 | 670 | } |
671 | 671 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @throws \EE_Error |
679 | 679 | */ |
680 | 680 | public function status_obj() { |
681 | - return $this->get_first_related( 'Status' ); |
|
681 | + return $this->get_first_related('Status'); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -690,8 +690,8 @@ discard block |
||
690 | 690 | * @return EE_Extra_Meta |
691 | 691 | * @throws \EE_Error |
692 | 692 | */ |
693 | - public function extra_meta( $query_params = array() ) { |
|
694 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
693 | + public function extra_meta($query_params = array()) { |
|
694 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | * @return EE_Base_Class the relation was added to |
704 | 704 | * @throws \EE_Error |
705 | 705 | */ |
706 | - public function add_registration( EE_Registration $registration ) { |
|
707 | - return $this->_add_relation_to( $registration, 'Registration' ); |
|
706 | + public function add_registration(EE_Registration $registration) { |
|
707 | + return $this->_add_relation_to($registration, 'Registration'); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | * @return EE_Base_Class that was removed from being related |
718 | 718 | * @throws \EE_Error |
719 | 719 | */ |
720 | - public function remove_registration_with_id( $registration_or_id ) { |
|
721 | - return $this->_remove_relation_to( $registration_or_id, 'Registration' ); |
|
720 | + public function remove_registration_with_id($registration_or_id) { |
|
721 | + return $this->_remove_relation_to($registration_or_id, 'Registration'); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | * @throws \EE_Error |
731 | 731 | */ |
732 | 732 | public function items_purchased() { |
733 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) ); |
|
733 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item))); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | * @return EE_Base_Class the relation was added to |
743 | 743 | * @throws \EE_Error |
744 | 744 | */ |
745 | - public function add_line_item( EE_Line_Item $line_item ) { |
|
746 | - return $this->_add_relation_to( $line_item, 'Line_Item' ); |
|
745 | + public function add_line_item(EE_Line_Item $line_item) { |
|
746 | + return $this->_add_relation_to($line_item, 'Line_Item'); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | |
@@ -755,8 +755,8 @@ discard block |
||
755 | 755 | * @return EE_Line_Item[] |
756 | 756 | * @throws \EE_Error |
757 | 757 | */ |
758 | - public function line_items( $query_params = array() ) { |
|
759 | - return $this->get_many_related( 'Line_Item', $query_params ); |
|
758 | + public function line_items($query_params = array()) { |
|
759 | + return $this->get_many_related('Line_Item', $query_params); |
|
760 | 760 | } |
761 | 761 | |
762 | 762 | |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * @throws \EE_Error |
769 | 769 | */ |
770 | 770 | public function tax_items() { |
771 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) ); |
|
771 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | |
@@ -781,10 +781,10 @@ discard block |
||
781 | 781 | * @return \EE_Line_Item |
782 | 782 | * @throws \EE_Error |
783 | 783 | */ |
784 | - public function total_line_item( $create_if_not_found = true ) { |
|
785 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) ); |
|
786 | - if( ! $item && $create_if_not_found ){ |
|
787 | - $item = EEH_Line_Item::create_total_line_item( $this ); |
|
784 | + public function total_line_item($create_if_not_found = true) { |
|
785 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total))); |
|
786 | + if ( ! $item && $create_if_not_found) { |
|
787 | + $item = EEH_Line_Item::create_total_line_item($this); |
|
788 | 788 | } |
789 | 789 | return $item; |
790 | 790 | } |
@@ -800,10 +800,10 @@ discard block |
||
800 | 800 | */ |
801 | 801 | public function tax_total() { |
802 | 802 | $tax_line_item = $this->tax_total_line_item(); |
803 | - if ( $tax_line_item ) { |
|
804 | - return (float)$tax_line_item->total(); |
|
803 | + if ($tax_line_item) { |
|
804 | + return (float) $tax_line_item->total(); |
|
805 | 805 | } else { |
806 | - return (float)0; |
|
806 | + return (float) 0; |
|
807 | 807 | } |
808 | 808 | } |
809 | 809 | |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * @throws \EE_Error |
817 | 817 | */ |
818 | 818 | public function tax_total_line_item() { |
819 | - return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() ); |
|
819 | + return EEH_Line_Item::get_taxes_subtotal($this->total_line_item()); |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | |
@@ -827,20 +827,20 @@ discard block |
||
827 | 827 | * @return EE_Form_Section_Proper |
828 | 828 | * @throws \EE_Error |
829 | 829 | */ |
830 | - public function billing_info(){ |
|
830 | + public function billing_info() { |
|
831 | 831 | $payment_method = $this->payment_method(); |
832 | - if ( !$payment_method){ |
|
832 | + if ( ! $payment_method) { |
|
833 | 833 | EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
834 | 834 | return false; |
835 | 835 | } |
836 | 836 | $primary_reg = $this->primary_registration(); |
837 | - if ( ! $primary_reg ) { |
|
838 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
837 | + if ( ! $primary_reg) { |
|
838 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
839 | 839 | return FALSE; |
840 | 840 | } |
841 | 841 | $attendee = $primary_reg->attendee(); |
842 | - if ( ! $attendee ) { |
|
843 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
842 | + if ( ! $attendee) { |
|
843 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
844 | 844 | return FALSE; |
845 | 845 | } |
846 | 846 | return $attendee->billing_info_for_payment_method($payment_method); |
@@ -881,15 +881,15 @@ discard block |
||
881 | 881 | * @return EE_Payment_Method |
882 | 882 | * @throws \EE_Error |
883 | 883 | */ |
884 | - public function payment_method(){ |
|
884 | + public function payment_method() { |
|
885 | 885 | $pm = $this->get_first_related('Payment_Method'); |
886 | - if( $pm instanceof EE_Payment_Method ){ |
|
886 | + if ($pm instanceof EE_Payment_Method) { |
|
887 | 887 | return $pm; |
888 | - }else{ |
|
888 | + } else { |
|
889 | 889 | $last_payment = $this->last_payment(); |
890 | - if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
|
890 | + if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) { |
|
891 | 891 | return $last_payment->payment_method(); |
892 | - }else{ |
|
892 | + } else { |
|
893 | 893 | return NULL; |
894 | 894 | } |
895 | 895 | } |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | * @throws \EE_Error |
905 | 905 | */ |
906 | 906 | public function last_payment() { |
907 | - return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) ); |
|
907 | + return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc'))); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | * @return EE_Line_Item[] |
916 | 916 | * @throws \EE_Error |
917 | 917 | */ |
918 | - public function non_ticket_line_items(){ |
|
919 | - return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() ); |
|
918 | + public function non_ticket_line_items() { |
|
919 | + return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID()); |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | public function update_based_on_payments() |
965 | 965 | { |
966 | 966 | EE_Error::doing_it_wrong( |
967 | - __CLASS__ . '::' . __FUNCTION__, |
|
967 | + __CLASS__.'::'.__FUNCTION__, |
|
968 | 968 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
969 | 969 | 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
970 | 970 | '4.6.0' |
@@ -988,9 +988,9 @@ discard block |
||
988 | 988 | /** |
989 | 989 | * @param string $old_txn_status |
990 | 990 | */ |
991 | - public function set_old_txn_status( $old_txn_status ) { |
|
991 | + public function set_old_txn_status($old_txn_status) { |
|
992 | 992 | // only set the first time |
993 | - if ( $this->_old_txn_status === null ) { |
|
993 | + if ($this->_old_txn_status === null) { |
|
994 | 994 | $this->_old_txn_status = $old_txn_status; |
995 | 995 | } |
996 | 996 | } |
@@ -1019,17 +1019,17 @@ discard block |
||
1019 | 1019 | * @param bool $check_all |
1020 | 1020 | * @return boolean | int |
1021 | 1021 | */ |
1022 | - private function _reg_steps_completed( $reg_step_slug = '', $check_all = true ) { |
|
1022 | + private function _reg_steps_completed($reg_step_slug = '', $check_all = true) { |
|
1023 | 1023 | $reg_steps = $this->reg_steps(); |
1024 | - if ( ! is_array( $reg_steps ) || empty( $reg_steps ) ) { |
|
1024 | + if ( ! is_array($reg_steps) || empty($reg_steps)) { |
|
1025 | 1025 | return false; |
1026 | 1026 | } |
1027 | 1027 | // loop thru reg steps array) |
1028 | - foreach ( $reg_steps as $slug => $reg_step_completed ) { |
|
1028 | + foreach ($reg_steps as $slug => $reg_step_completed) { |
|
1029 | 1029 | // if NOT checking ALL steps (only checking one step) |
1030 | - if ( ! $check_all ) { |
|
1030 | + if ( ! $check_all) { |
|
1031 | 1031 | // and this is the one |
1032 | - if ( $slug === $reg_step_slug ) { |
|
1032 | + if ($slug === $reg_step_slug) { |
|
1033 | 1033 | return $reg_step_completed; |
1034 | 1034 | } else { |
1035 | 1035 | // skip to next reg step in loop |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | } |
1038 | 1038 | } |
1039 | 1039 | // $check_all must be true, else we would never have gotten to this point |
1040 | - if ( $slug === $reg_step_slug ) { |
|
1040 | + if ($slug === $reg_step_slug) { |
|
1041 | 1041 | // if we reach this point, then we are testing either: |
1042 | 1042 | // all_reg_steps_completed_except() or |
1043 | 1043 | // all_reg_steps_completed_except_final_step(), |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | // ie: "is everything completed except the final step?" |
1047 | 1047 | // "that is correct... the final step is not completed, but all others are." |
1048 | 1048 | return $reg_step_completed !== true ? true : false; |
1049 | - } else if ( $reg_step_completed !== true ) { |
|
1049 | + } else if ($reg_step_completed !== true) { |
|
1050 | 1050 | // if any reg step is NOT completed, then ALL steps are not completed |
1051 | 1051 | return false; |
1052 | 1052 | } |
@@ -1080,8 +1080,8 @@ discard block |
||
1080 | 1080 | * @param string $exception |
1081 | 1081 | * @return boolean |
1082 | 1082 | */ |
1083 | - public function all_reg_steps_completed_except( $exception = '' ) { |
|
1084 | - return $this->_reg_steps_completed( $exception ); |
|
1083 | + public function all_reg_steps_completed_except($exception = '') { |
|
1084 | + return $this->_reg_steps_completed($exception); |
|
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | * @return boolean |
1097 | 1097 | */ |
1098 | 1098 | public function all_reg_steps_completed_except_final_step() { |
1099 | - return $this->_reg_steps_completed( 'finalize_registration' ); |
|
1099 | + return $this->_reg_steps_completed('finalize_registration'); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | |
@@ -1111,8 +1111,8 @@ discard block |
||
1111 | 1111 | * @param string $reg_step_slug |
1112 | 1112 | * @return boolean | int |
1113 | 1113 | */ |
1114 | - public function reg_step_completed( $reg_step_slug ) { |
|
1115 | - return $this->_reg_steps_completed( $reg_step_slug, false ); |
|
1114 | + public function reg_step_completed($reg_step_slug) { |
|
1115 | + return $this->_reg_steps_completed($reg_step_slug, false); |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | 1118 | |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | * @return boolean | int |
1128 | 1128 | */ |
1129 | 1129 | public function final_reg_step_completed() { |
1130 | - return $this->_reg_steps_completed( 'finalize_registration', false ); |
|
1130 | + return $this->_reg_steps_completed('finalize_registration', false); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | |
@@ -1141,8 +1141,8 @@ discard block |
||
1141 | 1141 | * @return boolean |
1142 | 1142 | * @throws \EE_Error |
1143 | 1143 | */ |
1144 | - public function set_reg_step_initiated( $reg_step_slug ) { |
|
1145 | - return $this->_set_reg_step_completed_status( $reg_step_slug, time() ); |
|
1144 | + public function set_reg_step_initiated($reg_step_slug) { |
|
1145 | + return $this->_set_reg_step_completed_status($reg_step_slug, time()); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | |
@@ -1156,8 +1156,8 @@ discard block |
||
1156 | 1156 | * @return boolean |
1157 | 1157 | * @throws \EE_Error |
1158 | 1158 | */ |
1159 | - public function set_reg_step_completed( $reg_step_slug ) { |
|
1160 | - return $this->_set_reg_step_completed_status( $reg_step_slug, true ); |
|
1159 | + public function set_reg_step_completed($reg_step_slug) { |
|
1160 | + return $this->_set_reg_step_completed_status($reg_step_slug, true); |
|
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | * @return boolean |
1172 | 1172 | * @throws \EE_Error |
1173 | 1173 | */ |
1174 | - public function set_reg_step_not_completed( $reg_step_slug ) { |
|
1175 | - return $this->_set_reg_step_completed_status( $reg_step_slug, false ); |
|
1174 | + public function set_reg_step_not_completed($reg_step_slug) { |
|
1175 | + return $this->_set_reg_step_completed_status($reg_step_slug, false); |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | |
@@ -1187,37 +1187,37 @@ discard block |
||
1187 | 1187 | * @return boolean |
1188 | 1188 | * @throws \EE_Error |
1189 | 1189 | */ |
1190 | - private function _set_reg_step_completed_status( $reg_step_slug, $status ) { |
|
1190 | + private function _set_reg_step_completed_status($reg_step_slug, $status) { |
|
1191 | 1191 | // validate status |
1192 | - $status = is_bool( $status ) || is_int( $status ) ? $status : false; |
|
1192 | + $status = is_bool($status) || is_int($status) ? $status : false; |
|
1193 | 1193 | // get reg steps array |
1194 | 1194 | $txn_reg_steps = $this->reg_steps(); |
1195 | 1195 | // if reg step does NOT exist |
1196 | - if ( ! isset( $txn_reg_steps[ $reg_step_slug ] ) ) { |
|
1196 | + if ( ! isset($txn_reg_steps[$reg_step_slug])) { |
|
1197 | 1197 | return false; |
1198 | 1198 | } |
1199 | 1199 | // if we're trying to complete a step that is already completed |
1200 | - if ( $txn_reg_steps[ $reg_step_slug ] === true ) { |
|
1200 | + if ($txn_reg_steps[$reg_step_slug] === true) { |
|
1201 | 1201 | return true; |
1202 | 1202 | } |
1203 | 1203 | // if we're trying to complete a step that hasn't even started |
1204 | - if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) { |
|
1204 | + if ($status === true && $txn_reg_steps[$reg_step_slug] === false) { |
|
1205 | 1205 | return false; |
1206 | 1206 | } |
1207 | 1207 | // if current status value matches the incoming value (no change) |
1208 | 1208 | // type casting as int means values should collapse to either 0, 1, or a timestamp like 1234567890 |
1209 | - if ( (int) $txn_reg_steps[ $reg_step_slug ] === (int) $status ) { |
|
1209 | + if ((int) $txn_reg_steps[$reg_step_slug] === (int) $status) { |
|
1210 | 1210 | // this will happen in cases where multiple AJAX requests occur during the same step |
1211 | 1211 | return true; |
1212 | 1212 | } |
1213 | 1213 | // if we're trying to set a start time, but it has already been set... |
1214 | - if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] ) ) { |
|
1214 | + if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) { |
|
1215 | 1215 | // skip the update below, but don't return FALSE so that errors won't be displayed |
1216 | 1216 | return true; |
1217 | 1217 | } |
1218 | 1218 | // update completed status |
1219 | - $txn_reg_steps[ $reg_step_slug ] = $status; |
|
1220 | - $this->set_reg_steps( $txn_reg_steps ); |
|
1219 | + $txn_reg_steps[$reg_step_slug] = $status; |
|
1220 | + $this->set_reg_steps($txn_reg_steps); |
|
1221 | 1221 | $this->save(); |
1222 | 1222 | return true; |
1223 | 1223 | } |
@@ -1233,11 +1233,11 @@ discard block |
||
1233 | 1233 | * @param string $reg_step_slug |
1234 | 1234 | * @return void |
1235 | 1235 | */ |
1236 | - public function remove_reg_step( $reg_step_slug ) { |
|
1236 | + public function remove_reg_step($reg_step_slug) { |
|
1237 | 1237 | // get reg steps array |
1238 | 1238 | $txn_reg_steps = $this->reg_steps(); |
1239 | - unset( $txn_reg_steps[ $reg_step_slug ] ); |
|
1240 | - $this->set_reg_steps( $txn_reg_steps ); |
|
1239 | + unset($txn_reg_steps[$reg_step_slug]); |
|
1240 | + $this->set_reg_steps($txn_reg_steps); |
|
1241 | 1241 | } |
1242 | 1242 | |
1243 | 1243 | |
@@ -1251,11 +1251,11 @@ discard block |
||
1251 | 1251 | * @param bool $save |
1252 | 1252 | * @return bool |
1253 | 1253 | */ |
1254 | - public function toggle_failed_transaction_status( $save = true ) { |
|
1254 | + public function toggle_failed_transaction_status($save = true) { |
|
1255 | 1255 | // if TXN status is still set as "failed"... |
1256 | - if ( $this->status_ID() === EEM_Transaction::failed_status_code ) { |
|
1257 | - $this->set_status( EEM_Transaction::abandoned_status_code ); |
|
1258 | - if ( $save ) { |
|
1256 | + if ($this->status_ID() === EEM_Transaction::failed_status_code) { |
|
1257 | + $this->set_status(EEM_Transaction::abandoned_status_code); |
|
1258 | + if ($save) { |
|
1259 | 1259 | $this->save(); |
1260 | 1260 | } |
1261 | 1261 | return true; |
@@ -1284,10 +1284,10 @@ discard block |
||
1284 | 1284 | $this->primary_registration() instanceof EE_Registration |
1285 | 1285 | && $this->primary_registration()->attendee() instanceof EE_Attendee |
1286 | 1286 | ) { |
1287 | - $this->set_status( EEM_Transaction::incomplete_status_code ); |
|
1287 | + $this->set_status(EEM_Transaction::incomplete_status_code); |
|
1288 | 1288 | } else { |
1289 | 1289 | // no contact record? yer abandoned! |
1290 | - $this->set_status( EEM_Transaction::abandoned_status_code ); |
|
1290 | + $this->set_status(EEM_Transaction::abandoned_status_code); |
|
1291 | 1291 | } |
1292 | 1292 | return true; |
1293 | 1293 | } |
@@ -1301,16 +1301,16 @@ discard block |
||
1301 | 1301 | * updates the TXN status based on the amount paid |
1302 | 1302 | */ |
1303 | 1303 | public function verify_abandoned_transaction_status() { |
1304 | - if ( $this->status_ID() !== EEM_Transaction::abandoned_status_code ) { |
|
1304 | + if ($this->status_ID() !== EEM_Transaction::abandoned_status_code) { |
|
1305 | 1305 | return; |
1306 | 1306 | } |
1307 | - $payments = $this->get_many_related( 'Payment' ); |
|
1308 | - if ( ! empty( $payments ) ) { |
|
1309 | - foreach ( $payments as $payment ) { |
|
1310 | - if ( $payment instanceof EE_Payment ) { |
|
1307 | + $payments = $this->get_many_related('Payment'); |
|
1308 | + if ( ! empty($payments)) { |
|
1309 | + foreach ($payments as $payment) { |
|
1310 | + if ($payment instanceof EE_Payment) { |
|
1311 | 1311 | // kk this TXN should NOT be abandoned |
1312 | 1312 | $this->update_status_based_on_total_paid(); |
1313 | - if ( is_admin() && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) { |
|
1313 | + if (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) { |
|
1314 | 1314 | EE_Error::add_attention( |
1315 | 1315 | sprintf( |
1316 | 1316 | esc_html__( |
@@ -1326,8 +1326,8 @@ discard block |
||
1326 | 1326 | $finalized = $this->final_reg_step_completed(); |
1327 | 1327 | // if the 'finalize_registration' step has been initiated (has a timestamp) |
1328 | 1328 | // but has not yet been fully completed (TRUE) |
1329 | - if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) { |
|
1330 | - $this->set_reg_step_completed( 'finalize_registration' ); |
|
1329 | + if (is_int($finalized) && $finalized !== false && $finalized !== true) { |
|
1330 | + $this->set_reg_step_completed('finalize_registration'); |
|
1331 | 1331 | $this->save(); |
1332 | 1332 | } |
1333 | 1333 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,32 +38,32 @@ discard block |
||
38 | 38 | public static function set_hooks() { |
39 | 39 | add_filter( |
40 | 40 | 'FHEE__SPCO__EE_Line_Item_Filter_Collection', |
41 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) |
|
41 | + array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters') |
|
42 | 42 | ); |
43 | 43 | add_action( |
44 | 44 | 'wp_ajax_switch_spco_billing_form', |
45 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ) |
|
45 | + array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form') |
|
46 | 46 | ); |
47 | 47 | add_action( |
48 | 48 | 'wp_ajax_nopriv_switch_spco_billing_form', |
49 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ) |
|
49 | + array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form') |
|
50 | 50 | ); |
51 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) ); |
|
51 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
52 | 52 | add_action( |
53 | 53 | 'wp_ajax_nopriv_save_payer_details', |
54 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) |
|
54 | + array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details') |
|
55 | 55 | ); |
56 | 56 | add_action( |
57 | 57 | 'wp_ajax_get_transaction_details_for_gateways', |
58 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
58 | + array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
59 | 59 | ); |
60 | 60 | add_action( |
61 | 61 | 'wp_ajax_nopriv_get_transaction_details_for_gateways', |
62 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
62 | + array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
63 | 63 | ); |
64 | 64 | add_filter( |
65 | 65 | 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', |
66 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), |
|
66 | + array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), |
|
67 | 67 | 10, |
68 | 68 | 1 |
69 | 69 | ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @throws \EE_Error |
78 | 78 | */ |
79 | 79 | public static function switch_spco_billing_form() { |
80 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
80 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @throws \EE_Error |
89 | 89 | */ |
90 | 90 | public static function save_payer_details() { |
91 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
91 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @throws \EE_Error |
100 | 100 | */ |
101 | 101 | public static function get_transaction_details() { |
102 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
102 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | * @access public |
127 | 127 | * @param EE_Checkout $checkout |
128 | 128 | */ |
129 | - public function __construct( EE_Checkout $checkout ) { |
|
129 | + public function __construct(EE_Checkout $checkout) { |
|
130 | 130 | $this->_slug = 'payment_options'; |
131 | - $this->_name = __( 'Payment Options', 'event_espresso' ); |
|
132 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
131 | + $this->_name = __('Payment Options', 'event_espresso'); |
|
132 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
133 | 133 | $this->checkout = $checkout; |
134 | 134 | $this->_reset_success_message(); |
135 | 135 | $this->set_instructions( |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | /** |
155 | 155 | * @param null $line_item_display |
156 | 156 | */ |
157 | - public function set_line_item_display( $line_item_display ) { |
|
157 | + public function set_line_item_display($line_item_display) { |
|
158 | 158 | $this->line_item_display = $line_item_display; |
159 | 159 | } |
160 | 160 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * @param boolean $handle_IPN_in_this_request |
174 | 174 | */ |
175 | - public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) { |
|
176 | - $this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN ); |
|
175 | + public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) { |
|
176 | + $this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | public function enqueue_styles_and_scripts() { |
209 | 209 | $transaction = $this->checkout->transaction; |
210 | 210 | //if the transaction isn't set or nothing is owed on it, don't enqueue any JS |
211 | - if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) { |
|
211 | + if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | - foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) { |
|
214 | + foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) { |
|
215 | 215 | $type_obj = $payment_method->type_obj(); |
216 | - if( $type_obj instanceof EE_PMT_Base ) { |
|
217 | - $billing_form = $type_obj->generate_new_billing_form( $transaction ); |
|
218 | - if( $billing_form instanceof EE_Form_Section_Proper ) { |
|
216 | + if ($type_obj instanceof EE_PMT_Base) { |
|
217 | + $billing_form = $type_obj->generate_new_billing_form($transaction); |
|
218 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
219 | 219 | $billing_form->enqueue_js(); |
220 | 220 | } |
221 | 221 | } |
@@ -240,20 +240,20 @@ discard block |
||
240 | 240 | // $ 0.00 transactions (no payment required) |
241 | 241 | ! $this->checkout->payment_required() |
242 | 242 | // but do NOT remove if current action being called belongs to this reg step |
243 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
243 | + && ! is_callable(array($this, $this->checkout->action)) |
|
244 | 244 | && ! $this->completed() |
245 | 245 | ) { |
246 | 246 | // and if so, then we no longer need the Payment Options step |
247 | - if ( $this->is_current_step() ) { |
|
247 | + if ($this->is_current_step()) { |
|
248 | 248 | $this->checkout->generate_reg_form = false; |
249 | 249 | } |
250 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
250 | + $this->checkout->remove_reg_step($this->_slug); |
|
251 | 251 | // DEBUG LOG |
252 | 252 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
253 | 253 | return false; |
254 | 254 | } |
255 | 255 | // load EEM_Payment_Method |
256 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
256 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
257 | 257 | // get all active payment methods |
258 | 258 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
259 | 259 | $this->checkout->transaction, |
@@ -280,15 +280,15 @@ discard block |
||
280 | 280 | $insufficient_spaces_available = array(); |
281 | 281 | $reg_count = 0; |
282 | 282 | // loop thru registrations to gather info |
283 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
283 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
284 | 284 | $ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space( |
285 | 285 | $registrations, |
286 | 286 | $this->checkout->revisit |
287 | 287 | ); |
288 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
288 | + foreach ($registrations as $REG_ID => $registration) { |
|
289 | 289 | // has this registration lost it's space ? |
290 | - if ( isset( $ejected_registrations[ $REG_ID ] ) ) { |
|
291 | - $insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event(); |
|
290 | + if (isset($ejected_registrations[$REG_ID])) { |
|
291 | + $insufficient_spaces_available[$registration->event()->ID()] = $registration->event(); |
|
292 | 292 | continue; |
293 | 293 | } |
294 | 294 | /** @var $registration EE_Registration */ |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | && $registration->status_ID() === EEM_Registration::status_id_approved |
301 | 301 | ) |
302 | 302 | ) { |
303 | - if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true ) ) { |
|
303 | + if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) { |
|
304 | 304 | // add event to list of events that are sold out |
305 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
305 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
306 | 306 | do_action( |
307 | 307 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
308 | 308 | $registration->event(), |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | continue; |
312 | 312 | } |
313 | 313 | // event requires admin approval |
314 | - if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) { |
|
314 | + if ($registration->status_ID() === EEM_Registration::status_id_not_approved) { |
|
315 | 315 | // add event to list of events with pre-approval reg status |
316 | - $registrations_requiring_pre_approval[ $REG_ID ] = $registration; |
|
316 | + $registrations_requiring_pre_approval[$REG_ID] = $registration; |
|
317 | 317 | do_action( |
318 | 318 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
319 | 319 | $registration->event(), |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | } |
323 | 323 | } |
324 | 324 | // are they allowed to pay now and is there monies owing? |
325 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
326 | - $registrations_requiring_payment[ $REG_ID ] = $registration; |
|
325 | + if ($registration->owes_monies_and_can_pay()) { |
|
326 | + $registrations_requiring_payment[$REG_ID] = $registration; |
|
327 | 327 | do_action( |
328 | 328 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
329 | 329 | $registration->event(), |
@@ -334,29 +334,29 @@ discard block |
||
334 | 334 | && $registration->status_ID() !== EEM_Registration::status_id_not_approved |
335 | 335 | && $registration->ticket()->is_free() |
336 | 336 | ) { |
337 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
337 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | $subsections = array(); |
341 | 341 | // now decide which template to load |
342 | - if ( ! empty( $sold_out_events ) ) { |
|
343 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
342 | + if ( ! empty($sold_out_events)) { |
|
343 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
344 | 344 | } |
345 | - if ( ! empty( $insufficient_spaces_available ) ) { |
|
345 | + if ( ! empty($insufficient_spaces_available)) { |
|
346 | 346 | $subsections['insufficient_space'] = $this->_insufficient_spaces_available( |
347 | 347 | $insufficient_spaces_available |
348 | 348 | ); |
349 | 349 | } |
350 | - if ( ! empty( $registrations_requiring_pre_approval ) ) { |
|
350 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
351 | 351 | $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( |
352 | 352 | $registrations_requiring_pre_approval |
353 | 353 | ); |
354 | 354 | } |
355 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
356 | - $subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events ); |
|
355 | + if ( ! empty($registrations_for_free_events)) { |
|
356 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
357 | 357 | } |
358 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
359 | - if ( $this->checkout->amount_owing > 0 ) { |
|
358 | + if ( ! empty($registrations_requiring_payment)) { |
|
359 | + if ($this->checkout->amount_owing > 0) { |
|
360 | 360 | // autoload Line_Item_Display classes |
361 | 361 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
362 | 362 | $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
@@ -369,15 +369,15 @@ discard block |
||
369 | 369 | /** @var EE_Line_Item $filtered_line_item_tree */ |
370 | 370 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
371 | 371 | EEH_Autoloader::register_line_item_display_autoloaders(); |
372 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
372 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
373 | 373 | $subsections['payment_options'] = $this->_display_payment_options( |
374 | 374 | $this->line_item_display->display_line_item( |
375 | 375 | $filtered_line_item_tree, |
376 | - array( 'registrations' => $registrations ) |
|
376 | + array('registrations' => $registrations) |
|
377 | 377 | ) |
378 | 378 | ); |
379 | 379 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
380 | - $this->_apply_registration_payments_to_amount_owing( $registrations ); |
|
380 | + $this->_apply_registration_payments_to_amount_owing($registrations); |
|
381 | 381 | } |
382 | 382 | } else { |
383 | 383 | $this->_hide_reg_step_submit_button_if_revisit(); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @return \EE_Line_Item_Filter_Collection |
409 | 409 | * @throws \EE_Error |
410 | 410 | */ |
411 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
411 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
412 | 412 | $line_item_filter_collection->add( |
413 | 413 | new EE_Billable_Line_Item_Filter( |
414 | 414 | EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations( |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | ) |
419 | 419 | ) |
420 | 420 | ); |
421 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
421 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
422 | 422 | return $line_item_filter_collection; |
423 | 423 | } |
424 | 424 | |
@@ -434,15 +434,15 @@ discard block |
||
434 | 434 | * @return \EE_Registration[] |
435 | 435 | * @throws \EE_Error |
436 | 436 | */ |
437 | - public static function remove_ejected_registrations( array $registrations ) { |
|
437 | + public static function remove_ejected_registrations(array $registrations) { |
|
438 | 438 | $ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space( |
439 | 439 | $registrations, |
440 | 440 | EE_Registry::instance()->SSN->checkout()->revisit |
441 | 441 | ); |
442 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
442 | + foreach ($registrations as $REG_ID => $registration) { |
|
443 | 443 | // has this registration lost it's space ? |
444 | - if ( isset( $ejected_registrations[ $REG_ID ] ) ) { |
|
445 | - unset( $registrations[ $REG_ID ] ); |
|
444 | + if (isset($ejected_registrations[$REG_ID])) { |
|
445 | + unset($registrations[$REG_ID]); |
|
446 | 446 | continue; |
447 | 447 | } |
448 | 448 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * @return array |
466 | 466 | * @throws \EE_Error |
467 | 467 | */ |
468 | - public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) { |
|
468 | + public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) { |
|
469 | 469 | // registrations per event |
470 | 470 | $event_reg_count = array(); |
471 | 471 | // spaces left per event |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | $tickets_remaining = array(); |
475 | 475 | // registrations that have lost their space |
476 | 476 | $ejected_registrations = array(); |
477 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
478 | - if ( $registration->status_ID() === EEM_Registration::status_id_approved ) { |
|
477 | + foreach ($registrations as $REG_ID => $registration) { |
|
478 | + if ($registration->status_ID() === EEM_Registration::status_id_approved) { |
|
479 | 479 | continue; |
480 | 480 | } |
481 | 481 | $EVT_ID = $registration->event_ID(); |
@@ -496,13 +496,13 @@ discard block |
||
496 | 496 | $revisit |
497 | 497 | && ( |
498 | 498 | $tickets_remaining[$ticket->ID()] === 0 |
499 | - || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ] |
|
499 | + || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID] |
|
500 | 500 | ) |
501 | 501 | ) { |
502 | - $ejected_registrations[ $REG_ID ] = $registration->event(); |
|
503 | - if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) { |
|
502 | + $ejected_registrations[$REG_ID] = $registration->event(); |
|
503 | + if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) { |
|
504 | 504 | /** @type EE_Registration_Processor $registration_processor */ |
505 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
505 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
506 | 506 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
507 | 507 | $registration_processor->manually_update_registration_status( |
508 | 508 | $registration, |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | * @return void |
538 | 538 | */ |
539 | 539 | protected function _hide_reg_step_submit_button_if_revisit() { |
540 | - if ( $this->checkout->revisit ) { |
|
541 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
540 | + if ($this->checkout->revisit) { |
|
541 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
@@ -552,13 +552,13 @@ discard block |
||
552 | 552 | * @return \EE_Form_Section_Proper |
553 | 553 | * @throws \EE_Error |
554 | 554 | */ |
555 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
555 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
556 | 556 | // set some defaults |
557 | 557 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
558 | 558 | $sold_out_events = ''; |
559 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
559 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
560 | 560 | $sold_out_events .= EEH_HTML::li( |
561 | - EEH_HTML::span( ' ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ) |
|
561 | + EEH_HTML::span(' '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text') |
|
562 | 562 | ); |
563 | 563 | } |
564 | 564 | return new EE_Form_Section_Proper( |
@@ -605,14 +605,14 @@ discard block |
||
605 | 605 | * @return \EE_Form_Section_Proper |
606 | 606 | * @throws \EE_Error |
607 | 607 | */ |
608 | - private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) { |
|
608 | + private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) { |
|
609 | 609 | // set some defaults |
610 | 610 | $this->checkout->selected_method_of_payment = 'invoice'; |
611 | 611 | $insufficient_space_events = ''; |
612 | - foreach ( $insufficient_spaces_events_array as $event ) { |
|
613 | - if ( $event instanceof EE_Event ) { |
|
612 | + foreach ($insufficient_spaces_events_array as $event) { |
|
613 | + if ($event instanceof EE_Event) { |
|
614 | 614 | $insufficient_space_events .= EEH_HTML::li( |
615 | - EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ) |
|
615 | + EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text') |
|
616 | 616 | ); |
617 | 617 | } |
618 | 618 | } |
@@ -656,17 +656,17 @@ discard block |
||
656 | 656 | * @return \EE_Form_Section_Proper |
657 | 657 | * @throws \EE_Error |
658 | 658 | */ |
659 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) { |
|
659 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
660 | 660 | $events_requiring_pre_approval = ''; |
661 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
662 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
663 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
661 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
662 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
663 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
664 | 664 | EEH_HTML::span( |
665 | 665 | '', |
666 | 666 | '', |
667 | 667 | 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
668 | 668 | ) |
669 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
669 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
670 | 670 | ); |
671 | 671 | } |
672 | 672 | } |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | 'template_args' => apply_filters( |
686 | 686 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
687 | 687 | array( |
688 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
688 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
689 | 689 | 'events_requiring_pre_approval_msg' => apply_filters( |
690 | 690 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
691 | 691 | __( |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | * @return \EE_Form_Section_Proper |
711 | 711 | * @throws \EE_Error |
712 | 712 | */ |
713 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
713 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
714 | 714 | // set some defaults |
715 | 715 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
716 | 716 | // generate no_payment_required form |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | 'ticket_count' => array(), |
735 | 735 | 'registrations_for_free_events' => $registrations_for_free_events, |
736 | 736 | 'no_payment_required_msg' => EEH_HTML::p( |
737 | - __( 'This is a free event, so no billing will occur.', 'event_espresso' ) |
|
737 | + __('This is a free event, so no billing will occur.', 'event_espresso') |
|
738 | 738 | ) |
739 | 739 | ) |
740 | 740 | ), |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | * @return \EE_Form_Section_Proper |
754 | 754 | * @throws \EE_Error |
755 | 755 | */ |
756 | - private function _display_payment_options( $transaction_details = '' ) { |
|
756 | + private function _display_payment_options($transaction_details = '') { |
|
757 | 757 | // has method_of_payment been set by no-js user? |
758 | 758 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
759 | 759 | // build payment options form |
@@ -765,18 +765,18 @@ discard block |
||
765 | 765 | 'before_payment_options' => apply_filters( |
766 | 766 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
767 | 767 | new EE_Form_Section_Proper( |
768 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
768 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
769 | 769 | ) |
770 | 770 | ), |
771 | 771 | 'payment_options' => $this->_setup_payment_options(), |
772 | 772 | 'after_payment_options' => apply_filters( |
773 | 773 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
774 | 774 | new EE_Form_Section_Proper( |
775 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
775 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
776 | 776 | ) |
777 | 777 | ), |
778 | 778 | 'default_hidden_inputs' => $this->reg_step_hidden_inputs(), |
779 | - 'extra_hidden_inputs' => $this->_extra_hidden_inputs( false ) |
|
779 | + 'extra_hidden_inputs' => $this->_extra_hidden_inputs(false) |
|
780 | 780 | ), |
781 | 781 | 'layout_strategy' => new EE_Template_Layout( |
782 | 782 | array( |
@@ -805,10 +805,10 @@ discard block |
||
805 | 805 | * @return \EE_Form_Section_Proper |
806 | 806 | * @throws \EE_Error |
807 | 807 | */ |
808 | - private function _extra_hidden_inputs( $no_payment_required = true ) { |
|
808 | + private function _extra_hidden_inputs($no_payment_required = true) { |
|
809 | 809 | return new EE_Form_Section_Proper( |
810 | 810 | array( |
811 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
811 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
812 | 812 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
813 | 813 | 'subsections' => array( |
814 | 814 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -840,16 +840,16 @@ discard block |
||
840 | 840 | * @access protected |
841 | 841 | * @param array $registrations |
842 | 842 | */ |
843 | - protected function _apply_registration_payments_to_amount_owing( array $registrations ) { |
|
843 | + protected function _apply_registration_payments_to_amount_owing(array $registrations) { |
|
844 | 844 | $payments = array(); |
845 | - foreach ( $registrations as $registration ) { |
|
846 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
845 | + foreach ($registrations as $registration) { |
|
846 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
847 | 847 | $payments += $registration->registration_payments(); |
848 | 848 | } |
849 | 849 | } |
850 | - if ( ! empty( $payments ) ) { |
|
851 | - foreach ( $payments as $payment ) { |
|
852 | - if ( $payment instanceof EE_Registration_Payment ) { |
|
850 | + if ( ! empty($payments)) { |
|
851 | + foreach ($payments as $payment) { |
|
852 | + if ($payment instanceof EE_Registration_Payment) { |
|
853 | 853 | $this->checkout->amount_owing -= $payment->amount(); |
854 | 854 | } |
855 | 855 | } |
@@ -865,11 +865,11 @@ discard block |
||
865 | 865 | * @param bool $force_reset |
866 | 866 | * @return void |
867 | 867 | */ |
868 | - private function _reset_selected_method_of_payment( $force_reset = false ) { |
|
868 | + private function _reset_selected_method_of_payment($force_reset = false) { |
|
869 | 869 | $reset_payment_method = $force_reset |
870 | 870 | ? true |
871 | - : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) ); |
|
872 | - if ( $reset_payment_method ) { |
|
871 | + : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false)); |
|
872 | + if ($reset_payment_method) { |
|
873 | 873 | $this->checkout->selected_method_of_payment = null; |
874 | 874 | $this->checkout->payment_method = null; |
875 | 875 | $this->checkout->billing_form = null; |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | * @param string $selected_method_of_payment |
889 | 889 | * @return void |
890 | 890 | */ |
891 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
892 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) |
|
891 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
892 | + $selected_method_of_payment = ! empty($selected_method_of_payment) |
|
893 | 893 | ? $selected_method_of_payment |
894 | 894 | : $this->checkout->selected_method_of_payment; |
895 | 895 | EE_Registry::instance()->SSN->set_session_data( |
896 | - array( 'selected_method_of_payment' => $selected_method_of_payment ) |
|
896 | + array('selected_method_of_payment' => $selected_method_of_payment) |
|
897 | 897 | ); |
898 | 898 | } |
899 | 899 | |
@@ -909,19 +909,19 @@ discard block |
||
909 | 909 | // load payment method classes |
910 | 910 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
911 | 911 | // switch up header depending on number of available payment methods |
912 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
912 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
913 | 913 | ? apply_filters( |
914 | 914 | 'FHEE__registration_page_payment_options__method_of_payment_hdr', |
915 | - __( 'Please Select Your Method of Payment', 'event_espresso' ) |
|
915 | + __('Please Select Your Method of Payment', 'event_espresso') |
|
916 | 916 | ) |
917 | 917 | : apply_filters( |
918 | 918 | 'FHEE__registration_page_payment_options__method_of_payment_hdr', |
919 | - __( 'Method of Payment', 'event_espresso' ) |
|
919 | + __('Method of Payment', 'event_espresso') |
|
920 | 920 | ); |
921 | 921 | $available_payment_methods = array( |
922 | 922 | // display the "Payment Method" header |
923 | 923 | 'payment_method_header' => new EE_Form_Section_HTML( |
924 | - EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' ) |
|
924 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
925 | 925 | ) |
926 | 926 | ); |
927 | 927 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
@@ -930,32 +930,32 @@ discard block |
||
930 | 930 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
931 | 931 | $payment_methods_billing_info = array( |
932 | 932 | new EE_Form_Section_HTML( |
933 | - EEH_HTML::div( '<br />', '', '', 'clear:both;' ) |
|
933 | + EEH_HTML::div('<br />', '', '', 'clear:both;') |
|
934 | 934 | ) |
935 | 935 | ); |
936 | 936 | // loop through payment methods |
937 | - foreach ( $this->checkout->available_payment_methods as $payment_method ) { |
|
938 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
937 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
938 | + if ($payment_method instanceof EE_Payment_Method) { |
|
939 | 939 | $payment_method_button = EEH_HTML::img( |
940 | 940 | $payment_method->button_url(), |
941 | 941 | $payment_method->name(), |
942 | - 'spco-payment-method-' . $payment_method->slug() . '-btn-img', |
|
942 | + 'spco-payment-method-'.$payment_method->slug().'-btn-img', |
|
943 | 943 | 'spco-payment-method-btn-img' |
944 | 944 | ); |
945 | 945 | // check if any payment methods are set as default |
946 | 946 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
947 | 947 | if ( |
948 | - ( $this->checkout->selected_method_of_payment === $payment_method->slug() ) |
|
949 | - || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() ) |
|
948 | + ($this->checkout->selected_method_of_payment === $payment_method->slug()) |
|
949 | + || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default()) |
|
950 | 950 | ) { |
951 | 951 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
952 | 952 | $this->_save_selected_method_of_payment(); |
953 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
953 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
954 | 954 | } else { |
955 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
955 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
956 | 956 | } |
957 | - $payment_methods_billing_info[ $payment_method->slug() |
|
958 | - . '-info' ] = $this->_payment_method_billing_info( |
|
957 | + $payment_methods_billing_info[$payment_method->slug() |
|
958 | + . '-info'] = $this->_payment_method_billing_info( |
|
959 | 959 | $payment_method |
960 | 960 | ); |
961 | 961 | } |
@@ -985,12 +985,12 @@ discard block |
||
985 | 985 | * @return EE_Payment_Method[] |
986 | 986 | */ |
987 | 987 | protected function _get_available_payment_methods() { |
988 | - if ( ! empty( $this->checkout->available_payment_methods ) ) { |
|
988 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
989 | 989 | return $this->checkout->available_payment_methods; |
990 | 990 | } |
991 | 991 | $available_payment_methods = array(); |
992 | 992 | // load EEM_Payment_Method |
993 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
993 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
994 | 994 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
995 | 995 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
996 | 996 | // get all active payment methods |
@@ -998,9 +998,9 @@ discard block |
||
998 | 998 | $this->checkout->transaction, |
999 | 999 | EEM_Payment_Method::scope_cart |
1000 | 1000 | ); |
1001 | - foreach ( $payment_methods as $payment_method ) { |
|
1002 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
1003 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
1001 | + foreach ($payment_methods as $payment_method) { |
|
1002 | + if ($payment_method instanceof EE_Payment_Method) { |
|
1003 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | return $available_payment_methods; |
@@ -1015,14 +1015,14 @@ discard block |
||
1015 | 1015 | * @param array $available_payment_method_options |
1016 | 1016 | * @return \EE_Form_Section_Proper |
1017 | 1017 | */ |
1018 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
1018 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
1019 | 1019 | // generate inputs |
1020 | 1020 | return new EE_Form_Section_Proper( |
1021 | 1021 | array( |
1022 | 1022 | 'html_id' => 'ee-available-payment-method-inputs', |
1023 | 1023 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
1024 | 1024 | 'subsections' => array( |
1025 | - '' => new EE_Radio_Button_Input ( |
|
1025 | + '' => new EE_Radio_Button_Input( |
|
1026 | 1026 | $available_payment_method_options, |
1027 | 1027 | array( |
1028 | 1028 | 'html_name' => 'selected_method_of_payment', |
@@ -1047,28 +1047,28 @@ discard block |
||
1047 | 1047 | * @return \EE_Form_Section_Proper |
1048 | 1048 | * @throws \EE_Error |
1049 | 1049 | */ |
1050 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
1050 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
1051 | 1051 | $currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug() |
1052 | 1052 | ? true |
1053 | 1053 | : false; |
1054 | 1054 | // generate the billing form for payment method |
1055 | 1055 | $billing_form = $currently_selected |
1056 | - ? $this->_get_billing_form_for_payment_method( $payment_method ) |
|
1056 | + ? $this->_get_billing_form_for_payment_method($payment_method) |
|
1057 | 1057 | : new EE_Form_Section_HTML(); |
1058 | 1058 | $this->checkout->billing_form = $currently_selected |
1059 | 1059 | ? $billing_form |
1060 | 1060 | : $this->checkout->billing_form; |
1061 | 1061 | // it's all in the details |
1062 | 1062 | $info_html = EEH_HTML::h3( |
1063 | - __( 'Important information regarding your payment', 'event_espresso' ), |
|
1063 | + __('Important information regarding your payment', 'event_espresso'), |
|
1064 | 1064 | '', |
1065 | 1065 | 'spco-payment-method-hdr' |
1066 | 1066 | ); |
1067 | 1067 | // add some info regarding the step, either from what's saved in the admin, |
1068 | 1068 | // or a default string depending on whether the PM has a billing form or not |
1069 | - if ( $payment_method->description() ) { |
|
1069 | + if ($payment_method->description()) { |
|
1070 | 1070 | $payment_method_info = $payment_method->description(); |
1071 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
1071 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
1072 | 1072 | $payment_method_info = sprintf( |
1073 | 1073 | __( |
1074 | 1074 | 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | ); |
1079 | 1079 | } else { |
1080 | 1080 | $payment_method_info = sprintf( |
1081 | - __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), |
|
1081 | + __('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), |
|
1082 | 1082 | $this->submit_button_text() |
1083 | 1083 | ); |
1084 | 1084 | } |
@@ -1092,13 +1092,13 @@ discard block |
||
1092 | 1092 | ); |
1093 | 1093 | return new EE_Form_Section_Proper( |
1094 | 1094 | array( |
1095 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
1095 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
1096 | 1096 | 'html_class' => 'spco-payment-method-info-dv', |
1097 | 1097 | // only display the selected or default PM |
1098 | 1098 | 'html_style' => $currently_selected ? '' : 'display:none;', |
1099 | 1099 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
1100 | 1100 | 'subsections' => array( |
1101 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
1101 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
1102 | 1102 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
1103 | 1103 | ) |
1104 | 1104 | ) |
@@ -1116,15 +1116,15 @@ discard block |
||
1116 | 1116 | */ |
1117 | 1117 | public function get_billing_form_html_for_payment_method() { |
1118 | 1118 | // how have they chosen to pay? |
1119 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1119 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1120 | 1120 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
1121 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
1121 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
1122 | 1122 | return false; |
1123 | 1123 | } |
1124 | - if ( apply_filters( |
|
1124 | + if (apply_filters( |
|
1125 | 1125 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1126 | 1126 | false |
1127 | - ) ) { |
|
1127 | + )) { |
|
1128 | 1128 | EE_Error::add_success( |
1129 | 1129 | apply_filters( |
1130 | 1130 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | ); |
1140 | 1140 | } |
1141 | 1141 | // now generate billing form for selected method of payment |
1142 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1142 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1143 | 1143 | // fill form with attendee info if applicable |
1144 | 1144 | if ( |
1145 | 1145 | $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form |
@@ -1161,10 +1161,10 @@ discard block |
||
1161 | 1161 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper |
1162 | 1162 | ? $payment_method_billing_form->get_html() |
1163 | 1163 | : ''; |
1164 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) ); |
|
1164 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
1165 | 1165 | // localize validation rules for main form |
1166 | 1166 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
1167 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
1167 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
1168 | 1168 | return true; |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1178,18 +1178,18 @@ discard block |
||
1178 | 1178 | * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML |
1179 | 1179 | * @throws \EE_Error |
1180 | 1180 | */ |
1181 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
1181 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
1182 | 1182 | $billing_form = $payment_method->type_obj()->billing_form( |
1183 | 1183 | $this->checkout->transaction, |
1184 | - array( 'amount_owing' => $this->checkout->amount_owing ) |
|
1184 | + array('amount_owing' => $this->checkout->amount_owing) |
|
1185 | 1185 | ); |
1186 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
1186 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
1187 | 1187 | if ( |
1188 | 1188 | apply_filters( |
1189 | 1189 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1190 | 1190 | false |
1191 | 1191 | ) |
1192 | - && EE_Registry::instance()->REQ->is_set( 'payment_method' ) |
|
1192 | + && EE_Registry::instance()->REQ->is_set('payment_method') |
|
1193 | 1193 | ) { |
1194 | 1194 | EE_Error::add_success( |
1195 | 1195 | apply_filters( |
@@ -1231,15 +1231,15 @@ discard block |
||
1231 | 1231 | $request_param = 'selected_method_of_payment' |
1232 | 1232 | ) { |
1233 | 1233 | // is selected_method_of_payment set in the request ? |
1234 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false ); |
|
1235 | - if ( $selected_method_of_payment ) { |
|
1234 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false); |
|
1235 | + if ($selected_method_of_payment) { |
|
1236 | 1236 | // sanitize it |
1237 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) |
|
1238 | - ? array_shift( $selected_method_of_payment ) |
|
1237 | + $selected_method_of_payment = is_array($selected_method_of_payment) |
|
1238 | + ? array_shift($selected_method_of_payment) |
|
1239 | 1239 | : $selected_method_of_payment; |
1240 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
1240 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
1241 | 1241 | // store it in the session so that it's available for all subsequent requests including AJAX |
1242 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
1242 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
1243 | 1243 | } else { |
1244 | 1244 | // or is is set in the session ? |
1245 | 1245 | $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | ); |
1248 | 1248 | } |
1249 | 1249 | // do ya really really gotta have it? |
1250 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
1250 | + if (empty($selected_method_of_payment) && $required) { |
|
1251 | 1251 | EE_Error::add_error( |
1252 | 1252 | sprintf( |
1253 | 1253 | __( |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | ), |
1257 | 1257 | '<br/>', |
1258 | 1258 | '<br/>', |
1259 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1259 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1260 | 1260 | ), |
1261 | 1261 | __FILE__, |
1262 | 1262 | __FUNCTION__, |
@@ -1283,13 +1283,13 @@ discard block |
||
1283 | 1283 | * @throws \EE_Error |
1284 | 1284 | */ |
1285 | 1285 | public function switch_payment_method() { |
1286 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
1286 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
1287 | 1287 | return false; |
1288 | 1288 | } |
1289 | - if ( apply_filters( |
|
1289 | + if (apply_filters( |
|
1290 | 1290 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1291 | 1291 | false |
1292 | - ) ) { |
|
1292 | + )) { |
|
1293 | 1293 | EE_Error::add_success( |
1294 | 1294 | apply_filters( |
1295 | 1295 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -1304,13 +1304,13 @@ discard block |
||
1304 | 1304 | ); |
1305 | 1305 | } |
1306 | 1306 | // generate billing form for selected method of payment if it hasn't been done already |
1307 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1307 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1308 | 1308 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1309 | 1309 | $this->checkout->payment_method |
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | // fill form with attendee info if applicable |
1313 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form |
|
1313 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form |
|
1314 | 1314 | && $this->checkout->transaction_has_primary_registrant() |
1315 | 1315 | ) { |
1316 | 1316 | $this->checkout->billing_form->populate_from_attendee( |
@@ -1318,7 +1318,7 @@ discard block |
||
1318 | 1318 | ); |
1319 | 1319 | } |
1320 | 1320 | // and debug content |
1321 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form |
|
1321 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form |
|
1322 | 1322 | && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
1323 | 1323 | ) { |
1324 | 1324 | $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
@@ -1326,15 +1326,15 @@ discard block |
||
1326 | 1326 | ); |
1327 | 1327 | } |
1328 | 1328 | // get html and validation rules for form |
1329 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
1329 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
1330 | 1330 | $this->checkout->json_response->set_return_data( |
1331 | - array( 'payment_method_info' => $this->checkout->billing_form->get_html() ) |
|
1331 | + array('payment_method_info' => $this->checkout->billing_form->get_html()) |
|
1332 | 1332 | ); |
1333 | 1333 | // localize validation rules for main form |
1334 | - $this->checkout->billing_form->localize_validation_rules( true ); |
|
1335 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
1334 | + $this->checkout->billing_form->localize_validation_rules(true); |
|
1335 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
1336 | 1336 | } else { |
1337 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) ); |
|
1337 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
1338 | 1338 | } |
1339 | 1339 | //prevents advancement to next step |
1340 | 1340 | $this->checkout->continue_reg = false; |
@@ -1351,12 +1351,12 @@ discard block |
||
1351 | 1351 | */ |
1352 | 1352 | protected function _verify_payment_method_is_set() { |
1353 | 1353 | // generate billing form for selected method of payment if it hasn't been done already |
1354 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1354 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1355 | 1355 | // how have they chosen to pay? |
1356 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1356 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1357 | 1357 | } |
1358 | 1358 | // verify payment method |
1359 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
1359 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
1360 | 1360 | // get payment method for selected method of payment |
1361 | 1361 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
1362 | 1362 | } |
@@ -1375,25 +1375,25 @@ discard block |
||
1375 | 1375 | * @throws \EE_Error |
1376 | 1376 | */ |
1377 | 1377 | public function save_payer_details_via_ajax() { |
1378 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
1378 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
1379 | 1379 | return; |
1380 | 1380 | } |
1381 | 1381 | // generate billing form for selected method of payment if it hasn't been done already |
1382 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1382 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1383 | 1383 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1384 | 1384 | $this->checkout->payment_method |
1385 | 1385 | ); |
1386 | 1386 | } |
1387 | 1387 | // generate primary attendee from payer info if applicable |
1388 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1388 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1389 | 1389 | $attendee = $this->_create_attendee_from_request_data(); |
1390 | - if ( $attendee instanceof EE_Attendee ) { |
|
1391 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
1392 | - if ( $registration->is_primary_registrant() ) { |
|
1390 | + if ($attendee instanceof EE_Attendee) { |
|
1391 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
1392 | + if ($registration->is_primary_registrant()) { |
|
1393 | 1393 | $this->checkout->primary_attendee_obj = $attendee; |
1394 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1395 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1396 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1394 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1395 | + $registration->set_attendee_id($attendee->ID()); |
|
1396 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1397 | 1397 | } |
1398 | 1398 | } |
1399 | 1399 | } |
@@ -1411,50 +1411,50 @@ discard block |
||
1411 | 1411 | */ |
1412 | 1412 | protected function _create_attendee_from_request_data() { |
1413 | 1413 | // get State ID |
1414 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
1415 | - if ( ! empty( $STA_ID ) ) { |
|
1414 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
1415 | + if ( ! empty($STA_ID)) { |
|
1416 | 1416 | // can we get state object from name ? |
1417 | - EE_Registry::instance()->load_model( 'State' ); |
|
1418 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' ); |
|
1419 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
1417 | + EE_Registry::instance()->load_model('State'); |
|
1418 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
1419 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
1420 | 1420 | } |
1421 | 1421 | // get Country ISO |
1422 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
1423 | - if ( ! empty( $CNT_ISO ) ) { |
|
1422 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
1423 | + if ( ! empty($CNT_ISO)) { |
|
1424 | 1424 | // can we get country object from name ? |
1425 | - EE_Registry::instance()->load_model( 'Country' ); |
|
1425 | + EE_Registry::instance()->load_model('Country'); |
|
1426 | 1426 | $country = EEM_Country::instance()->get_col( |
1427 | - array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ), |
|
1427 | + array(array('CNT_name' => $CNT_ISO), 'limit' => 1), |
|
1428 | 1428 | 'CNT_ISO' |
1429 | 1429 | ); |
1430 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
1430 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
1431 | 1431 | } |
1432 | 1432 | // grab attendee data |
1433 | 1433 | $attendee_data = array( |
1434 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
1435 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
1436 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1437 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1438 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1439 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
1434 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
1435 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
1436 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1437 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1438 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1439 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1440 | 1440 | 'STA_ID' => $STA_ID, |
1441 | 1441 | 'CNT_ISO' => $CNT_ISO, |
1442 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1443 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1442 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1443 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1444 | 1444 | ); |
1445 | 1445 | // validate the email address since it is the most important piece of info |
1446 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) { |
|
1446 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) { |
|
1447 | 1447 | EE_Error::add_error( |
1448 | - __( 'An invalid email address was submitted.', 'event_espresso' ), |
|
1448 | + __('An invalid email address was submitted.', 'event_espresso'), |
|
1449 | 1449 | __FILE__, |
1450 | 1450 | __FUNCTION__, |
1451 | 1451 | __LINE__ |
1452 | 1452 | ); |
1453 | 1453 | } |
1454 | 1454 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1455 | - if ( ! empty( $attendee_data['ATT_fname'] ) |
|
1456 | - && ! empty( $attendee_data['ATT_lname'] ) |
|
1457 | - && ! empty( $attendee_data['ATT_email'] ) |
|
1455 | + if ( ! empty($attendee_data['ATT_fname']) |
|
1456 | + && ! empty($attendee_data['ATT_lname']) |
|
1457 | + && ! empty($attendee_data['ATT_email']) |
|
1458 | 1458 | ) { |
1459 | 1459 | $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( |
1460 | 1460 | array( |
@@ -1463,19 +1463,19 @@ discard block |
||
1463 | 1463 | 'ATT_email' => $attendee_data['ATT_email'] |
1464 | 1464 | ) |
1465 | 1465 | ); |
1466 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1466 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1467 | 1467 | return $existing_attendee; |
1468 | 1468 | } |
1469 | 1469 | } |
1470 | 1470 | // no existing attendee? kk let's create a new one |
1471 | 1471 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1472 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) |
|
1472 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) |
|
1473 | 1473 | ? $attendee_data['ATT_fname'] |
1474 | 1474 | : $attendee_data['ATT_email']; |
1475 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) |
|
1475 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) |
|
1476 | 1476 | ? $attendee_data['ATT_lname'] |
1477 | 1477 | : $attendee_data['ATT_email']; |
1478 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1478 | + return EE_Attendee::new_instance($attendee_data); |
|
1479 | 1479 | } |
1480 | 1480 | |
1481 | 1481 | |
@@ -1493,26 +1493,26 @@ discard block |
||
1493 | 1493 | // how have they chosen to pay? |
1494 | 1494 | $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() |
1495 | 1495 | ? 'no_payment_required' |
1496 | - : $this->_get_selected_method_of_payment( true ); |
|
1496 | + : $this->_get_selected_method_of_payment(true); |
|
1497 | 1497 | // choose your own adventure based on method_of_payment |
1498 | - switch ( $this->checkout->selected_method_of_payment ) { |
|
1498 | + switch ($this->checkout->selected_method_of_payment) { |
|
1499 | 1499 | |
1500 | 1500 | case 'events_sold_out' : |
1501 | 1501 | $this->checkout->redirect = true; |
1502 | 1502 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1503 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1503 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1504 | 1504 | // mark this reg step as completed |
1505 | 1505 | $this->set_completed(); |
1506 | 1506 | return false; |
1507 | 1507 | break; |
1508 | 1508 | |
1509 | 1509 | case 'payments_closed' : |
1510 | - if ( apply_filters( |
|
1510 | + if (apply_filters( |
|
1511 | 1511 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', |
1512 | 1512 | false |
1513 | - ) ) { |
|
1513 | + )) { |
|
1514 | 1514 | EE_Error::add_success( |
1515 | - __( 'no payment required at this time.', 'event_espresso' ), |
|
1515 | + __('no payment required at this time.', 'event_espresso'), |
|
1516 | 1516 | __FILE__, |
1517 | 1517 | __FUNCTION__, |
1518 | 1518 | __LINE__ |
@@ -1524,12 +1524,12 @@ discard block |
||
1524 | 1524 | break; |
1525 | 1525 | |
1526 | 1526 | case 'no_payment_required' : |
1527 | - if ( apply_filters( |
|
1527 | + if (apply_filters( |
|
1528 | 1528 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', |
1529 | 1529 | false |
1530 | - ) ) { |
|
1530 | + )) { |
|
1531 | 1531 | EE_Error::add_success( |
1532 | - __( 'no payment required.', 'event_espresso' ), |
|
1532 | + __('no payment required.', 'event_espresso'), |
|
1533 | 1533 | __FILE__, |
1534 | 1534 | __FUNCTION__, |
1535 | 1535 | __LINE__ |
@@ -1549,15 +1549,15 @@ discard block |
||
1549 | 1549 | EE_Registry::instance()->SSN->checkout()->revisit |
1550 | 1550 | ); |
1551 | 1551 | // calculate difference between the two arrays |
1552 | - $registrations = array_diff( $registrations, $ejected_registrations ); |
|
1553 | - if ( empty( $registrations ) ) { |
|
1552 | + $registrations = array_diff($registrations, $ejected_registrations); |
|
1553 | + if (empty($registrations)) { |
|
1554 | 1554 | $this->_redirect_because_event_sold_out(); |
1555 | 1555 | return false; |
1556 | 1556 | } |
1557 | 1557 | $payment_successful = $this->_process_payment(); |
1558 | - if ( $payment_successful ) { |
|
1558 | + if ($payment_successful) { |
|
1559 | 1559 | $this->checkout->continue_reg = true; |
1560 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1560 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1561 | 1561 | } else { |
1562 | 1562 | $this->checkout->continue_reg = false; |
1563 | 1563 | } |
@@ -1578,10 +1578,10 @@ discard block |
||
1578 | 1578 | $this->checkout->continue_reg = false; |
1579 | 1579 | // set redirect URL |
1580 | 1580 | $this->checkout->redirect_url = add_query_arg( |
1581 | - array( 'e_reg_url_link' => $this->checkout->reg_url_link ), |
|
1581 | + array('e_reg_url_link' => $this->checkout->reg_url_link), |
|
1582 | 1582 | $this->checkout->current_step->reg_step_url() |
1583 | 1583 | ); |
1584 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1584 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1585 | 1585 | } |
1586 | 1586 | |
1587 | 1587 | |
@@ -1594,8 +1594,8 @@ discard block |
||
1594 | 1594 | * @return void |
1595 | 1595 | * @throws \EE_Error |
1596 | 1596 | */ |
1597 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1598 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1597 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1598 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1599 | 1599 | case EE_PMT_Base::offsite : |
1600 | 1600 | break; |
1601 | 1601 | case EE_PMT_Base::onsite : |
@@ -1618,7 +1618,7 @@ discard block |
||
1618 | 1618 | public function update_reg_step() { |
1619 | 1619 | $success = true; |
1620 | 1620 | // if payment required |
1621 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1621 | + if ($this->checkout->transaction->total() > 0) { |
|
1622 | 1622 | do_action( |
1623 | 1623 | 'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', |
1624 | 1624 | $this->checkout->transaction |
@@ -1626,13 +1626,13 @@ discard block |
||
1626 | 1626 | // attempt payment via payment method |
1627 | 1627 | $success = $this->process_reg_step(); |
1628 | 1628 | } |
1629 | - if ( $success && ! $this->checkout->redirect ) { |
|
1629 | + if ($success && ! $this->checkout->redirect) { |
|
1630 | 1630 | $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
1631 | 1631 | $this->checkout->transaction->ID() |
1632 | 1632 | ); |
1633 | 1633 | // set return URL |
1634 | 1634 | $this->checkout->redirect_url = add_query_arg( |
1635 | - array( 'e_reg_url_link' => $this->checkout->reg_url_link ), |
|
1635 | + array('e_reg_url_link' => $this->checkout->reg_url_link), |
|
1636 | 1636 | $this->checkout->thank_you_page_url |
1637 | 1637 | ); |
1638 | 1638 | } |
@@ -1652,28 +1652,28 @@ discard block |
||
1652 | 1652 | // clear any previous errors related to not selecting a payment method |
1653 | 1653 | // EE_Error::overwrite_errors(); |
1654 | 1654 | // ya gotta make a choice man |
1655 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1655 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1656 | 1656 | $this->checkout->json_response->set_plz_select_method_of_payment( |
1657 | - __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
1657 | + __('Please select a method of payment before proceeding.', 'event_espresso') |
|
1658 | 1658 | ); |
1659 | 1659 | return false; |
1660 | 1660 | } |
1661 | 1661 | // get EE_Payment_Method object |
1662 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1662 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1663 | 1663 | return false; |
1664 | 1664 | } |
1665 | 1665 | // setup billing form |
1666 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1666 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1667 | 1667 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1668 | 1668 | $this->checkout->payment_method |
1669 | 1669 | ); |
1670 | 1670 | // bad billing form ? |
1671 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1671 | + if ( ! $this->_billing_form_is_valid()) { |
|
1672 | 1672 | return false; |
1673 | 1673 | } |
1674 | 1674 | } |
1675 | 1675 | // ensure primary registrant has been fully processed |
1676 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1676 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1677 | 1677 | return false; |
1678 | 1678 | } |
1679 | 1679 | /** @type EE_Transaction_Processor $transaction_processor */ |
@@ -1681,12 +1681,12 @@ discard block |
||
1681 | 1681 | // in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved |
1682 | 1682 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1683 | 1683 | // attempt payment |
1684 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1684 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1685 | 1685 | // process results |
1686 | - $payment = $this->_validate_payment( $payment ); |
|
1687 | - $payment = $this->_post_payment_processing( $payment ); |
|
1686 | + $payment = $this->_validate_payment($payment); |
|
1687 | + $payment = $this->_post_payment_processing($payment); |
|
1688 | 1688 | // verify payment |
1689 | - if ( $payment instanceof EE_Payment ) { |
|
1689 | + if ($payment instanceof EE_Payment) { |
|
1690 | 1690 | // store that for later |
1691 | 1691 | $this->checkout->payment = $payment; |
1692 | 1692 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | } else { |
1701 | 1701 | return false; |
1702 | 1702 | } |
1703 | - } else if ( $payment === true ) { |
|
1703 | + } else if ($payment === true) { |
|
1704 | 1704 | // please note that offline payment methods will NOT make a payment, |
1705 | 1705 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1706 | 1706 | $this->checkout->payment = $payment; |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | ); |
1726 | 1726 | $html = $payment_method_billing_info->get_html(); |
1727 | 1727 | $html .= $this->checkout->redirect_form; |
1728 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1728 | + EE_Registry::instance()->REQ->add_output($html); |
|
1729 | 1729 | return true; |
1730 | 1730 | } |
1731 | 1731 | |
@@ -1739,28 +1739,28 @@ discard block |
||
1739 | 1739 | * @throws \EE_Error |
1740 | 1740 | */ |
1741 | 1741 | private function _billing_form_is_valid() { |
1742 | - if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1742 | + if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1743 | 1743 | return true; |
1744 | 1744 | } |
1745 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1746 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1745 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1746 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1747 | 1747 | $this->checkout->billing_form->receive_form_submission(); |
1748 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1748 | + if ($this->checkout->billing_form->is_valid()) { |
|
1749 | 1749 | return true; |
1750 | 1750 | } |
1751 | 1751 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1752 | 1752 | $error_strings = array(); |
1753 | - foreach ( $validation_errors as $validation_error ) { |
|
1754 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1753 | + foreach ($validation_errors as $validation_error) { |
|
1754 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1755 | 1755 | $form_section = $validation_error->get_form_section(); |
1756 | - if ( $form_section instanceof EE_Form_Input_Base ) { |
|
1756 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1757 | 1757 | $label = $form_section->html_label_text(); |
1758 | - } elseif ( $form_section instanceof EE_Form_Section_Base ) { |
|
1758 | + } elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1759 | 1759 | $label = $form_section->name(); |
1760 | 1760 | } else { |
1761 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1761 | + $label = __('Validation Error', 'event_espresso'); |
|
1762 | 1762 | } |
1763 | - $error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1763 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1764 | 1764 | } |
1765 | 1765 | } |
1766 | 1766 | EE_Error::add_error( |
@@ -1770,7 +1770,7 @@ discard block |
||
1770 | 1770 | 'event_espresso' |
1771 | 1771 | ), |
1772 | 1772 | '<br/>', |
1773 | - implode( '<br/>', $error_strings ) |
|
1773 | + implode('<br/>', $error_strings) |
|
1774 | 1774 | ), |
1775 | 1775 | __FILE__, |
1776 | 1776 | __FUNCTION__, |
@@ -1789,7 +1789,7 @@ discard block |
||
1789 | 1789 | } |
1790 | 1790 | } else { |
1791 | 1791 | EE_Error::add_error( |
1792 | - __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), |
|
1792 | + __('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), |
|
1793 | 1793 | __FILE__, |
1794 | 1794 | __FUNCTION__, |
1795 | 1795 | __LINE__ |
@@ -1828,7 +1828,7 @@ discard block |
||
1828 | 1828 | // save the TXN ( which clears cached copy of primary_registration) |
1829 | 1829 | $this->checkout->transaction->save(); |
1830 | 1830 | // grab TXN ID and save it to the primary_registration |
1831 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1831 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1832 | 1832 | // save what we have so far |
1833 | 1833 | $primary_registration->save(); |
1834 | 1834 | return true; |
@@ -1846,7 +1846,7 @@ discard block |
||
1846 | 1846 | private function _capture_primary_registration_data_from_billing_form() { |
1847 | 1847 | // convert billing form data into an attendee |
1848 | 1848 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1849 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1849 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1850 | 1850 | EE_Error::add_error( |
1851 | 1851 | sprintf( |
1852 | 1852 | __( |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | 'event_espresso' |
1855 | 1855 | ), |
1856 | 1856 | '<br/>', |
1857 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1857 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1858 | 1858 | ), |
1859 | 1859 | __FILE__, |
1860 | 1860 | __FUNCTION__, |
@@ -1863,7 +1863,7 @@ discard block |
||
1863 | 1863 | return false; |
1864 | 1864 | } |
1865 | 1865 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1866 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1866 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1867 | 1867 | EE_Error::add_error( |
1868 | 1868 | sprintf( |
1869 | 1869 | __( |
@@ -1871,7 +1871,7 @@ discard block |
||
1871 | 1871 | 'event_espresso' |
1872 | 1872 | ), |
1873 | 1873 | '<br/>', |
1874 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1874 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1875 | 1875 | ), |
1876 | 1876 | __FILE__, |
1877 | 1877 | __FUNCTION__, |
@@ -1879,7 +1879,7 @@ discard block |
||
1879 | 1879 | ); |
1880 | 1880 | return false; |
1881 | 1881 | } |
1882 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) |
|
1882 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') |
|
1883 | 1883 | instanceof |
1884 | 1884 | EE_Attendee |
1885 | 1885 | ) { |
@@ -1890,7 +1890,7 @@ discard block |
||
1890 | 1890 | 'event_espresso' |
1891 | 1891 | ), |
1892 | 1892 | '<br/>', |
1893 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1893 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1894 | 1894 | ), |
1895 | 1895 | __FILE__, |
1896 | 1896 | __FUNCTION__, |
@@ -1899,9 +1899,9 @@ discard block |
||
1899 | 1899 | return false; |
1900 | 1900 | } |
1901 | 1901 | /** @type EE_Registration_Processor $registration_processor */ |
1902 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1902 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1903 | 1903 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1904 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1904 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1905 | 1905 | return true; |
1906 | 1906 | } |
1907 | 1907 | |
@@ -1916,22 +1916,22 @@ discard block |
||
1916 | 1916 | * @throws \EE_Error |
1917 | 1917 | */ |
1918 | 1918 | private function _get_payment_method_for_selected_method_of_payment() { |
1919 | - if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) { |
|
1919 | + if ($this->checkout->selected_method_of_payment === 'events_sold_out') { |
|
1920 | 1920 | $this->_redirect_because_event_sold_out(); |
1921 | 1921 | return null; |
1922 | 1922 | } |
1923 | 1923 | // get EE_Payment_Method object |
1924 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) { |
|
1925 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1924 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1925 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1926 | 1926 | } else { |
1927 | 1927 | // load EEM_Payment_Method |
1928 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1928 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1929 | 1929 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1930 | 1930 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1931 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1931 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1932 | 1932 | } |
1933 | 1933 | // verify $payment_method |
1934 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1934 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1935 | 1935 | // not a payment |
1936 | 1936 | EE_Error::add_error( |
1937 | 1937 | sprintf( |
@@ -1940,7 +1940,7 @@ discard block |
||
1940 | 1940 | 'event_espresso' |
1941 | 1941 | ), |
1942 | 1942 | '<br/>', |
1943 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1943 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1944 | 1944 | ), |
1945 | 1945 | __FILE__, |
1946 | 1946 | __FUNCTION__, |
@@ -1949,7 +1949,7 @@ discard block |
||
1949 | 1949 | return null; |
1950 | 1950 | } |
1951 | 1951 | // and verify it has a valid Payment_Method Type object |
1952 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1952 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1953 | 1953 | // not a payment |
1954 | 1954 | EE_Error::add_error( |
1955 | 1955 | sprintf( |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | 'event_espresso' |
1959 | 1959 | ), |
1960 | 1960 | '<br/>', |
1961 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1961 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1962 | 1962 | ), |
1963 | 1963 | __FILE__, |
1964 | 1964 | __FUNCTION__, |
@@ -1979,29 +1979,29 @@ discard block |
||
1979 | 1979 | * @return mixed EE_Payment | boolean |
1980 | 1980 | * @throws \EE_Error |
1981 | 1981 | */ |
1982 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1982 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1983 | 1983 | $payment = null; |
1984 | 1984 | $this->checkout->transaction->save(); |
1985 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1986 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1985 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1986 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1987 | 1987 | return false; |
1988 | 1988 | } |
1989 | 1989 | try { |
1990 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1990 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1991 | 1991 | // generate payment object |
1992 | 1992 | $payment = $payment_processor->process_payment( |
1993 | 1993 | $payment_method, |
1994 | 1994 | $this->checkout->transaction, |
1995 | 1995 | $this->checkout->amount_owing, |
1996 | 1996 | $this->checkout->billing_form, |
1997 | - $this->_get_return_url( $payment_method ), |
|
1997 | + $this->_get_return_url($payment_method), |
|
1998 | 1998 | 'CART', |
1999 | 1999 | $this->checkout->admin_request, |
2000 | 2000 | true, |
2001 | 2001 | $this->reg_step_url() |
2002 | 2002 | ); |
2003 | - } catch ( Exception $e ) { |
|
2004 | - $this->_handle_payment_processor_exception( $e ); |
|
2003 | + } catch (Exception $e) { |
|
2004 | + $this->_handle_payment_processor_exception($e); |
|
2005 | 2005 | } |
2006 | 2006 | return $payment; |
2007 | 2007 | } |
@@ -2016,7 +2016,7 @@ discard block |
||
2016 | 2016 | * @return void |
2017 | 2017 | * @throws \EE_Error |
2018 | 2018 | */ |
2019 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
2019 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
2020 | 2020 | EE_Error::add_error( |
2021 | 2021 | sprintf( |
2022 | 2022 | __( |
@@ -2024,7 +2024,7 @@ discard block |
||
2024 | 2024 | 'event_espresso' |
2025 | 2025 | ), |
2026 | 2026 | '<br/>', |
2027 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
2027 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
2028 | 2028 | $e->getMessage(), |
2029 | 2029 | $e->getFile(), |
2030 | 2030 | $e->getLine() |
@@ -2045,9 +2045,9 @@ discard block |
||
2045 | 2045 | * @return string |
2046 | 2046 | * @throws \EE_Error |
2047 | 2047 | */ |
2048 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
2048 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
2049 | 2049 | $return_url = ''; |
2050 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
2050 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
2051 | 2051 | case EE_PMT_Base::offsite : |
2052 | 2052 | $return_url = add_query_arg( |
2053 | 2053 | array( |
@@ -2076,12 +2076,12 @@ discard block |
||
2076 | 2076 | * @return EE_Payment | FALSE |
2077 | 2077 | * @throws \EE_Error |
2078 | 2078 | */ |
2079 | - private function _validate_payment( $payment = null ) { |
|
2080 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
2079 | + private function _validate_payment($payment = null) { |
|
2080 | + if ($this->checkout->payment_method->is_off_line()) { |
|
2081 | 2081 | return true; |
2082 | 2082 | } |
2083 | 2083 | // verify payment object |
2084 | - if ( ! $payment instanceof EE_Payment ) { |
|
2084 | + if ( ! $payment instanceof EE_Payment) { |
|
2085 | 2085 | // not a payment |
2086 | 2086 | EE_Error::add_error( |
2087 | 2087 | sprintf( |
@@ -2090,7 +2090,7 @@ discard block |
||
2090 | 2090 | 'event_espresso' |
2091 | 2091 | ), |
2092 | 2092 | '<br/>', |
2093 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2093 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2094 | 2094 | ), |
2095 | 2095 | __FILE__, |
2096 | 2096 | __FUNCTION__, |
@@ -2111,27 +2111,27 @@ discard block |
||
2111 | 2111 | * @return bool |
2112 | 2112 | * @throws \EE_Error |
2113 | 2113 | */ |
2114 | - private function _post_payment_processing( $payment = null ) { |
|
2114 | + private function _post_payment_processing($payment = null) { |
|
2115 | 2115 | // Off-Line payment? |
2116 | - if ( $payment === true ) { |
|
2116 | + if ($payment === true) { |
|
2117 | 2117 | //$this->_setup_redirect_for_next_step(); |
2118 | 2118 | return true; |
2119 | 2119 | // On-Site payment? |
2120 | - } else if ( $this->checkout->payment_method->is_on_site() ) { |
|
2121 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) { |
|
2120 | + } else if ($this->checkout->payment_method->is_on_site()) { |
|
2121 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
2122 | 2122 | //$this->_setup_redirect_for_next_step(); |
2123 | 2123 | $this->checkout->continue_reg = false; |
2124 | 2124 | } |
2125 | 2125 | // Off-Site payment? |
2126 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
2126 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
2127 | 2127 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
2128 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ) { |
|
2129 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
2128 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
2129 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
2130 | 2130 | $this->checkout->redirect = true; |
2131 | 2131 | $this->checkout->redirect_form = $payment->redirect_form(); |
2132 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
2132 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
2133 | 2133 | // set JSON response |
2134 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
2134 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
2135 | 2135 | // set cron job for finalizing the TXN |
2136 | 2136 | // in case the user does not return from the off-site gateway |
2137 | 2137 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -2139,7 +2139,7 @@ discard block |
||
2139 | 2139 | $this->checkout->transaction->ID() |
2140 | 2140 | ); |
2141 | 2141 | // and lastly, let's bump the payment status to pending |
2142 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
2142 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
2143 | 2143 | $payment->save(); |
2144 | 2144 | } else { |
2145 | 2145 | // not a payment |
@@ -2151,7 +2151,7 @@ discard block |
||
2151 | 2151 | 'event_espresso' |
2152 | 2152 | ), |
2153 | 2153 | '<br/>', |
2154 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2154 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2155 | 2155 | ), |
2156 | 2156 | __FILE__, |
2157 | 2157 | __FUNCTION__, |
@@ -2189,21 +2189,21 @@ discard block |
||
2189 | 2189 | * @return bool |
2190 | 2190 | * @throws \EE_Error |
2191 | 2191 | */ |
2192 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
2192 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
2193 | 2193 | // off-line payment? carry on |
2194 | - if ( $payment_occurs === EE_PMT_Base::offline ) { |
|
2194 | + if ($payment_occurs === EE_PMT_Base::offline) { |
|
2195 | 2195 | return true; |
2196 | 2196 | } |
2197 | 2197 | // verify payment validity |
2198 | - if ( $payment instanceof EE_Payment ) { |
|
2199 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
2198 | + if ($payment instanceof EE_Payment) { |
|
2199 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
2200 | 2200 | $msg = $payment->gateway_response(); |
2201 | 2201 | // check results |
2202 | - switch ( $payment->status() ) { |
|
2202 | + switch ($payment->status()) { |
|
2203 | 2203 | // good payment |
2204 | 2204 | case EEM_Payment::status_id_approved : |
2205 | 2205 | EE_Error::add_success( |
2206 | - __( 'Your payment was processed successfully.', 'event_espresso' ), |
|
2206 | + __('Your payment was processed successfully.', 'event_espresso'), |
|
2207 | 2207 | __FILE__, |
2208 | 2208 | __FUNCTION__, |
2209 | 2209 | __LINE__ |
@@ -2212,45 +2212,45 @@ discard block |
||
2212 | 2212 | break; |
2213 | 2213 | // slow payment |
2214 | 2214 | case EEM_Payment::status_id_pending : |
2215 | - if ( empty( $msg ) ) { |
|
2215 | + if (empty($msg)) { |
|
2216 | 2216 | $msg = __( |
2217 | 2217 | 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', |
2218 | 2218 | 'event_espresso' |
2219 | 2219 | ); |
2220 | 2220 | } |
2221 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2221 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2222 | 2222 | return true; |
2223 | 2223 | break; |
2224 | 2224 | // don't wanna payment |
2225 | 2225 | case EEM_Payment::status_id_cancelled : |
2226 | - if ( empty( $msg ) ) { |
|
2226 | + if (empty($msg)) { |
|
2227 | 2227 | $msg = _n( |
2228 | 2228 | 'Payment cancelled. Please try again.', |
2229 | 2229 | 'Payment cancelled. Please try again or select another method of payment.', |
2230 | - count( $this->checkout->available_payment_methods ), |
|
2230 | + count($this->checkout->available_payment_methods), |
|
2231 | 2231 | 'event_espresso' |
2232 | 2232 | ); |
2233 | 2233 | } |
2234 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2234 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2235 | 2235 | return false; |
2236 | 2236 | break; |
2237 | 2237 | // not enough payment |
2238 | 2238 | case EEM_Payment::status_id_declined : |
2239 | - if ( empty( $msg ) ) { |
|
2239 | + if (empty($msg)) { |
|
2240 | 2240 | $msg = _n( |
2241 | 2241 | 'We\'re sorry but your payment was declined. Please try again.', |
2242 | 2242 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
2243 | - count( $this->checkout->available_payment_methods ), |
|
2243 | + count($this->checkout->available_payment_methods), |
|
2244 | 2244 | 'event_espresso' |
2245 | 2245 | ); |
2246 | 2246 | } |
2247 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2247 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2248 | 2248 | return false; |
2249 | 2249 | break; |
2250 | 2250 | // bad payment |
2251 | 2251 | case EEM_Payment::status_id_failed : |
2252 | - if ( ! empty( $msg ) ) { |
|
2253 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2252 | + if ( ! empty($msg)) { |
|
2253 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2254 | 2254 | return false; |
2255 | 2255 | } |
2256 | 2256 | // default to error below |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | } |
2260 | 2260 | // off-site payment gateway responses are too unreliable, so let's just assume that |
2261 | 2261 | // the payment processing is just running slower than the registrant's request |
2262 | - if ( $payment_occurs === EE_PMT_Base::offsite ) { |
|
2262 | + if ($payment_occurs === EE_PMT_Base::offsite) { |
|
2263 | 2263 | return true; |
2264 | 2264 | } |
2265 | 2265 | EE_Error::add_error( |
@@ -2269,7 +2269,7 @@ discard block |
||
2269 | 2269 | 'event_espresso' |
2270 | 2270 | ), |
2271 | 2271 | '<br/>', |
2272 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2272 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2273 | 2273 | ), |
2274 | 2274 | __FILE__, |
2275 | 2275 | __FUNCTION__, |
@@ -2302,13 +2302,13 @@ discard block |
||
2302 | 2302 | public function process_gateway_response() { |
2303 | 2303 | $payment = null; |
2304 | 2304 | // how have they chosen to pay? |
2305 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
2305 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
2306 | 2306 | // get EE_Payment_Method object |
2307 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
2307 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
2308 | 2308 | $this->checkout->continue_reg = false; |
2309 | 2309 | return false; |
2310 | 2310 | } |
2311 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
2311 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
2312 | 2312 | return false; |
2313 | 2313 | } |
2314 | 2314 | $this->_validate_offsite_return(); |
@@ -2322,23 +2322,23 @@ discard block |
||
2322 | 2322 | // true |
2323 | 2323 | //); |
2324 | 2324 | // verify TXN |
2325 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
2325 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
2326 | 2326 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
2327 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
2327 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
2328 | 2328 | $this->checkout->continue_reg = false; |
2329 | 2329 | return false; |
2330 | 2330 | } |
2331 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
2332 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
2333 | - $payment = $this->_validate_payment( $payment ); |
|
2331 | + $payment = $this->_process_off_site_payment($gateway); |
|
2332 | + $payment = $this->_process_cancelled_payments($payment); |
|
2333 | + $payment = $this->_validate_payment($payment); |
|
2334 | 2334 | // if payment was not declined by the payment gateway or cancelled by the registrant |
2335 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
2335 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
2336 | 2336 | //$this->_setup_redirect_for_next_step(); |
2337 | 2337 | // store that for later |
2338 | 2338 | $this->checkout->payment = $payment; |
2339 | 2339 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
2340 | 2340 | // because we will complete this step during the IPN processing then |
2341 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) { |
|
2341 | + if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) { |
|
2342 | 2342 | $this->set_completed(); |
2343 | 2343 | } |
2344 | 2344 | return true; |
@@ -2362,21 +2362,21 @@ discard block |
||
2362 | 2362 | * @throws \EE_Error |
2363 | 2363 | */ |
2364 | 2364 | private function _validate_offsite_return() { |
2365 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
2366 | - if ( $TXN_ID !== $this->checkout->transaction->ID() ) { |
|
2365 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
2366 | + if ($TXN_ID !== $this->checkout->transaction->ID()) { |
|
2367 | 2367 | // Houston... we might have a problem |
2368 | 2368 | $invalid_TXN = false; |
2369 | 2369 | // first gather some info |
2370 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
2370 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
2371 | 2371 | $primary_registrant = $valid_TXN instanceof EE_Transaction |
2372 | 2372 | ? $valid_TXN->primary_registration() |
2373 | 2373 | : null; |
2374 | 2374 | // let's start by retrieving the cart for this TXN |
2375 | - $cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction ); |
|
2376 | - if ( $cart instanceof EE_Cart ) { |
|
2375 | + $cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction); |
|
2376 | + if ($cart instanceof EE_Cart) { |
|
2377 | 2377 | // verify that the current cart has tickets |
2378 | 2378 | $tickets = $cart->get_tickets(); |
2379 | - if ( empty( $tickets ) ) { |
|
2379 | + if (empty($tickets)) { |
|
2380 | 2380 | $invalid_TXN = true; |
2381 | 2381 | } |
2382 | 2382 | } else { |
@@ -2386,35 +2386,35 @@ discard block |
||
2386 | 2386 | ? $primary_registrant->session_ID() |
2387 | 2387 | : null; |
2388 | 2388 | // validate current Session ID and compare against valid TXN session ID |
2389 | - if ( EE_Session::instance()->id() === null ) { |
|
2389 | + if (EE_Session::instance()->id() === null) { |
|
2390 | 2390 | $invalid_TXN = true; |
2391 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
2391 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
2392 | 2392 | // WARNING !!! |
2393 | 2393 | // this could be PayPal sending back duplicate requests (ya they do that) |
2394 | 2394 | // or it **could** mean someone is simply registering AGAIN after having just done so |
2395 | 2395 | // so now we need to determine if this current TXN looks valid or not |
2396 | 2396 | // has this step even been started ? |
2397 | - if ( $this->checkout->transaction->reg_step_completed( $this->slug() === false ) |
|
2397 | + if ($this->checkout->transaction->reg_step_completed($this->slug() === false) |
|
2398 | 2398 | ) { |
2399 | 2399 | // really? you're half way through this reg step, but you never started it ? |
2400 | 2400 | $invalid_TXN = true; |
2401 | 2401 | } |
2402 | 2402 | } |
2403 | - if ( $invalid_TXN ) { |
|
2403 | + if ($invalid_TXN) { |
|
2404 | 2404 | // is the valid TXN completed ? |
2405 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
2405 | + if ($valid_TXN instanceof EE_Transaction) { |
|
2406 | 2406 | // has this step even been started ? |
2407 | - $reg_step_completed = $valid_TXN->reg_step_completed( $this->slug() ); |
|
2408 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
2407 | + $reg_step_completed = $valid_TXN->reg_step_completed($this->slug()); |
|
2408 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
2409 | 2409 | // so it **looks** like this is a double request from PayPal |
2410 | 2410 | // so let's try to pick up where we left off |
2411 | 2411 | $this->checkout->transaction = $valid_TXN; |
2412 | - $this->checkout->refresh_all_entities( true ); |
|
2412 | + $this->checkout->refresh_all_entities(true); |
|
2413 | 2413 | return; |
2414 | 2414 | } |
2415 | 2415 | } |
2416 | 2416 | // you appear to be lost? |
2417 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
2417 | + $this->_redirect_wayward_request($primary_registrant); |
|
2418 | 2418 | } |
2419 | 2419 | } |
2420 | 2420 | } |
@@ -2429,14 +2429,14 @@ discard block |
||
2429 | 2429 | * @return bool |
2430 | 2430 | * @throws \EE_Error |
2431 | 2431 | */ |
2432 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
2433 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
2432 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
2433 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
2434 | 2434 | // try redirecting based on the current TXN |
2435 | 2435 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction |
2436 | 2436 | ? $this->checkout->transaction->primary_registration() |
2437 | 2437 | : null; |
2438 | 2438 | } |
2439 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
2439 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
2440 | 2440 | EE_Error::add_error( |
2441 | 2441 | sprintf( |
2442 | 2442 | __( |
@@ -2444,7 +2444,7 @@ discard block |
||
2444 | 2444 | 'event_espresso' |
2445 | 2445 | ), |
2446 | 2446 | '<br/>', |
2447 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2447 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2448 | 2448 | ), |
2449 | 2449 | __FILE__, |
2450 | 2450 | __FUNCTION__, |
@@ -2475,17 +2475,17 @@ discard block |
||
2475 | 2475 | * @return \EE_Payment |
2476 | 2476 | * @throws \EE_Error |
2477 | 2477 | */ |
2478 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
2478 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
2479 | 2479 | try { |
2480 | 2480 | $request_data = \EE_Registry::instance()->REQ->params(); |
2481 | 2481 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
2482 | 2482 | $this->set_handle_IPN_in_this_request( |
2483 | - $gateway->handle_IPN_in_this_request( $request_data, false ) |
|
2483 | + $gateway->handle_IPN_in_this_request($request_data, false) |
|
2484 | 2484 | ); |
2485 | - if ( $this->handle_IPN_in_this_request() ) { |
|
2485 | + if ($this->handle_IPN_in_this_request()) { |
|
2486 | 2486 | // get payment details and process results |
2487 | 2487 | /** @type EE_Payment_Processor $payment_processor */ |
2488 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
2488 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
2489 | 2489 | $payment = $payment_processor->process_ipn( |
2490 | 2490 | $request_data, |
2491 | 2491 | $this->checkout->transaction, |
@@ -2498,14 +2498,14 @@ discard block |
||
2498 | 2498 | $payment = $this->checkout->transaction->last_payment(); |
2499 | 2499 | //$payment_source = 'last_payment'; |
2500 | 2500 | } |
2501 | - } catch ( Exception $e ) { |
|
2501 | + } catch (Exception $e) { |
|
2502 | 2502 | // let's just eat the exception and try to move on using any previously set payment info |
2503 | 2503 | $payment = $this->checkout->transaction->last_payment(); |
2504 | 2504 | //$payment_source = 'last_payment after Exception'; |
2505 | 2505 | // but if we STILL don't have a payment object |
2506 | - if ( ! $payment instanceof EE_Payment ) { |
|
2506 | + if ( ! $payment instanceof EE_Payment) { |
|
2507 | 2507 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
2508 | - $this->_handle_payment_processor_exception( $e ); |
|
2508 | + $this->_handle_payment_processor_exception($e); |
|
2509 | 2509 | } |
2510 | 2510 | } |
2511 | 2511 | // DEBUG LOG |
@@ -2530,13 +2530,13 @@ discard block |
||
2530 | 2530 | * @return EE_Payment | FALSE |
2531 | 2531 | * @throws \EE_Error |
2532 | 2532 | */ |
2533 | - private function _process_cancelled_payments( $payment = null ) { |
|
2533 | + private function _process_cancelled_payments($payment = null) { |
|
2534 | 2534 | if ( |
2535 | 2535 | $payment instanceof EE_Payment |
2536 | - && isset( $_REQUEST['ee_cancel_payment'] ) |
|
2536 | + && isset($_REQUEST['ee_cancel_payment']) |
|
2537 | 2537 | && $payment->status() === EEM_Payment::status_id_failed |
2538 | 2538 | ) { |
2539 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
2539 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
2540 | 2540 | } |
2541 | 2541 | return $payment; |
2542 | 2542 | } |
@@ -2553,14 +2553,14 @@ discard block |
||
2553 | 2553 | public function get_transaction_details_for_gateways() { |
2554 | 2554 | $txn_details = array(); |
2555 | 2555 | // ya gotta make a choice man |
2556 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
2556 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
2557 | 2557 | $txn_details = array( |
2558 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
2558 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
2559 | 2559 | ); |
2560 | 2560 | } |
2561 | 2561 | // get EE_Payment_Method object |
2562 | 2562 | if ( |
2563 | - empty( $txn_details ) |
|
2563 | + empty($txn_details) |
|
2564 | 2564 | && |
2565 | 2565 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
2566 | 2566 | ) { |
@@ -2572,8 +2572,8 @@ discard block |
||
2572 | 2572 | ) |
2573 | 2573 | ); |
2574 | 2574 | } |
2575 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
2576 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
2575 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
2576 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
2577 | 2577 | $txn_details = array( |
2578 | 2578 | 'TXN_ID' => $this->checkout->transaction->ID(), |
2579 | 2579 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -2584,7 +2584,7 @@ discard block |
||
2584 | 2584 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
2585 | 2585 | 'payment_amount' => $this->checkout->amount_owing, |
2586 | 2586 | 'return_url' => $return_url, |
2587 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
2587 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
2588 | 2588 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
2589 | 2589 | array( |
2590 | 2590 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -2593,7 +2593,7 @@ discard block |
||
2593 | 2593 | ) |
2594 | 2594 | ); |
2595 | 2595 | } |
2596 | - echo json_encode( $txn_details ); |
|
2596 | + echo json_encode($txn_details); |
|
2597 | 2597 | exit(); |
2598 | 2598 | } |
2599 | 2599 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param EE_Checkout $checkout |
23 | 23 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
24 | 24 | */ |
25 | - public function __construct( EE_Checkout $checkout ) { |
|
25 | + public function __construct(EE_Checkout $checkout) { |
|
26 | 26 | $this->_slug = 'finalize_registration'; |
27 | - $this->_name = __( 'Finalize Registration', 'event_espresso' ); |
|
27 | + $this->_name = __('Finalize Registration', 'event_espresso'); |
|
28 | 28 | $this->_submit_button_text = $this->_name; |
29 | 29 | $this->_template = ''; |
30 | 30 | $this->checkout = $checkout; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function initialize_reg_step() { |
49 | 49 | // there's actually no reg form to process if this is the final step |
50 | - if ( $this->is_current_step() ) { |
|
50 | + if ($this->is_current_step()) { |
|
51 | 51 | $this->checkout->step = $_REQUEST['step'] = $this->slug(); |
52 | 52 | $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
53 | 53 | $this->checkout->generate_reg_form = false; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function process_reg_step() { |
75 | 75 | // ensure all data gets refreshed from the db |
76 | - $this->checkout->refresh_all_entities( true ); |
|
76 | + $this->checkout->refresh_all_entities(true); |
|
77 | 77 | // ensures that all details and statuses for transaction, registration, and payments are updated |
78 | 78 | $txn_update_params = $this->_finalize_transaction(); |
79 | 79 | // DEBUG LOG |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | $txn_update_params |
103 | 103 | ); |
104 | 104 | // check if transaction has a primary registrant and that it has a related Attendee object |
105 | - if ( ! $this->_validate_primary_registrant() ) { |
|
105 | + if ( ! $this->_validate_primary_registrant()) { |
|
106 | 106 | return false; |
107 | 107 | } |
108 | 108 | // you don't have to go home but you can't stay here ! |
109 | 109 | $this->checkout->redirect = true; |
110 | 110 | $this->checkout->continue_reg = true; |
111 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
111 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
112 | 112 | if ( |
113 | 113 | ! ( |
114 | 114 | $this->checkout->payment_method instanceof EE_Payment_Method |
@@ -133,24 +133,24 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function _finalize_transaction() { |
135 | 135 | /** @type EE_Transaction_Processor $transaction_processor */ |
136 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
136 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
137 | 137 | //set revisit flag in txn processor |
138 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
138 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
139 | 139 | // at this point we'll consider a TXN to not have been abandoned |
140 | 140 | $this->checkout->transaction->toggle_abandoned_transaction_status(); |
141 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
141 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
142 | 142 | // save TXN data to the cart |
143 | 143 | $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
144 | 144 | $this->checkout->transaction->ID() |
145 | 145 | ); |
146 | 146 | } |
147 | 147 | // maybe update status, but don't save transaction just yet |
148 | - $this->checkout->transaction->update_status_based_on_total_paid( false ); |
|
148 | + $this->checkout->transaction->update_status_based_on_total_paid(false); |
|
149 | 149 | // maybe send messages |
150 | 150 | $this->_trigger_notifications(); |
151 | 151 | // this will result in the base session properties getting saved to the TXN_Session_data field |
152 | 152 | $this->checkout->transaction->set_txn_session_data( |
153 | - EE_Registry::instance()->SSN->get_session_data( null, true ) |
|
153 | + EE_Registry::instance()->SSN->get_session_data(null, true) |
|
154 | 154 | ); |
155 | 155 | // update the TXN if payment conditions have changed |
156 | 156 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | * @throws \EE_Error |
173 | 173 | */ |
174 | 174 | protected function _trigger_notifications() { |
175 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
176 | - $is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ); |
|
177 | - if ( $this->checkout->payment_method->is_off_site() ) { |
|
178 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
175 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
176 | + $is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN); |
|
177 | + if ($this->checkout->payment_method->is_off_site()) { |
|
178 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
179 | 179 | if ( |
180 | 180 | ! $is_revisit |
181 | 181 | && $gateway instanceof EE_Offsite_Gateway |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | ) |
186 | 186 | ) { |
187 | 187 | // first time through SPCO and we are processing the payment notification NOW |
188 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
188 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
189 | 189 | } else { |
190 | 190 | // do NOT trigger notifications because this is a revisit, OR it was already done during the IPN |
191 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
191 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
192 | 192 | add_filter( |
193 | 193 | 'FHEE__EED_Messages___maybe_registration__deliver_notifications', |
194 | 194 | '__return_false', |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | } |
198 | 198 | } else if ( |
199 | 199 | // if SPCO revisit and TXN status has changed due to a payment |
200 | - $is_revisit && ( $this->checkout->transaction->txn_status_updated() || $this->checkout->any_reg_status_updated() ) |
|
200 | + $is_revisit && ($this->checkout->transaction->txn_status_updated() || $this->checkout->any_reg_status_updated()) |
|
201 | 201 | ) { |
202 | 202 | // send out notifications |
203 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
204 | - } else if ( ! $is_revisit ) { |
|
205 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
203 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
204 | + } else if ( ! $is_revisit) { |
|
205 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | } |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | * @throws \EE_Error |
217 | 217 | */ |
218 | 218 | protected function _validate_primary_registrant() { |
219 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
219 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
220 | 220 | EE_Error::add_error( |
221 | - __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), |
|
221 | + __('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), |
|
222 | 222 | __FILE__, |
223 | 223 | __FUNCTION__, |
224 | 224 | __LINE__ |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | // setup URL for redirect |
231 | 231 | $this->checkout->redirect_url = add_query_arg( |
232 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
232 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
233 | 233 | $this->checkout->thank_you_page_url |
234 | 234 | ); |
235 | 235 | return true; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function update_reg_step() { |
244 | 244 | EE_Error::doing_it_wrong( |
245 | - __CLASS__ . '::' . __FILE__, |
|
245 | + __CLASS__.'::'.__FILE__, |
|
246 | 246 | __( |
247 | 247 | 'Can not call update_reg_step() on the Finalize Registration reg step.', |
248 | 248 | 'event_espresso' |
@@ -240,7 +240,7 @@ |
||
240 | 240 | |
241 | 241 | |
242 | 242 | /** |
243 | - * @return boolean |
|
243 | + * @return boolean|null |
|
244 | 244 | */ |
245 | 245 | public function update_reg_step() { |
246 | 246 | EE_Error::doing_it_wrong( |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @param EE_Checkout $checkout |
43 | 43 | */ |
44 | - public function __construct( EE_Checkout $checkout ) { |
|
44 | + public function __construct(EE_Checkout $checkout) { |
|
45 | 45 | $this->_slug = 'attendee_information'; |
46 | 46 | $this->_name = __('Attendee Information', 'event_espresso'); |
47 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
47 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
48 | 48 | $this->checkout = $checkout; |
49 | 49 | $this->_reset_success_message(); |
50 | 50 | $this->set_instructions( |
51 | - __( 'Please answer the following registration questions before proceeding.', 'event_espresso' ) |
|
51 | + __('Please answer the following registration questions before proceeding.', 'event_espresso') |
|
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | 57 | public function translate_js_strings() { |
58 | - EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' ); |
|
58 | + EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
|
59 | 59 | EE_Registry::$i18n_js_strings['required_multi_field'] = __( |
60 | 60 | ' is a required question. Please enter a value for at least one of the options.', |
61 | 61 | 'event_espresso' |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | // calculate taxes |
116 | 116 | $Line_Item_Display->display_line_item( |
117 | 117 | $this->checkout->cart->get_grand_total(), |
118 | - array( 'set_tax_rate' => true ) |
|
118 | + array('set_tax_rate' => true) |
|
119 | 119 | ); |
120 | 120 | /** @var $subsections EE_Form_Section_Proper[] */ |
121 | 121 | $subsections = array( |
@@ -127,51 +127,51 @@ discard block |
||
127 | 127 | 'ticket_count' => array() |
128 | 128 | ); |
129 | 129 | // grab the saved registrations from the transaction |
130 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
131 | - if ( $registrations ) { |
|
132 | - foreach ( $registrations as $registration ) { |
|
130 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
131 | + if ($registrations) { |
|
132 | + foreach ($registrations as $registration) { |
|
133 | 133 | // can this registration be processed during this visit ? |
134 | 134 | if ( |
135 | 135 | $registration instanceof EE_Registration |
136 | - && $this->checkout->visit_allows_processing_of_this_registration( $registration ) |
|
136 | + && $this->checkout->visit_allows_processing_of_this_registration($registration) |
|
137 | 137 | ) { |
138 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
139 | - if ( ! $this->checkout->admin_request ) { |
|
140 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
141 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( |
|
142 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] |
|
138 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
139 | + if ( ! $this->checkout->admin_request) { |
|
140 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
141 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset( |
|
142 | + $template_args['ticket_count'][$registration->ticket()->ID()] |
|
143 | 143 | ) |
144 | - ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 |
|
144 | + ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
145 | 145 | : 1; |
146 | 146 | $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
147 | 147 | $this->checkout->cart->get_grand_total(), |
148 | 148 | 'Ticket', |
149 | - array( $registration->ticket()->ID() ) |
|
149 | + array($registration->ticket()->ID()) |
|
150 | 150 | ); |
151 | - $ticket_line_item = is_array( $ticket_line_item ) |
|
152 | - ? reset( $ticket_line_item ) |
|
151 | + $ticket_line_item = is_array($ticket_line_item) |
|
152 | + ? reset($ticket_line_item) |
|
153 | 153 | : $ticket_line_item; |
154 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( |
|
154 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item( |
|
155 | 155 | $ticket_line_item |
156 | 156 | ); |
157 | 157 | } |
158 | - if ( $registration->is_primary_registrant() ) { |
|
158 | + if ($registration->is_primary_registrant()) { |
|
159 | 159 | $primary_registrant = $registration->reg_url_link(); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
163 | 163 | // print_copy_info ? |
164 | - if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) { |
|
164 | + if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) { |
|
165 | 165 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
166 | 166 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info |
167 | 167 | ? $this->_copy_attendee_info_form() |
168 | 168 | : $this->_auto_copy_attendee_info(); |
169 | 169 | // generate hidden input |
170 | 170 | if ( |
171 | - isset( $subsections[ $primary_registrant ] ) |
|
172 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
171 | + isset($subsections[$primary_registrant]) |
|
172 | + && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper |
|
173 | 173 | ) { |
174 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
174 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -183,8 +183,7 @@ discard block |
||
183 | 183 | 'html_id' => $this->reg_form_name(), |
184 | 184 | 'subsections' => $subsections, |
185 | 185 | 'layout_strategy' => $this->checkout->admin_request ? |
186 | - new EE_Div_Per_Section_Layout() : |
|
187 | - new EE_Template_Layout( |
|
186 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
188 | 187 | array( |
189 | 188 | 'layout_template_file' => $this->_template, // layout_template |
190 | 189 | 'template_args' => $template_args |
@@ -202,11 +201,11 @@ discard block |
||
202 | 201 | * @return EE_Form_Section_Proper |
203 | 202 | * @throws \EE_Error |
204 | 203 | */ |
205 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
204 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
206 | 205 | static $attendee_nmbr = 1; |
207 | 206 | // array of params to pass to parent constructor |
208 | 207 | $form_args = array( |
209 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
208 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
210 | 209 | 'html_class' => 'ee-reg-form-attendee-dv', |
211 | 210 | 'html_style' => $this->checkout->admin_request |
212 | 211 | ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
@@ -215,24 +214,24 @@ discard block |
||
215 | 214 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
216 | 215 | array( |
217 | 216 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
218 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
217 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
219 | 218 | ) |
220 | 219 | ) |
221 | 220 | ); |
222 | 221 | // verify that registration has valid event |
223 | - if ( $registration->event() instanceof EE_Event ) { |
|
222 | + if ($registration->event() instanceof EE_Event) { |
|
224 | 223 | $query_params = array( |
225 | 224 | array( |
226 | 225 | 'Event.EVT_ID' => $registration->event()->ID(), |
227 | 226 | 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
228 | 227 | ), |
229 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
228 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
230 | 229 | ); |
231 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
232 | - if ( $question_groups ) { |
|
233 | - foreach ( $question_groups as $question_group ) { |
|
234 | - if ( $question_group instanceof EE_Question_Group ) { |
|
235 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
|
230 | + $question_groups = $registration->event()->question_groups($query_params); |
|
231 | + if ($question_groups) { |
|
232 | + foreach ($question_groups as $question_group) { |
|
233 | + if ($question_group instanceof EE_Question_Group) { |
|
234 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form( |
|
236 | 235 | $registration, |
237 | 236 | $question_group |
238 | 237 | ); |
@@ -245,10 +244,10 @@ discard block |
||
245 | 244 | // if we have question groups for additional attendees, then display the copy options |
246 | 245 | $this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info; |
247 | 246 | } else { |
248 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link( |
|
249 | - ) ] = new EE_Form_Section_HTML( |
|
247 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link( |
|
248 | + )] = new EE_Form_Section_HTML( |
|
250 | 249 | EEH_Template::locate_template( |
251 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
250 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
252 | 251 | apply_filters( |
253 | 252 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', |
254 | 253 | array() |
@@ -267,12 +266,12 @@ discard block |
||
267 | 266 | |
268 | 267 | } |
269 | 268 | } |
270 | - if ( $registration->is_primary_registrant() ) { |
|
269 | + if ($registration->is_primary_registrant()) { |
|
271 | 270 | // generate hidden input |
272 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
271 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
273 | 272 | } |
274 | 273 | $attendee_nmbr++; |
275 | - return new EE_Form_Section_Proper( $form_args ); |
|
274 | + return new EE_Form_Section_Proper($form_args); |
|
276 | 275 | } |
277 | 276 | |
278 | 277 | |
@@ -293,7 +292,7 @@ discard block |
||
293 | 292 | // generate hidden input |
294 | 293 | return new EE_Hidden_Input( |
295 | 294 | array( |
296 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
295 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
297 | 296 | 'default' => $additional_attendee_reg_info |
298 | 297 | ) |
299 | 298 | ); |
@@ -307,26 +306,26 @@ discard block |
||
307 | 306 | * @return EE_Form_Section_Proper |
308 | 307 | * @throws \EE_Error |
309 | 308 | */ |
310 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
309 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
311 | 310 | // array of params to pass to parent constructor |
312 | 311 | $form_args = array( |
313 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
312 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
314 | 313 | 'html_class' => $this->checkout->admin_request |
315 | 314 | ? 'form-table ee-reg-form-qstn-grp-dv' |
316 | 315 | : 'ee-reg-form-qstn-grp-dv', |
317 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
316 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
318 | 317 | 'subsections' => array( |
319 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
318 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
320 | 319 | ), |
321 | 320 | 'layout_strategy' => $this->checkout->admin_request |
322 | 321 | ? new EE_Admin_Two_Column_Layout() |
323 | 322 | : new EE_Div_Per_Section_Layout() |
324 | 323 | ); |
325 | 324 | // where params |
326 | - $query_params = array( 'QST_deleted' => 0 ); |
|
325 | + $query_params = array('QST_deleted' => 0); |
|
327 | 326 | // don't load admin only questions on the frontend |
328 | - if ( ! $this->checkout->admin_request ) { |
|
329 | - $query_params['QST_admin_only'] = array( '!=', true ); |
|
327 | + if ( ! $this->checkout->admin_request) { |
|
328 | + $query_params['QST_admin_only'] = array('!=', true); |
|
330 | 329 | } |
331 | 330 | $questions = $question_group->get_many_related( |
332 | 331 | 'Question', |
@@ -348,10 +347,10 @@ discard block |
||
348 | 347 | ) |
349 | 348 | ); |
350 | 349 | // loop thru questions |
351 | - foreach ( $questions as $question ) { |
|
352 | - if( $question instanceof EE_Question ){ |
|
350 | + foreach ($questions as $question) { |
|
351 | + if ($question instanceof EE_Question) { |
|
353 | 352 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
354 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
353 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
355 | 354 | } |
356 | 355 | } |
357 | 356 | $form_args['subsections'] = apply_filters( |
@@ -372,7 +371,7 @@ discard block |
||
372 | 371 | ) |
373 | 372 | ); |
374 | 373 | // d( $form_args ); |
375 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
374 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
376 | 375 | return apply_filters( |
377 | 376 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
378 | 377 | $question_group_reg_form, |
@@ -389,11 +388,11 @@ discard block |
||
389 | 388 | * @param EE_Question_Group $question_group |
390 | 389 | * @return EE_Form_Section_HTML |
391 | 390 | */ |
392 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
391 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
393 | 392 | $html = ''; |
394 | 393 | // group_name |
395 | - if ( $question_group->show_group_name() && $question_group->name() !== '' ) { |
|
396 | - if ( $this->checkout->admin_request ) { |
|
394 | + if ($question_group->show_group_name() && $question_group->name() !== '') { |
|
395 | + if ($this->checkout->admin_request) { |
|
397 | 396 | $html .= EEH_HTML::br(); |
398 | 397 | $html .= EEH_HTML::h3( |
399 | 398 | $question_group->name(), |
@@ -407,7 +406,7 @@ discard block |
||
407 | 406 | } |
408 | 407 | } |
409 | 408 | // group_desc |
410 | - if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) { |
|
409 | + if ($question_group->show_group_desc() && $question_group->desc() !== '') { |
|
411 | 410 | $html .= EEH_HTML::p( |
412 | 411 | $question_group->desc(), |
413 | 412 | '', |
@@ -417,7 +416,7 @@ discard block |
||
417 | 416 | ); |
418 | 417 | |
419 | 418 | } |
420 | - return new EE_Form_Section_HTML( $html ); |
|
419 | + return new EE_Form_Section_HTML($html); |
|
421 | 420 | } |
422 | 421 | |
423 | 422 | |
@@ -427,7 +426,7 @@ discard block |
||
427 | 426 | * @return EE_Form_Section_Proper |
428 | 427 | * @throws \EE_Error |
429 | 428 | */ |
430 | - private function _copy_attendee_info_form(){ |
|
429 | + private function _copy_attendee_info_form() { |
|
431 | 430 | // array of params to pass to parent constructor |
432 | 431 | return new EE_Form_Section_Proper( |
433 | 432 | array( |
@@ -456,7 +455,7 @@ discard block |
||
456 | 455 | private function _auto_copy_attendee_info() { |
457 | 456 | return new EE_Form_Section_HTML( |
458 | 457 | EEH_Template::locate_template( |
459 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
458 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
460 | 459 | apply_filters( |
461 | 460 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', |
462 | 461 | array() |
@@ -480,32 +479,32 @@ discard block |
||
480 | 479 | $copy_attendee_info_inputs = array(); |
481 | 480 | $prev_ticket = NULL; |
482 | 481 | // grab the saved registrations from the transaction |
483 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
484 | - foreach ( $registrations as $registration ) { |
|
482 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
483 | + foreach ($registrations as $registration) { |
|
485 | 484 | // for all attendees other than the primary attendee |
486 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
485 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
487 | 486 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
488 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
487 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
489 | 488 | $item_name = $registration->ticket()->name(); |
490 | 489 | $item_name .= $registration->ticket()->description() !== '' |
491 | - ? ' - ' . $registration->ticket()->description() |
|
490 | + ? ' - '.$registration->ticket()->description() |
|
492 | 491 | : ''; |
493 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
494 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
492 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
493 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
495 | 494 | ); |
496 | 495 | $prev_ticket = $registration->ticket()->ID(); |
497 | 496 | } |
498 | 497 | |
499 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
498 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
500 | 499 | EE_Checkbox_Multi_Input( |
501 | 500 | array( |
502 | 501 | $registration->ID() => sprintf( |
503 | - __( 'Attendee #%s', 'event_espresso' ), |
|
502 | + __('Attendee #%s', 'event_espresso'), |
|
504 | 503 | $registration->count() |
505 | 504 | ) |
506 | 505 | ), |
507 | 506 | array( |
508 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
507 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
509 | 508 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
510 | 509 | 'display_html_label_text' => false |
511 | 510 | ) |
@@ -525,7 +524,7 @@ discard block |
||
525 | 524 | * @return EE_Form_Input_Base |
526 | 525 | * @throws \EE_Error |
527 | 526 | */ |
528 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
527 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
529 | 528 | // generate hidden input |
530 | 529 | return new EE_Hidden_Input( |
531 | 530 | array( |
@@ -544,7 +543,7 @@ discard block |
||
544 | 543 | * @return EE_Form_Input_Base |
545 | 544 | * @throws \EE_Error |
546 | 545 | */ |
547 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
546 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
548 | 547 | |
549 | 548 | // if this question was for an attendee detail, then check for that answer |
550 | 549 | $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( |
@@ -553,32 +552,32 @@ discard block |
||
553 | 552 | ); |
554 | 553 | $answer = $answer_value === null |
555 | 554 | ? EEM_Answer::instance()->get_one( |
556 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
555 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
557 | 556 | ) |
558 | 557 | : null; |
559 | 558 | // if NOT returning to edit an existing registration |
560 | 559 | // OR if this question is for an attendee property |
561 | 560 | // OR we still don't have an EE_Answer object |
562 | - if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) { |
|
561 | + if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) { |
|
563 | 562 | // create an EE_Answer object for storing everything in |
564 | - $answer = EE_Answer::new_instance ( array( |
|
563 | + $answer = EE_Answer::new_instance(array( |
|
565 | 564 | 'QST_ID'=> $question->ID(), |
566 | 565 | 'REG_ID'=> $registration->ID() |
567 | 566 | )); |
568 | 567 | } |
569 | 568 | // verify instance |
570 | - if( $answer instanceof EE_Answer ){ |
|
571 | - if ( ! empty( $answer_value )) { |
|
572 | - $answer->set( 'ANS_value', $answer_value ); |
|
569 | + if ($answer instanceof EE_Answer) { |
|
570 | + if ( ! empty($answer_value)) { |
|
571 | + $answer->set('ANS_value', $answer_value); |
|
573 | 572 | } |
574 | - $answer->cache( 'Question', $question ); |
|
573 | + $answer->cache('Question', $question); |
|
575 | 574 | //remember system ID had a bug where sometimes it could be null |
576 | - $answer_cache_id =$question->is_system_question() |
|
577 | - ? $question->system_ID() . '-' . $registration->reg_url_link() |
|
578 | - : $question->ID() . '-' . $registration->reg_url_link(); |
|
579 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
575 | + $answer_cache_id = $question->is_system_question() |
|
576 | + ? $question->system_ID().'-'.$registration->reg_url_link() |
|
577 | + : $question->ID().'-'.$registration->reg_url_link(); |
|
578 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
580 | 579 | } |
581 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
580 | + return $this->_generate_question_input($registration, $question, $answer); |
|
582 | 581 | |
583 | 582 | } |
584 | 583 | |
@@ -591,46 +590,46 @@ discard block |
||
591 | 590 | * @return EE_Form_Input_Base |
592 | 591 | * @throws \EE_Error |
593 | 592 | */ |
594 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
593 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
595 | 594 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
596 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
595 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
597 | 596 | add_filter( |
598 | 597 | 'FHEE__EE_Question__generate_form_input__country_options', |
599 | - array( $this, 'use_cached_countries_for_form_input' ), |
|
598 | + array($this, 'use_cached_countries_for_form_input'), |
|
600 | 599 | 10, |
601 | 600 | 4 |
602 | 601 | ); |
603 | 602 | add_filter( |
604 | 603 | 'FHEE__EE_Question__generate_form_input__state_options', |
605 | - array( $this, 'use_cached_states_for_form_input' ), |
|
604 | + array($this, 'use_cached_states_for_form_input'), |
|
606 | 605 | 10, |
607 | 606 | 4 |
608 | 607 | ); |
609 | 608 | $input_constructor_args = array( |
610 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
611 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
612 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
613 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
609 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
610 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
611 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
612 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
614 | 613 | 'html_label_class' => 'ee-reg-qstn', |
615 | 614 | ); |
616 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
617 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
618 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
619 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
620 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
615 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
616 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
617 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
618 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
619 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
621 | 620 | } |
622 | - $form_input = $question->generate_form_input( |
|
621 | + $form_input = $question->generate_form_input( |
|
623 | 622 | $registration, |
624 | 623 | $answer, |
625 | 624 | $input_constructor_args |
626 | 625 | ); |
627 | 626 | remove_filter( |
628 | 627 | 'FHEE__EE_Question__generate_form_input__country_options', |
629 | - array( $this, 'use_cached_countries_for_form_input' ) |
|
628 | + array($this, 'use_cached_countries_for_form_input') |
|
630 | 629 | ); |
631 | 630 | remove_filter( |
632 | 631 | 'FHEE__EE_Question__generate_form_input__state_options', |
633 | - array( $this, 'use_cached_states_for_form_input' ) |
|
632 | + array($this, 'use_cached_states_for_form_input') |
|
634 | 633 | ); |
635 | 634 | return $form_input; |
636 | 635 | } |
@@ -652,22 +651,22 @@ discard block |
||
652 | 651 | \EE_Registration $registration = null, |
653 | 652 | \EE_Answer $answer = null |
654 | 653 | ) { |
655 | - $country_options = array( '' => '' ); |
|
654 | + $country_options = array('' => ''); |
|
656 | 655 | // get possibly cached list of countries |
657 | 656 | $countries = $this->checkout->action === 'process_reg_step' |
658 | 657 | ? EEM_Country::instance()->get_all_countries() |
659 | 658 | : EEM_Country::instance()->get_all_active_countries(); |
660 | - if ( ! empty( $countries )) { |
|
661 | - foreach( $countries as $country ){ |
|
662 | - if ( $country instanceof EE_Country ) { |
|
663 | - $country_options[ $country->ID() ] = $country->name(); |
|
659 | + if ( ! empty($countries)) { |
|
660 | + foreach ($countries as $country) { |
|
661 | + if ($country instanceof EE_Country) { |
|
662 | + $country_options[$country->ID()] = $country->name(); |
|
664 | 663 | } |
665 | 664 | } |
666 | 665 | } |
667 | - if( $question instanceof EE_Question |
|
668 | - && $registration instanceof EE_Registration ) { |
|
666 | + if ($question instanceof EE_Question |
|
667 | + && $registration instanceof EE_Registration) { |
|
669 | 668 | $answer = EEM_Answer::instance()->get_one( |
670 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
669 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
671 | 670 | ); |
672 | 671 | } else { |
673 | 672 | $answer = EE_Answer::new_instance(); |
@@ -700,14 +699,14 @@ discard block |
||
700 | 699 | \EE_Registration $registration = null, |
701 | 700 | \EE_Answer $answer = null |
702 | 701 | ) { |
703 | - $state_options = array( '' => array( '' => '')); |
|
702 | + $state_options = array('' => array('' => '')); |
|
704 | 703 | $states = $this->checkout->action === 'process_reg_step' |
705 | 704 | ? EEM_State::instance()->get_all_states() |
706 | 705 | : EEM_State::instance()->get_all_active_states(); |
707 | - if ( ! empty( $states )) { |
|
708 | - foreach( $states as $state ){ |
|
709 | - if ( $state instanceof EE_State ) { |
|
710 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
706 | + if ( ! empty($states)) { |
|
707 | + foreach ($states as $state) { |
|
708 | + if ($state instanceof EE_State) { |
|
709 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
711 | 710 | } |
712 | 711 | } |
713 | 712 | } |
@@ -735,24 +734,24 @@ discard block |
||
735 | 734 | * @throws \EE_Error |
736 | 735 | */ |
737 | 736 | public function process_reg_step() { |
738 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
737 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
739 | 738 | // grab validated data from form |
740 | 739 | $valid_data = $this->checkout->current_step->valid_data(); |
741 | 740 | // EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
742 | 741 | // EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
743 | 742 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
744 | - if ( empty( $valid_data )) { |
|
743 | + if (empty($valid_data)) { |
|
745 | 744 | EE_Error::add_error( |
746 | - __( 'No valid question responses were received.', 'event_espresso' ), |
|
745 | + __('No valid question responses were received.', 'event_espresso'), |
|
747 | 746 | __FILE__, |
748 | 747 | __FUNCTION__, |
749 | 748 | __LINE__ |
750 | 749 | ); |
751 | 750 | return false; |
752 | 751 | } |
753 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
752 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
754 | 753 | EE_Error::add_error( |
755 | - __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), |
|
754 | + __('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), |
|
756 | 755 | __FILE__, |
757 | 756 | __FUNCTION__, |
758 | 757 | __LINE__ |
@@ -760,11 +759,11 @@ discard block |
||
760 | 759 | return false; |
761 | 760 | } |
762 | 761 | // get cached registrations |
763 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
762 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
764 | 763 | // verify we got the goods |
765 | - if ( empty( $registrations )) { |
|
764 | + if (empty($registrations)) { |
|
766 | 765 | EE_Error::add_error( |
767 | - __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), |
|
766 | + __('Your form data could not be applied to any valid registrations.', 'event_espresso'), |
|
768 | 767 | __FILE__, |
769 | 768 | __FUNCTION__, |
770 | 769 | __LINE__ |
@@ -772,15 +771,15 @@ discard block |
||
772 | 771 | return false; |
773 | 772 | } |
774 | 773 | // extract attendee info from form data and save to model objects |
775 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
774 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
776 | 775 | // if first pass thru SPCO, |
777 | 776 | // then let's check processed registrations against the total number of tickets in the cart |
778 | - if ( $registrations_processed === false ) { |
|
777 | + if ($registrations_processed === false) { |
|
779 | 778 | // but return immediately if the previous step exited early due to errors |
780 | 779 | return false; |
781 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
780 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
782 | 781 | // generate a correctly translated string for all possible singular/plural combinations |
783 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
782 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
784 | 783 | $error_msg = sprintf( |
785 | 784 | __( |
786 | 785 | 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', |
@@ -789,7 +788,7 @@ discard block |
||
789 | 788 | $this->checkout->total_ticket_count, |
790 | 789 | $registrations_processed |
791 | 790 | ); |
792 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
791 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
793 | 792 | $error_msg = sprintf( |
794 | 793 | __( |
795 | 794 | 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', |
@@ -808,17 +807,17 @@ discard block |
||
808 | 807 | $registrations_processed |
809 | 808 | ); |
810 | 809 | } |
811 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
810 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
812 | 811 | return false; |
813 | 812 | } |
814 | 813 | // mark this reg step as completed |
815 | 814 | $this->set_completed(); |
816 | 815 | $this->_set_success_message( |
817 | - __( 'The Attendee Information Step has been successfully completed.', 'event_espresso' ) |
|
816 | + __('The Attendee Information Step has been successfully completed.', 'event_espresso') |
|
818 | 817 | ); |
819 | 818 | //do action in case a plugin wants to do something with the data submitted in step 1. |
820 | 819 | //passes EE_Single_Page_Checkout, and it's posted data |
821 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
820 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
822 | 821 | return true; |
823 | 822 | } |
824 | 823 | |
@@ -832,9 +831,9 @@ discard block |
||
832 | 831 | * @return boolean | int |
833 | 832 | * @throws \EE_Error |
834 | 833 | */ |
835 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
834 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
836 | 835 | // load resources and set some defaults |
837 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
836 | + EE_Registry::instance()->load_model('Attendee'); |
|
838 | 837 | // holder for primary registrant attendee object |
839 | 838 | $this->checkout->primary_attendee_obj = NULL; |
840 | 839 | // array for tracking reg form data for the primary registrant |
@@ -851,9 +850,9 @@ discard block |
||
851 | 850 | // attendee counter |
852 | 851 | $att_nmbr = 0; |
853 | 852 | // grab the saved registrations from the transaction |
854 | - foreach ( $registrations as $registration ) { |
|
853 | + foreach ($registrations as $registration) { |
|
855 | 854 | // verify EE_Registration object |
856 | - if ( ! $registration instanceof EE_Registration ) { |
|
855 | + if ( ! $registration instanceof EE_Registration) { |
|
857 | 856 | EE_Error::add_error( |
858 | 857 | __( |
859 | 858 | 'An invalid Registration object was discovered when attempting to process your registration information.', |
@@ -868,12 +867,12 @@ discard block |
||
868 | 867 | /** @var string $reg_url_link */ |
869 | 868 | $reg_url_link = $registration->reg_url_link(); |
870 | 869 | // reg_url_link exists ? |
871 | - if ( ! empty( $reg_url_link ) ) { |
|
870 | + if ( ! empty($reg_url_link)) { |
|
872 | 871 | // should this registration be processed during this visit ? |
873 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
872 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
874 | 873 | // if NOT revisiting, then let's save the registration now, |
875 | 874 | // so that we have a REG_ID to use when generating other objects |
876 | - if ( ! $this->checkout->revisit ) { |
|
875 | + if ( ! $this->checkout->revisit) { |
|
877 | 876 | $registration->save(); |
878 | 877 | } |
879 | 878 | /** |
@@ -883,7 +882,7 @@ discard block |
||
883 | 882 | * @var bool if true is returned by the plugin then the |
884 | 883 | * registration processing is halted. |
885 | 884 | */ |
886 | - if ( apply_filters( |
|
885 | + if (apply_filters( |
|
887 | 886 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', |
888 | 887 | false, |
889 | 888 | $att_nmbr, |
@@ -891,38 +890,38 @@ discard block |
||
891 | 890 | $registrations, |
892 | 891 | $valid_data, |
893 | 892 | $this |
894 | - ) ) { |
|
893 | + )) { |
|
895 | 894 | return false; |
896 | 895 | } |
897 | 896 | |
898 | 897 | // Houston, we have a registration! |
899 | 898 | $att_nmbr++; |
900 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
899 | + $this->_attendee_data[$reg_url_link] = array(); |
|
901 | 900 | // grab any existing related answer objects |
902 | 901 | $this->_registration_answers = $registration->answers(); |
903 | 902 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
904 | - if ( isset( $valid_data[ $reg_url_link ] ) ) { |
|
903 | + if (isset($valid_data[$reg_url_link])) { |
|
905 | 904 | // do we need to copy basic info from primary attendee ? |
906 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
|
907 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
905 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) |
|
906 | + && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 |
|
908 | 907 | ? true |
909 | 908 | : false; |
910 | 909 | // filter form input data for this registration |
911 | - $valid_data[ $reg_url_link ] = (array)apply_filters( |
|
910 | + $valid_data[$reg_url_link] = (array) apply_filters( |
|
912 | 911 | 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
913 | - $valid_data[ $reg_url_link ] |
|
912 | + $valid_data[$reg_url_link] |
|
914 | 913 | ); |
915 | 914 | // EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
916 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
917 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) |
|
915 | + if (isset($valid_data['primary_attendee'])) { |
|
916 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) |
|
918 | 917 | ? $valid_data['primary_attendee'] |
919 | 918 | : false; |
920 | - unset( $valid_data['primary_attendee'] ); |
|
919 | + unset($valid_data['primary_attendee']); |
|
921 | 920 | } |
922 | 921 | // now loop through our array of valid post data && process attendee reg forms |
923 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
924 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
925 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
922 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
923 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
924 | + foreach ($form_inputs as $form_input => $input_value) { |
|
926 | 925 | // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ ); |
927 | 926 | // check for critical inputs |
928 | 927 | if ( |
@@ -936,16 +935,16 @@ discard block |
||
936 | 935 | // store a bit of data about the primary attendee |
937 | 936 | if ( |
938 | 937 | $att_nmbr === 1 |
939 | - && ! empty( $input_value ) |
|
938 | + && ! empty($input_value) |
|
940 | 939 | && $reg_url_link === $primary_registrant['line_item_id'] |
941 | 940 | ) { |
942 | - $primary_registrant[ $form_input ] = $input_value; |
|
941 | + $primary_registrant[$form_input] = $input_value; |
|
943 | 942 | } else if ( |
944 | 943 | $copy_primary |
945 | 944 | && $input_value === null |
946 | - && isset( $primary_registrant[ $form_input ] ) |
|
945 | + && isset($primary_registrant[$form_input]) |
|
947 | 946 | ) { |
948 | - $input_value = $primary_registrant[ $form_input ]; |
|
947 | + $input_value = $primary_registrant[$form_input]; |
|
949 | 948 | } |
950 | 949 | // now attempt to save the input data |
951 | 950 | if ( |
@@ -987,55 +986,55 @@ discard block |
||
987 | 986 | // have we met before? |
988 | 987 | $attendee = $this->_find_existing_attendee( |
989 | 988 | $registration, |
990 | - $this->_attendee_data[ $reg_url_link ] |
|
989 | + $this->_attendee_data[$reg_url_link] |
|
991 | 990 | ); |
992 | 991 | // did we find an already existing record for this attendee ? |
993 | - if ( $attendee instanceof EE_Attendee ) { |
|
992 | + if ($attendee instanceof EE_Attendee) { |
|
994 | 993 | $attendee = $this->_update_existing_attendee_data( |
995 | 994 | $attendee, |
996 | - $this->_attendee_data[ $reg_url_link ] |
|
995 | + $this->_attendee_data[$reg_url_link] |
|
997 | 996 | ); |
998 | 997 | } else { |
999 | 998 | // ensure critical details are set for additional attendees |
1000 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 |
|
999 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 |
|
1001 | 1000 | ? $this->_copy_critical_attendee_details_from_primary_registrant( |
1002 | - $this->_attendee_data[ $reg_url_link ] |
|
1001 | + $this->_attendee_data[$reg_url_link] |
|
1003 | 1002 | ) |
1004 | - : $this->_attendee_data[ $reg_url_link ]; |
|
1003 | + : $this->_attendee_data[$reg_url_link]; |
|
1005 | 1004 | $attendee = $this->_create_new_attendee( |
1006 | 1005 | $registration, |
1007 | - $this->_attendee_data[ $reg_url_link ] |
|
1006 | + $this->_attendee_data[$reg_url_link] |
|
1008 | 1007 | ); |
1009 | 1008 | } |
1010 | 1009 | // who's #1 ? |
1011 | - if ( $att_nmbr === 1 ) { |
|
1010 | + if ($att_nmbr === 1) { |
|
1012 | 1011 | $this->checkout->primary_attendee_obj = $attendee; |
1013 | 1012 | } |
1014 | 1013 | } |
1015 | 1014 | // EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
1016 | 1015 | // add relation to registration, set attendee ID, and cache attendee |
1017 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
1016 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
1018 | 1017 | // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ ); |
1019 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
1020 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1018 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
1019 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
1021 | 1020 | return false; |
1022 | 1021 | } |
1023 | 1022 | /** @type EE_Registration_Processor $registration_processor */ |
1024 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1023 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1025 | 1024 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1026 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
1025 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, false); |
|
1027 | 1026 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1028 | 1027 | $this->checkout->transaction->toggle_failed_transaction_status(); |
1029 | 1028 | // if we've gotten this far, then let's save what we have |
1030 | 1029 | $registration->save(); |
1031 | 1030 | // add relation between TXN and registration |
1032 | - $this->_associate_registration_with_transaction( $registration ); |
|
1031 | + $this->_associate_registration_with_transaction($registration); |
|
1033 | 1032 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
1034 | 1033 | |
1035 | - } else { |
|
1036 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1034 | + } else { |
|
1035 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1037 | 1036 | // remove malformed data |
1038 | - unset( $valid_data[ $reg_url_link ] ); |
|
1037 | + unset($valid_data[$reg_url_link]); |
|
1039 | 1038 | return false; |
1040 | 1039 | } |
1041 | 1040 | |
@@ -1064,26 +1063,26 @@ discard block |
||
1064 | 1063 | // \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
1065 | 1064 | // allow for plugins to hook in and do their own processing of the form input. |
1066 | 1065 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
1067 | - if ( apply_filters( |
|
1066 | + if (apply_filters( |
|
1068 | 1067 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', |
1069 | 1068 | false, |
1070 | 1069 | $registration, |
1071 | 1070 | $form_input, |
1072 | 1071 | $input_value, |
1073 | 1072 | $this |
1074 | - ) ) { |
|
1073 | + )) { |
|
1075 | 1074 | return true; |
1076 | 1075 | } |
1077 | 1076 | // $answer_cache_id is the key used to find the EE_Answer we want |
1078 | 1077 | $answer_cache_id = $this->checkout->reg_url_link |
1079 | 1078 | ? $form_input |
1080 | - : $form_input . '-' . $registration->reg_url_link(); |
|
1081 | - $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
|
1082 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1079 | + : $form_input.'-'.$registration->reg_url_link(); |
|
1080 | + $answer_is_obj = isset($this->_registration_answers[$answer_cache_id]) |
|
1081 | + && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer |
|
1083 | 1082 | ? true |
1084 | 1083 | : false; |
1085 | 1084 | //rename form_inputs if they are EE_Attendee properties |
1086 | - switch( (string)$form_input ) { |
|
1085 | + switch ((string) $form_input) { |
|
1087 | 1086 | |
1088 | 1087 | case 'state' : |
1089 | 1088 | case 'STA_ID' : |
@@ -1098,32 +1097,32 @@ discard block |
||
1098 | 1097 | break; |
1099 | 1098 | |
1100 | 1099 | default : |
1101 | - $ATT_input = 'ATT_' . $form_input; |
|
1100 | + $ATT_input = 'ATT_'.$form_input; |
|
1102 | 1101 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
1103 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false; |
|
1104 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
1102 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false; |
|
1103 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
1105 | 1104 | } |
1106 | 1105 | // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
1107 | 1106 | // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
1108 | 1107 | // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
1109 | 1108 | // if this form input has a corresponding attendee property |
1110 | - if ( $attendee_property ) { |
|
1111 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
1112 | - if ( $answer_is_obj ) { |
|
1109 | + if ($attendee_property) { |
|
1110 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
1111 | + if ($answer_is_obj) { |
|
1113 | 1112 | // and delete the corresponding answer since we won't be storing this data in that object |
1114 | - $registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' ); |
|
1115 | - $this->_registration_answers[ $answer_cache_id ]->delete_permanently(); |
|
1113 | + $registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer'); |
|
1114 | + $this->_registration_answers[$answer_cache_id]->delete_permanently(); |
|
1116 | 1115 | } |
1117 | 1116 | return true; |
1118 | - } elseif ( $answer_is_obj ) { |
|
1117 | + } elseif ($answer_is_obj) { |
|
1119 | 1118 | // save this data to the answer object |
1120 | - $this->_registration_answers[ $answer_cache_id ]->set_value( $input_value ); |
|
1121 | - $result = $this->_registration_answers[ $answer_cache_id ]->save(); |
|
1119 | + $this->_registration_answers[$answer_cache_id]->set_value($input_value); |
|
1120 | + $result = $this->_registration_answers[$answer_cache_id]->save(); |
|
1122 | 1121 | return $result !== false ? true : false; |
1123 | 1122 | } else { |
1124 | - foreach ( $this->_registration_answers as $answer ) { |
|
1125 | - if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) { |
|
1126 | - $answer->set_value( $input_value ); |
|
1123 | + foreach ($this->_registration_answers as $answer) { |
|
1124 | + if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) { |
|
1125 | + $answer->set_value($input_value); |
|
1127 | 1126 | $result = $answer->save(); |
1128 | 1127 | return $result !== false ? true : false; |
1129 | 1128 | } |
@@ -1145,15 +1144,15 @@ discard block |
||
1145 | 1144 | $form_input = '', |
1146 | 1145 | $input_value = '' |
1147 | 1146 | ) { |
1148 | - if ( empty( $input_value ) ) { |
|
1147 | + if (empty($input_value)) { |
|
1149 | 1148 | // if the form input isn't marked as being required, then just return |
1150 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
1149 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
1151 | 1150 | return true; |
1152 | 1151 | } |
1153 | - switch ( $form_input ) { |
|
1152 | + switch ($form_input) { |
|
1154 | 1153 | case 'fname' : |
1155 | 1154 | EE_Error::add_error( |
1156 | - __( 'First Name is a required value.', 'event_espresso' ), |
|
1155 | + __('First Name is a required value.', 'event_espresso'), |
|
1157 | 1156 | __FILE__, |
1158 | 1157 | __FUNCTION__, |
1159 | 1158 | __LINE__ |
@@ -1162,7 +1161,7 @@ discard block |
||
1162 | 1161 | break; |
1163 | 1162 | case 'lname' : |
1164 | 1163 | EE_Error::add_error( |
1165 | - __( 'Last Name is a required value.', 'event_espresso' ), |
|
1164 | + __('Last Name is a required value.', 'event_espresso'), |
|
1166 | 1165 | __FILE__, |
1167 | 1166 | __FUNCTION__, |
1168 | 1167 | __LINE__ |
@@ -1171,7 +1170,7 @@ discard block |
||
1171 | 1170 | break; |
1172 | 1171 | case 'email' : |
1173 | 1172 | EE_Error::add_error( |
1174 | - __( 'Please enter a valid email address.', 'event_espresso' ), |
|
1173 | + __('Please enter a valid email address.', 'event_espresso'), |
|
1175 | 1174 | __FILE__, |
1176 | 1175 | __FUNCTION__, |
1177 | 1176 | __LINE__ |
@@ -1204,21 +1203,21 @@ discard block |
||
1204 | 1203 | * @param array $attendee_data |
1205 | 1204 | * @return boolean |
1206 | 1205 | */ |
1207 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1206 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1208 | 1207 | $existing_attendee = null; |
1209 | 1208 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1210 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) |
|
1209 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) |
|
1211 | 1210 | ? $attendee_data['ATT_fname'] |
1212 | 1211 | : ''; |
1213 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) |
|
1212 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) |
|
1214 | 1213 | ? $attendee_data['ATT_lname'] |
1215 | 1214 | : ''; |
1216 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) |
|
1215 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) |
|
1217 | 1216 | ? $attendee_data['ATT_email'] |
1218 | 1217 | : ''; |
1219 | 1218 | // but only if those have values |
1220 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
1221 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
1219 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
1220 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
1222 | 1221 | 'ATT_fname' => $ATT_fname, |
1223 | 1222 | 'ATT_lname' => $ATT_lname, |
1224 | 1223 | 'ATT_email' => $ATT_email |
@@ -1242,13 +1241,13 @@ discard block |
||
1242 | 1241 | * @return \EE_Attendee |
1243 | 1242 | * @throws \EE_Error |
1244 | 1243 | */ |
1245 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
1244 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
1246 | 1245 | // first remove fname, lname, and email from attendee data |
1247 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1246 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1248 | 1247 | // now loop thru what's left and add to attendee CPT |
1249 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1250 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1251 | - $existing_attendee->set( $property_name, $property_value ); |
|
1248 | + foreach ($attendee_data as $property_name => $property_value) { |
|
1249 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1250 | + $existing_attendee->set($property_name, $property_value); |
|
1252 | 1251 | } |
1253 | 1252 | } |
1254 | 1253 | // better save that now |
@@ -1266,11 +1265,11 @@ discard block |
||
1266 | 1265 | * @return void |
1267 | 1266 | * @throws \EE_Error |
1268 | 1267 | */ |
1269 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1268 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1270 | 1269 | // add relation to attendee |
1271 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1272 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1273 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1270 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1271 | + $registration->set_attendee_id($attendee->ID()); |
|
1272 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1274 | 1273 | } |
1275 | 1274 | |
1276 | 1275 | |
@@ -1282,10 +1281,10 @@ discard block |
||
1282 | 1281 | * @return void |
1283 | 1282 | * @throws \EE_Error |
1284 | 1283 | */ |
1285 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1284 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1286 | 1285 | // add relation to attendee |
1287 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1288 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1286 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1287 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1289 | 1288 | } |
1290 | 1289 | |
1291 | 1290 | |
@@ -1298,14 +1297,14 @@ discard block |
||
1298 | 1297 | * @return array |
1299 | 1298 | * @throws \EE_Error |
1300 | 1299 | */ |
1301 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1300 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1302 | 1301 | // bare minimum critical details include first name, last name, email address |
1303 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1302 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1304 | 1303 | // add address info to critical details? |
1305 | - if ( apply_filters( |
|
1304 | + if (apply_filters( |
|
1306 | 1305 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', |
1307 | 1306 | false |
1308 | - ) ) { |
|
1307 | + )) { |
|
1309 | 1308 | $address_details = array( |
1310 | 1309 | 'ATT_address', |
1311 | 1310 | 'ATT_address2', |
@@ -1315,13 +1314,13 @@ discard block |
||
1315 | 1314 | 'ATT_zip', |
1316 | 1315 | 'ATT_phone' |
1317 | 1316 | ); |
1318 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1317 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1319 | 1318 | } |
1320 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1321 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
|
1322 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1319 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1320 | + if ( ! isset($attendee_data[$critical_attendee_detail]) |
|
1321 | + || empty($attendee_data[$critical_attendee_detail]) |
|
1323 | 1322 | ) { |
1324 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
|
1323 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get( |
|
1325 | 1324 | $critical_attendee_detail |
1326 | 1325 | ); |
1327 | 1326 | } |
@@ -1339,11 +1338,11 @@ discard block |
||
1339 | 1338 | * @return \EE_Attendee |
1340 | 1339 | * @throws \EE_Error |
1341 | 1340 | */ |
1342 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1341 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1343 | 1342 | // create new attendee object |
1344 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1343 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1345 | 1344 | // set author to event creator |
1346 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1345 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1347 | 1346 | $new_attendee->save(); |
1348 | 1347 | return $new_attendee; |
1349 | 1348 | } |
@@ -1360,7 +1359,7 @@ discard block |
||
1360 | 1359 | */ |
1361 | 1360 | public function update_reg_step() { |
1362 | 1361 | // save everything |
1363 | - if ( $this->process_reg_step() ) { |
|
1362 | + if ($this->process_reg_step()) { |
|
1364 | 1363 | $this->checkout->redirect = true; |
1365 | 1364 | $this->checkout->redirect_url = add_query_arg( |
1366 | 1365 | array( |
@@ -1369,7 +1368,7 @@ discard block |
||
1369 | 1368 | ), |
1370 | 1369 | $this->checkout->thank_you_page_url |
1371 | 1370 | ); |
1372 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1371 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1373 | 1372 | return true; |
1374 | 1373 | } |
1375 | 1374 | return false; |
@@ -1012,7 +1012,7 @@ |
||
1012 | 1012 | $this->_associate_registration_with_transaction( $registration ); |
1013 | 1013 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
1014 | 1014 | |
1015 | - } else { |
|
1015 | + } else { |
|
1016 | 1016 | EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
1017 | 1017 | // remove malformed data |
1018 | 1018 | unset( $valid_data[ $reg_url_link ] ); |
@@ -588,6 +588,7 @@ |
||
588 | 588 | * @param EE_Registration $registration |
589 | 589 | * @param EE_Question $question |
590 | 590 | * @param mixed EE_Answer|NULL $answer |
591 | + * @param EE_Answer $answer |
|
591 | 592 | * @return EE_Form_Input_Base |
592 | 593 | * @throws \EE_Error |
593 | 594 | */ |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * |
11 | 11 | */ |
12 | 12 | |
13 | -class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy { |
|
13 | +class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Table header for display. |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * @param array $options |
19 | 19 | * @return string |
20 | 20 | */ |
21 | - protected function _table_header( $options ) { |
|
22 | - $html = EEH_HTML::table( '','', $options['table_css_class'] ); |
|
21 | + protected function _table_header($options) { |
|
22 | + $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
23 | 23 | $html .= EEH_HTML::thead(); |
24 | 24 | $html .= EEH_HTML::tr(); |
25 | - $html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' ); |
|
26 | - $html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' ); |
|
27 | - $html .= EEH_HTML::th( __( 'Date(s)', 'event_espresso' ), '', 'jst-left' ); |
|
28 | - $html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' ); |
|
25 | + $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
26 | + $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
27 | + $html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left'); |
|
28 | + $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
29 | 29 | $html .= EEH_HTML::tbody(); |
30 | 30 | return $html; |
31 | 31 | } |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | * @param array $options |
42 | 42 | * @return mixed |
43 | 43 | */ |
44 | - protected function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
44 | + protected function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
45 | 45 | $line_item_related_object = $line_item->get_object(); |
46 | 46 | $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item |
47 | 47 | ? $line_item->parent()->get_object() |
48 | 48 | : null; |
49 | 49 | // start of row |
50 | 50 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
51 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
51 | + $html = EEH_HTML::tr('', '', $row_class); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | //Name Column |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object |
59 | 59 | ? $parent_line_item_related_object->name() |
60 | 60 | : ''; |
61 | - $parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item |
|
61 | + $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item |
|
62 | 62 | ? $line_item->parent()->name() |
63 | 63 | : $parent_related_object_name; |
64 | 64 | $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links |
@@ -68,51 +68,51 @@ discard block |
||
68 | 68 | |
69 | 69 | $name_html = $line_item_related_object instanceof EEI_Line_Item_Object |
70 | 70 | ? $line_item_related_object->name() : $line_item->name(); |
71 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' |
|
71 | + $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' |
|
72 | 72 | : $name_html; |
73 | 73 | $name_html .= $line_item->is_taxable() ? ' *' : ''; |
74 | 74 | //maybe preface with icon? |
75 | 75 | $name_html = $line_item_related_object instanceof EEI_Has_Icon |
76 | - ? $line_item_related_object->get_icon() . $name_html |
|
76 | + ? $line_item_related_object->get_icon().$name_html |
|
77 | 77 | : $name_html; |
78 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
79 | - $name_html .= sprintf( |
|
80 | - _x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
78 | + $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>'; |
|
79 | + $name_html .= sprintf( |
|
80 | + _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
81 | 81 | '<span class="ee-line-item-related-parent-object">', |
82 | 82 | $line_item->parent() instanceof EE_Line_Item |
83 | 83 | ? $line_item->parent()->OBJ_type_i18n() |
84 | - : __( 'Item:', 'event_espresso' ), |
|
84 | + : __('Item:', 'event_espresso'), |
|
85 | 85 | $parent_related_object_link |
86 | - ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
86 | + ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' |
|
87 | 87 | : $parent_related_object_name, |
88 | 88 | '</span>' |
89 | 89 | ); |
90 | - $html .= EEH_HTML::td( $name_html, '', 'jst-left' ); |
|
90 | + $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
91 | 91 | //Type Column |
92 | 92 | $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
93 | - $type_html .= $this->_get_cancellations( $line_item ); |
|
93 | + $type_html .= $this->_get_cancellations($line_item); |
|
94 | 94 | $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
95 | 95 | $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
96 | - $type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : ''; |
|
97 | - $html .= EEH_HTML::td( $type_html, '', 'jst-left' ); |
|
96 | + $type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : ''; |
|
97 | + $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
98 | 98 | |
99 | 99 | //Date column |
100 | 100 | $datetime_content = ''; |
101 | - if ( $line_item_related_object instanceof EE_Ticket ) { |
|
101 | + if ($line_item_related_object instanceof EE_Ticket) { |
|
102 | 102 | $datetimes = $line_item_related_object->datetimes(); |
103 | - foreach ( $datetimes as $datetime ) { |
|
104 | - if ( $datetime instanceof EE_Datetime ) { |
|
105 | - $datetime_content .= $datetime->get_dtt_display_name() . '<br>'; |
|
103 | + foreach ($datetimes as $datetime) { |
|
104 | + if ($datetime instanceof EE_Datetime) { |
|
105 | + $datetime_content .= $datetime->get_dtt_display_name().'<br>'; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
109 | - $html .= EEH_HTML::td( $datetime_content, '', 'jst-left' ); |
|
109 | + $html .= EEH_HTML::td($datetime_content, '', 'jst-left'); |
|
110 | 110 | |
111 | 111 | //Amount Column |
112 | - if ( $line_item->is_percent() ) { |
|
113 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' ); |
|
112 | + if ($line_item->is_percent()) { |
|
113 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght'); |
|
114 | 114 | } else { |
115 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' ); |
|
115 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | * @param array $options |
131 | 131 | * @return mixed |
132 | 132 | */ |
133 | - protected function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
133 | + protected function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
134 | 134 | // start of row |
135 | - $html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' ); |
|
135 | + $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
136 | 136 | // name th |
137 | - $html .= EEH_HTML::th( $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '', 'jst-rght', '', ' colspan="3"' ); |
|
137 | + $html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="3"'); |
|
138 | 138 | // total th |
139 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
139 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
140 | 140 | // end of row |
141 | 141 | $html .= EEH_HTML::trx(); |
142 | 142 | return $html; |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | * @param array $options |
154 | 154 | * @return mixed |
155 | 155 | */ |
156 | - protected function _total_row( EE_Line_Item $line_item, $options = array() ) { |
|
156 | + protected function _total_row(EE_Line_Item $line_item, $options = array()) { |
|
157 | 157 | |
158 | - $registration = isset( $options['EE_Registration'] ) ? $options['EE_Registration'] : null; |
|
158 | + $registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null; |
|
159 | 159 | $registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0; |
160 | 160 | //if no valid registration object then we're not going to show the approximate text. |
161 | 161 | $total_match = $registration instanceof EE_Registration |
@@ -163,26 +163,26 @@ discard block |
||
163 | 163 | : true; |
164 | 164 | |
165 | 165 | // start of row |
166 | - $html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' ); |
|
166 | + $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
167 | 167 | // Total th label |
168 | - if ( $total_match ) { |
|
169 | - $total_label = sprintf( __( 'This registration\'s total %s:', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' ); |
|
168 | + if ($total_match) { |
|
169 | + $total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); |
|
170 | 170 | } else { |
171 | - $total_label = sprintf( __( 'This registration\'s approximate total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' ); |
|
171 | + $total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); |
|
172 | 172 | $total_label .= '<br>'; |
173 | 173 | $total_label .= '<p class="ee-footnote-text">' |
174 | 174 | . sprintf( |
175 | - __( 'The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others. This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso' ), |
|
175 | + __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others. This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'), |
|
176 | 176 | '<strong>', |
177 | 177 | $registration_total, |
178 | 178 | '</strong>' |
179 | 179 | ) |
180 | 180 | . '</p>'; |
181 | 181 | } |
182 | - $html .= EEH_HTML::th( $total_label, '', 'jst-rght', '', ' colspan="3"' ); |
|
182 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"'); |
|
183 | 183 | // total th |
184 | 184 | |
185 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
185 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
186 | 186 | // end of row |
187 | 187 | $html .= EEH_HTML::trx(); |
188 | 188 | return $html; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\domain\services\ticket\CancelTicketLineItemService; |
5 | 5 | |
6 | 6 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
7 | - exit('No direct script access allowed'); |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -21,22 +21,22 @@ discard block |
||
21 | 21 | class CancelRegistrationService |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
26 | - */ |
|
27 | - private $cancel_ticket_line_item_service; |
|
24 | + /** |
|
25 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
26 | + */ |
|
27 | + private $cancel_ticket_line_item_service; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * Command constructor |
|
33 | - * |
|
34 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
35 | - */ |
|
36 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
37 | - { |
|
38 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
39 | - } |
|
31 | + /** |
|
32 | + * Command constructor |
|
33 | + * |
|
34 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
35 | + */ |
|
36 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
37 | + { |
|
38 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
@@ -44,27 +44,27 @@ discard block |
||
44 | 44 | * @param \EE_Registration $registration |
45 | 45 | * @param bool $cancel_ticket_line_item |
46 | 46 | */ |
47 | - public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
|
48 | - { |
|
49 | - // first cancel the original line item for the registration's ticket |
|
50 | - if ( $cancel_ticket_line_item ) { |
|
51 | - $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
52 | - } |
|
53 | - $this->cancelRegistrationOnly($registration); |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * @param \EE_Registration $registration |
|
60 | - * @throws \EE_Error |
|
61 | - */ |
|
62 | - public function cancelRegistrationOnly(\EE_Registration $registration) |
|
63 | - { |
|
64 | - // now cancel the registration itself |
|
65 | - $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
66 | - $registration->save(); |
|
67 | - } |
|
47 | + public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
|
48 | + { |
|
49 | + // first cancel the original line item for the registration's ticket |
|
50 | + if ( $cancel_ticket_line_item ) { |
|
51 | + $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
52 | + } |
|
53 | + $this->cancelRegistrationOnly($registration); |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * @param \EE_Registration $registration |
|
60 | + * @throws \EE_Error |
|
61 | + */ |
|
62 | + public function cancelRegistrationOnly(\EE_Registration $registration) |
|
63 | + { |
|
64 | + // now cancel the registration itself |
|
65 | + $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
66 | + $registration->save(); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | 70 |
@@ -47,8 +47,8 @@ |
||
47 | 47 | public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
48 | 48 | { |
49 | 49 | // first cancel the original line item for the registration's ticket |
50 | - if ( $cancel_ticket_line_item ) { |
|
51 | - $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
50 | + if ($cancel_ticket_line_item) { |
|
51 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
52 | 52 | } |
53 | 53 | $this->cancelRegistrationOnly($registration); |
54 | 54 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <div style="float:right"> |
2 | - <?php printf( __( 'View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso' ), '<a href="' . $filtered_registrations_link . '">', '<a href="' . $filtered_transactions_link . '">', '<a href="' . $event_link . '">', '</a>' );?> |
|
2 | + <?php printf(__('View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso'), '<a href="'.$filtered_registrations_link.'">', '<a href="'.$filtered_transactions_link.'">', '<a href="'.$event_link.'">', '</a>'); ?> |
|
3 | 3 | </div> |
4 | -<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration . ' '; echo __( 'Registration # ', 'event_espresso' ) . $reg_nmbr['value']; echo ' ' . $next_registration; ?></h3> |
|
5 | -<h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value'];?></h2> |
|
4 | +<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration.' '; echo __('Registration # ', 'event_espresso').$reg_nmbr['value']; echo ' '.$next_registration; ?></h3> |
|
5 | +<h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value']; ?></h2> |
|
6 | 6 | |
7 | -<?php if ( $registration->group_size() > 1 ) : ?> |
|
8 | - <a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"><?php echo __( 'Scroll to Other Registrations in the Same Transaction', 'event_espresso' );?></a> |
|
7 | +<?php if ($registration->group_size() > 1) : ?> |
|
8 | + <a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"><?php echo __('Scroll to Other Registrations in the Same Transaction', 'event_espresso'); ?></a> |
|
9 | 9 | <?php endif; ?> |
10 | 10 | |
11 | -<?php do_action( 'AHEE__reg_status_change_buttons__after_header', $REG_ID ); ?> |
|
11 | +<?php do_action('AHEE__reg_status_change_buttons__after_header', $REG_ID); ?> |
|
12 | 12 |
@@ -829,11 +829,11 @@ discard block |
||
829 | 829 | if ( ! empty( $id ) ) { |
830 | 830 | $post = get_post( $id ); |
831 | 831 | $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' |
832 | - . esc_html__( 'Shortcode', 'event_espresso' ) |
|
833 | - . '</a> '; |
|
832 | + . esc_html__( 'Shortcode', 'event_espresso' ) |
|
833 | + . '</a> '; |
|
834 | 834 | $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' |
835 | - . $post->ID |
|
836 | - . ']">'; |
|
835 | + . $post->ID |
|
836 | + . ']">'; |
|
837 | 837 | } |
838 | 838 | return $return; |
839 | 839 | } |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
1046 | 1046 | if ( ! empty( $dtt['DTT_ID'] ) ) { |
1047 | 1047 | $DTM = EE_Registry::instance() |
1048 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1048 | + ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | + ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1050 | 1050 | $DTM->set_date_format( $incoming_date_formats[0] ); |
1051 | 1051 | $DTM->set_time_format( $incoming_date_formats[1] ); |
1052 | 1052 | foreach ( $datetime_values as $field => $value ) { |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | ) > 0 ? true : false; |
1145 | 1145 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1146 | 1146 | $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
1147 | - && ! $TKT->get( |
|
1147 | + && ! $TKT->get( |
|
1148 | 1148 | 'TKT_deleted' |
1149 | 1149 | ) ? true : false; |
1150 | 1150 | $TKT->set_date_format( $incoming_date_formats[0] ); |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | $first_datetime = reset( $times ); |
1455 | 1455 | //do we get related tickets? |
1456 | 1456 | if ( $first_datetime instanceof EE_Datetime |
1457 | - && $first_datetime->ID() !== 0 |
|
1457 | + && $first_datetime->ID() !== 0 |
|
1458 | 1458 | ) { |
1459 | 1459 | $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
1460 | 1460 | $template_args['time'] = $first_datetime; |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1530 | 1530 | 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
1531 | 1531 | 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
1532 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1532 | + && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1533 | 1533 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1534 | 1534 | 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
1535 | 1535 | : ' disabled=disabled', |
@@ -1695,8 +1695,8 @@ discard block |
||
1695 | 1695 | $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
1696 | 1696 | $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
1697 | 1697 | $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
1698 | - ->setTime( 23, 59, 59 ) |
|
1699 | - ->format( implode( ' ', $start_formats ) ); |
|
1698 | + ->setTime( 23, 59, 59 ) |
|
1699 | + ->format( implode( ' ', $start_formats ) ); |
|
1700 | 1700 | $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
1701 | 1701 | } |
1702 | 1702 | if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | } |
1717 | 1717 | if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
1718 | 1718 | if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
1719 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1719 | + && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1720 | 1720 | ) { |
1721 | 1721 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1722 | 1722 | } |
@@ -2213,13 +2213,13 @@ discard block |
||
2213 | 2213 | protected function _template_settings() { |
2214 | 2214 | $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
2215 | 2215 | $this->_template_args['preview_img'] = '<img src="' |
2216 | - . EVENTS_ASSETS_URL |
|
2217 | - . DS |
|
2218 | - . 'images' |
|
2219 | - . DS |
|
2220 | - . 'caffeinated_template_features.jpg" alt="' |
|
2221 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2222 | - . '" />'; |
|
2216 | + . EVENTS_ASSETS_URL |
|
2217 | + . DS |
|
2218 | + . 'images' |
|
2219 | + . DS |
|
2220 | + . 'caffeinated_template_features.jpg" alt="' |
|
2221 | + . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2222 | + . '" />'; |
|
2223 | 2223 | $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
2224 | 2224 | 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', |
2225 | 2225 | 'event_espresso' |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ); |
64 | 64 | add_action( |
65 | 65 | 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', |
66 | - array( $this, 'verify_event_edit' ) |
|
66 | + array($this, 'verify_event_edit') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
@@ -79,22 +79,22 @@ discard block |
||
79 | 79 | $this->_admin_page_title = EVENTS_LABEL; |
80 | 80 | $this->_labels = array( |
81 | 81 | 'buttons' => array( |
82 | - 'add' => esc_html__( 'Add New Event', 'event_espresso' ), |
|
83 | - 'edit' => esc_html__( 'Edit Event', 'event_espresso' ), |
|
84 | - 'delete' => esc_html__( 'Delete Event', 'event_espresso' ), |
|
85 | - 'add_category' => esc_html__( 'Add New Category', 'event_espresso' ), |
|
86 | - 'edit_category' => esc_html__( 'Edit Category', 'event_espresso' ), |
|
87 | - 'delete_category' => esc_html__( 'Delete Category', 'event_espresso' ), |
|
82 | + 'add' => esc_html__('Add New Event', 'event_espresso'), |
|
83 | + 'edit' => esc_html__('Edit Event', 'event_espresso'), |
|
84 | + 'delete' => esc_html__('Delete Event', 'event_espresso'), |
|
85 | + 'add_category' => esc_html__('Add New Category', 'event_espresso'), |
|
86 | + 'edit_category' => esc_html__('Edit Category', 'event_espresso'), |
|
87 | + 'delete_category' => esc_html__('Delete Category', 'event_espresso'), |
|
88 | 88 | ), |
89 | 89 | 'editor_title' => array( |
90 | - 'espresso_events' => esc_html__( 'Enter event title here', 'event_espresso' ), |
|
90 | + 'espresso_events' => esc_html__('Enter event title here', 'event_espresso'), |
|
91 | 91 | ), |
92 | 92 | 'publishbox' => array( |
93 | - 'create_new' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
94 | - 'edit' => esc_html__( 'Update Event', 'event_espresso' ), |
|
95 | - 'add_category' => esc_html__( 'Save New Category', 'event_espresso' ), |
|
96 | - 'edit_category' => esc_html__( 'Update Category', 'event_espresso' ), |
|
97 | - 'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ), |
|
93 | + 'create_new' => esc_html__('Save New Event', 'event_espresso'), |
|
94 | + 'edit' => esc_html__('Update Event', 'event_espresso'), |
|
95 | + 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
|
96 | + 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
|
97 | + 'template_settings' => esc_html__('Update Settings', 'event_espresso'), |
|
98 | 98 | ), |
99 | 99 | ); |
100 | 100 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | //load formatter helper |
106 | 106 | //load field generator helper |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
109 | 109 | ? $this->_req_data['EVT_ID'] : 0; |
110 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
110 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
111 | 111 | $this->_page_routes = array( |
112 | 112 | 'default' => array( |
113 | 113 | 'func' => '_events_overview_list_table', |
@@ -130,27 +130,27 @@ discard block |
||
130 | 130 | ), |
131 | 131 | 'trash_event' => array( |
132 | 132 | 'func' => '_trash_or_restore_event', |
133 | - 'args' => array( 'event_status' => 'trash' ), |
|
133 | + 'args' => array('event_status' => 'trash'), |
|
134 | 134 | 'capability' => 'ee_delete_event', |
135 | 135 | 'obj_id' => $evt_id, |
136 | 136 | 'noheader' => true, |
137 | 137 | ), |
138 | 138 | 'trash_events' => array( |
139 | 139 | 'func' => '_trash_or_restore_events', |
140 | - 'args' => array( 'event_status' => 'trash' ), |
|
140 | + 'args' => array('event_status' => 'trash'), |
|
141 | 141 | 'capability' => 'ee_delete_events', |
142 | 142 | 'noheader' => true, |
143 | 143 | ), |
144 | 144 | 'restore_event' => array( |
145 | 145 | 'func' => '_trash_or_restore_event', |
146 | - 'args' => array( 'event_status' => 'draft' ), |
|
146 | + 'args' => array('event_status' => 'draft'), |
|
147 | 147 | 'capability' => 'ee_delete_event', |
148 | 148 | 'obj_id' => $evt_id, |
149 | 149 | 'noheader' => true, |
150 | 150 | ), |
151 | 151 | 'restore_events' => array( |
152 | 152 | 'func' => '_trash_or_restore_events', |
153 | - 'args' => array( 'event_status' => 'draft' ), |
|
153 | + 'args' => array('event_status' => 'draft'), |
|
154 | 154 | 'capability' => 'ee_delete_events', |
155 | 155 | 'noheader' => true, |
156 | 156 | ), |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | 'add_category' => array( |
187 | 187 | 'func' => '_category_details', |
188 | 188 | 'capability' => 'ee_edit_event_category', |
189 | - 'args' => array( 'add' ), |
|
189 | + 'args' => array('add'), |
|
190 | 190 | ), |
191 | 191 | 'edit_category' => array( |
192 | 192 | 'func' => '_category_details', |
193 | 193 | 'capability' => 'ee_edit_event_category', |
194 | - 'args' => array( 'edit' ), |
|
194 | + 'args' => array('edit'), |
|
195 | 195 | ), |
196 | 196 | 'delete_categories' => array( |
197 | 197 | 'func' => '_delete_categories', |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | ), |
206 | 206 | 'insert_category' => array( |
207 | 207 | 'func' => '_insert_or_update_category', |
208 | - 'args' => array( 'new_category' => true ), |
|
208 | + 'args' => array('new_category' => true), |
|
209 | 209 | 'capability' => 'ee_edit_event_category', |
210 | 210 | 'noheader' => true, |
211 | 211 | ), |
212 | 212 | 'update_category' => array( |
213 | 213 | 'func' => '_insert_or_update_category', |
214 | - 'args' => array( 'new_category' => false ), |
|
214 | + 'args' => array('new_category' => false), |
|
215 | 215 | 'capability' => 'ee_edit_event_category', |
216 | 216 | 'noheader' => true, |
217 | 217 | ), |
@@ -228,29 +228,29 @@ discard block |
||
228 | 228 | $this->_page_config = array( |
229 | 229 | 'default' => array( |
230 | 230 | 'nav' => array( |
231 | - 'label' => esc_html__( 'Overview', 'event_espresso' ), |
|
231 | + 'label' => esc_html__('Overview', 'event_espresso'), |
|
232 | 232 | 'order' => 10, |
233 | 233 | ), |
234 | 234 | 'list_table' => 'Events_Admin_List_Table', |
235 | 235 | 'help_tabs' => array( |
236 | 236 | 'events_overview_help_tab' => array( |
237 | - 'title' => esc_html__( 'Events Overview', 'event_espresso' ), |
|
237 | + 'title' => esc_html__('Events Overview', 'event_espresso'), |
|
238 | 238 | 'filename' => 'events_overview', |
239 | 239 | ), |
240 | 240 | 'events_overview_table_column_headings_help_tab' => array( |
241 | - 'title' => esc_html__( 'Events Overview Table Column Headings', 'event_espresso' ), |
|
241 | + 'title' => esc_html__('Events Overview Table Column Headings', 'event_espresso'), |
|
242 | 242 | 'filename' => 'events_overview_table_column_headings', |
243 | 243 | ), |
244 | 244 | 'events_overview_filters_help_tab' => array( |
245 | - 'title' => esc_html__( 'Events Overview Filters', 'event_espresso' ), |
|
245 | + 'title' => esc_html__('Events Overview Filters', 'event_espresso'), |
|
246 | 246 | 'filename' => 'events_overview_filters', |
247 | 247 | ), |
248 | 248 | 'events_overview_view_help_tab' => array( |
249 | - 'title' => esc_html__( 'Events Overview Views', 'event_espresso' ), |
|
249 | + 'title' => esc_html__('Events Overview Views', 'event_espresso'), |
|
250 | 250 | 'filename' => 'events_overview_views', |
251 | 251 | ), |
252 | 252 | 'events_overview_other_help_tab' => array( |
253 | - 'title' => esc_html__( 'Events Overview Other', 'event_espresso' ), |
|
253 | + 'title' => esc_html__('Events Overview Other', 'event_espresso'), |
|
254 | 254 | 'filename' => 'events_overview_other', |
255 | 255 | ), |
256 | 256 | ), |
@@ -265,218 +265,218 @@ discard block |
||
265 | 265 | ), |
266 | 266 | 'create_new' => array( |
267 | 267 | 'nav' => array( |
268 | - 'label' => esc_html__( 'Add Event', 'event_espresso' ), |
|
268 | + 'label' => esc_html__('Add Event', 'event_espresso'), |
|
269 | 269 | 'order' => 5, |
270 | 270 | 'persistent' => false, |
271 | 271 | ), |
272 | - 'metaboxes' => array( '_register_event_editor_meta_boxes' ), |
|
272 | + 'metaboxes' => array('_register_event_editor_meta_boxes'), |
|
273 | 273 | 'help_tabs' => array( |
274 | 274 | 'event_editor_help_tab' => array( |
275 | - 'title' => esc_html__( 'Event Editor', 'event_espresso' ), |
|
275 | + 'title' => esc_html__('Event Editor', 'event_espresso'), |
|
276 | 276 | 'filename' => 'event_editor', |
277 | 277 | ), |
278 | 278 | 'event_editor_title_richtexteditor_help_tab' => array( |
279 | - 'title' => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ), |
|
279 | + 'title' => esc_html__('Event Title & Rich Text Editor', 'event_espresso'), |
|
280 | 280 | 'filename' => 'event_editor_title_richtexteditor', |
281 | 281 | ), |
282 | 282 | 'event_editor_venue_details_help_tab' => array( |
283 | - 'title' => esc_html__( 'Event Venue Details', 'event_espresso' ), |
|
283 | + 'title' => esc_html__('Event Venue Details', 'event_espresso'), |
|
284 | 284 | 'filename' => 'event_editor_venue_details', |
285 | 285 | ), |
286 | 286 | 'event_editor_event_datetimes_help_tab' => array( |
287 | - 'title' => esc_html__( 'Event Datetimes', 'event_espresso' ), |
|
287 | + 'title' => esc_html__('Event Datetimes', 'event_espresso'), |
|
288 | 288 | 'filename' => 'event_editor_event_datetimes', |
289 | 289 | ), |
290 | 290 | 'event_editor_event_tickets_help_tab' => array( |
291 | - 'title' => esc_html__( 'Event Tickets', 'event_espresso' ), |
|
291 | + 'title' => esc_html__('Event Tickets', 'event_espresso'), |
|
292 | 292 | 'filename' => 'event_editor_event_tickets', |
293 | 293 | ), |
294 | 294 | 'event_editor_event_registration_options_help_tab' => array( |
295 | - 'title' => esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
295 | + 'title' => esc_html__('Event Registration Options', 'event_espresso'), |
|
296 | 296 | 'filename' => 'event_editor_event_registration_options', |
297 | 297 | ), |
298 | 298 | 'event_editor_tags_categories_help_tab' => array( |
299 | - 'title' => esc_html__( 'Event Tags & Categories', 'event_espresso' ), |
|
299 | + 'title' => esc_html__('Event Tags & Categories', 'event_espresso'), |
|
300 | 300 | 'filename' => 'event_editor_tags_categories', |
301 | 301 | ), |
302 | 302 | 'event_editor_questions_registrants_help_tab' => array( |
303 | - 'title' => esc_html__( 'Questions for Registrants', 'event_espresso' ), |
|
303 | + 'title' => esc_html__('Questions for Registrants', 'event_espresso'), |
|
304 | 304 | 'filename' => 'event_editor_questions_registrants', |
305 | 305 | ), |
306 | 306 | 'event_editor_save_new_event_help_tab' => array( |
307 | - 'title' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
307 | + 'title' => esc_html__('Save New Event', 'event_espresso'), |
|
308 | 308 | 'filename' => 'event_editor_save_new_event', |
309 | 309 | ), |
310 | 310 | 'event_editor_other_help_tab' => array( |
311 | - 'title' => esc_html__( 'Event Other', 'event_espresso' ), |
|
311 | + 'title' => esc_html__('Event Other', 'event_espresso'), |
|
312 | 312 | 'filename' => 'event_editor_other', |
313 | 313 | ), |
314 | 314 | ), |
315 | 315 | 'help_tour' => array( |
316 | 316 | 'Event_Editor_Help_Tour', |
317 | 317 | ), |
318 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
318 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
319 | 319 | 'require_nonce' => false, |
320 | 320 | ), |
321 | 321 | 'edit' => array( |
322 | 322 | 'nav' => array( |
323 | - 'label' => esc_html__( 'Edit Event', 'event_espresso' ), |
|
323 | + 'label' => esc_html__('Edit Event', 'event_espresso'), |
|
324 | 324 | 'order' => 5, |
325 | 325 | 'persistent' => false, |
326 | - 'url' => isset( $this->_req_data['post'] ) |
|
326 | + 'url' => isset($this->_req_data['post']) |
|
327 | 327 | ? EE_Admin_Page::add_query_args_and_nonce( |
328 | - array( 'post' => $this->_req_data['post'], 'action' => 'edit' ), |
|
328 | + array('post' => $this->_req_data['post'], 'action' => 'edit'), |
|
329 | 329 | $this->_current_page_view_url |
330 | 330 | ) |
331 | 331 | : $this->_admin_base_url, |
332 | 332 | ), |
333 | - 'metaboxes' => array( '_register_event_editor_meta_boxes' ), |
|
333 | + 'metaboxes' => array('_register_event_editor_meta_boxes'), |
|
334 | 334 | 'help_tabs' => array( |
335 | 335 | 'event_editor_help_tab' => array( |
336 | - 'title' => esc_html__( 'Event Editor', 'event_espresso' ), |
|
336 | + 'title' => esc_html__('Event Editor', 'event_espresso'), |
|
337 | 337 | 'filename' => 'event_editor', |
338 | 338 | ), |
339 | 339 | 'event_editor_title_richtexteditor_help_tab' => array( |
340 | - 'title' => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ), |
|
340 | + 'title' => esc_html__('Event Title & Rich Text Editor', 'event_espresso'), |
|
341 | 341 | 'filename' => 'event_editor_title_richtexteditor', |
342 | 342 | ), |
343 | 343 | 'event_editor_venue_details_help_tab' => array( |
344 | - 'title' => esc_html__( 'Event Venue Details', 'event_espresso' ), |
|
344 | + 'title' => esc_html__('Event Venue Details', 'event_espresso'), |
|
345 | 345 | 'filename' => 'event_editor_venue_details', |
346 | 346 | ), |
347 | 347 | 'event_editor_event_datetimes_help_tab' => array( |
348 | - 'title' => esc_html__( 'Event Datetimes', 'event_espresso' ), |
|
348 | + 'title' => esc_html__('Event Datetimes', 'event_espresso'), |
|
349 | 349 | 'filename' => 'event_editor_event_datetimes', |
350 | 350 | ), |
351 | 351 | 'event_editor_event_tickets_help_tab' => array( |
352 | - 'title' => esc_html__( 'Event Tickets', 'event_espresso' ), |
|
352 | + 'title' => esc_html__('Event Tickets', 'event_espresso'), |
|
353 | 353 | 'filename' => 'event_editor_event_tickets', |
354 | 354 | ), |
355 | 355 | 'event_editor_event_registration_options_help_tab' => array( |
356 | - 'title' => esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
356 | + 'title' => esc_html__('Event Registration Options', 'event_espresso'), |
|
357 | 357 | 'filename' => 'event_editor_event_registration_options', |
358 | 358 | ), |
359 | 359 | 'event_editor_tags_categories_help_tab' => array( |
360 | - 'title' => esc_html__( 'Event Tags & Categories', 'event_espresso' ), |
|
360 | + 'title' => esc_html__('Event Tags & Categories', 'event_espresso'), |
|
361 | 361 | 'filename' => 'event_editor_tags_categories', |
362 | 362 | ), |
363 | 363 | 'event_editor_questions_registrants_help_tab' => array( |
364 | - 'title' => esc_html__( 'Questions for Registrants', 'event_espresso' ), |
|
364 | + 'title' => esc_html__('Questions for Registrants', 'event_espresso'), |
|
365 | 365 | 'filename' => 'event_editor_questions_registrants', |
366 | 366 | ), |
367 | 367 | 'event_editor_save_new_event_help_tab' => array( |
368 | - 'title' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
368 | + 'title' => esc_html__('Save New Event', 'event_espresso'), |
|
369 | 369 | 'filename' => 'event_editor_save_new_event', |
370 | 370 | ), |
371 | 371 | 'event_editor_other_help_tab' => array( |
372 | - 'title' => esc_html__( 'Event Other', 'event_espresso' ), |
|
372 | + 'title' => esc_html__('Event Other', 'event_espresso'), |
|
373 | 373 | 'filename' => 'event_editor_other', |
374 | 374 | ), |
375 | 375 | ), |
376 | 376 | /*'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ),*/ |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => false, |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
383 | 383 | 'nav' => array( |
384 | - 'label' => esc_html__( 'Default Settings', 'event_espresso' ), |
|
384 | + 'label' => esc_html__('Default Settings', 'event_espresso'), |
|
385 | 385 | 'order' => 40, |
386 | 386 | ), |
387 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
387 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
388 | 388 | 'labels' => array( |
389 | - 'publishbox' => esc_html__( 'Update Settings', 'event_espresso' ), |
|
389 | + 'publishbox' => esc_html__('Update Settings', 'event_espresso'), |
|
390 | 390 | ), |
391 | 391 | 'help_tabs' => array( |
392 | 392 | 'default_settings_help_tab' => array( |
393 | - 'title' => esc_html__( 'Default Event Settings', 'event_espresso' ), |
|
393 | + 'title' => esc_html__('Default Event Settings', 'event_espresso'), |
|
394 | 394 | 'filename' => 'events_default_settings', |
395 | 395 | ), |
396 | 396 | 'default_settings_status_help_tab' => array( |
397 | - 'title' => esc_html__( 'Default Registration Status', 'event_espresso' ), |
|
397 | + 'title' => esc_html__('Default Registration Status', 'event_espresso'), |
|
398 | 398 | 'filename' => 'events_default_settings_status', |
399 | 399 | ), |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour' ), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => false, |
403 | 403 | ), |
404 | 404 | //template settings |
405 | 405 | 'template_settings' => array( |
406 | 406 | 'nav' => array( |
407 | - 'label' => esc_html__( 'Templates', 'event_espresso' ), |
|
407 | + 'label' => esc_html__('Templates', 'event_espresso'), |
|
408 | 408 | 'order' => 30, |
409 | 409 | ), |
410 | 410 | 'metaboxes' => $this->_default_espresso_metaboxes, |
411 | 411 | 'help_tabs' => array( |
412 | 412 | 'general_settings_templates_help_tab' => array( |
413 | - 'title' => esc_html__( 'Templates', 'event_espresso' ), |
|
413 | + 'title' => esc_html__('Templates', 'event_espresso'), |
|
414 | 414 | 'filename' => 'general_settings_templates', |
415 | 415 | ), |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => false, |
419 | 419 | ), |
420 | 420 | //event category stuff |
421 | 421 | 'add_category' => array( |
422 | 422 | 'nav' => array( |
423 | - 'label' => esc_html__( 'Add Category', 'event_espresso' ), |
|
423 | + 'label' => esc_html__('Add Category', 'event_espresso'), |
|
424 | 424 | 'order' => 15, |
425 | 425 | 'persistent' => false, |
426 | 426 | ), |
427 | 427 | 'help_tabs' => array( |
428 | 428 | 'add_category_help_tab' => array( |
429 | - 'title' => esc_html__( 'Add New Event Category', 'event_espresso' ), |
|
429 | + 'title' => esc_html__('Add New Event Category', 'event_espresso'), |
|
430 | 430 | 'filename' => 'events_add_category', |
431 | 431 | ), |
432 | 432 | ), |
433 | - 'help_tour' => array( 'Event_Add_Category_Help_Tour' ), |
|
434 | - 'metaboxes' => array( '_publish_post_box' ), |
|
433 | + 'help_tour' => array('Event_Add_Category_Help_Tour'), |
|
434 | + 'metaboxes' => array('_publish_post_box'), |
|
435 | 435 | 'require_nonce' => false, |
436 | 436 | ), |
437 | 437 | 'edit_category' => array( |
438 | 438 | 'nav' => array( |
439 | - 'label' => esc_html__( 'Edit Category', 'event_espresso' ), |
|
439 | + 'label' => esc_html__('Edit Category', 'event_espresso'), |
|
440 | 440 | 'order' => 15, |
441 | 441 | 'persistent' => false, |
442 | - 'url' => isset( $this->_req_data['EVT_CAT_ID'] ) |
|
442 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) |
|
443 | 443 | ? add_query_arg( |
444 | - array( 'EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), |
|
444 | + array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
445 | 445 | $this->_current_page_view_url |
446 | 446 | ) |
447 | 447 | : $this->_admin_base_url, |
448 | 448 | ), |
449 | 449 | 'help_tabs' => array( |
450 | 450 | 'edit_category_help_tab' => array( |
451 | - 'title' => esc_html__( 'Edit Event Category', 'event_espresso' ), |
|
451 | + 'title' => esc_html__('Edit Event Category', 'event_espresso'), |
|
452 | 452 | 'filename' => 'events_edit_category', |
453 | 453 | ), |
454 | 454 | ), |
455 | 455 | /*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/ |
456 | - 'metaboxes' => array( '_publish_post_box' ), |
|
456 | + 'metaboxes' => array('_publish_post_box'), |
|
457 | 457 | 'require_nonce' => false, |
458 | 458 | ), |
459 | 459 | 'category_list' => array( |
460 | 460 | 'nav' => array( |
461 | - 'label' => esc_html__( 'Categories', 'event_espresso' ), |
|
461 | + 'label' => esc_html__('Categories', 'event_espresso'), |
|
462 | 462 | 'order' => 20, |
463 | 463 | ), |
464 | 464 | 'list_table' => 'Event_Categories_Admin_List_Table', |
465 | 465 | 'help_tabs' => array( |
466 | 466 | 'events_categories_help_tab' => array( |
467 | - 'title' => esc_html__( 'Event Categories', 'event_espresso' ), |
|
467 | + 'title' => esc_html__('Event Categories', 'event_espresso'), |
|
468 | 468 | 'filename' => 'events_categories', |
469 | 469 | ), |
470 | 470 | 'events_categories_table_column_headings_help_tab' => array( |
471 | - 'title' => esc_html__( 'Event Categories Table Column Headings', 'event_espresso' ), |
|
471 | + 'title' => esc_html__('Event Categories Table Column Headings', 'event_espresso'), |
|
472 | 472 | 'filename' => 'events_categories_table_column_headings', |
473 | 473 | ), |
474 | 474 | 'events_categories_view_help_tab' => array( |
475 | - 'title' => esc_html__( 'Event Categories Views', 'event_espresso' ), |
|
475 | + 'title' => esc_html__('Event Categories Views', 'event_espresso'), |
|
476 | 476 | 'filename' => 'events_categories_views', |
477 | 477 | ), |
478 | 478 | 'events_categories_other_help_tab' => array( |
479 | - 'title' => esc_html__( 'Event Categories Other', 'event_espresso' ), |
|
479 | + 'title' => esc_html__('Event Categories Other', 'event_espresso'), |
|
480 | 480 | 'filename' => 'events_categories_other', |
481 | 481 | ), |
482 | 482 | ), |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | protected function _add_screen_options_category_list() { |
507 | 507 | $page_title = $this->_admin_page_title; |
508 | - $this->_admin_page_title = esc_html__( 'Categories', 'event_espresso' ); |
|
508 | + $this->_admin_page_title = esc_html__('Categories', 'event_espresso'); |
|
509 | 509 | $this->_per_page_screen_option(); |
510 | 510 | $this->_admin_page_title = $page_title; |
511 | 511 | } |
@@ -521,20 +521,20 @@ discard block |
||
521 | 521 | public function load_scripts_styles() { |
522 | 522 | wp_register_style( |
523 | 523 | 'events-admin-css', |
524 | - EVENTS_ASSETS_URL . 'events-admin-page.css', |
|
524 | + EVENTS_ASSETS_URL.'events-admin-page.css', |
|
525 | 525 | array(), |
526 | 526 | EVENT_ESPRESSO_VERSION |
527 | 527 | ); |
528 | - wp_register_style( 'ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
529 | - wp_enqueue_style( 'events-admin-css' ); |
|
530 | - wp_enqueue_style( 'ee-cat-admin' ); |
|
528 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
529 | + wp_enqueue_style('events-admin-css'); |
|
530 | + wp_enqueue_style('ee-cat-admin'); |
|
531 | 531 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
532 | 532 | //registers for all views |
533 | 533 | //scripts |
534 | 534 | wp_register_script( |
535 | 535 | 'event_editor_js', |
536 | - EVENTS_ASSETS_URL . 'event_editor.js', |
|
537 | - array( 'ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon' ), |
|
536 | + EVENTS_ASSETS_URL.'event_editor.js', |
|
537 | + array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), |
|
538 | 538 | EVENT_ESPRESSO_VERSION, |
539 | 539 | true |
540 | 540 | ); |
@@ -560,22 +560,22 @@ discard block |
||
560 | 560 | */ |
561 | 561 | public function load_scripts_styles_edit() { |
562 | 562 | //styles |
563 | - wp_enqueue_style( 'espresso-ui-theme' ); |
|
563 | + wp_enqueue_style('espresso-ui-theme'); |
|
564 | 564 | wp_register_style( |
565 | 565 | 'event-editor-css', |
566 | - EVENTS_ASSETS_URL . 'event-editor.css', |
|
567 | - array( 'ee-admin-css' ), |
|
566 | + EVENTS_ASSETS_URL.'event-editor.css', |
|
567 | + array('ee-admin-css'), |
|
568 | 568 | EVENT_ESPRESSO_VERSION |
569 | 569 | ); |
570 | - wp_enqueue_style( 'event-editor-css' ); |
|
570 | + wp_enqueue_style('event-editor-css'); |
|
571 | 571 | //scripts |
572 | 572 | wp_register_script( |
573 | 573 | 'event-datetime-metabox', |
574 | - EVENTS_ASSETS_URL . 'event-datetime-metabox.js', |
|
575 | - array( 'event_editor_js', 'ee-datepicker' ), |
|
574 | + EVENTS_ASSETS_URL.'event-datetime-metabox.js', |
|
575 | + array('event_editor_js', 'ee-datepicker'), |
|
576 | 576 | EVENT_ESPRESSO_VERSION |
577 | 577 | ); |
578 | - wp_enqueue_script( 'event-datetime-metabox' ); |
|
578 | + wp_enqueue_script('event-datetime-metabox'); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | $this->_views = array( |
596 | 596 | 'all' => array( |
597 | 597 | 'slug' => 'all', |
598 | - 'label' => esc_html__( 'All', 'event_espresso' ), |
|
598 | + 'label' => esc_html__('All', 'event_espresso'), |
|
599 | 599 | 'count' => 0, |
600 | 600 | 'bulk_action' => array( |
601 | - 'delete_categories' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
601 | + 'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'), |
|
602 | 602 | ), |
603 | 603 | ), |
604 | 604 | ); |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | * @access public |
635 | 635 | * @return void |
636 | 636 | */ |
637 | - public function verify_event_edit( $event = null ) { |
|
637 | + public function verify_event_edit($event = null) { |
|
638 | 638 | // no event? |
639 | - if ( empty( $event ) ) { |
|
639 | + if (empty($event)) { |
|
640 | 640 | // set event |
641 | 641 | $event = $this->_cpt_model_obj; |
642 | 642 | } |
643 | 643 | // STILL no event? |
644 | - if ( empty ( $event ) ) { |
|
644 | + if (empty ($event)) { |
|
645 | 645 | return; |
646 | 646 | } |
647 | 647 | $orig_status = $event->status(); |
@@ -655,32 +655,32 @@ discard block |
||
655 | 655 | return; |
656 | 656 | } |
657 | 657 | //made it here so it IS active... next check that any of the tickets are sold. |
658 | - if ( $event->is_sold_out( true ) ) { |
|
659 | - if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) { |
|
658 | + if ($event->is_sold_out(true)) { |
|
659 | + if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) { |
|
660 | 660 | EE_Error::add_attention( |
661 | 661 | sprintf( |
662 | 662 | esc_html__( |
663 | 663 | 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', |
664 | 664 | 'event_espresso' |
665 | 665 | ), |
666 | - EEH_Template::pretty_status( EEM_Event::sold_out, false, 'sentence' ) |
|
666 | + EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence') |
|
667 | 667 | ) |
668 | 668 | ); |
669 | 669 | } |
670 | 670 | return; |
671 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
671 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
672 | 672 | EE_Error::add_attention( |
673 | 673 | sprintf( |
674 | 674 | esc_html__( |
675 | 675 | 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
676 | 676 | 'event_espresso' |
677 | 677 | ), |
678 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
678 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
679 | 679 | ) |
680 | 680 | ); |
681 | 681 | } |
682 | 682 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
683 | - if ( ! $event->tickets_on_sale() ) { |
|
683 | + if ( ! $event->tickets_on_sale()) { |
|
684 | 684 | return; |
685 | 685 | } |
686 | 686 | //made it here so show warning |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | */ |
699 | 699 | protected function _edit_event_warning() { |
700 | 700 | // we don't want to add warnings during these requests |
701 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) { |
|
701 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') { |
|
702 | 702 | return; |
703 | 703 | } |
704 | 704 | EE_Error::add_attention( |
@@ -715,29 +715,29 @@ discard block |
||
715 | 715 | $this->_views = array( |
716 | 716 | 'all' => array( |
717 | 717 | 'slug' => 'all', |
718 | - 'label' => esc_html__( 'View All Events', 'event_espresso' ), |
|
718 | + 'label' => esc_html__('View All Events', 'event_espresso'), |
|
719 | 719 | 'count' => 0, |
720 | 720 | 'bulk_action' => array( |
721 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
721 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
722 | 722 | ), |
723 | 723 | ), |
724 | 724 | 'draft' => array( |
725 | 725 | 'slug' => 'draft', |
726 | - 'label' => esc_html__( 'Draft', 'event_espresso' ), |
|
726 | + 'label' => esc_html__('Draft', 'event_espresso'), |
|
727 | 727 | 'count' => 0, |
728 | 728 | 'bulk_action' => array( |
729 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
729 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
730 | 730 | ), |
731 | 731 | ), |
732 | 732 | ); |
733 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
733 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
734 | 734 | $this->_views['trash'] = array( |
735 | 735 | 'slug' => 'trash', |
736 | - 'label' => esc_html__( 'Trash', 'event_espresso' ), |
|
736 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
737 | 737 | 'count' => 0, |
738 | 738 | 'bulk_action' => array( |
739 | - 'restore_events' => esc_html__( 'Restore From Trash', 'event_espresso' ), |
|
740 | - 'delete_events' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
739 | + 'restore_events' => esc_html__('Restore From Trash', 'event_espresso'), |
|
740 | + 'delete_events' => esc_html__('Delete Permanently', 'event_espresso'), |
|
741 | 741 | ), |
742 | 742 | ); |
743 | 743 | } |
@@ -752,50 +752,50 @@ discard block |
||
752 | 752 | $items = array( |
753 | 753 | 'view_details' => array( |
754 | 754 | 'class' => 'dashicons dashicons-search', |
755 | - 'desc' => esc_html__( 'View Event', 'event_espresso' ), |
|
755 | + 'desc' => esc_html__('View Event', 'event_espresso'), |
|
756 | 756 | ), |
757 | 757 | 'edit_event' => array( |
758 | 758 | 'class' => 'ee-icon ee-icon-calendar-edit', |
759 | - 'desc' => esc_html__( 'Edit Event Details', 'event_espresso' ), |
|
759 | + 'desc' => esc_html__('Edit Event Details', 'event_espresso'), |
|
760 | 760 | ), |
761 | 761 | 'view_attendees' => array( |
762 | 762 | 'class' => 'dashicons dashicons-groups', |
763 | - 'desc' => esc_html__( 'View Registrations for Event', 'event_espresso' ), |
|
763 | + 'desc' => esc_html__('View Registrations for Event', 'event_espresso'), |
|
764 | 764 | ), |
765 | 765 | ); |
766 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
766 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
767 | 767 | $statuses = array( |
768 | 768 | 'sold_out_status' => array( |
769 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
770 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, false, 'sentence' ), |
|
769 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
770 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'), |
|
771 | 771 | ), |
772 | 772 | 'active_status' => array( |
773 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
774 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, false, 'sentence' ), |
|
773 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
774 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'), |
|
775 | 775 | ), |
776 | 776 | 'upcoming_status' => array( |
777 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
778 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, false, 'sentence' ), |
|
777 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
778 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'), |
|
779 | 779 | ), |
780 | 780 | 'postponed_status' => array( |
781 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
782 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, false, 'sentence' ), |
|
781 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
782 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'), |
|
783 | 783 | ), |
784 | 784 | 'cancelled_status' => array( |
785 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
786 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, false, 'sentence' ), |
|
785 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
786 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'), |
|
787 | 787 | ), |
788 | 788 | 'expired_status' => array( |
789 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
790 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, false, 'sentence' ), |
|
789 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
790 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'), |
|
791 | 791 | ), |
792 | 792 | 'inactive_status' => array( |
793 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
794 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, false, 'sentence' ), |
|
793 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
794 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'), |
|
795 | 795 | ), |
796 | 796 | ); |
797 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
798 | - return array_merge( $items, $statuses ); |
|
797 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
798 | + return array_merge($items, $statuses); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | * @return EEM_Event |
807 | 807 | */ |
808 | 808 | private function _event_model() { |
809 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
810 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
809 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
810 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
811 | 811 | } |
812 | 812 | return $this->_event_model; |
813 | 813 | } |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | * @param string $new_slug what the slug is |
825 | 825 | * @return string The new html string for the permalink area |
826 | 826 | */ |
827 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
827 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
828 | 828 | //make sure this is only when editing |
829 | - if ( ! empty( $id ) ) { |
|
830 | - $post = get_post( $id ); |
|
829 | + if ( ! empty($id)) { |
|
830 | + $post = get_post($id); |
|
831 | 831 | $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' |
832 | - . esc_html__( 'Shortcode', 'event_espresso' ) |
|
832 | + . esc_html__('Shortcode', 'event_espresso') |
|
833 | 833 | . '</a> '; |
834 | 834 | $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' |
835 | 835 | . $post->ID |
@@ -848,14 +848,14 @@ discard block |
||
848 | 848 | * @return void |
849 | 849 | */ |
850 | 850 | protected function _events_overview_list_table() { |
851 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
851 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
852 | 852 | $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
853 | - get_post_type_archive_link( 'espresso_events' ), |
|
854 | - esc_html__( "View Event Archive Page", "event_espresso" ), |
|
853 | + get_post_type_archive_link('espresso_events'), |
|
854 | + esc_html__("View Event Archive Page", "event_espresso"), |
|
855 | 855 | 'button' |
856 | 856 | ); |
857 | - $this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() ); |
|
858 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
857 | + $this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items()); |
|
858 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
859 | 859 | 'create_new', |
860 | 860 | 'add', |
861 | 861 | array(), |
@@ -881,48 +881,48 @@ discard block |
||
881 | 881 | * @param string $post_id |
882 | 882 | * @param object $post |
883 | 883 | */ |
884 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
885 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
884 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
885 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
886 | 886 | //get out we're not processing an event save. |
887 | 887 | return; |
888 | 888 | } |
889 | 889 | $event_values = array( |
890 | - 'EVT_display_desc' => ! empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
891 | - 'EVT_display_ticket_selector' => ! empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
890 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
891 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
892 | 892 | 'EVT_additional_limit' => min( |
893 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
894 | - ! empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : null |
|
893 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
894 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : null |
|
895 | 895 | ), |
896 | - 'EVT_default_registration_status' => ! empty( $this->_req_data['EVT_default_registration_status'] ) |
|
896 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) |
|
897 | 897 | ? $this->_req_data['EVT_default_registration_status'] |
898 | 898 | : EE_Registry::instance()->CFG->registration->default_STS_ID, |
899 | - 'EVT_member_only' => ! empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
900 | - 'EVT_allow_overflow' => ! empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
901 | - 'EVT_timezone_string' => ! empty( $this->_req_data['timezone_string'] ) |
|
899 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
900 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
901 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) |
|
902 | 902 | ? $this->_req_data['timezone_string'] : null, |
903 | - 'EVT_external_URL' => ! empty( $this->_req_data['externalURL'] ) |
|
903 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) |
|
904 | 904 | ? $this->_req_data['externalURL'] : null, |
905 | - 'EVT_phone' => ! empty( $this->_req_data['event_phone'] ) |
|
905 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) |
|
906 | 906 | ? $this->_req_data['event_phone'] : null, |
907 | 907 | ); |
908 | 908 | //update event |
909 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
909 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
910 | 910 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
911 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
912 | - $event = $this->_event_model()->get_one( array( $get_one_where ) ); |
|
911 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
912 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
913 | 913 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
914 | 914 | $event_update_callbacks = apply_filters( |
915 | 915 | 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
916 | - array( array( $this, '_default_venue_update' ), array( $this, '_default_tickets_update' ) ) |
|
916 | + array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')) |
|
917 | 917 | ); |
918 | 918 | $att_success = true; |
919 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
920 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
919 | + foreach ($event_update_callbacks as $e_callback) { |
|
920 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
921 | 921 | $att_success = ! $att_success ? $att_success |
922 | 922 | : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
923 | 923 | } |
924 | 924 | //any errors? |
925 | - if ( $success && false === $att_success ) { |
|
925 | + if ($success && false === $att_success) { |
|
926 | 926 | EE_Error::add_error( |
927 | 927 | esc_html__( |
928 | 928 | 'Event Details saved successfully but something went wrong with saving attachments.', |
@@ -932,9 +932,9 @@ discard block |
||
932 | 932 | __FUNCTION__, |
933 | 933 | __LINE__ |
934 | 934 | ); |
935 | - } else if ( $success === false ) { |
|
935 | + } else if ($success === false) { |
|
936 | 936 | EE_Error::add_error( |
937 | - esc_html__( 'Event Details did not save successfully.', 'event_espresso' ), |
|
937 | + esc_html__('Event Details did not save successfully.', 'event_espresso'), |
|
938 | 938 | __FILE__, |
939 | 939 | __FUNCTION__, |
940 | 940 | __LINE__ |
@@ -949,14 +949,14 @@ discard block |
||
949 | 949 | * @param int $post_id |
950 | 950 | * @param int $revision_id |
951 | 951 | */ |
952 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
952 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
953 | 953 | //copy existing event meta to new post |
954 | - $post_evt = $this->_event_model()->get_one_by_ID( $post_id ); |
|
955 | - if ( $post_evt instanceof EE_Event ) { |
|
954 | + $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
|
955 | + if ($post_evt instanceof EE_Event) { |
|
956 | 956 | //meta revision restore |
957 | - $post_evt->restore_revision( $revision_id ); |
|
957 | + $post_evt->restore_revision($revision_id); |
|
958 | 958 | //related objs restore |
959 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
959 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
960 | 960 | } |
961 | 961 | } |
962 | 962 | |
@@ -969,49 +969,49 @@ discard block |
||
969 | 969 | * @param array $data The request data from the form |
970 | 970 | * @return bool Success or fail. |
971 | 971 | */ |
972 | - protected function _default_venue_update( \EE_Event $evtobj, $data ) { |
|
973 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
974 | - $venue_model = EE_Registry::instance()->load_model( 'Venue' ); |
|
972 | + protected function _default_venue_update(\EE_Event $evtobj, $data) { |
|
973 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
974 | + $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
975 | 975 | $rows_affected = null; |
976 | - $venue_id = ! empty( $data['venue_id'] ) ? $data['venue_id'] : null; |
|
976 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
977 | 977 | // very important. If we don't have a venue name... |
978 | 978 | // then we'll get out because not necessary to create empty venue |
979 | - if ( empty( $data['venue_title'] ) ) { |
|
979 | + if (empty($data['venue_title'])) { |
|
980 | 980 | return false; |
981 | 981 | } |
982 | 982 | $venue_array = array( |
983 | - 'VNU_wp_user' => $evtobj->get( 'EVT_wp_user' ), |
|
984 | - 'VNU_name' => ! empty( $data['venue_title'] ) ? $data['venue_title'] : null, |
|
985 | - 'VNU_desc' => ! empty( $data['venue_description'] ) ? $data['venue_description'] : null, |
|
986 | - 'VNU_identifier' => ! empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : null, |
|
987 | - 'VNU_short_desc' => ! empty( $data['venue_short_description'] ) ? $data['venue_short_description'] |
|
983 | + 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
|
984 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : null, |
|
985 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : null, |
|
986 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null, |
|
987 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] |
|
988 | 988 | : null, |
989 | - 'VNU_address' => ! empty( $data['address'] ) ? $data['address'] : null, |
|
990 | - 'VNU_address2' => ! empty( $data['address2'] ) ? $data['address2'] : null, |
|
991 | - 'VNU_city' => ! empty( $data['city'] ) ? $data['city'] : null, |
|
992 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : null, |
|
993 | - 'CNT_ISO' => ! empty( $data['countries'] ) ? $data['countries'] : null, |
|
994 | - 'VNU_zip' => ! empty( $data['zip'] ) ? $data['zip'] : null, |
|
995 | - 'VNU_phone' => ! empty( $data['venue_phone'] ) ? $data['venue_phone'] : null, |
|
996 | - 'VNU_capacity' => ! empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : null, |
|
997 | - 'VNU_url' => ! empty( $data['venue_url'] ) ? $data['venue_url'] : null, |
|
998 | - 'VNU_virtual_phone' => ! empty( $data['virtual_phone'] ) ? $data['virtual_phone'] : null, |
|
999 | - 'VNU_virtual_url' => ! empty( $data['virtual_url'] ) ? $data['virtual_url'] : null, |
|
1000 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
989 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : null, |
|
990 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : null, |
|
991 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : null, |
|
992 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : null, |
|
993 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : null, |
|
994 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : null, |
|
995 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : null, |
|
996 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null, |
|
997 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : null, |
|
998 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null, |
|
999 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : null, |
|
1000 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
1001 | 1001 | 'status' => 'publish', |
1002 | 1002 | ); |
1003 | 1003 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
1004 | - if ( ! empty( $venue_id ) ) { |
|
1005 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
1006 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
1004 | + if ( ! empty($venue_id)) { |
|
1005 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
1006 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
1007 | 1007 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
1008 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1008 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1009 | 1009 | return $rows_affected > 0 ? true : false; |
1010 | 1010 | } else { |
1011 | 1011 | //we insert the venue |
1012 | - $venue_id = $venue_model->insert( $venue_array ); |
|
1013 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1014 | - return ! empty( $venue_id ) ? true : false; |
|
1012 | + $venue_id = $venue_model->insert($venue_array); |
|
1013 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1014 | + return ! empty($venue_id) ? true : false; |
|
1015 | 1015 | } |
1016 | 1016 | //when we have the ancestor come in it's already been handled by the revision save. |
1017 | 1017 | } |
@@ -1025,51 +1025,51 @@ discard block |
||
1025 | 1025 | * @param array $data The request data from the form |
1026 | 1026 | * @return array |
1027 | 1027 | */ |
1028 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
1028 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
1029 | 1029 | $success = true; |
1030 | 1030 | $saved_dtt = null; |
1031 | 1031 | $saved_tickets = array(); |
1032 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1033 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
1032 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1033 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
1034 | 1034 | //trim all values to ensure any excess whitespace is removed. |
1035 | - $dtt = array_map( 'trim', $dtt ); |
|
1036 | - $dtt['DTT_EVT_end'] = isset( $dtt['DTT_EVT_end'] ) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] |
|
1035 | + $dtt = array_map('trim', $dtt); |
|
1036 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] |
|
1037 | 1037 | : $dtt['DTT_EVT_start']; |
1038 | 1038 | $datetime_values = array( |
1039 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : null, |
|
1039 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null, |
|
1040 | 1040 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
1041 | 1041 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
1042 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1042 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1043 | 1043 | 'DTT_order' => $row, |
1044 | 1044 | ); |
1045 | 1045 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
1046 | - if ( ! empty( $dtt['DTT_ID'] ) ) { |
|
1046 | + if ( ! empty($dtt['DTT_ID'])) { |
|
1047 | 1047 | $DTM = EE_Registry::instance() |
1048 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1050 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1051 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1052 | - foreach ( $datetime_values as $field => $value ) { |
|
1053 | - $DTM->set( $field, $value ); |
|
1048 | + ->load_model('Datetime', array($evtobj->get_timezone())) |
|
1049 | + ->get_one_by_ID($dtt['DTT_ID']); |
|
1050 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1051 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1052 | + foreach ($datetime_values as $field => $value) { |
|
1053 | + $DTM->set($field, $value); |
|
1054 | 1054 | } |
1055 | 1055 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
1056 | - $saved_dtts[ $DTM->ID() ] = $DTM; |
|
1056 | + $saved_dtts[$DTM->ID()] = $DTM; |
|
1057 | 1057 | } else { |
1058 | - $DTM = EE_Registry::instance()->load_class( 'Datetime', array( $datetime_values ), false, false ); |
|
1059 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1060 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1061 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
1062 | - foreach ( $datetime_values as $field => $value ) { |
|
1063 | - $DTM->set( $field, $value ); |
|
1058 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), false, false); |
|
1059 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1060 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1061 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
1062 | + foreach ($datetime_values as $field => $value) { |
|
1063 | + $DTM->set($field, $value); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | $DTM->save(); |
1067 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
1067 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
1068 | 1068 | //load DTT helper |
1069 | 1069 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1070 | - if ( $DTT->get_raw( 'DTT_EVT_start' ) > $DTT->get_raw( 'DTT_EVT_end' ) ) { |
|
1071 | - $DTT->set( 'DTT_EVT_end', $DTT->get( 'DTT_EVT_start' ) ); |
|
1072 | - $DTT = EEH_DTT_Helper::date_time_add( $DTT, 'DTT_EVT_end', 'days' ); |
|
1070 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
1071 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
1072 | + $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
|
1073 | 1073 | $DTT->save(); |
1074 | 1074 | } |
1075 | 1075 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
@@ -1080,20 +1080,20 @@ discard block |
||
1080 | 1080 | } |
1081 | 1081 | //no dtts get deleted so we don't do any of that logic here. |
1082 | 1082 | //update tickets next |
1083 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode( ',', $data['ticket_IDs'] ) : array(); |
|
1084 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1085 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1083 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1084 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1085 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1086 | 1086 | $update_prices = false; |
1087 | - $ticket_price = isset( $data['edit_prices'][ $row ][1]['PRC_amount'] ) |
|
1088 | - ? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0; |
|
1087 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) |
|
1088 | + ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1089 | 1089 | // trim inputs to ensure any excess whitespace is removed. |
1090 | - $tkt = array_map( 'trim', $tkt ); |
|
1091 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1090 | + $tkt = array_map('trim', $tkt); |
|
1091 | + if (empty($tkt['TKT_start_date'])) { |
|
1092 | 1092 | //let's use now in the set timezone. |
1093 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1094 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1093 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1094 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1095 | 1095 | } |
1096 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1096 | + if (empty($tkt['TKT_end_date'])) { |
|
1097 | 1097 | //use the start date of the first datetime |
1098 | 1098 | $dtt = $evtobj->first_datetime(); |
1099 | 1099 | $tkt['TKT_end_date'] = $dtt->start_date_and_time( |
@@ -1102,22 +1102,22 @@ discard block |
||
1102 | 1102 | ); |
1103 | 1103 | } |
1104 | 1104 | $TKT_values = array( |
1105 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : null, |
|
1106 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1107 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1108 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1105 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null, |
|
1106 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1107 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1108 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1109 | 1109 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1110 | 1110 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1111 | - 'TKT_qty' => ! isset( $tkt['TKT_qty'] ) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1112 | - 'TKT_uses' => ! isset( $tkt['TKT_uses'] ) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1113 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1114 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1111 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1112 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1113 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1114 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1115 | 1115 | 'TKT_row' => $row, |
1116 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1116 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1117 | 1117 | 'TKT_price' => $ticket_price, |
1118 | 1118 | ); |
1119 | 1119 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1120 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1120 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1121 | 1121 | $TKT_values['TKT_ID'] = 0; |
1122 | 1122 | $TKT_values['TKT_is_default'] = 0; |
1123 | 1123 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1126,110 +1126,110 @@ discard block |
||
1126 | 1126 | //if we have a TKT_ID then we need to get that existing TKT_obj and update it |
1127 | 1127 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1128 | 1128 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1129 | - if ( ! empty( $tkt['TKT_ID'] ) ) { |
|
1129 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1130 | 1130 | $TKT = EE_Registry::instance() |
1131 | - ->load_model( 'Ticket', array( $evtobj->get_timezone() ) ) |
|
1132 | - ->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1133 | - if ( $TKT instanceof EE_Ticket ) { |
|
1131 | + ->load_model('Ticket', array($evtobj->get_timezone())) |
|
1132 | + ->get_one_by_ID($tkt['TKT_ID']); |
|
1133 | + if ($TKT instanceof EE_Ticket) { |
|
1134 | 1134 | $ticket_sold = $TKT->count_related( |
1135 | 1135 | 'Registration', |
1136 | 1136 | array( |
1137 | 1137 | array( |
1138 | 1138 | 'STS_ID' => array( |
1139 | 1139 | 'NOT IN', |
1140 | - array( EEM_Registration::status_id_incomplete ), |
|
1140 | + array(EEM_Registration::status_id_incomplete), |
|
1141 | 1141 | ), |
1142 | 1142 | ), |
1143 | 1143 | ) |
1144 | 1144 | ) > 0 ? true : false; |
1145 | 1145 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1146 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
|
1146 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') |
|
1147 | 1147 | && ! $TKT->get( |
1148 | 1148 | 'TKT_deleted' |
1149 | 1149 | ) ? true : false; |
1150 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1151 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1150 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1151 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1152 | 1152 | //set new values |
1153 | - foreach ( $TKT_values as $field => $value ) { |
|
1154 | - if ( $field == 'TKT_qty' ) { |
|
1155 | - $TKT->set_qty( $value ); |
|
1153 | + foreach ($TKT_values as $field => $value) { |
|
1154 | + if ($field == 'TKT_qty') { |
|
1155 | + $TKT->set_qty($value); |
|
1156 | 1156 | } else { |
1157 | - $TKT->set( $field, $value ); |
|
1157 | + $TKT->set($field, $value); |
|
1158 | 1158 | } |
1159 | 1159 | } |
1160 | 1160 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1161 | - if ( $create_new_TKT ) { |
|
1161 | + if ($create_new_TKT) { |
|
1162 | 1162 | //archive the old ticket first |
1163 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1163 | + $TKT->set('TKT_deleted', 1); |
|
1164 | 1164 | $TKT->save(); |
1165 | 1165 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1166 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1166 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1167 | 1167 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1168 | 1168 | $TKT = clone $TKT; |
1169 | - $TKT->set( 'TKT_ID', 0 ); |
|
1170 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1171 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1172 | - $TKT->set( 'TKT_sold', 0 ); |
|
1169 | + $TKT->set('TKT_ID', 0); |
|
1170 | + $TKT->set('TKT_deleted', 0); |
|
1171 | + $TKT->set('TKT_price', $ticket_price); |
|
1172 | + $TKT->set('TKT_sold', 0); |
|
1173 | 1173 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1174 | 1174 | $update_prices = true; |
1175 | 1175 | } |
1176 | 1176 | //make sure price is set if it hasn't been already |
1177 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1177 | + $TKT->set('TKT_price', $ticket_price); |
|
1178 | 1178 | } |
1179 | 1179 | } else { |
1180 | 1180 | //no TKT_id so a new TKT |
1181 | 1181 | $TKT_values['TKT_price'] = $ticket_price; |
1182 | - $TKT = EE_Registry::instance()->load_class( 'Ticket', array( $TKT_values ), false, false ); |
|
1183 | - if ( $TKT instanceof EE_Ticket ) { |
|
1182 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), false, false); |
|
1183 | + if ($TKT instanceof EE_Ticket) { |
|
1184 | 1184 | //need to reset values to properly account for the date formats |
1185 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1186 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1187 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1185 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1186 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1187 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1188 | 1188 | //set new values |
1189 | - foreach ( $TKT_values as $field => $value ) { |
|
1190 | - if ( $field == 'TKT_qty' ) { |
|
1191 | - $TKT->set_qty( $value ); |
|
1189 | + foreach ($TKT_values as $field => $value) { |
|
1190 | + if ($field == 'TKT_qty') { |
|
1191 | + $TKT->set_qty($value); |
|
1192 | 1192 | } else { |
1193 | - $TKT->set( $field, $value ); |
|
1193 | + $TKT->set($field, $value); |
|
1194 | 1194 | } |
1195 | 1195 | } |
1196 | 1196 | $update_prices = true; |
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | // cap ticket qty by datetime reg limits |
1200 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1200 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1201 | 1201 | //update ticket. |
1202 | 1202 | $TKT->save(); |
1203 | 1203 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1204 | - if ( $TKT->get_raw( 'TKT_start_date' ) > $TKT->get_raw( 'TKT_end_date' ) ) { |
|
1205 | - $TKT->set( 'TKT_end_date', $TKT->get( 'TKT_start_date' ) ); |
|
1206 | - $TKT = EEH_DTT_Helper::date_time_add( $TKT, 'TKT_end_date', 'days' ); |
|
1204 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1205 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1206 | + $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
|
1207 | 1207 | $TKT->save(); |
1208 | 1208 | } |
1209 | 1209 | //initially let's add the ticket to the dtt |
1210 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1211 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1210 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1211 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1212 | 1212 | //add prices to ticket |
1213 | - $this->_add_prices_to_ticket( $data['edit_prices'][ $row ], $TKT, $update_prices ); |
|
1213 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1214 | 1214 | } |
1215 | 1215 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1216 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1217 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1218 | - foreach ( $tickets_removed as $id ) { |
|
1219 | - $id = absint( $id ); |
|
1216 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1217 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1218 | + foreach ($tickets_removed as $id) { |
|
1219 | + $id = absint($id); |
|
1220 | 1220 | //get the ticket for this id |
1221 | - $tkt_to_remove = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $id ); |
|
1221 | + $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
|
1222 | 1222 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1223 | - $dtts = $tkt_to_remove->get_many_related( 'Datetime' ); |
|
1224 | - foreach ( $dtts as $dtt ) { |
|
1225 | - $tkt_to_remove->_remove_relation_to( $dtt, 'Datetime' ); |
|
1223 | + $dtts = $tkt_to_remove->get_many_related('Datetime'); |
|
1224 | + foreach ($dtts as $dtt) { |
|
1225 | + $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
|
1226 | 1226 | } |
1227 | 1227 | //need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
1228 | - $tkt_to_remove->delete_related_permanently( 'Price' ); |
|
1228 | + $tkt_to_remove->delete_related_permanently('Price'); |
|
1229 | 1229 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1230 | 1230 | $tkt_to_remove->delete_permanently(); |
1231 | 1231 | } |
1232 | - return array( $saved_dtt, $saved_tickets ); |
|
1232 | + return array($saved_dtt, $saved_tickets); |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | |
@@ -1246,29 +1246,29 @@ discard block |
||
1246 | 1246 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1247 | 1247 | * @return void |
1248 | 1248 | */ |
1249 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = false ) { |
|
1250 | - foreach ( $prices as $row => $prc ) { |
|
1249 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false) { |
|
1250 | + foreach ($prices as $row => $prc) { |
|
1251 | 1251 | $PRC_values = array( |
1252 | - 'PRC_ID' => ! empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : null, |
|
1253 | - 'PRT_ID' => ! empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : null, |
|
1254 | - 'PRC_amount' => ! empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1255 | - 'PRC_name' => ! empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1256 | - 'PRC_desc' => ! empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1252 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null, |
|
1253 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null, |
|
1254 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1255 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1256 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1257 | 1257 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1258 | 1258 | 'PRC_order' => $row, |
1259 | 1259 | ); |
1260 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1260 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1261 | 1261 | $PRC_values['PRC_ID'] = 0; |
1262 | - $PRC = EE_Registry::instance()->load_class( 'Price', array( $PRC_values ), false, false ); |
|
1262 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false); |
|
1263 | 1263 | } else { |
1264 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1264 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1265 | 1265 | //update this price with new values |
1266 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1267 | - $PRC->set( $field, $newprc ); |
|
1266 | + foreach ($PRC_values as $field => $newprc) { |
|
1267 | + $PRC->set($field, $newprc); |
|
1268 | 1268 | } |
1269 | 1269 | $PRC->save(); |
1270 | 1270 | } |
1271 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1271 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1272 | 1272 | } |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | private function _generate_publish_box_extra_content() { |
1301 | 1301 | //load formatter helper |
1302 | 1302 | //args for getting related registrations |
1303 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1303 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1304 | 1304 | $not_approved_query_args = array( |
1305 | 1305 | array( |
1306 | 1306 | 'REG_deleted' => 0, |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
1372 | 1372 | // load template |
1373 | 1373 | EEH_Template::display_template( |
1374 | - EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', |
|
1374 | + EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', |
|
1375 | 1375 | $publish_box_extra_args |
1376 | 1376 | ); |
1377 | 1377 | } |
@@ -1405,16 +1405,16 @@ discard block |
||
1405 | 1405 | $this->verify_cpt_object(); |
1406 | 1406 | add_meta_box( |
1407 | 1407 | 'espresso_event_editor_tickets', |
1408 | - esc_html__( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1409 | - array( $this, 'ticket_metabox' ), |
|
1408 | + esc_html__('Event Datetime & Ticket', 'event_espresso'), |
|
1409 | + array($this, 'ticket_metabox'), |
|
1410 | 1410 | $this->page_slug, |
1411 | 1411 | 'normal', |
1412 | 1412 | 'high' |
1413 | 1413 | ); |
1414 | 1414 | add_meta_box( |
1415 | 1415 | 'espresso_event_editor_event_options', |
1416 | - esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
1417 | - array( $this, 'registration_options_meta_box' ), |
|
1416 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
1417 | + array($this, 'registration_options_meta_box'), |
|
1418 | 1418 | $this->page_slug, |
1419 | 1419 | 'side', |
1420 | 1420 | 'default' |
@@ -1442,65 +1442,65 @@ discard block |
||
1442 | 1442 | 'trash_icon' => 'ee-lock-icon', |
1443 | 1443 | 'disabled' => '', |
1444 | 1444 | ); |
1445 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : null; |
|
1446 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1445 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null; |
|
1446 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1447 | 1447 | /** |
1448 | 1448 | * 1. Start with retrieving Datetimes |
1449 | 1449 | * 2. Fore each datetime get related tickets |
1450 | 1450 | * 3. For each ticket get related prices |
1451 | 1451 | */ |
1452 | - $times = EE_Registry::instance()->load_model( 'Datetime' )->get_all_event_dates( $event_id ); |
|
1452 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1453 | 1453 | /** @type EE_Datetime $first_datetime */ |
1454 | - $first_datetime = reset( $times ); |
|
1454 | + $first_datetime = reset($times); |
|
1455 | 1455 | //do we get related tickets? |
1456 | - if ( $first_datetime instanceof EE_Datetime |
|
1456 | + if ($first_datetime instanceof EE_Datetime |
|
1457 | 1457 | && $first_datetime->ID() !== 0 |
1458 | 1458 | ) { |
1459 | - $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
|
1459 | + $existing_datetime_ids[] = $first_datetime->get('DTT_ID'); |
|
1460 | 1460 | $template_args['time'] = $first_datetime; |
1461 | 1461 | $related_tickets = $first_datetime->tickets( |
1462 | 1462 | array( |
1463 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1463 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1464 | 1464 | 'default_where_conditions' => 'none', |
1465 | 1465 | ) |
1466 | 1466 | ); |
1467 | - if ( ! empty( $related_tickets ) ) { |
|
1468 | - $template_args['total_ticket_rows'] = count( $related_tickets ); |
|
1467 | + if ( ! empty($related_tickets)) { |
|
1468 | + $template_args['total_ticket_rows'] = count($related_tickets); |
|
1469 | 1469 | $row = 0; |
1470 | - foreach ( $related_tickets as $ticket ) { |
|
1471 | - $existing_ticket_ids[] = $ticket->get( 'TKT_ID' ); |
|
1472 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket, false, $row ); |
|
1470 | + foreach ($related_tickets as $ticket) { |
|
1471 | + $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
|
1472 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row); |
|
1473 | 1473 | $row++; |
1474 | 1474 | } |
1475 | 1475 | } else { |
1476 | 1476 | $template_args['total_ticket_rows'] = 1; |
1477 | 1477 | /** @type EE_Ticket $ticket */ |
1478 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(); |
|
1479 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1478 | + $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
|
1479 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1480 | 1480 | } |
1481 | 1481 | } else { |
1482 | 1482 | $template_args['time'] = $times[0]; |
1483 | 1483 | /** @type EE_Ticket $ticket */ |
1484 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->get_all_default_tickets(); |
|
1485 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1484 | + $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
|
1485 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1486 | 1486 | // NOTE: we're just sending the first default row |
1487 | 1487 | // (decaf can't manage default tickets so this should be sufficient); |
1488 | 1488 | } |
1489 | 1489 | $template_args['event_datetime_help_link'] = $this->_get_help_tab_link( |
1490 | 1490 | 'event_editor_event_datetimes_help_tab' |
1491 | 1491 | ); |
1492 | - $template_args['ticket_options_help_link'] = $this->_get_help_tab_link( 'ticket_options_info' ); |
|
1493 | - $template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
1494 | - $template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
1492 | + $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
|
1493 | + $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
1494 | + $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
1495 | 1495 | $template_args['ticket_js_structure'] = $this->_get_ticket_row( |
1496 | - EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(), |
|
1496 | + EE_Registry::instance()->load_model('Ticket')->create_default_object(), |
|
1497 | 1497 | true |
1498 | 1498 | ); |
1499 | 1499 | $template = apply_filters( |
1500 | 1500 | 'FHEE__Events_Admin_Page__ticket_metabox__template', |
1501 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' |
|
1501 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php' |
|
1502 | 1502 | ); |
1503 | - EEH_Template::display_template( $template, $template_args ); |
|
1503 | + EEH_Template::display_template($template, $template_args); |
|
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | |
@@ -1514,74 +1514,74 @@ discard block |
||
1514 | 1514 | * @param int $row |
1515 | 1515 | * @return string generated html for the ticket row. |
1516 | 1516 | */ |
1517 | - private function _get_ticket_row( $ticket, $skeleton = false, $row = 0 ) { |
|
1517 | + private function _get_ticket_row($ticket, $skeleton = false, $row = 0) { |
|
1518 | 1518 | $template_args = array( |
1519 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1519 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1520 | 1520 | 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' |
1521 | 1521 | : '', |
1522 | 1522 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1523 | - 'TKT_ID' => $ticket->get( 'TKT_ID' ), |
|
1524 | - 'TKT_name' => $ticket->get( 'TKT_name' ), |
|
1525 | - 'TKT_start_date' => $skeleton ? '' : $ticket->get_date( 'TKT_start_date', 'Y-m-d h:i a' ), |
|
1526 | - 'TKT_end_date' => $skeleton ? '' : $ticket->get_date( 'TKT_end_date', 'Y-m-d h:i a' ), |
|
1527 | - 'TKT_is_default' => $ticket->get( 'TKT_is_default' ), |
|
1528 | - 'TKT_qty' => $ticket->get_pretty( 'TKT_qty', 'input' ), |
|
1523 | + 'TKT_ID' => $ticket->get('TKT_ID'), |
|
1524 | + 'TKT_name' => $ticket->get('TKT_name'), |
|
1525 | + 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
|
1526 | + 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
|
1527 | + 'TKT_is_default' => $ticket->get('TKT_is_default'), |
|
1528 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1529 | 1529 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1530 | - 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
|
1531 | - 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
|
1532 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1530 | + 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
|
1531 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) |
|
1532 | + && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) |
|
1533 | 1533 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1534 | - 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
|
1534 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' |
|
1535 | 1535 | : ' disabled=disabled', |
1536 | 1536 | ); |
1537 | 1537 | $price = $ticket->ID() !== 0 |
1538 | - ? $ticket->get_first_related( 'Price', array( 'default_where_conditions' => 'none' ) ) |
|
1539 | - : EE_Registry::instance()->load_model( 'Price' )->create_default_object(); |
|
1538 | + ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) |
|
1539 | + : EE_Registry::instance()->load_model('Price')->create_default_object(); |
|
1540 | 1540 | $price_args = array( |
1541 | 1541 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1542 | - 'PRC_amount' => $price->get( 'PRC_amount' ), |
|
1543 | - 'PRT_ID' => $price->get( 'PRT_ID' ), |
|
1544 | - 'PRC_ID' => $price->get( 'PRC_ID' ), |
|
1545 | - 'PRC_is_default' => $price->get( 'PRC_is_default' ), |
|
1542 | + 'PRC_amount' => $price->get('PRC_amount'), |
|
1543 | + 'PRT_ID' => $price->get('PRT_ID'), |
|
1544 | + 'PRC_ID' => $price->get('PRC_ID'), |
|
1545 | + 'PRC_is_default' => $price->get('PRC_is_default'), |
|
1546 | 1546 | ); |
1547 | 1547 | //make sure we have default start and end dates if skeleton |
1548 | 1548 | //handle rows that should NOT be empty |
1549 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1549 | + if (empty($template_args['TKT_start_date'])) { |
|
1550 | 1550 | //if empty then the start date will be now. |
1551 | - $template_args['TKT_start_date'] = date( 'Y-m-d h:i a', current_time( 'timestamp' ) ); |
|
1551 | + $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
|
1552 | 1552 | } |
1553 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1553 | + if (empty($template_args['TKT_end_date'])) { |
|
1554 | 1554 | //get the earliest datetime (if present); |
1555 | 1555 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 |
1556 | 1556 | ? $this->_cpt_model_obj->get_first_related( |
1557 | 1557 | 'Datetime', |
1558 | - array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) |
|
1558 | + array('order_by' => array('DTT_EVT_start' => 'ASC')) |
|
1559 | 1559 | ) |
1560 | 1560 | : null; |
1561 | - if ( ! empty( $earliest_dtt ) ) { |
|
1562 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime( 'DTT_EVT_start', 'Y-m-d', 'h:i a' ); |
|
1561 | + if ( ! empty($earliest_dtt)) { |
|
1562 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1563 | 1563 | } else { |
1564 | 1564 | $template_args['TKT_end_date'] = date( |
1565 | 1565 | 'Y-m-d h:i a', |
1566 | - mktime( 0, 0, 0, date( "m" ), date( "d" ) + 7, date( "Y" ) ) |
|
1566 | + mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")) |
|
1567 | 1567 | ); |
1568 | 1568 | } |
1569 | 1569 | } |
1570 | - $template_args = array_merge( $template_args, $price_args ); |
|
1570 | + $template_args = array_merge($template_args, $price_args); |
|
1571 | 1571 | $template = apply_filters( |
1572 | 1572 | 'FHEE__Events_Admin_Page__get_ticket_row__template', |
1573 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', |
|
1573 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', |
|
1574 | 1574 | $ticket |
1575 | 1575 | ); |
1576 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
1576 | + return EEH_Template::display_template($template, $template_args, true); |
|
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | |
1580 | 1580 | |
1581 | 1581 | public function registration_options_meta_box() { |
1582 | 1582 | $yes_no_values = array( |
1583 | - array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ), |
|
1584 | - array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ), |
|
1583 | + array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')), |
|
1584 | + array('id' => false, 'text' => esc_html__('No', 'event_espresso')), |
|
1585 | 1585 | ); |
1586 | 1586 | $default_reg_status_values = EEM_Registration::reg_status_array( |
1587 | 1587 | array( |
@@ -1593,7 +1593,7 @@ discard block |
||
1593 | 1593 | ); |
1594 | 1594 | //$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active()); |
1595 | 1595 | $template_args['_event'] = $this->_cpt_model_obj; |
1596 | - $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false ); |
|
1596 | + $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
1597 | 1597 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
1598 | 1598 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
1599 | 1599 | 'default_reg_status', |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | $default_reg_status_values |
1622 | 1622 | ); |
1623 | 1623 | EEH_Template::display_template( |
1624 | - EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
1624 | + EVENTS_TEMPLATE_PATH.'event_registration_options.template.php', |
|
1625 | 1625 | $template_args |
1626 | 1626 | ); |
1627 | 1627 | } |
@@ -1640,97 +1640,97 @@ discard block |
||
1640 | 1640 | * that match the given _view and paging parameters. |
1641 | 1641 | * @return array an array of event objects. |
1642 | 1642 | */ |
1643 | - public function get_events( $per_page = 10, $current_page = 1, $count = false ) { |
|
1643 | + public function get_events($per_page = 10, $current_page = 1, $count = false) { |
|
1644 | 1644 | $EEME = $this->_event_model(); |
1645 | - $offset = ( $current_page - 1 ) * $per_page; |
|
1646 | - $limit = $count ? null : $offset . ',' . $per_page; |
|
1647 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1648 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : "DESC"; |
|
1649 | - if ( isset( $this->_req_data['month_range'] ) ) { |
|
1650 | - $pieces = explode( ' ', $this->_req_data['month_range'], 3 ); |
|
1651 | - $month_r = ! empty( $pieces[0] ) ? date( 'm', strtotime( $pieces[0] ) ) : ''; |
|
1652 | - $year_r = ! empty( $pieces[1] ) ? $pieces[1] : ''; |
|
1645 | + $offset = ($current_page - 1) * $per_page; |
|
1646 | + $limit = $count ? null : $offset.','.$per_page; |
|
1647 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1648 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
|
1649 | + if (isset($this->_req_data['month_range'])) { |
|
1650 | + $pieces = explode(' ', $this->_req_data['month_range'], 3); |
|
1651 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1652 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1653 | 1653 | } |
1654 | 1654 | $where = array(); |
1655 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null; |
|
1655 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1656 | 1656 | //determine what post_status our condition will have for the query. |
1657 | - switch ( $status ) { |
|
1657 | + switch ($status) { |
|
1658 | 1658 | case 'month' : |
1659 | 1659 | case 'today' : |
1660 | 1660 | case null : |
1661 | 1661 | case 'all' : |
1662 | 1662 | break; |
1663 | 1663 | case 'draft' : |
1664 | - $where['status'] = array( 'IN', array( 'draft', 'auto-draft' ) ); |
|
1664 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1665 | 1665 | break; |
1666 | 1666 | default : |
1667 | 1667 | $where['status'] = $status; |
1668 | 1668 | } |
1669 | 1669 | //categories? |
1670 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 |
|
1670 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
1671 | 1671 | ? $this->_req_data['EVT_CAT'] : null; |
1672 | - if ( ! empty ( $category ) ) { |
|
1672 | + if ( ! empty ($category)) { |
|
1673 | 1673 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1674 | 1674 | $where['Term_Taxonomy.term_id'] = $category; |
1675 | 1675 | } |
1676 | 1676 | //date where conditions |
1677 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1678 | - if ( isset( $this->_req_data['month_range'] ) && $this->_req_data['month_range'] != '' ) { |
|
1677 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1678 | + if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
|
1679 | 1679 | $DateTime = new DateTime( |
1680 | - $year_r . '-' . $month_r . '-01 00:00:00', |
|
1681 | - new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) |
|
1680 | + $year_r.'-'.$month_r.'-01 00:00:00', |
|
1681 | + new DateTimeZone(EEM_Datetime::instance()->get_timezone()) |
|
1682 | 1682 | ); |
1683 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1684 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format( 't' ) )->setTime( 23, 59, 59 )->format( |
|
1685 | - implode( ' ', $start_formats ) |
|
1683 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1684 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format( |
|
1685 | + implode(' ', $start_formats) |
|
1686 | 1686 | ); |
1687 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1688 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ) { |
|
1689 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1690 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1691 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1692 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1693 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ) { |
|
1694 | - $now = date( 'Y-m-01' ); |
|
1695 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1696 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1697 | - $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
|
1698 | - ->setTime( 23, 59, 59 ) |
|
1699 | - ->format( implode( ' ', $start_formats ) ); |
|
1700 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1687 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1688 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
|
1689 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1690 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1691 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1692 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1693 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1694 | + $now = date('Y-m-01'); |
|
1695 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1696 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1697 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t')) |
|
1698 | + ->setTime(23, 59, 59) |
|
1699 | + ->format(implode(' ', $start_formats)); |
|
1700 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1701 | 1701 | } |
1702 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1702 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1703 | 1703 | $where['EVT_wp_user'] = get_current_user_id(); |
1704 | 1704 | } else { |
1705 | - if ( ! isset( $where['status'] ) ) { |
|
1706 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1705 | + if ( ! isset($where['status'])) { |
|
1706 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1707 | 1707 | $where['OR'] = array( |
1708 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1708 | + 'status*restrict_private' => array('!=', 'private'), |
|
1709 | 1709 | 'AND' => array( |
1710 | - 'status*inclusive' => array( '=', 'private' ), |
|
1710 | + 'status*inclusive' => array('=', 'private'), |
|
1711 | 1711 | 'EVT_wp_user' => get_current_user_id(), |
1712 | 1712 | ), |
1713 | 1713 | ); |
1714 | 1714 | } |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1718 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1719 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1717 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1718 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1719 | + && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events') |
|
1720 | 1720 | ) { |
1721 | 1721 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1722 | 1722 | } |
1723 | 1723 | } |
1724 | 1724 | //search query handling |
1725 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1726 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1725 | + if (isset($this->_req_data['s'])) { |
|
1726 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1727 | 1727 | $where['OR'] = array( |
1728 | - 'EVT_name' => array( 'LIKE', $search_string ), |
|
1729 | - 'EVT_desc' => array( 'LIKE', $search_string ), |
|
1730 | - 'EVT_short_desc' => array( 'LIKE', $search_string ), |
|
1728 | + 'EVT_name' => array('LIKE', $search_string), |
|
1729 | + 'EVT_desc' => array('LIKE', $search_string), |
|
1730 | + 'EVT_short_desc' => array('LIKE', $search_string), |
|
1731 | 1731 | ); |
1732 | 1732 | } |
1733 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1733 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1734 | 1734 | $query_params = apply_filters( |
1735 | 1735 | 'FHEE__Events_Admin_Page__get_events__query_params', |
1736 | 1736 | array( |
@@ -1743,23 +1743,23 @@ discard block |
||
1743 | 1743 | $this->_req_data |
1744 | 1744 | ); |
1745 | 1745 | //let's first check if we have special requests coming in. |
1746 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1747 | - switch ( $this->_req_data['active_status'] ) { |
|
1746 | + if (isset($this->_req_data['active_status'])) { |
|
1747 | + switch ($this->_req_data['active_status']) { |
|
1748 | 1748 | case 'upcoming' : |
1749 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1749 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1750 | 1750 | break; |
1751 | 1751 | case 'expired' : |
1752 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1752 | + return $EEME->get_expired_events($query_params, $count); |
|
1753 | 1753 | break; |
1754 | 1754 | case 'active' : |
1755 | - return $EEME->get_active_events( $query_params, $count ); |
|
1755 | + return $EEME->get_active_events($query_params, $count); |
|
1756 | 1756 | break; |
1757 | 1757 | case 'inactive' : |
1758 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1758 | + return $EEME->get_inactive_events($query_params, $count); |
|
1759 | 1759 | break; |
1760 | 1760 | } |
1761 | 1761 | } |
1762 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1762 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1763 | 1763 | return $events; |
1764 | 1764 | } |
1765 | 1765 | |
@@ -1770,9 +1770,9 @@ discard block |
||
1770 | 1770 | * |
1771 | 1771 | * @param string $post_id |
1772 | 1772 | */ |
1773 | - public function trash_cpt_item( $post_id ) { |
|
1773 | + public function trash_cpt_item($post_id) { |
|
1774 | 1774 | $this->_req_data['EVT_ID'] = $post_id; |
1775 | - $this->_trash_or_restore_event( 'trash', false ); |
|
1775 | + $this->_trash_or_restore_event('trash', false); |
|
1776 | 1776 | } |
1777 | 1777 | |
1778 | 1778 | |
@@ -1780,9 +1780,9 @@ discard block |
||
1780 | 1780 | /** |
1781 | 1781 | * @param string $post_id |
1782 | 1782 | */ |
1783 | - public function restore_cpt_item( $post_id ) { |
|
1783 | + public function restore_cpt_item($post_id) { |
|
1784 | 1784 | $this->_req_data['EVT_ID'] = $post_id; |
1785 | - $this->_trash_or_restore_event( 'draft', false ); |
|
1785 | + $this->_trash_or_restore_event('draft', false); |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | |
@@ -1790,9 +1790,9 @@ discard block |
||
1790 | 1790 | /** |
1791 | 1791 | * @param string $post_id |
1792 | 1792 | */ |
1793 | - public function delete_cpt_item( $post_id ) { |
|
1793 | + public function delete_cpt_item($post_id) { |
|
1794 | 1794 | $this->_req_data['EVT_ID'] = $post_id; |
1795 | - $this->_delete_event( false ); |
|
1795 | + $this->_delete_event(false); |
|
1796 | 1796 | } |
1797 | 1797 | |
1798 | 1798 | |
@@ -1804,23 +1804,23 @@ discard block |
||
1804 | 1804 | * @param string $event_status |
1805 | 1805 | * @param bool $redirect_after |
1806 | 1806 | */ |
1807 | - protected function _trash_or_restore_event( $event_status = 'trash', $redirect_after = true ) { |
|
1807 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true) { |
|
1808 | 1808 | //determine the event id and set to array. |
1809 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : false; |
|
1809 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false; |
|
1810 | 1810 | // loop thru events |
1811 | - if ( $EVT_ID ) { |
|
1811 | + if ($EVT_ID) { |
|
1812 | 1812 | // clean status |
1813 | - $event_status = sanitize_key( $event_status ); |
|
1813 | + $event_status = sanitize_key($event_status); |
|
1814 | 1814 | // grab status |
1815 | - if ( ! empty( $event_status ) ) { |
|
1816 | - $success = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1815 | + if ( ! empty($event_status)) { |
|
1816 | + $success = $this->_change_event_status($EVT_ID, $event_status); |
|
1817 | 1817 | } else { |
1818 | 1818 | $success = false; |
1819 | 1819 | $msg = esc_html__( |
1820 | 1820 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1821 | 1821 | 'event_espresso' |
1822 | 1822 | ); |
1823 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1823 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1824 | 1824 | } |
1825 | 1825 | } else { |
1826 | 1826 | $success = false; |
@@ -1828,11 +1828,11 @@ discard block |
||
1828 | 1828 | 'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.', |
1829 | 1829 | 'event_espresso' |
1830 | 1830 | ); |
1831 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1831 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1832 | 1832 | } |
1833 | 1833 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1834 | - if ( $redirect_after ) { |
|
1835 | - $this->_redirect_after_action( $success, 'Event', $action, array( 'action' => 'default' ) ); |
|
1834 | + if ($redirect_after) { |
|
1835 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1836 | 1836 | } |
1837 | 1837 | } |
1838 | 1838 | |
@@ -1845,18 +1845,18 @@ discard block |
||
1845 | 1845 | * @param string $event_status |
1846 | 1846 | * @return void |
1847 | 1847 | */ |
1848 | - protected function _trash_or_restore_events( $event_status = 'trash' ) { |
|
1848 | + protected function _trash_or_restore_events($event_status = 'trash') { |
|
1849 | 1849 | // clean status |
1850 | - $event_status = sanitize_key( $event_status ); |
|
1850 | + $event_status = sanitize_key($event_status); |
|
1851 | 1851 | // grab status |
1852 | - if ( ! empty( $event_status ) ) { |
|
1852 | + if ( ! empty($event_status)) { |
|
1853 | 1853 | $success = true; |
1854 | 1854 | //determine the event id and set to array. |
1855 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1855 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1856 | 1856 | // loop thru events |
1857 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
1858 | - if ( $EVT_ID = absint( $EVT_ID ) ) { |
|
1859 | - $results = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1857 | + foreach ($EVT_IDs as $EVT_ID) { |
|
1858 | + if ($EVT_ID = absint($EVT_ID)) { |
|
1859 | + $results = $this->_change_event_status($EVT_ID, $event_status); |
|
1860 | 1860 | $success = $results !== false ? $success : false; |
1861 | 1861 | } else { |
1862 | 1862 | $msg = sprintf( |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | ), |
1867 | 1867 | $EVT_ID |
1868 | 1868 | ); |
1869 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1869 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1870 | 1870 | $success = false; |
1871 | 1871 | } |
1872 | 1872 | } |
@@ -1876,12 +1876,12 @@ discard block |
||
1876 | 1876 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1877 | 1877 | 'event_espresso' |
1878 | 1878 | ); |
1879 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1879 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1880 | 1880 | } |
1881 | 1881 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
1882 | 1882 | $success = $success ? 2 : false; |
1883 | 1883 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1884 | - $this->_redirect_after_action( $success, 'Events', $action, array( 'action' => 'default' ) ); |
|
1884 | + $this->_redirect_after_action($success, 'Events', $action, array('action' => 'default')); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | |
@@ -1894,30 +1894,30 @@ discard block |
||
1894 | 1894 | * @param string $event_status |
1895 | 1895 | * @return bool |
1896 | 1896 | */ |
1897 | - private function _change_event_status( $EVT_ID = 0, $event_status = '' ) { |
|
1897 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1898 | 1898 | // grab event id |
1899 | - if ( ! $EVT_ID ) { |
|
1899 | + if ( ! $EVT_ID) { |
|
1900 | 1900 | $msg = esc_html__( |
1901 | 1901 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
1902 | 1902 | 'event_espresso' |
1903 | 1903 | ); |
1904 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1904 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1905 | 1905 | return false; |
1906 | 1906 | } |
1907 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1907 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1908 | 1908 | // clean status |
1909 | - $event_status = sanitize_key( $event_status ); |
|
1909 | + $event_status = sanitize_key($event_status); |
|
1910 | 1910 | // grab status |
1911 | - if ( empty( $event_status ) ) { |
|
1911 | + if (empty($event_status)) { |
|
1912 | 1912 | $msg = esc_html__( |
1913 | 1913 | 'An error occurred. No Event Status or an invalid Event Status was received.', |
1914 | 1914 | 'event_espresso' |
1915 | 1915 | ); |
1916 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1916 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1917 | 1917 | return false; |
1918 | 1918 | } |
1919 | 1919 | // was event trashed or restored ? |
1920 | - switch ( $event_status ) { |
|
1920 | + switch ($event_status) { |
|
1921 | 1921 | case 'draft' : |
1922 | 1922 | $action = 'restored from the trash'; |
1923 | 1923 | $hook = 'AHEE_event_restored_from_trash'; |
@@ -1931,15 +1931,15 @@ discard block |
||
1931 | 1931 | $hook = false; |
1932 | 1932 | } |
1933 | 1933 | //use class to change status |
1934 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1934 | + $this->_cpt_model_obj->set_status($event_status); |
|
1935 | 1935 | $success = $this->_cpt_model_obj->save(); |
1936 | - if ( $success === false ) { |
|
1937 | - $msg = sprintf( esc_html__( 'An error occurred. The event could not be %s.', 'event_espresso' ), $action ); |
|
1938 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1936 | + if ($success === false) { |
|
1937 | + $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1938 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1939 | 1939 | return false; |
1940 | 1940 | } |
1941 | - if ( $hook ) { |
|
1942 | - do_action( $hook ); |
|
1941 | + if ($hook) { |
|
1942 | + do_action($hook); |
|
1943 | 1943 | } |
1944 | 1944 | return true; |
1945 | 1945 | } |
@@ -1952,34 +1952,34 @@ discard block |
||
1952 | 1952 | * @access protected |
1953 | 1953 | * @param bool $redirect_after |
1954 | 1954 | */ |
1955 | - protected function _delete_event( $redirect_after = true ) { |
|
1955 | + protected function _delete_event($redirect_after = true) { |
|
1956 | 1956 | //determine the event id and set to array. |
1957 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : null; |
|
1958 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1957 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null; |
|
1958 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1959 | 1959 | // loop thru events |
1960 | - if ( $EVT_ID ) { |
|
1961 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1960 | + if ($EVT_ID) { |
|
1961 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1962 | 1962 | // get list of events with no prices |
1963 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
1963 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
1964 | 1964 | // remove this event from the list of events with no prices |
1965 | - if ( isset( $espresso_no_ticket_prices[ $EVT_ID ] ) ) { |
|
1966 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1965 | + if (isset($espresso_no_ticket_prices[$EVT_ID])) { |
|
1966 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1967 | 1967 | } |
1968 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
1968 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
1969 | 1969 | } else { |
1970 | 1970 | $success = false; |
1971 | 1971 | $msg = esc_html__( |
1972 | 1972 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
1973 | 1973 | 'event_espresso' |
1974 | 1974 | ); |
1975 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1975 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1976 | 1976 | } |
1977 | - if ( $redirect_after ) { |
|
1977 | + if ($redirect_after) { |
|
1978 | 1978 | $this->_redirect_after_action( |
1979 | 1979 | $success, |
1980 | 1980 | 'Event', |
1981 | 1981 | 'deleted', |
1982 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
1982 | + array('action' => 'default', 'status' => 'trash') |
|
1983 | 1983 | ); |
1984 | 1984 | } |
1985 | 1985 | } |
@@ -1995,30 +1995,30 @@ discard block |
||
1995 | 1995 | protected function _delete_events() { |
1996 | 1996 | $success = true; |
1997 | 1997 | // get list of events with no prices |
1998 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
1998 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
1999 | 1999 | //determine the event id and set to array. |
2000 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2000 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2001 | 2001 | // loop thru events |
2002 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
2003 | - $EVT_ID = absint( $EVT_ID ); |
|
2004 | - if ( $EVT_ID ) { |
|
2005 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
2002 | + foreach ($EVT_IDs as $EVT_ID) { |
|
2003 | + $EVT_ID = absint($EVT_ID); |
|
2004 | + if ($EVT_ID) { |
|
2005 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
2006 | 2006 | $success = $results !== false ? $success : false; |
2007 | 2007 | // remove this event from the list of events with no prices |
2008 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
2008 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
2009 | 2009 | } else { |
2010 | 2010 | $success = false; |
2011 | 2011 | $msg = esc_html__( |
2012 | 2012 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
2013 | 2013 | 'event_espresso' |
2014 | 2014 | ); |
2015 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2015 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2016 | 2016 | } |
2017 | 2017 | } |
2018 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
2018 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
2019 | 2019 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
2020 | 2020 | $success = $success ? 2 : false; |
2021 | - $this->_redirect_after_action( $success, 'Events', 'deleted', array( 'action' => 'default' ) ); |
|
2021 | + $this->_redirect_after_action($success, 'Events', 'deleted', array('action' => 'default')); |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | |
@@ -2030,70 +2030,70 @@ discard block |
||
2030 | 2030 | * @param int $EVT_ID |
2031 | 2031 | * @return bool |
2032 | 2032 | */ |
2033 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
2033 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
2034 | 2034 | // grab event id |
2035 | - if ( ! $EVT_ID ) { |
|
2035 | + if ( ! $EVT_ID) { |
|
2036 | 2036 | $msg = esc_html__( |
2037 | 2037 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
2038 | 2038 | 'event_espresso' |
2039 | 2039 | ); |
2040 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2040 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2041 | 2041 | return false; |
2042 | 2042 | } |
2043 | 2043 | if ( |
2044 | 2044 | ! $this->_cpt_model_obj instanceof EE_Event |
2045 | 2045 | || $this->_cpt_model_obj->ID() !== $EVT_ID |
2046 | 2046 | ) { |
2047 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
2047 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
2048 | 2048 | } |
2049 | - if ( ! $this->_cpt_model_obj instanceof EE_Event ) { |
|
2049 | + if ( ! $this->_cpt_model_obj instanceof EE_Event) { |
|
2050 | 2050 | return false; |
2051 | 2051 | } |
2052 | 2052 | //need to delete related tickets and prices first. |
2053 | - $datetimes = $this->_cpt_model_obj->get_many_related( 'Datetime' ); |
|
2054 | - foreach ( $datetimes as $datetime ) { |
|
2055 | - $this->_cpt_model_obj->_remove_relation_to( $datetime, 'Datetime' ); |
|
2056 | - $tickets = $datetime->get_many_related( 'Ticket' ); |
|
2057 | - foreach ( $tickets as $ticket ) { |
|
2058 | - $ticket->_remove_relation_to( $datetime, 'Datetime' ); |
|
2059 | - $ticket->delete_related_permanently( 'Price' ); |
|
2053 | + $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
|
2054 | + foreach ($datetimes as $datetime) { |
|
2055 | + $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
|
2056 | + $tickets = $datetime->get_many_related('Ticket'); |
|
2057 | + foreach ($tickets as $ticket) { |
|
2058 | + $ticket->_remove_relation_to($datetime, 'Datetime'); |
|
2059 | + $ticket->delete_related_permanently('Price'); |
|
2060 | 2060 | $ticket->delete_permanently(); |
2061 | 2061 | } |
2062 | 2062 | $datetime->delete(); |
2063 | 2063 | } |
2064 | 2064 | //what about related venues or terms? |
2065 | - $venues = $this->_cpt_model_obj->get_many_related( 'Venue' ); |
|
2066 | - foreach ( $venues as $venue ) { |
|
2067 | - $this->_cpt_model_obj->_remove_relation_to( $venue, 'Venue' ); |
|
2065 | + $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
|
2066 | + foreach ($venues as $venue) { |
|
2067 | + $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
|
2068 | 2068 | } |
2069 | 2069 | //any attached question groups? |
2070 | - $question_groups = $this->_cpt_model_obj->get_many_related( 'Question_Group' ); |
|
2071 | - if ( ! empty( $question_groups ) ) { |
|
2072 | - foreach ( $question_groups as $question_group ) { |
|
2073 | - $this->_cpt_model_obj->_remove_relation_to( $question_group, 'Question_Group' ); |
|
2070 | + $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
|
2071 | + if ( ! empty($question_groups)) { |
|
2072 | + foreach ($question_groups as $question_group) { |
|
2073 | + $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
|
2074 | 2074 | } |
2075 | 2075 | } |
2076 | 2076 | //Message Template Groups |
2077 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
2077 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
2078 | 2078 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
2079 | 2079 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
2080 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
2081 | - $this->_cpt_model_obj->remove_relation_to_term_taxonomy( $term_taxonomy ); |
|
2080 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
2081 | + $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
|
2082 | 2082 | } |
2083 | 2083 | $success = $this->_cpt_model_obj->delete_permanently(); |
2084 | 2084 | // did it all go as planned ? |
2085 | - if ( $success ) { |
|
2086 | - $msg = sprintf( esc_html__( 'Event ID # %d has been deleted.', 'event_espresso' ), $EVT_ID ); |
|
2087 | - EE_Error::add_success( $msg ); |
|
2085 | + if ($success) { |
|
2086 | + $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
2087 | + EE_Error::add_success($msg); |
|
2088 | 2088 | } else { |
2089 | 2089 | $msg = sprintf( |
2090 | - esc_html__( 'An error occurred. Event ID # %d could not be deleted.', 'event_espresso' ), |
|
2090 | + esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), |
|
2091 | 2091 | $EVT_ID |
2092 | 2092 | ); |
2093 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2093 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2094 | 2094 | return false; |
2095 | 2095 | } |
2096 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
2096 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
2097 | 2097 | return true; |
2098 | 2098 | } |
2099 | 2099 | |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | * @return int |
2107 | 2107 | */ |
2108 | 2108 | public function total_events() { |
2109 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2109 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
2110 | 2110 | return $count; |
2111 | 2111 | } |
2112 | 2112 | |
@@ -2120,9 +2120,9 @@ discard block |
||
2120 | 2120 | */ |
2121 | 2121 | public function total_events_draft() { |
2122 | 2122 | $where = array( |
2123 | - 'status' => array( 'IN', array( 'draft', 'auto-draft' ) ), |
|
2123 | + 'status' => array('IN', array('draft', 'auto-draft')), |
|
2124 | 2124 | ); |
2125 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2125 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2126 | 2126 | return $count; |
2127 | 2127 | } |
2128 | 2128 | |
@@ -2138,7 +2138,7 @@ discard block |
||
2138 | 2138 | $where = array( |
2139 | 2139 | 'status' => 'trash', |
2140 | 2140 | ); |
2141 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2141 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2142 | 2142 | return $count; |
2143 | 2143 | } |
2144 | 2144 | |
@@ -2169,12 +2169,12 @@ discard block |
||
2169 | 2169 | EE_Registry::instance()->CFG->registration->default_STS_ID, |
2170 | 2170 | $this->_template_args['reg_status_array'] |
2171 | 2171 | ) |
2172 | - ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) |
|
2172 | + ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) |
|
2173 | 2173 | : EEM_Registration::status_id_pending_payment; |
2174 | - $this->_set_add_edit_form_tags( 'update_default_event_settings' ); |
|
2175 | - $this->_set_publish_post_box_vars( null, false, false, null, false ); |
|
2174 | + $this->_set_add_edit_form_tags('update_default_event_settings'); |
|
2175 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
2176 | 2176 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2177 | - EVENTS_TEMPLATE_PATH . 'event_settings.template.php', |
|
2177 | + EVENTS_TEMPLATE_PATH.'event_settings.template.php', |
|
2178 | 2178 | $this->_template_args, |
2179 | 2179 | true |
2180 | 2180 | ); |
@@ -2190,8 +2190,8 @@ discard block |
||
2190 | 2190 | * @return void |
2191 | 2191 | */ |
2192 | 2192 | protected function _update_default_event_settings() { |
2193 | - EE_Config::instance()->registration->default_STS_ID = isset( $this->_req_data['default_reg_status'] ) |
|
2194 | - ? sanitize_text_field( $this->_req_data['default_reg_status'] ) |
|
2193 | + EE_Config::instance()->registration->default_STS_ID = isset($this->_req_data['default_reg_status']) |
|
2194 | + ? sanitize_text_field($this->_req_data['default_reg_status']) |
|
2195 | 2195 | : EEM_Registration::status_id_pending_payment; |
2196 | 2196 | $what = 'Default Event Settings'; |
2197 | 2197 | $success = $this->_update_espresso_configuration( |
@@ -2201,7 +2201,7 @@ discard block |
||
2201 | 2201 | __FUNCTION__, |
2202 | 2202 | __LINE__ |
2203 | 2203 | ); |
2204 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default_event_settings' ) ); |
|
2204 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default_event_settings')); |
|
2205 | 2205 | } |
2206 | 2206 | |
2207 | 2207 | |
@@ -2211,20 +2211,20 @@ discard block |
||
2211 | 2211 | |
2212 | 2212 | |
2213 | 2213 | protected function _template_settings() { |
2214 | - $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
|
2214 | + $this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso'); |
|
2215 | 2215 | $this->_template_args['preview_img'] = '<img src="' |
2216 | 2216 | . EVENTS_ASSETS_URL |
2217 | 2217 | . DS |
2218 | 2218 | . 'images' |
2219 | 2219 | . DS |
2220 | 2220 | . 'caffeinated_template_features.jpg" alt="' |
2221 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2221 | + . esc_attr__('Template Settings Preview screenshot', 'event_espresso') |
|
2222 | 2222 | . '" />'; |
2223 | - $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
|
2223 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__( |
|
2224 | 2224 | 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', |
2225 | 2225 | 'event_espresso' |
2226 | - ) . '</strong>'; |
|
2227 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2226 | + ).'</strong>'; |
|
2227 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2228 | 2228 | } |
2229 | 2229 | |
2230 | 2230 | |
@@ -2236,18 +2236,18 @@ discard block |
||
2236 | 2236 | * @return void |
2237 | 2237 | */ |
2238 | 2238 | private function _set_category_object() { |
2239 | - if ( isset( $this->_category->id ) && ! empty( $this->_category->id ) ) { |
|
2239 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
2240 | 2240 | return; |
2241 | 2241 | } //already have the category object so get out. |
2242 | 2242 | //set default category object |
2243 | 2243 | $this->_set_empty_category_object(); |
2244 | 2244 | //only set if we've got an id |
2245 | - if ( ! isset( $this->_req_data['EVT_CAT_ID'] ) ) { |
|
2245 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2246 | 2246 | return; |
2247 | 2247 | } |
2248 | - $category_id = absint( $this->_req_data['EVT_CAT_ID'] ); |
|
2249 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2250 | - if ( ! empty( $term ) ) { |
|
2248 | + $category_id = absint($this->_req_data['EVT_CAT_ID']); |
|
2249 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2250 | + if ( ! empty($term)) { |
|
2251 | 2251 | $this->_category->category_name = $term->name; |
2252 | 2252 | $this->_category->category_identifier = $term->slug; |
2253 | 2253 | $this->_category->category_desc = $term->description; |
@@ -2267,9 +2267,9 @@ discard block |
||
2267 | 2267 | |
2268 | 2268 | |
2269 | 2269 | protected function _category_list_table() { |
2270 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2271 | - $this->_search_btn_label = esc_html__( 'Categories', 'event_espresso' ); |
|
2272 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
2270 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2271 | + $this->_search_btn_label = esc_html__('Categories', 'event_espresso'); |
|
2272 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
2273 | 2273 | 'add_category', |
2274 | 2274 | 'add_category', |
2275 | 2275 | array(), |
@@ -2283,20 +2283,20 @@ discard block |
||
2283 | 2283 | /** |
2284 | 2284 | * @param $view |
2285 | 2285 | */ |
2286 | - protected function _category_details( $view ) { |
|
2286 | + protected function _category_details($view) { |
|
2287 | 2287 | //load formatter helper |
2288 | 2288 | //load field generator helper |
2289 | 2289 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2290 | - $this->_set_add_edit_form_tags( $route ); |
|
2290 | + $this->_set_add_edit_form_tags($route); |
|
2291 | 2291 | $this->_set_category_object(); |
2292 | - $id = ! empty( $this->_category->id ) ? $this->_category->id : ''; |
|
2292 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2293 | 2293 | $delete_action = 'delete_category'; |
2294 | 2294 | //custom redirect |
2295 | 2295 | $redirect = EE_Admin_Page::add_query_args_and_nonce( |
2296 | - array( 'action' => 'category_list' ), |
|
2296 | + array('action' => 'category_list'), |
|
2297 | 2297 | $this->_admin_base_url |
2298 | 2298 | ); |
2299 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2299 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2300 | 2300 | //take care of contents |
2301 | 2301 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
2302 | 2302 | $this->display_admin_page_with_sidebar(); |
@@ -2310,21 +2310,21 @@ discard block |
||
2310 | 2310 | protected function _category_details_content() { |
2311 | 2311 | $editor_args['category_desc'] = array( |
2312 | 2312 | 'type' => 'wp_editor', |
2313 | - 'value' => EEH_Formatter::admin_format_content( $this->_category->category_desc ), |
|
2313 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
2314 | 2314 | 'class' => 'my_editor_custom', |
2315 | - 'wpeditor_args' => array( 'media_buttons' => false ), |
|
2315 | + 'wpeditor_args' => array('media_buttons' => false), |
|
2316 | 2316 | ); |
2317 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2317 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2318 | 2318 | $all_terms = get_terms( |
2319 | - array( 'espresso_event_categories' ), |
|
2320 | - array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) |
|
2319 | + array('espresso_event_categories'), |
|
2320 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
2321 | 2321 | ); |
2322 | 2322 | //setup category select for term parents. |
2323 | 2323 | $category_select_values[] = array( |
2324 | - 'text' => esc_html__( 'No Parent', 'event_espresso' ), |
|
2324 | + 'text' => esc_html__('No Parent', 'event_espresso'), |
|
2325 | 2325 | 'id' => 0, |
2326 | 2326 | ); |
2327 | - foreach ( $all_terms as $term ) { |
|
2327 | + foreach ($all_terms as $term) { |
|
2328 | 2328 | $category_select_values[] = array( |
2329 | 2329 | 'text' => $term->name, |
2330 | 2330 | 'id' => $term->term_id, |
@@ -2338,28 +2338,28 @@ discard block |
||
2338 | 2338 | $template_args = array( |
2339 | 2339 | 'category' => $this->_category, |
2340 | 2340 | 'category_select' => $category_select, |
2341 | - 'unique_id_info_help_link' => $this->_get_help_tab_link( 'unique_id_info' ), |
|
2341 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
2342 | 2342 | 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
2343 | 2343 | 'disable' => '', |
2344 | 2344 | 'disabled_message' => false, |
2345 | 2345 | ); |
2346 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2347 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
2346 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2347 | + return EEH_Template::display_template($template, $template_args, true); |
|
2348 | 2348 | } |
2349 | 2349 | |
2350 | 2350 | |
2351 | 2351 | |
2352 | 2352 | protected function _delete_categories() { |
2353 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2353 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2354 | 2354 | : (array) $this->_req_data['category_id']; |
2355 | - foreach ( $cat_ids as $cat_id ) { |
|
2356 | - $this->_delete_category( $cat_id ); |
|
2355 | + foreach ($cat_ids as $cat_id) { |
|
2356 | + $this->_delete_category($cat_id); |
|
2357 | 2357 | } |
2358 | 2358 | //doesn't matter what page we're coming from... we're going to the same place after delete. |
2359 | 2359 | $query_args = array( |
2360 | 2360 | 'action' => 'category_list', |
2361 | 2361 | ); |
2362 | - $this->_redirect_after_action( 0, '', '', $query_args ); |
|
2362 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2363 | 2363 | } |
2364 | 2364 | |
2365 | 2365 | |
@@ -2367,9 +2367,9 @@ discard block |
||
2367 | 2367 | /** |
2368 | 2368 | * @param $cat_id |
2369 | 2369 | */ |
2370 | - protected function _delete_category( $cat_id ) { |
|
2371 | - $cat_id = absint( $cat_id ); |
|
2372 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2370 | + protected function _delete_category($cat_id) { |
|
2371 | + $cat_id = absint($cat_id); |
|
2372 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2373 | 2373 | } |
2374 | 2374 | |
2375 | 2375 | |
@@ -2377,18 +2377,18 @@ discard block |
||
2377 | 2377 | /** |
2378 | 2378 | * @param $new_category |
2379 | 2379 | */ |
2380 | - protected function _insert_or_update_category( $new_category ) { |
|
2381 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( true ); |
|
2380 | + protected function _insert_or_update_category($new_category) { |
|
2381 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
2382 | 2382 | $success = 0; //we already have a success message so lets not send another. |
2383 | - if ( $cat_id ) { |
|
2383 | + if ($cat_id) { |
|
2384 | 2384 | $query_args = array( |
2385 | 2385 | 'action' => 'edit_category', |
2386 | 2386 | 'EVT_CAT_ID' => $cat_id, |
2387 | 2387 | ); |
2388 | 2388 | } else { |
2389 | - $query_args = array( 'action' => 'add_category' ); |
|
2389 | + $query_args = array('action' => 'add_category'); |
|
2390 | 2390 | } |
2391 | - $this->_redirect_after_action( $success, '', '', $query_args, true ); |
|
2391 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
2392 | 2392 | } |
2393 | 2393 | |
2394 | 2394 | |
@@ -2397,14 +2397,14 @@ discard block |
||
2397 | 2397 | * @param bool $update |
2398 | 2398 | * @return bool|mixed|string |
2399 | 2399 | */ |
2400 | - private function _insert_category( $update = false ) { |
|
2400 | + private function _insert_category($update = false) { |
|
2401 | 2401 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2402 | - $category_name = isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2403 | - $category_desc = isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2404 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2405 | - if ( empty( $category_name ) ) { |
|
2406 | - $msg = esc_html__( 'You must add a name for the category.', 'event_espresso' ); |
|
2407 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2402 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2403 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2404 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2405 | + if (empty($category_name)) { |
|
2406 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
2407 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2408 | 2408 | return false; |
2409 | 2409 | } |
2410 | 2410 | $term_args = array( |
@@ -2413,22 +2413,22 @@ discard block |
||
2413 | 2413 | 'parent' => $category_parent, |
2414 | 2414 | ); |
2415 | 2415 | //was the category_identifier input disabled? |
2416 | - if ( isset( $this->_req_data['category_identifier'] ) ) { |
|
2416 | + if (isset($this->_req_data['category_identifier'])) { |
|
2417 | 2417 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2418 | 2418 | } |
2419 | 2419 | $insert_ids = $update |
2420 | - ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) |
|
2421 | - : wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2422 | - if ( ! is_array( $insert_ids ) ) { |
|
2420 | + ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) |
|
2421 | + : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2422 | + if ( ! is_array($insert_ids)) { |
|
2423 | 2423 | $msg = esc_html__( |
2424 | 2424 | 'An error occurred and the category has not been saved to the database.', |
2425 | 2425 | 'event_espresso' |
2426 | 2426 | ); |
2427 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2427 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2428 | 2428 | } else { |
2429 | 2429 | $cat_id = $insert_ids['term_id']; |
2430 | - $msg = sprintf( esc_html__( 'The category %s was successfully saved', 'event_espresso' ), $category_name ); |
|
2431 | - EE_Error::add_success( $msg ); |
|
2430 | + $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name); |
|
2431 | + EE_Error::add_success($msg); |
|
2432 | 2432 | } |
2433 | 2433 | return $cat_id; |
2434 | 2434 | } |
@@ -2441,28 +2441,28 @@ discard block |
||
2441 | 2441 | * @param bool $count |
2442 | 2442 | * @return \EE_Base_Class[]|int |
2443 | 2443 | */ |
2444 | - public function get_categories( $per_page = 10, $current_page = 1, $count = false ) { |
|
2444 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) { |
|
2445 | 2445 | //testing term stuff |
2446 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2447 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2448 | - $limit = ( $current_page - 1 ) * $per_page; |
|
2449 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2450 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2451 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2446 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2447 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2448 | + $limit = ($current_page - 1) * $per_page; |
|
2449 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2450 | + if (isset($this->_req_data['s'])) { |
|
2451 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2452 | 2452 | $where['OR'] = array( |
2453 | - 'Term.name' => array( 'LIKE', $sstr ), |
|
2454 | - 'description' => array( 'LIKE', $sstr ), |
|
2453 | + 'Term.name' => array('LIKE', $sstr), |
|
2454 | + 'description' => array('LIKE', $sstr), |
|
2455 | 2455 | ); |
2456 | 2456 | } |
2457 | 2457 | $query_params = array( |
2458 | 2458 | $where, |
2459 | - 'order_by' => array( $orderby => $order ), |
|
2460 | - 'limit' => $limit . ',' . $per_page, |
|
2461 | - 'force_join' => array( 'Term' ), |
|
2459 | + 'order_by' => array($orderby => $order), |
|
2460 | + 'limit' => $limit.','.$per_page, |
|
2461 | + 'force_join' => array('Term'), |
|
2462 | 2462 | ); |
2463 | 2463 | $categories = $count |
2464 | - ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) |
|
2465 | - : EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2464 | + ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
2465 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2466 | 2466 | return $categories; |
2467 | 2467 | } |
2468 | 2468 |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | * This just returns whatever is set as the _event object property |
1383 | 1383 | * //todo this will become obsolete once the models are in place |
1384 | 1384 | * |
1385 | - * @return object |
|
1385 | + * @return EE_Event |
|
1386 | 1386 | */ |
1387 | 1387 | public function get_event_object() { |
1388 | 1388 | return $this->_cpt_model_obj; |
@@ -2305,7 +2305,7 @@ discard block |
||
2305 | 2305 | |
2306 | 2306 | |
2307 | 2307 | /** |
2308 | - * @return mixed |
|
2308 | + * @return string |
|
2309 | 2309 | */ |
2310 | 2310 | protected function _category_details_content() { |
2311 | 2311 | $editor_args['category_desc'] = array( |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function instance() { |
42 | 42 | // check if class object is instantiated |
43 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
43 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
44 | 44 | self::$_instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$_instance; |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | // define global EE_Admin constants |
58 | 58 | $this->_define_all_constants(); |
59 | 59 | // set autoloaders for our admin page classes based on included path information |
60 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
60 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
61 | 61 | // admin hooks |
62 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
62 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
63 | 63 | // load EE_Request_Handler early |
64 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
65 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
64 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
65 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
66 | 66 | // post shortcode tracking |
67 | 67 | add_action( |
68 | 68 | 'AHEE__EE_System__initialize_last', |
69 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' ) |
|
69 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin') |
|
70 | 70 | ); |
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin === $main_file ) { |
|
122 | + if ($plugin === $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -174,31 +174,31 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function init() { |
176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
177 | - if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
177 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
178 | 178 | //ok so we want to enable the entire admin |
179 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
180 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
179 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
180 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
181 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
182 | 182 | //at a glance dashboard widget |
183 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 ); |
|
183 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
184 | 184 | //filter for get_edit_post_link used on comments for custom post types |
185 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 ); |
|
185 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2); |
|
186 | 186 | } |
187 | 187 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
188 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
188 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
189 | 189 | try { |
190 | 190 | //this loads the controller for the admin pages which will setup routing etc |
191 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
192 | - } catch ( EE_Error $e ) { |
|
191 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
192 | + } catch (EE_Error $e) { |
|
193 | 193 | $e->get_error(); |
194 | 194 | } |
195 | 195 | } |
196 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
196 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
197 | 197 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
198 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
199 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
198 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
199 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
200 | 200 | //exclude EE critical pages from all nav menus and wp_list_pages |
201 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
201 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * @param object $post_type WP post type object |
212 | 212 | * @return object WP post type object |
213 | 213 | */ |
214 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
214 | + public function remove_pages_from_nav_menu($post_type) { |
|
215 | 215 | //if this isn't the "pages" post type let's get out |
216 | - if ( $post_type->name !== 'page' ) { |
|
216 | + if ($post_type->name !== 'page') { |
|
217 | 217 | return $post_type; |
218 | 218 | } |
219 | 219 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -233,28 +233,28 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function enable_hidden_ee_nav_menu_metaboxes() { |
235 | 235 | global $wp_meta_boxes, $pagenow; |
236 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
236 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | $user = wp_get_current_user(); |
240 | 240 | //has this been done yet? |
241 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
241 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
245 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
246 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
245 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
246 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
247 | 247 | |
248 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
249 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
250 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
251 | - unset( $hidden_meta_boxes[ $key ] ); |
|
248 | + if (is_array($hidden_meta_boxes)) { |
|
249 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
250 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
251 | + unset($hidden_meta_boxes[$key]); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
257 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
256 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
257 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return void |
274 | 274 | */ |
275 | 275 | public function register_custom_nav_menu_boxes() { |
276 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
276 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string the (maybe) modified link |
291 | 291 | */ |
292 | - public function modify_edit_post_link( $link, $id ) { |
|
293 | - if ( ! $post = get_post( $id ) ){ |
|
292 | + public function modify_edit_post_link($link, $id) { |
|
293 | + if ( ! $post = get_post($id)) { |
|
294 | 294 | return $link; |
295 | 295 | } |
296 | - if ( $post->post_type === 'espresso_attendees' ) { |
|
296 | + if ($post->post_type === 'espresso_attendees') { |
|
297 | 297 | $query_args = array( |
298 | 298 | 'action' => 'edit_attendee', |
299 | 299 | 'post' => $id |
300 | 300 | ); |
301 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
301 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
302 | 302 | } |
303 | 303 | return $link; |
304 | 304 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | global $nav_menu_selected_id; |
311 | 311 | |
312 | 312 | $db_fields = false; |
313 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
313 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
314 | 314 | $current_tab = 'event-archives'; |
315 | 315 | |
316 | 316 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
331 | 331 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
332 | - <li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>> |
|
333 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
332 | + <li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>> |
|
333 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
335 | 335 | </a> |
336 | 336 | </li> |
337 | 337 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | <?php */ ?> |
350 | 350 | |
351 | 351 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
352 | - echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
352 | + echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
353 | 353 | ?>"> |
354 | 354 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
355 | 355 | <?php |
356 | 356 | $pages = $this->_get_extra_nav_menu_pages_items(); |
357 | 357 | $args['walker'] = $walker; |
358 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
358 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
359 | 359 | ?> |
360 | 360 | </ul> |
361 | 361 | </div><!-- /.tabs-panel --> |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | <p class="button-controls"> |
364 | 364 | <span class="list-controls"> |
365 | 365 | <a href="<?php |
366 | - echo esc_url( add_query_arg( |
|
366 | + echo esc_url(add_query_arg( |
|
367 | 367 | array( |
368 | 368 | 'extra-nav-menu-pages-tab' => 'event-archives', |
369 | 369 | 'selectall' => 1, |
370 | 370 | ), |
371 | - remove_query_arg( $removed_args ) |
|
371 | + remove_query_arg($removed_args) |
|
372 | 372 | )); |
373 | 373 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
374 | 374 | </span> |
375 | 375 | |
376 | 376 | <span class="add-to-menu"> |
377 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
377 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
378 | 378 | <span class="spinner"></span> |
379 | 379 | </span> |
380 | 380 | </p> |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | private function _get_extra_nav_menu_pages_items() { |
396 | 396 | $menuitems[] = array( |
397 | 397 | 'title' => __('Event List', 'event_espresso'), |
398 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
398 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
399 | 399 | 'description' => __('Archive page for all events.', 'event_espresso') |
400 | 400 | ); |
401 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
401 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param $menu_item_values |
411 | 411 | * @return stdClass |
412 | 412 | */ |
413 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
413 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
414 | 414 | $menu_item = new stdClass(); |
415 | 415 | $keys = array( |
416 | 416 | 'ID' => 0, |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | 'xfn' => '' |
431 | 431 | ); |
432 | 432 | |
433 | - foreach ( $keys as $key => $value) { |
|
434 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
433 | + foreach ($keys as $key => $value) { |
|
434 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
435 | 435 | } |
436 | 436 | return $menu_item; |
437 | 437 | } |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | * - check if doing post processing of one of EE CPTs |
471 | 471 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
472 | 472 | */ |
473 | - if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) { |
|
474 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
475 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
473 | + if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') { |
|
474 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
475 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
482 | 482 | */ |
483 | 483 | global $pagenow; |
484 | - if ( $pagenow === 'options-reading.php' ) { |
|
485 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
484 | + if ($pagenow === 'options-reading.php') { |
|
485 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -494,25 +494,25 @@ discard block |
||
494 | 494 | * @param string $output Current output. |
495 | 495 | * @return string |
496 | 496 | */ |
497 | - public function modify_dropdown_pages( $output ) { |
|
497 | + public function modify_dropdown_pages($output) { |
|
498 | 498 | //get critical pages |
499 | 499 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
500 | 500 | |
501 | 501 | //split current output by line break for easier parsing. |
502 | - $split_output = explode( "\n", $output ); |
|
502 | + $split_output = explode("\n", $output); |
|
503 | 503 | |
504 | 504 | //loop through to remove any critical pages from the array. |
505 | - foreach ( $critical_pages as $page_id ) { |
|
506 | - $needle = 'value="' . $page_id . '"'; |
|
507 | - foreach( $split_output as $key => $haystack ) { |
|
508 | - if( strpos( $haystack, $needle ) !== false ) { |
|
509 | - unset( $split_output[$key] ); |
|
505 | + foreach ($critical_pages as $page_id) { |
|
506 | + $needle = 'value="'.$page_id.'"'; |
|
507 | + foreach ($split_output as $key => $haystack) { |
|
508 | + if (strpos($haystack, $needle) !== false) { |
|
509 | + unset($split_output[$key]); |
|
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | 514 | //replace output with the new contents |
515 | - return implode( "\n", $split_output ); |
|
515 | + return implode("\n", $split_output); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -526,36 +526,36 @@ discard block |
||
526 | 526 | public function enqueue_admin_scripts() { |
527 | 527 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
528 | 528 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
529 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
529 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
530 | 530 | // register cookie script for future dependencies |
531 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
531 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
532 | 532 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
533 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
533 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
534 | 534 | // register jQuery Validate |
535 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
535 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
536 | 536 | } |
537 | 537 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
538 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
538 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
539 | 539 | //joyride style |
540 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
542 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
540 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
542 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
543 | 543 | //joyride JS |
544 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
545 | 545 | // wanna go for a joyride? |
546 | 546 | wp_enqueue_style('ee-joyride-css'); |
547 | 547 | wp_enqueue_script('jquery-joyride'); |
548 | 548 | } |
549 | 549 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
551 | 551 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
552 | 552 | } |
553 | 553 | //accounting.js library |
554 | 554 | // @link http://josscrowcroft.github.io/accounting.js/ |
555 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
556 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
557 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
558 | - wp_enqueue_script( 'ee-accounting' ); |
|
555 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
556 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
557 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
558 | + wp_enqueue_script('ee-accounting'); |
|
559 | 559 | // array of settings to get converted to JSON array via wp_localize_script |
560 | 560 | $currency_config = array( |
561 | 561 | 'currency' => array( |
@@ -602,11 +602,11 @@ discard block |
||
602 | 602 | public function get_persistent_admin_notices() { |
603 | 603 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
604 | 604 | $args = array( |
605 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
606 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
605 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
606 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
607 | 607 | ); |
608 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
609 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
608 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
609 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -627,26 +627,26 @@ discard block |
||
627 | 627 | * @param $elements |
628 | 628 | * @return array |
629 | 629 | */ |
630 | - public function dashboard_glance_items( $elements ) { |
|
630 | + public function dashboard_glance_items($elements) { |
|
631 | 631 | $events = EEM_Event::instance()->count(); |
632 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
633 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
632 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
633 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
634 | 634 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
635 | 635 | $registrations = EEM_Registration::instance()->count( |
636 | 636 | array( |
637 | 637 | array( |
638 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
638 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
639 | 639 | ) |
640 | 640 | ) |
641 | 641 | ); |
642 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
643 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
642 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
643 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
644 | 644 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
645 | 645 | |
646 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
646 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
647 | 647 | |
648 | - foreach ( $items as $type => $item_properties ) { |
|
649 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
648 | + foreach ($items as $type => $item_properties) { |
|
649 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
650 | 650 | } |
651 | 651 | return $elements; |
652 | 652 | } |
@@ -663,31 +663,31 @@ discard block |
||
663 | 663 | * @throws EE_Error |
664 | 664 | * @return string |
665 | 665 | */ |
666 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
666 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
667 | 667 | // check for date_format or time_format |
668 | - switch ( $option ) { |
|
668 | + switch ($option) { |
|
669 | 669 | case 'date_format' : |
670 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
670 | + $date_time_format = $value.' '.get_option('time_format'); |
|
671 | 671 | break; |
672 | 672 | case 'time_format' : |
673 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
673 | + $date_time_format = get_option('date_format').' '.$value; |
|
674 | 674 | break; |
675 | 675 | default : |
676 | 676 | $date_time_format = FALSE; |
677 | 677 | } |
678 | 678 | // do we have a date_time format to check ? |
679 | - if ( $date_time_format ) { |
|
680 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
679 | + if ($date_time_format) { |
|
680 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
681 | 681 | |
682 | - if ( is_array( $error_msg ) ) { |
|
683 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
682 | + if (is_array($error_msg)) { |
|
683 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
684 | 684 | |
685 | 685 | |
686 | - foreach ( $error_msg as $error ) { |
|
687 | - $msg .= '<li>' . $error . '</li>'; |
|
686 | + foreach ($error_msg as $error) { |
|
687 | + $msg .= '<li>'.$error.'</li>'; |
|
688 | 688 | } |
689 | 689 | |
690 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
690 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
691 | 691 | |
692 | 692 | // trigger WP settings error |
693 | 693 | add_settings_error( |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ); |
698 | 698 | |
699 | 699 | // set format to something valid |
700 | - switch ( $option ) { |
|
700 | + switch ($option) { |
|
701 | 701 | case 'date_format' : |
702 | 702 | $value = 'F j, Y'; |
703 | 703 | break; |
@@ -719,8 +719,8 @@ discard block |
||
719 | 719 | * @param $content |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function its_eSpresso( $content ) { |
|
723 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
722 | + public function its_eSpresso($content) { |
|
723 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * @return string |
733 | 733 | */ |
734 | 734 | public function espresso_admin_footer() { |
735 | - return \EEH_Template::powered_by_event_espresso( 'aln-cntr' ); |
|
735 | + return \EEH_Template::powered_by_event_espresso('aln-cntr'); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | * @param array $config |
752 | 752 | * @return void |
753 | 753 | */ |
754 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
755 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
756 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
754 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
755 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
756 | + if (class_exists('EE_Register_Admin_Page')) { |
|
757 | 757 | $config['page_path'] = $page_path; |
758 | 758 | } |
759 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
759 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
760 | 760 | |
761 | 761 | } |
762 | 762 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param \WP_Post $post |
770 | 770 | * @return void |
771 | 771 | */ |
772 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
772 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
773 | 773 | EE_Error::doing_it_wrong( |
774 | 774 | __METHOD__, |
775 | 775 | __( |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | ), |
779 | 779 | '4.8.41' |
780 | 780 | ); |
781 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post ); |
|
781 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @param $value |
792 | 792 | * @return void |
793 | 793 | */ |
794 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
794 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
795 | 795 | EE_Error::doing_it_wrong( |
796 | 796 | __METHOD__, |
797 | 797 | __( |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | ), |
801 | 801 | '4.8.41' |
802 | 802 | ); |
803 | - EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value ); |
|
803 | + EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | |
168 | 168 | |
169 | 169 | /** |
170 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
171 | - * |
|
172 | - * @access public |
|
173 | - * @return void |
|
174 | - */ |
|
170 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
171 | + * |
|
172 | + * @access public |
|
173 | + * @return void |
|
174 | + */ |
|
175 | 175 | public function init() { |
176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
177 | 177 | if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
@@ -456,11 +456,11 @@ discard block |
||
456 | 456 | |
457 | 457 | |
458 | 458 | /** |
459 | - * admin_init |
|
460 | - * |
|
461 | - * @access public |
|
462 | - * @return void |
|
463 | - */ |
|
459 | + * admin_init |
|
460 | + * |
|
461 | + * @access public |
|
462 | + * @return void |
|
463 | + */ |
|
464 | 464 | public function admin_init() { |
465 | 465 | |
466 | 466 | /** |
@@ -612,11 +612,11 @@ discard block |
||
612 | 612 | |
613 | 613 | |
614 | 614 | /** |
615 | - * dismiss_persistent_admin_notice |
|
616 | - * |
|
617 | - * @access public |
|
618 | - * @return void |
|
619 | - */ |
|
615 | + * dismiss_persistent_admin_notice |
|
616 | + * |
|
617 | + * @access public |
|
618 | + * @return void |
|
619 | + */ |
|
620 | 620 | public function dismiss_ee_nag_notice_callback() { |
621 | 621 | EE_Error::dismiss_persistent_admin_notice(); |
622 | 622 | } |