@@ -5,25 +5,25 @@ |
||
5 | 5 | <table class="admin-primary-mbox-tbl"> |
6 | 6 | <thead> |
7 | 7 | <tr> |
8 | - <th class="jst-left"><?php _e( '#', 'event_espresso' );?></th> |
|
9 | - <th class="jst-left"><?php _e( 'Event Name and Ticket', 'event_espresso' );?></th> |
|
10 | - <th class="jst-left"><?php _e( 'Registrant', 'event_espresso' );?></th> |
|
11 | - <th class="jst-left"><?php _e( 'Ticket Price', 'event_espresso' );?></th> |
|
12 | - <th class="jst-left"><?php _e( 'Email', 'event_espresso' );?></th> |
|
13 | - <th class="jst-left"><?php _e( 'Address', 'event_espresso' );?></th> |
|
8 | + <th class="jst-left"><?php _e('#', 'event_espresso'); ?></th> |
|
9 | + <th class="jst-left"><?php _e('Event Name and Ticket', 'event_espresso'); ?></th> |
|
10 | + <th class="jst-left"><?php _e('Registrant', 'event_espresso'); ?></th> |
|
11 | + <th class="jst-left"><?php _e('Ticket Price', 'event_espresso'); ?></th> |
|
12 | + <th class="jst-left"><?php _e('Email', 'event_espresso'); ?></th> |
|
13 | + <th class="jst-left"><?php _e('Address', 'event_espresso'); ?></th> |
|
14 | 14 | </tr> |
15 | 15 | </thead> |
16 | 16 | <tbody> |
17 | - <?php if ( isset( $event_attendees ) && is_array( $event_attendees )) : ?> |
|
18 | - <?php foreach ( $event_attendees as $registration => $attendee ) : ?> |
|
17 | + <?php if (isset($event_attendees) && is_array($event_attendees)) : ?> |
|
18 | + <?php foreach ($event_attendees as $registration => $attendee) : ?> |
|
19 | 19 | <tr> |
20 | - <td class="jst-left"><?php echo $attendee['att_num'];?></td> |
|
21 | - <td class="jst-left"><?php echo $attendee['event_ticket_name'];?></td> |
|
20 | + <td class="jst-left"><?php echo $attendee['att_num']; ?></td> |
|
21 | + <td class="jst-left"><?php echo $attendee['event_ticket_name']; ?></td> |
|
22 | 22 | <td class="jst-left"> |
23 | 23 | <?php |
24 | - $att_link = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration), REG_ADMIN_URL ); |
|
24 | + $att_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration), REG_ADMIN_URL); |
|
25 | 25 | ?> |
26 | - <a href="<?php echo $att_link; ?>" title="<?php _e( 'View details for this registrant', 'event_espresso' );?>"> |
|
26 | + <a href="<?php echo $att_link; ?>" title="<?php _e('View details for this registrant', 'event_espresso'); ?>"> |
|
27 | 27 | <?php echo $attendee['attendee']?> |
28 | 28 | </a> |
29 | 29 | </td> |
@@ -649,8 +649,9 @@ |
||
649 | 649 | * @return EE_Registration |
650 | 650 | */ |
651 | 651 | public function get_primary_registration() { |
652 | - if ( $this->is_primary_registrant() ) |
|
653 | - return $this; |
|
652 | + if ( $this->is_primary_registrant() ) { |
|
653 | + return $this; |
|
654 | + } |
|
654 | 655 | |
655 | 656 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
656 | 657 | $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\exceptions\EntityNotFoundException; |
2 | 2 | |
3 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | /** |
7 | 7 | * EE_Registration class |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * date_format and the second value is the time format |
44 | 44 | * @return EE_Registration |
45 | 45 | */ |
46 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
47 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
48 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
46 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
47 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
48 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * the website will be used. |
57 | 57 | * @return EE_Registration |
58 | 58 | */ |
59 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
60 | - return new self( $props_n_values, TRUE, $timezone ); |
|
59 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
60 | + return new self($props_n_values, TRUE, $timezone); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @access public |
69 | 69 | * @param int $EVT_ID Event ID |
70 | 70 | */ |
71 | - public function set_event( $EVT_ID = 0 ) { |
|
72 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
71 | + public function set_event($EVT_ID = 0) { |
|
72 | + $this->set('EVT_ID', $EVT_ID); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -80,18 +80,18 @@ discard block |
||
80 | 80 | * @param mixed $field_value |
81 | 81 | * @param bool $use_default |
82 | 82 | */ |
83 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
84 | - switch( $field_name ) { |
|
83 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
84 | + switch ($field_name) { |
|
85 | 85 | case 'REG_code' : |
86 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
87 | - $this->set_reg_code( $field_value, $use_default ); |
|
86 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
87 | + $this->set_reg_code($field_value, $use_default); |
|
88 | 88 | } |
89 | 89 | break; |
90 | 90 | case 'STS_ID' : |
91 | - $this->set_status( $field_value, $use_default ); |
|
91 | + $this->set_status($field_value, $use_default); |
|
92 | 92 | break; |
93 | 93 | default : |
94 | - parent::set( $field_name, $field_value, $use_default ); |
|
94 | + parent::set($field_name, $field_value, $use_default); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -109,42 +109,42 @@ discard block |
||
109 | 109 | * @return bool |
110 | 110 | * @throws \EE_Error |
111 | 111 | */ |
112 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
112 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
113 | 113 | // get current REG_Status |
114 | 114 | $old_STS_ID = $this->status_ID(); |
115 | 115 | // if status has changed |
116 | 116 | if ( |
117 | 117 | $this->ID() // ensure registration is in the db |
118 | 118 | && $old_STS_ID != $new_STS_ID // and that status has actually changed |
119 | - && ! empty( $old_STS_ID ) // and that old status is actually set |
|
120 | - && ! empty( $new_STS_ID ) // as well as the new status |
|
119 | + && ! empty($old_STS_ID) // and that old status is actually set |
|
120 | + && ! empty($new_STS_ID) // as well as the new status |
|
121 | 121 | ) { |
122 | 122 | // TO approved |
123 | - if ( $new_STS_ID === EEM_Registration::status_id_approved ) { |
|
123 | + if ($new_STS_ID === EEM_Registration::status_id_approved) { |
|
124 | 124 | // reserve a space by incrementing ticket and datetime sold values |
125 | 125 | $this->_reserve_registration_space(); |
126 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
126 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
127 | 127 | // OR FROM approved |
128 | - } else if ( $old_STS_ID === EEM_Registration::status_id_approved ) { |
|
128 | + } else if ($old_STS_ID === EEM_Registration::status_id_approved) { |
|
129 | 129 | // release a space by decrementing ticket and datetime sold values |
130 | 130 | $this->_release_registration_space(); |
131 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
131 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
132 | 132 | } |
133 | 133 | // update status |
134 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
134 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
135 | 135 | /** @type EE_Registration_Processor $registration_processor */ |
136 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
136 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
137 | 137 | /** @type EE_Transaction_Processor $transaction_processor */ |
138 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
138 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
139 | 139 | /** @type EE_Transaction_Payments $transaction_payments */ |
140 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
140 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
141 | 141 | // these reg statuses should not be considered in any calculations involving monies owing |
142 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) |
|
142 | + $closed_reg_statuses = ! empty($closed_reg_statuses) |
|
143 | 143 | ? $closed_reg_statuses |
144 | 144 | : EEM_Registration::closed_reg_statuses(); |
145 | 145 | if ( |
146 | - in_array( $new_STS_ID, $closed_reg_statuses ) |
|
147 | - && ! in_array( $old_STS_ID, $closed_reg_statuses ) |
|
146 | + in_array($new_STS_ID, $closed_reg_statuses) |
|
147 | + && ! in_array($old_STS_ID, $closed_reg_statuses) |
|
148 | 148 | ) { |
149 | 149 | // cancelled or declined registration |
150 | 150 | $registration_processor->update_registration_after_being_canceled_or_declined( |
@@ -157,24 +157,24 @@ discard block |
||
157 | 157 | false |
158 | 158 | ); |
159 | 159 | } else if ( |
160 | - in_array( $old_STS_ID, $closed_reg_statuses ) |
|
161 | - && ! in_array( $new_STS_ID, $closed_reg_statuses ) |
|
160 | + in_array($old_STS_ID, $closed_reg_statuses) |
|
161 | + && ! in_array($new_STS_ID, $closed_reg_statuses) |
|
162 | 162 | ) { |
163 | 163 | // reinstating cancelled or declined registration |
164 | 164 | $registration_processor->update_canceled_or_declined_registration_after_being_reinstated( |
165 | 165 | $this, |
166 | 166 | $closed_reg_statuses |
167 | 167 | ); |
168 | - $transaction_processor->update_transaction_after_reinstating_canceled_registration( $this ); |
|
168 | + $transaction_processor->update_transaction_after_reinstating_canceled_registration($this); |
|
169 | 169 | } |
170 | - $transaction_payments->recalculate_transaction_total( $this->transaction(), false ); |
|
171 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->transaction(), true ); |
|
172 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
170 | + $transaction_payments->recalculate_transaction_total($this->transaction(), false); |
|
171 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->transaction(), true); |
|
172 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
173 | 173 | return TRUE; |
174 | 174 | } else { |
175 | 175 | //even though the old value matches the new value, it's still good to |
176 | 176 | //allow the parent set method to have a say |
177 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
177 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
178 | 178 | return TRUE; |
179 | 179 | } |
180 | 180 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @access public |
187 | 187 | */ |
188 | 188 | public function status_ID() { |
189 | - return $this->get( 'STS_ID' ); |
|
189 | + return $this->get('STS_ID'); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | * @param boolean $include_archived whether to include archived tickets or not. |
212 | 212 | * @return EE_Ticket |
213 | 213 | */ |
214 | - public function ticket( $include_archived = TRUE ) { |
|
214 | + public function ticket($include_archived = TRUE) { |
|
215 | 215 | $query_params = array(); |
216 | - if ( $include_archived ) { |
|
217 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
216 | + if ($include_archived) { |
|
217 | + $query_params['default_where_conditions'] = 'none'; |
|
218 | 218 | } |
219 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
219 | + return $this->get_first_related('Ticket', $query_params); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function wp_user() { |
246 | 246 | $event = $this->event(); |
247 | - if ( $event instanceof EE_Event ) { |
|
247 | + if ($event instanceof EE_Event) { |
|
248 | 248 | return $event->wp_user(); |
249 | 249 | } |
250 | 250 | return 0; |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @param int $ATT_ID Attendee ID |
272 | 272 | */ |
273 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
274 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
273 | + public function set_attendee_id($ATT_ID = 0) { |
|
274 | + $this->set('ATT_ID', $ATT_ID); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | * @access public |
283 | 283 | * @param int $TXN_ID Transaction ID |
284 | 284 | */ |
285 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
286 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
285 | + public function set_transaction_id($TXN_ID = 0) { |
|
286 | + $this->set('TXN_ID', $TXN_ID); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -294,8 +294,8 @@ discard block |
||
294 | 294 | * @access public |
295 | 295 | * @param string $REG_session PHP Session ID |
296 | 296 | */ |
297 | - public function set_session( $REG_session = '' ) { |
|
298 | - $this->set( 'REG_session', $REG_session ); |
|
297 | + public function set_session($REG_session = '') { |
|
298 | + $this->set('REG_session', $REG_session); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | * @access public |
307 | 307 | * @param string $REG_url_link Registration URL Link |
308 | 308 | */ |
309 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
310 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
309 | + public function set_reg_url_link($REG_url_link = '') { |
|
310 | + $this->set('REG_url_link', $REG_url_link); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * @access public |
319 | 319 | * @param int $REG_count Primary Attendee |
320 | 320 | */ |
321 | - public function set_count( $REG_count = 1 ) { |
|
322 | - $this->set( 'REG_count', $REG_count ); |
|
321 | + public function set_count($REG_count = 1) { |
|
322 | + $this->set('REG_count', $REG_count); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | * @access public |
331 | 331 | * @param boolean $REG_group_size Group Registration |
332 | 332 | */ |
333 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
334 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
333 | + public function set_group_size($REG_group_size = FALSE) { |
|
334 | + $this->set('REG_group_size', $REG_group_size); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | * @access public |
415 | 415 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
416 | 416 | */ |
417 | - public function set_reg_date( $REG_date = FALSE ) { |
|
418 | - $this->set( 'REG_date', $REG_date ); |
|
417 | + public function set_reg_date($REG_date = FALSE) { |
|
418 | + $this->set('REG_date', $REG_date); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | * @access public |
427 | 427 | * @param float $REG_final_price |
428 | 428 | */ |
429 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
430 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
429 | + public function set_final_price($REG_final_price = 0.00) { |
|
430 | + $this->set('REG_final_price', $REG_final_price); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | * @access public |
439 | 439 | * @param float $REG_paid |
440 | 440 | */ |
441 | - public function set_paid( $REG_paid = 0.00 ) { |
|
442 | - $this->set( 'REG_paid', $REG_paid ); |
|
441 | + public function set_paid($REG_paid = 0.00) { |
|
442 | + $this->set('REG_paid', $REG_paid); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | * @access public |
451 | 451 | * @param boolean $REG_att_is_going Attendee Is Going |
452 | 452 | */ |
453 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
454 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
453 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
454 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @return EE_Attendee |
462 | 462 | */ |
463 | 463 | public function attendee() { |
464 | - return $this->get_first_related( 'Attendee' ); |
|
464 | + return $this->get_first_related('Attendee'); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @access public |
472 | 472 | */ |
473 | 473 | public function event_ID() { |
474 | - return $this->get( 'EVT_ID' ); |
|
474 | + return $this->get('EVT_ID'); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | */ |
483 | 483 | public function event_name() { |
484 | 484 | $event = $this->event_obj(); |
485 | - if ( $event ) { |
|
485 | + if ($event) { |
|
486 | 486 | return $event->name(); |
487 | 487 | } else { |
488 | 488 | return NULL; |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return EE_Event |
497 | 497 | */ |
498 | 498 | public function event_obj() { |
499 | - return $this->get_first_related( 'Event' ); |
|
499 | + return $this->get_first_related('Event'); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @access public |
507 | 507 | */ |
508 | 508 | public function attendee_ID() { |
509 | - return $this->get( 'ATT_ID' ); |
|
509 | + return $this->get('ATT_ID'); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @access public |
517 | 517 | */ |
518 | 518 | public function session_ID() { |
519 | - return $this->get( 'REG_session' ); |
|
519 | + return $this->get('REG_session'); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
527 | 527 | * @return string |
528 | 528 | */ |
529 | - public function receipt_url( $messenger = 'html' ) { |
|
529 | + public function receipt_url($messenger = 'html') { |
|
530 | 530 | |
531 | 531 | /** |
532 | 532 | * The below will be deprecated one version after this. We check first if there is a custom receipt template already in use on old system. If there is then we just return the standard url for it. |
@@ -534,12 +534,12 @@ discard block |
||
534 | 534 | * @since 4.5.0 |
535 | 535 | */ |
536 | 536 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
537 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
537 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
538 | 538 | |
539 | - if ( $has_custom ) { |
|
540 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
539 | + if ($has_custom) { |
|
540 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
541 | 541 | } |
542 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
542 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -550,28 +550,28 @@ discard block |
||
550 | 550 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
551 | 551 | * @return string |
552 | 552 | */ |
553 | - public function invoice_url( $messenger = 'html' ) { |
|
553 | + public function invoice_url($messenger = 'html') { |
|
554 | 554 | /** |
555 | 555 | * The below will be deprecated one version after this. We check first if there is a custom invoice template already in use on old system. If there is then we just return the standard url for it. |
556 | 556 | * |
557 | 557 | * @since 4.5.0 |
558 | 558 | */ |
559 | 559 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
560 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
560 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
561 | 561 | |
562 | - if ( $has_custom ) { |
|
563 | - if ( $messenger == 'html' ) { |
|
564 | - return $this->invoice_url( 'launch' ); |
|
562 | + if ($has_custom) { |
|
563 | + if ($messenger == 'html') { |
|
564 | + return $this->invoice_url('launch'); |
|
565 | 565 | } |
566 | 566 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
567 | 567 | |
568 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
569 | - if ( $messenger == 'html' ) { |
|
568 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
569 | + if ($messenger == 'html') { |
|
570 | 570 | $query_args['html'] = TRUE; |
571 | 571 | } |
572 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
572 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
573 | 573 | } |
574 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
574 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | * @throws \EE_Error |
585 | 585 | */ |
586 | 586 | public function reg_url_link() { |
587 | - return (string)$this->get( 'REG_url_link' ); |
|
587 | + return (string) $this->get('REG_url_link'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
595 | 595 | * @return void |
596 | 596 | */ |
597 | - public function e_invoice_url( $type = 'launch' ) { |
|
598 | - echo $this->invoice_url( $type ); |
|
597 | + public function e_invoice_url($type = 'launch') { |
|
598 | + echo $this->invoice_url($type); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | * @return string |
616 | 616 | */ |
617 | 617 | public function payment_overview_url() { |
618 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
618 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @return string |
627 | 627 | */ |
628 | 628 | public function edit_attendee_information_url() { |
629 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
629 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | * @return string |
637 | 637 | */ |
638 | 638 | public function get_admin_edit_url() { |
639 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
639 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @access public |
647 | 647 | */ |
648 | 648 | public function is_primary_registrant() { |
649 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
649 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | * This returns the primary registration object for this registration group (which may be this object). |
656 | 656 | * @return EE_Registration |
657 | 657 | */ |
658 | - public function get_primary_registration() { |
|
659 | - if ( $this->is_primary_registrant() ) |
|
658 | + public function get_primary_registration() { |
|
659 | + if ($this->is_primary_registrant()) |
|
660 | 660 | return $this; |
661 | 661 | |
662 | 662 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
663 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
663 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
664 | 664 | return $primary_registrant; |
665 | 665 | } |
666 | 666 | |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | * @access public |
672 | 672 | */ |
673 | 673 | public function count() { |
674 | - return $this->get( 'REG_count' ); |
|
674 | + return $this->get('REG_count'); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @access public |
682 | 682 | */ |
683 | 683 | public function group_size() { |
684 | - return $this->get( 'REG_group_size' ); |
|
684 | + return $this->get('REG_group_size'); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * @access public |
692 | 692 | */ |
693 | 693 | public function date() { |
694 | - return $this->get( 'REG_date' ); |
|
694 | + return $this->get('REG_date'); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | |
@@ -702,8 +702,8 @@ discard block |
||
702 | 702 | * @param string $time_format |
703 | 703 | * @return string |
704 | 704 | */ |
705 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
706 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
705 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
706 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | * @return float |
717 | 717 | */ |
718 | 718 | public function final_price() { |
719 | - return $this->get( 'REG_final_price' ); |
|
719 | + return $this->get('REG_final_price'); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * @return string |
728 | 728 | */ |
729 | 729 | public function pretty_final_price() { |
730 | - return $this->get_pretty( 'REG_final_price' ); |
|
730 | + return $this->get_pretty('REG_final_price'); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * @return float |
739 | 739 | */ |
740 | 740 | public function paid() { |
741 | - return $this->get( 'REG_paid' ); |
|
741 | + return $this->get('REG_paid'); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | * @return float |
750 | 750 | */ |
751 | 751 | public function pretty_paid() { |
752 | - return $this->get_pretty( 'REG_paid' ); |
|
752 | + return $this->get_pretty('REG_paid'); |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | * @param array $requires_payment |
762 | 762 | * @return bool |
763 | 763 | */ |
764 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
764 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
765 | 765 | // these reg statuses require payment (if event is not free) |
766 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
766 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
767 | 767 | if ( |
768 | - in_array( $this->status_ID(), $requires_payment ) && |
|
768 | + in_array($this->status_ID(), $requires_payment) && |
|
769 | 769 | $this->final_price() != 0 && |
770 | 770 | $this->final_price() != $this->paid() |
771 | 771 | ) { |
@@ -782,8 +782,8 @@ discard block |
||
782 | 782 | * @param bool $show_icons |
783 | 783 | * @return void |
784 | 784 | */ |
785 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
786 | - echo $this->pretty_status( $show_icons ); |
|
785 | + public function e_pretty_status($show_icons = FALSE) { |
|
786 | + echo $this->pretty_status($show_icons); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | |
@@ -794,10 +794,10 @@ discard block |
||
794 | 794 | * @param bool $show_icons |
795 | 795 | * @return string |
796 | 796 | */ |
797 | - public function pretty_status( $show_icons = FALSE ) { |
|
798 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
797 | + public function pretty_status($show_icons = FALSE) { |
|
798 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
799 | 799 | $icon = ''; |
800 | - switch ( $this->status_ID() ) { |
|
800 | + switch ($this->status_ID()) { |
|
801 | 801 | case EEM_Registration::status_id_approved: |
802 | 802 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
803 | 803 | break; |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : ''; |
821 | 821 | break; |
822 | 822 | } |
823 | - return $icon . $status[ $this->status_ID() ]; |
|
823 | + return $icon.$status[$this->status_ID()]; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | * @access public |
831 | 831 | */ |
832 | 832 | public function att_is_going() { |
833 | - return $this->get( 'REG_att_is_going' ); |
|
833 | + return $this->get('REG_att_is_going'); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | |
@@ -840,8 +840,8 @@ discard block |
||
840 | 840 | * @param array $query_params like EEM_Base::get_all |
841 | 841 | * @return EE_Answer[] |
842 | 842 | */ |
843 | - public function answers( $query_params = NULL ) { |
|
844 | - return $this->get_many_related( 'Answer', $query_params ); |
|
843 | + public function answers($query_params = NULL) { |
|
844 | + return $this->get_many_related('Answer', $query_params); |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | |
@@ -855,9 +855,9 @@ discard block |
||
855 | 855 | * (because the answer might be an array of answer values, so passing pretty_value=true |
856 | 856 | * will convert it into some kind of string) |
857 | 857 | */ |
858 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
858 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
859 | 859 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
860 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
860 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
861 | 861 | } |
862 | 862 | |
863 | 863 | |
@@ -870,13 +870,13 @@ discard block |
||
870 | 870 | */ |
871 | 871 | public function question_groups() { |
872 | 872 | $question_groups = array(); |
873 | - if ( $this->event() instanceof EE_Event ) { |
|
873 | + if ($this->event() instanceof EE_Event) { |
|
874 | 874 | $question_groups = $this->event()->question_groups( |
875 | 875 | array( |
876 | 876 | array( |
877 | 877 | 'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false |
878 | 878 | ), |
879 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
879 | + 'order_by' => array('QSG_order' => 'ASC') |
|
880 | 880 | ) |
881 | 881 | ); |
882 | 882 | } |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | */ |
894 | 894 | public function count_question_groups() { |
895 | 895 | $qg_count = 0; |
896 | - if ( $this->event() instanceof EE_Event ) { |
|
896 | + if ($this->event() instanceof EE_Event) { |
|
897 | 897 | $qg_count = $this->event()->count_related( |
898 | 898 | 'Question_Group', |
899 | 899 | array( |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | * @return string |
915 | 915 | */ |
916 | 916 | public function reg_date() { |
917 | - return $this->get_datetime( 'REG_date' ); |
|
917 | + return $this->get_datetime('REG_date'); |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | * @return EE_Datetime_Ticket |
927 | 927 | */ |
928 | 928 | public function datetime_ticket() { |
929 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
929 | + return $this->get_first_related('Datetime_Ticket'); |
|
930 | 930 | } |
931 | 931 | |
932 | 932 | |
@@ -936,15 +936,15 @@ discard block |
||
936 | 936 | * @param EE_Datetime_Ticket $datetime_ticket |
937 | 937 | * @return EE_Datetime_Ticket |
938 | 938 | */ |
939 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
940 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
939 | + public function set_datetime_ticket($datetime_ticket) { |
|
940 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
941 | 941 | } |
942 | 942 | /** |
943 | 943 | * Gets deleted |
944 | 944 | * @return boolean |
945 | 945 | */ |
946 | 946 | public function deleted() { |
947 | - return $this->get( 'REG_deleted' ); |
|
947 | + return $this->get('REG_deleted'); |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | /** |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | * @return boolean |
954 | 954 | */ |
955 | 955 | public function set_deleted($deleted) { |
956 | - $this->set( 'REG_deleted', $deleted ); |
|
956 | + $this->set('REG_deleted', $deleted); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | * @return EE_Status |
964 | 964 | */ |
965 | 965 | public function status_obj() { |
966 | - return $this->get_first_related( 'Status' ); |
|
966 | + return $this->get_first_related('Status'); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * @return int |
975 | 975 | */ |
976 | 976 | public function count_checkins() { |
977 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
977 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | * @return int |
985 | 985 | */ |
986 | 986 | public function count_checkins_not_checkedout() { |
987 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
987 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | |
@@ -997,20 +997,20 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return bool |
999 | 999 | */ |
1000 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
1001 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
1000 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
1001 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
1002 | 1002 | |
1003 | 1003 | //first check registration status |
1004 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
1004 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
1005 | 1005 | return false; |
1006 | 1006 | } |
1007 | 1007 | //is there a datetime ticket that matches this dtt_ID? |
1008 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
1008 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
1009 | 1009 | return false; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | //final check is against TKT_uses |
1013 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
1013 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | |
@@ -1023,10 +1023,10 @@ discard block |
||
1023 | 1023 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
1024 | 1024 | * @return bool true means can checkin. false means cannot checkin. |
1025 | 1025 | */ |
1026 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
1027 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
1026 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
1027 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
1028 | 1028 | |
1029 | - if ( ! $DTT_ID ) { |
|
1029 | + if ( ! $DTT_ID) { |
|
1030 | 1030 | return false; |
1031 | 1031 | } |
1032 | 1032 | |
@@ -1034,23 +1034,23 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
1036 | 1036 | // or not. |
1037 | - if ( ! $max_uses || $max_uses === EE_INF ) { |
|
1037 | + if ( ! $max_uses || $max_uses === EE_INF) { |
|
1038 | 1038 | return true; |
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
1042 | 1042 | //go ahead and toggle. |
1043 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
1043 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
1044 | 1044 | return true; |
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
1048 | 1048 | //disallows further check-ins. |
1049 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
1049 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
1050 | 1050 | // checkins have already reached their max number of uses |
1051 | 1051 | // so registrant can NOT checkin |
1052 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
1053 | - EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1052 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
1053 | + EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1054 | 1054 | return false; |
1055 | 1055 | } |
1056 | 1056 | return true; |
@@ -1071,15 +1071,15 @@ discard block |
||
1071 | 1071 | * @param bool $verify If true then can_checkin() is used to verify whether the person can be checked in or not. Otherwise this forces change in checkin status. |
1072 | 1072 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
1073 | 1073 | */ |
1074 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
1075 | - if ( empty( $DTT_ID ) ) { |
|
1074 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
1075 | + if (empty($DTT_ID)) { |
|
1076 | 1076 | $datetime = $this->get_related_primary_datetime(); |
1077 | 1077 | $DTT_ID = $datetime->ID(); |
1078 | 1078 | // verify the registration can checkin for the given DTT_ID |
1079 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
1079 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
1080 | 1080 | EE_Error::add_error( |
1081 | 1081 | sprintf( |
1082 | - __( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1082 | + __('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1083 | 1083 | $this->ID(), |
1084 | 1084 | $DTT_ID |
1085 | 1085 | ), |
@@ -1093,8 +1093,8 @@ discard block |
||
1093 | 1093 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
1094 | 1094 | ); |
1095 | 1095 | //start by getting the current status so we know what status we'll be changing to. |
1096 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
1097 | - $status_to = $status_paths[ $cur_status ]; |
|
1096 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
1097 | + $status_to = $status_paths[$cur_status]; |
|
1098 | 1098 | // database only records true for checked IN or false for checked OUT |
1099 | 1099 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
1100 | 1100 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1102,24 +1102,24 @@ discard block |
||
1102 | 1102 | // because we are keeping track of Check-ins over time. |
1103 | 1103 | // Eventually we'll probably want to show a list table |
1104 | 1104 | // for the individual Check-ins so that they can be managed. |
1105 | - $checkin = EE_Checkin::new_instance( array( |
|
1105 | + $checkin = EE_Checkin::new_instance(array( |
|
1106 | 1106 | 'REG_ID' => $this->ID(), |
1107 | 1107 | 'DTT_ID' => $DTT_ID, |
1108 | 1108 | 'CHK_in' => $new_status |
1109 | - ) ); |
|
1109 | + )); |
|
1110 | 1110 | // if the record could not be saved then return false |
1111 | - if ( $checkin->save() === 0 ) { |
|
1112 | - if ( WP_DEBUG ) { |
|
1111 | + if ($checkin->save() === 0) { |
|
1112 | + if (WP_DEBUG) { |
|
1113 | 1113 | global $wpdb; |
1114 | 1114 | $error = sprintf( |
1115 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
1115 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
1116 | 1116 | '<br />', |
1117 | 1117 | $wpdb->last_error |
1118 | 1118 | ); |
1119 | 1119 | } else { |
1120 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
1120 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
1121 | 1121 | } |
1122 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
1122 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
1123 | 1123 | return false; |
1124 | 1124 | } |
1125 | 1125 | return $status_to; |
@@ -1143,19 +1143,19 @@ discard block |
||
1143 | 1143 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
1144 | 1144 | * @return int Integer representing Check-in status. |
1145 | 1145 | */ |
1146 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
1147 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
1146 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
1147 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
1148 | 1148 | $datetime = $this->get_related_primary_datetime(); |
1149 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1149 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1150 | 1150 | return 0; |
1151 | 1151 | } |
1152 | 1152 | $DTT_ID = $datetime->ID(); |
1153 | 1153 | //verify the registration can checkin for the given DTT_ID |
1154 | 1154 | } |
1155 | 1155 | //get checkin object (if exists) |
1156 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
1157 | - if ( $checkin instanceof EE_Checkin ) { |
|
1158 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
1156 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
1157 | + if ($checkin instanceof EE_Checkin) { |
|
1158 | + if ($checkin->get('CHK_in')) { |
|
1159 | 1159 | return EE_Registration::checkin_status_in; //checked in |
1160 | 1160 | } else { |
1161 | 1161 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1173,28 +1173,28 @@ discard block |
||
1173 | 1173 | * @param bool $error This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name. |
1174 | 1174 | * @return string internationalized message |
1175 | 1175 | */ |
1176 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
1176 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
1177 | 1177 | //let's get the attendee first so we can include the name of the attendee |
1178 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
1179 | - if ( $attendee instanceof EE_Attendee ) { |
|
1180 | - if ( $error ) { |
|
1181 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
1178 | + $attendee = $this->get_first_related('Attendee'); |
|
1179 | + if ($attendee instanceof EE_Attendee) { |
|
1180 | + if ($error) { |
|
1181 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
1182 | 1182 | } |
1183 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
1183 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
1184 | 1184 | //what is the status message going to be? |
1185 | - switch ( $cur_status ) { |
|
1185 | + switch ($cur_status) { |
|
1186 | 1186 | case EE_Registration::checkin_status_never : |
1187 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
1187 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
1188 | 1188 | break; |
1189 | 1189 | case EE_Registration::checkin_status_in : |
1190 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
1190 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
1191 | 1191 | break; |
1192 | 1192 | case EE_Registration::checkin_status_out : |
1193 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
1193 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
1194 | 1194 | break; |
1195 | 1195 | } |
1196 | 1196 | } |
1197 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
1197 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | * @access public |
1220 | 1220 | */ |
1221 | 1221 | public function reg_code() { |
1222 | - return $this->get( 'REG_code' ); |
|
1222 | + return $this->get('REG_code'); |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | * @access public |
1230 | 1230 | */ |
1231 | 1231 | public function transaction_ID() { |
1232 | - return $this->get( 'TXN_ID' ); |
|
1232 | + return $this->get('TXN_ID'); |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * @return int |
1239 | 1239 | */ |
1240 | 1240 | public function ticket_ID() { |
1241 | - return $this->get( 'TKT_ID' ); |
|
1241 | + return $this->get('TKT_ID'); |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | |
@@ -1250,17 +1250,17 @@ discard block |
||
1250 | 1250 | * @param string $REG_code Registration Code |
1251 | 1251 | * @param boolean $use_default |
1252 | 1252 | */ |
1253 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
1254 | - if ( empty( $REG_code )) { |
|
1255 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1253 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
1254 | + if (empty($REG_code)) { |
|
1255 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | return; |
1257 | 1257 | } |
1258 | - if ( ! $this->reg_code() ) { |
|
1259 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
1258 | + if ( ! $this->reg_code()) { |
|
1259 | + parent::set('REG_code', $REG_code, $use_default); |
|
1260 | 1260 | } else { |
1261 | 1261 | EE_Error::doing_it_wrong( |
1262 | - __CLASS__ . '::' . __FUNCTION__, |
|
1263 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
1262 | + __CLASS__.'::'.__FUNCTION__, |
|
1263 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
1264 | 1264 | '4.6.0' |
1265 | 1265 | ); |
1266 | 1266 | } |
@@ -1280,17 +1280,17 @@ discard block |
||
1280 | 1280 | * @return EE_Registration[] or empty array if this isn't a group registration. |
1281 | 1281 | */ |
1282 | 1282 | public function get_all_other_registrations_in_group() { |
1283 | - if ( $this->group_size() < 2 ) { |
|
1283 | + if ($this->group_size() < 2) { |
|
1284 | 1284 | return array(); |
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | $query[0] = array( |
1288 | 1288 | 'TXN_ID' => $this->transaction_ID(), |
1289 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
1289 | + 'REG_ID' => array('!=', $this->ID()), |
|
1290 | 1290 | 'TKT_ID' => $this->ticket_ID() |
1291 | 1291 | ); |
1292 | 1292 | |
1293 | - $registrations = $this->get_model()->get_all( $query ); |
|
1293 | + $registrations = $this->get_model()->get_all($query); |
|
1294 | 1294 | return $registrations; |
1295 | 1295 | } |
1296 | 1296 | |
@@ -1299,14 +1299,14 @@ discard block |
||
1299 | 1299 | * @return string |
1300 | 1300 | */ |
1301 | 1301 | public function get_admin_details_link() { |
1302 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
1302 | + EE_Registry::instance()->load_helper('URL'); |
|
1303 | 1303 | return EEH_URL::add_query_args_and_nonce( |
1304 | 1304 | array( |
1305 | 1305 | 'page' => 'espresso_registrations', |
1306 | 1306 | 'action' => 'view_registration', |
1307 | 1307 | '_REG_ID' => $this->ID() |
1308 | 1308 | ), |
1309 | - admin_url( 'admin.php' ) |
|
1309 | + admin_url('admin.php') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | |
@@ -1331,12 +1331,12 @@ discard block |
||
1331 | 1331 | * @return string |
1332 | 1332 | */ |
1333 | 1333 | public function get_admin_overview_link() { |
1334 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
1334 | + EE_Registry::instance()->load_helper('URL'); |
|
1335 | 1335 | return EEH_URL::add_query_args_and_nonce( |
1336 | 1336 | array( |
1337 | 1337 | 'page' => 'espresso_registrations' |
1338 | 1338 | ), |
1339 | - admin_url( 'admin.php' ) |
|
1339 | + admin_url('admin.php') |
|
1340 | 1340 | ); |
1341 | 1341 | } |
1342 | 1342 | |
@@ -1347,8 +1347,8 @@ discard block |
||
1347 | 1347 | * @return \EE_Registration[] |
1348 | 1348 | * @throws \EE_Error |
1349 | 1349 | */ |
1350 | - public function payments( $query_params = array() ) { |
|
1351 | - return $this->get_many_related( 'Payment', $query_params ); |
|
1350 | + public function payments($query_params = array()) { |
|
1351 | + return $this->get_many_related('Payment', $query_params); |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | |
@@ -1358,8 +1358,8 @@ discard block |
||
1358 | 1358 | * @return \EE_Registration_Payment[] |
1359 | 1359 | * @throws \EE_Error |
1360 | 1360 | */ |
1361 | - public function registration_payments( $query_params = array() ) { |
|
1362 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
1361 | + public function registration_payments($query_params = array()) { |
|
1362 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | * @return EE_Payment_Method|null |
1373 | 1373 | */ |
1374 | 1374 | public function payment_method() { |
1375 | - return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
|
1375 | + return EEM_Payment_Method::instance()->get_last_used_for_registration($this); |
|
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | /** |
951 | 951 | * Sets deleted |
952 | 952 | * @param boolean $deleted |
953 | - * @return boolean |
|
953 | + * @return boolean|null |
|
954 | 954 | */ |
955 | 955 | public function set_deleted($deleted) { |
956 | 956 | $this->set( 'REG_deleted', $deleted ); |
@@ -994,6 +994,7 @@ discard block |
||
994 | 994 | * |
995 | 995 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
996 | 996 | * @param bool $check_approved This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access. |
997 | + * @param integer $DTT_OR_ID |
|
997 | 998 | * |
998 | 999 | * @return bool |
999 | 1000 | */ |
@@ -1369,7 +1370,7 @@ discard block |
||
1369 | 1370 | * This grabs the payment method corresponding to the last payment made for the amount owing on the registration. |
1370 | 1371 | * Note: if there are no payments on the registration there will be no payment method returned. |
1371 | 1372 | * |
1372 | - * @return EE_Payment_Method|null |
|
1373 | + * @return null|EE_Base_Class |
|
1373 | 1374 | */ |
1374 | 1375 | public function payment_method() { |
1375 | 1376 | return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
@@ -18,10 +18,10 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Specific_Registrations_Line_Item_Filter extends EE_Line_Item_Filter_Base { |
20 | 20 | /** |
21 | - * array of line item codes and their corresponding quantities for registrations |
|
22 | - * |
|
21 | + * array of line item codes and their corresponding quantities for registrations |
|
22 | + * |
|
23 | 23 | *@type array $_line_item_registrations |
24 | - */ |
|
24 | + */ |
|
25 | 25 | protected $_line_item_registrations = array(); |
26 | 26 | |
27 | 27 | /** |
@@ -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 | /** |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * EE_Billable_Line_Item_Filter constructor. |
43 | 43 | * @param EE_Registration[] $registrations |
44 | 44 | */ |
45 | - public function __construct( $registrations ) { |
|
45 | + public function __construct($registrations) { |
|
46 | 46 | $this->_registrations = $registrations; |
47 | - $this->_calculate_registrations_per_line_item_code( $registrations ); |
|
47 | + $this->_calculate_registrations_per_line_item_code($registrations); |
|
48 | 48 | // these reg statuses should NOT increment the line item quantity |
49 | 49 | $this->_closed_reg_statuses = EEM_Registration::closed_reg_statuses(); |
50 | 50 | } |
@@ -55,20 +55,20 @@ discard block |
||
55 | 55 | * @param EE_Registration[] $registrations |
56 | 56 | * @return void |
57 | 57 | */ |
58 | - protected function _calculate_registrations_per_line_item_code( $registrations ) { |
|
59 | - foreach( $registrations as $registration ) { |
|
58 | + protected function _calculate_registrations_per_line_item_code($registrations) { |
|
59 | + foreach ($registrations as $registration) { |
|
60 | 60 | $line_item_code = EEM_Line_Item::instance()->get_var( |
61 | 61 | EEM_Line_Item::instance()->line_item_for_registration_query_params( |
62 | 62 | $registration, |
63 | - array( 'limit' => 1 ) |
|
63 | + array('limit' => 1) |
|
64 | 64 | ), |
65 | 65 | 'LIN_code' |
66 | 66 | ); |
67 | - if( $line_item_code ) { |
|
68 | - if( ! isset( $this->_line_item_registrations[ $line_item_code ] ) ) { |
|
69 | - $this->_line_item_registrations[ $line_item_code ] = array(); |
|
67 | + if ($line_item_code) { |
|
68 | + if ( ! isset($this->_line_item_registrations[$line_item_code])) { |
|
69 | + $this->_line_item_registrations[$line_item_code] = array(); |
|
70 | 70 | } |
71 | - $this->_line_item_registrations[ $line_item_code ][ $registration->ID() ] = $registration; |
|
71 | + $this->_line_item_registrations[$line_item_code][$registration->ID()] = $registration; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
@@ -81,61 +81,61 @@ discard block |
||
81 | 81 | * @param EEI_Line_Item $line_item |
82 | 82 | * @return \EEI_Line_Item |
83 | 83 | */ |
84 | - public function process( EEI_Line_Item $line_item ) { |
|
85 | - $this->_adjust_line_item_quantity( $line_item ); |
|
86 | - if( ! $line_item->children() ) { |
|
84 | + public function process(EEI_Line_Item $line_item) { |
|
85 | + $this->_adjust_line_item_quantity($line_item); |
|
86 | + if ( ! $line_item->children()) { |
|
87 | 87 | return $line_item; |
88 | 88 | } |
89 | 89 | //the original running total (taking ALL tickets into account) |
90 | 90 | $running_total_of_children = 0; |
91 | 91 | //the new running total (only taking the specified ticket quantities into account) |
92 | 92 | $running_total_of_children_under_consideration = 0; |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - if( $child_line_item->is_percent() ) { |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + if ($child_line_item->is_percent()) { |
|
95 | 95 | $original_li_total = $running_total_of_children * $child_line_item->percent() / 100; |
96 | - }else{ |
|
96 | + } else { |
|
97 | 97 | $original_li_total = $child_line_item->unit_price() * $child_line_item->quantity(); |
98 | 98 | } |
99 | 99 | |
100 | - $this->process( $child_line_item ); |
|
100 | + $this->process($child_line_item); |
|
101 | 101 | /* |
102 | 102 | * If this line item is a normal line item that isn't for a ticket |
103 | 103 | * we want to modify its total (and unit price if not a percentage line item) |
104 | 104 | * so it reflects only that portion of the surcharge/discount shared by these |
105 | 105 | * registrations |
106 | 106 | */ |
107 | - if( |
|
107 | + if ( |
|
108 | 108 | $child_line_item->type() === EEM_Line_Item::type_line_item |
109 | 109 | && $child_line_item->OBJ_type() !== 'Ticket' |
110 | 110 | ) { |
111 | - if( $running_total_of_children ) { |
|
111 | + if ($running_total_of_children) { |
|
112 | 112 | $percent_of_running_total = $original_li_total / $running_total_of_children; |
113 | 113 | } else { |
114 | 114 | $percent_of_running_total = 0; |
115 | 115 | } |
116 | 116 | |
117 | - $child_line_item->set_total( $running_total_of_children_under_consideration * $percent_of_running_total ); |
|
118 | - if( ! $child_line_item->is_percent() ) { |
|
119 | - $child_line_item->set_unit_price( $child_line_item->total() / $child_line_item->quantity() ); |
|
117 | + $child_line_item->set_total($running_total_of_children_under_consideration * $percent_of_running_total); |
|
118 | + if ( ! $child_line_item->is_percent()) { |
|
119 | + $child_line_item->set_unit_price($child_line_item->total() / $child_line_item->quantity()); |
|
120 | 120 | } |
121 | 121 | } else if ( |
122 | 122 | $line_item->type() === EEM_Line_Item::type_line_item |
123 | 123 | && $line_item->OBJ_type() === 'Ticket' |
124 | 124 | ) { |
125 | 125 | //make sure this item's quantity matches its parent |
126 | - if( ! $child_line_item->is_percent() ) { |
|
127 | - $child_line_item->set_quantity( $line_item->quantity() ); |
|
128 | - $child_line_item->set_total( $child_line_item->unit_price() * $child_line_item->quantity() ); |
|
126 | + if ( ! $child_line_item->is_percent()) { |
|
127 | + $child_line_item->set_quantity($line_item->quantity()); |
|
128 | + $child_line_item->set_total($child_line_item->unit_price() * $child_line_item->quantity()); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | $running_total_of_children += $original_li_total; |
132 | 132 | $running_total_of_children_under_consideration += $child_line_item->total(); |
133 | 133 | } |
134 | - $line_item->set_total( $running_total_of_children_under_consideration ); |
|
135 | - if( $line_item->quantity() ) { |
|
136 | - $line_item->set_unit_price( $running_total_of_children_under_consideration / $line_item->quantity() ); |
|
134 | + $line_item->set_total($running_total_of_children_under_consideration); |
|
135 | + if ($line_item->quantity()) { |
|
136 | + $line_item->set_unit_price($running_total_of_children_under_consideration / $line_item->quantity()); |
|
137 | 137 | } else { |
138 | - $line_item->set_unit_price( 0 ); |
|
138 | + $line_item->set_unit_price(0); |
|
139 | 139 | } |
140 | 140 | return $line_item; |
141 | 141 | } |
@@ -148,27 +148,27 @@ discard block |
||
148 | 148 | * @param EEI_Line_Item $line_item |
149 | 149 | * @return EEI_Line_Item |
150 | 150 | */ |
151 | - protected function _adjust_line_item_quantity( EEI_Line_Item $line_item ) { |
|
151 | + protected function _adjust_line_item_quantity(EEI_Line_Item $line_item) { |
|
152 | 152 | // is this a ticket ? |
153 | - if ( $line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket' ) { |
|
153 | + if ($line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket') { |
|
154 | 154 | $quantity = 0; |
155 | 155 | // if this ticket is billable at this moment, then we should have a positive quantity |
156 | 156 | if ( |
157 | - isset( $this->_line_item_registrations[ $line_item->code() ] ) |
|
158 | - && is_array( $this->_line_item_registrations[ $line_item->code() ] ) |
|
157 | + isset($this->_line_item_registrations[$line_item->code()]) |
|
158 | + && is_array($this->_line_item_registrations[$line_item->code()]) |
|
159 | 159 | ) { |
160 | 160 | // set quantity based on number of open registrations for this ticket |
161 | - foreach ( $this->_line_item_registrations[ $line_item->code() ] as $registration ) { |
|
161 | + foreach ($this->_line_item_registrations[$line_item->code()] as $registration) { |
|
162 | 162 | if ( |
163 | 163 | $registration instanceof EE_Registration |
164 | - && ! in_array( $registration->status_ID(), $this->_closed_reg_statuses ) |
|
164 | + && ! in_array($registration->status_ID(), $this->_closed_reg_statuses) |
|
165 | 165 | ) { |
166 | 166 | $quantity++; |
167 | 167 | } |
168 | 168 | } |
169 | 169 | } |
170 | - $line_item->set_quantity( $quantity ); |
|
171 | - $line_item->set_total( $line_item->unit_price() * $line_item->quantity() ); |
|
170 | + $line_item->set_quantity($quantity); |
|
171 | + $line_item->set_total($line_item->unit_price() * $line_item->quantity()); |
|
172 | 172 | } |
173 | 173 | return $line_item; |
174 | 174 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | if( $normalized_value ){ |
34 | 34 | if (filter_var($normalized_value, FILTER_VALIDATE_URL) === false){ |
35 | 35 | throw new EE_Validation_Error( $this->get_validation_error_message(), 'invalid_url'); |
36 | - }else{ |
|
36 | + } else{ |
|
37 | 37 | EE_Registry::instance()->load_helper('URL'); |
38 | 38 | if( ! EEH_URL::remote_file_exists( |
39 | 39 | $normalized_value, |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEG_Paypal_Pro extends EE_Onsite_Gateway{ |
|
28 | +class EEG_Paypal_Pro extends EE_Onsite_Gateway { |
|
29 | 29 | /** |
30 | 30 | * |
31 | 31 | * @var $_paypal_api_username string |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | * } @see parent::do_direct_payment for more info |
89 | 89 | * @return \EE_Payment|\EEI_Payment |
90 | 90 | */ |
91 | - public function do_direct_payment($payment,$billing_info = null){ |
|
91 | + public function do_direct_payment($payment, $billing_info = null) { |
|
92 | 92 | $transaction = $payment->transaction(); |
93 | 93 | $primary_registrant = $transaction->primary_registration(); |
94 | - $order_description = sprintf(__("Event Registrations from %s", "event_espresso"),get_bloginfo('name')); |
|
94 | + $order_description = sprintf(__("Event Registrations from %s", "event_espresso"), get_bloginfo('name')); |
|
95 | 95 | //charge for the full amount. Show itemized list |
96 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
96 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
97 | 97 | $item_num = 1; |
98 | 98 | $total_line_item = $transaction->total_line_item(); |
99 | 99 | $order_items = array(); |
100 | 100 | foreach ($total_line_item->get_items() as $line_item) { |
101 | 101 | //ignore line items with a quantity of 0 |
102 | - if( $line_item->quantity() == 0 ) { |
|
102 | + if ($line_item->quantity() == 0) { |
|
103 | 103 | continue; |
104 | 104 | } |
105 | 105 | $item = array( |
106 | 106 | // Item Name. 127 char max. |
107 | - 'l_name' => substr($line_item->name(),0,127), |
|
107 | + 'l_name' => substr($line_item->name(), 0, 127), |
|
108 | 108 | // Item description. 127 char max. |
109 | - 'l_desc' => substr($line_item->desc(),0,127), |
|
109 | + 'l_desc' => substr($line_item->desc(), 0, 127), |
|
110 | 110 | // Cost of individual item. |
111 | 111 | 'l_amt' => $line_item->unit_price(), |
112 | 112 | // Item Number. 127 char max. |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | } |
128 | 128 | $item_amount = $total_line_item->get_items_total(); |
129 | 129 | $tax_amount = $total_line_item->get_total_tax(); |
130 | - }else{ |
|
130 | + } else { |
|
131 | 131 | $order_items = array(); |
132 | 132 | $item_amount = $payment->amount(); |
133 | - $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
133 | + $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
134 | 134 | $tax_amount = 0; |
135 | - array_push($order_items,array( |
|
135 | + array_push($order_items, array( |
|
136 | 136 | // Item Name. 127 char max. |
137 | - 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()), |
|
137 | + 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()), |
|
138 | 138 | // Item description. 127 char max. |
139 | 139 | 'l_desc' => $single_item_desc, |
140 | 140 | // Cost of individual item. |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | // Payer's salutation. 20 char max. |
182 | 182 | 'salutation' => '', |
183 | 183 | // Payer's first name. 25 char max. |
184 | - 'firstname' => substr($billing_info['first_name'],0,25), |
|
184 | + 'firstname' => substr($billing_info['first_name'], 0, 25), |
|
185 | 185 | // Payer's middle name. 25 char max. |
186 | 186 | 'middlename' => '', |
187 | 187 | // Payer's last name. 25 char max. |
188 | - 'lastname' => substr($billing_info['last_name'],0,25), |
|
188 | + 'lastname' => substr($billing_info['last_name'], 0, 25), |
|
189 | 189 | // Payer's suffix. 12 char max. |
190 | 190 | 'suffix' => '' |
191 | 191 | ); |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | // Required. Name of City. |
199 | 199 | 'city' => $billing_info['city'], |
200 | 200 | // Required. Name of State or Province. |
201 | - 'state' => substr( $billing_info['state'], 0, 40 ), |
|
201 | + 'state' => substr($billing_info['state'], 0, 40), |
|
202 | 202 | // Required. Country code. |
203 | 203 | 'countrycode' => $billing_info['country'], |
204 | 204 | // Required. Postal code of payer. |
205 | 205 | 'zip' => $billing_info['zip'], |
206 | 206 | // Phone Number of payer. 20 char max. |
207 | - 'shiptophonenum' => substr($billing_info['phone'],0,20) |
|
207 | + 'shiptophonenum' => substr($billing_info['phone'], 0, 20) |
|
208 | 208 | ); |
209 | 209 | |
210 | 210 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | // Required. Three-letter currency code. Default is USD. |
215 | 215 | 'currencycode' => $payment->currency_code(), |
216 | 216 | // Required if you include itemized cart details. (L_AMTn, etc.) Subtotal of items not including S&H, or tax. |
217 | - 'itemamt' => $this->format_currency($item_amount),// |
|
217 | + 'itemamt' => $this->format_currency($item_amount), // |
|
218 | 218 | // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt. |
219 | 219 | 'shippingamt' => '', |
220 | 220 | // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | // Free-form field for your own use. 256 char max. |
227 | 227 | 'custom' => $primary_registrant ? $primary_registrant->ID() : '', |
228 | 228 | // Your own invoice or tracking number |
229 | - 'invnum' => wp_generate_password(12,false),//$transaction->ID(), |
|
229 | + 'invnum' => wp_generate_password(12, false), //$transaction->ID(), |
|
230 | 230 | // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use. |
231 | 231 | 'notifyurl' => '', |
232 | - 'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this |
|
232 | + 'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this |
|
233 | 233 | ); |
234 | 234 | // Wrap all data arrays into a single, "master" array which will be passed into the class function. |
235 | 235 | $PayPalRequestData = array( |
@@ -242,32 +242,32 @@ discard block |
||
242 | 242 | 'OrderItems' => $order_items, |
243 | 243 | ); |
244 | 244 | $this->_log_clean_request($PayPalRequestData, $payment); |
245 | - try{ |
|
245 | + try { |
|
246 | 246 | $PayPalResult = $this->prep_and_curl_request($PayPalRequestData); |
247 | 247 | //remove PCI-sensitive data so it doesn't get stored |
248 | - $PayPalResult = $this->_log_clean_response($PayPalResult,$payment); |
|
248 | + $PayPalResult = $this->_log_clean_response($PayPalResult, $payment); |
|
249 | 249 | |
250 | 250 | $message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK']; |
251 | - if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) { |
|
252 | - $payment->set_status( $this->_pay_model->failed_status() ) ; |
|
253 | - $payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) ); |
|
251 | + if (empty($PayPalResult['RAWRESPONSE'])) { |
|
252 | + $payment->set_status($this->_pay_model->failed_status()); |
|
253 | + $payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso')); |
|
254 | 254 | $payment->set_details($PayPalResult); |
255 | - }else{ |
|
256 | - if($this->_APICallSuccessful($PayPalResult)){ |
|
255 | + } else { |
|
256 | + if ($this->_APICallSuccessful($PayPalResult)) { |
|
257 | 257 | $payment->set_status($this->_pay_model->approved_status()); |
258 | - }else{ |
|
258 | + } else { |
|
259 | 259 | $payment->set_status($this->_pay_model->declined_status()); |
260 | 260 | } |
261 | 261 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators) |
262 | - $payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0); |
|
262 | + $payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0); |
|
263 | 263 | $payment->set_gateway_response($message); |
264 | - $payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null); |
|
264 | + $payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null); |
|
265 | 265 | |
266 | 266 | $primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : ''; |
267 | 267 | $payment->set_extra_accntng($primary_registration_code); |
268 | 268 | $payment->set_details($PayPalResult); |
269 | 269 | } |
270 | - }catch(Exception $e){ |
|
270 | + } catch (Exception $e) { |
|
271 | 271 | $payment->set_status($this->_pay_model->failed_status()); |
272 | 272 | $payment->set_gateway_response($e->getMessage()); |
273 | 273 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @param EEI_Payment $payment |
285 | 285 | * @return array |
286 | 286 | */ |
287 | - private function _log_clean_request($request,$payment){ |
|
287 | + private function _log_clean_request($request, $payment) { |
|
288 | 288 | $cleaned_request_data = $request; |
289 | 289 | unset($cleaned_request_data['CCDetails']['acct']); |
290 | 290 | unset($cleaned_request_data['CCDetails']['cvv2']); |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | * @param EEI_Payment $payment |
301 | 301 | * @return array cleaned |
302 | 302 | */ |
303 | - private function _log_clean_response($response,$payment){ |
|
303 | + private function _log_clean_response($response, $payment) { |
|
304 | 304 | unset($response['REQUESTDATA']['CREDITCARDTYPE']); |
305 | 305 | unset($response['REQUESTDATA']['ACCT']); |
306 | 306 | unset($response['REQUESTDATA']['EXPDATE']); |
307 | 307 | unset($response['REQUESTDATA']['CVV2']); |
308 | 308 | unset($response['RAWREQUEST']); |
309 | - $this->log(array('Paypal Response'=>$response),$payment); |
|
309 | + $this->log(array('Paypal Response'=>$response), $payment); |
|
310 | 310 | return $response; |
311 | 311 | } |
312 | 312 | |
@@ -331,32 +331,32 @@ discard block |
||
331 | 331 | // DP Fields |
332 | 332 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
333 | 333 | foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
334 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
334 | + $DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal); |
|
335 | 335 | |
336 | 336 | // CC Details Fields |
337 | 337 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
338 | 338 | foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
339 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
339 | + $CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal); |
|
340 | 340 | |
341 | 341 | // PayerInfo Type Fields |
342 | 342 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
343 | 343 | foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
344 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
344 | + $PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal); |
|
345 | 345 | |
346 | 346 | // Payer Name Fields |
347 | 347 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
348 | 348 | foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
349 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
349 | + $PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal); |
|
350 | 350 | |
351 | 351 | // Address Fields (Billing) |
352 | 352 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
353 | 353 | foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
354 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
354 | + $BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal); |
|
355 | 355 | |
356 | 356 | // Payment Details Type Fields |
357 | 357 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
358 | 358 | foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
359 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
359 | + $PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal); |
|
360 | 360 | |
361 | 361 | // Payment Details Item Type Fields |
362 | 362 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
@@ -364,22 +364,22 @@ discard block |
||
364 | 364 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
365 | 365 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
366 | 366 | foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
367 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
367 | + $OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal); |
|
368 | 368 | $n++; |
369 | 369 | } |
370 | 370 | |
371 | 371 | // Ship To Address Fields |
372 | 372 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
373 | 373 | foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
374 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
374 | + $ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal); |
|
375 | 375 | |
376 | 376 | // 3D Secure Fields |
377 | 377 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
378 | 378 | foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
379 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
379 | + $Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal); |
|
380 | 380 | |
381 | 381 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
382 | - $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
|
382 | + $NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP; |
|
383 | 383 | $NVPResponse = $this->_CURLRequest($NVPRequest); |
384 | 384 | $NVPRequestArray = $this->_NVPToArray($NVPRequest); |
385 | 385 | $NVPResponseArray = $this->_NVPToArray($NVPResponse); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | private function _CURLRequest($Request) { |
404 | 404 | $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; |
405 | 405 | $curl = curl_init(); |
406 | - curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) ); |
|
406 | + curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE)); |
|
407 | 407 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); |
408 | 408 | curl_setopt($curl, CURLOPT_TIMEOUT, 60); |
409 | 409 | curl_setopt($curl, CURLOPT_URL, $EndPointURL); |
@@ -453,9 +453,9 @@ discard block |
||
453 | 453 | private function _APICallSuccessful($PayPalResult) { |
454 | 454 | $approved = false; |
455 | 455 | // check main response message from PayPal |
456 | - if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) { |
|
456 | + if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) { |
|
457 | 457 | $ack = strtoupper($PayPalResult['ACK']); |
458 | - $approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false; |
|
458 | + $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | return $approved; |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | |
472 | 472 | $Errors = array(); |
473 | 473 | $n = 0; |
474 | - while (isset($DataArray['L_ERRORCODE' . $n . ''])) { |
|
475 | - $LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : ''; |
|
476 | - $LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : ''; |
|
477 | - $LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : ''; |
|
478 | - $LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : ''; |
|
474 | + while (isset($DataArray['L_ERRORCODE'.$n.''])) { |
|
475 | + $LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : ''; |
|
476 | + $LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : ''; |
|
477 | + $LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : ''; |
|
478 | + $LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : ''; |
|
479 | 479 | |
480 | 480 | $CurrentItem = array( |
481 | 481 | 'L_ERRORCODE' => $LErrorCode, |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
516 | 516 | $CurrentVarName = 'Severity Code'; |
517 | 517 | |
518 | - $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
518 | + $error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal; |
|
519 | 519 | } |
520 | 520 | } |
521 | 521 | return $error; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEG_Aim extends EE_Onsite_Gateway{ |
|
28 | +class EEG_Aim extends EE_Onsite_Gateway { |
|
29 | 29 | |
30 | 30 | const LIVE_URL = 'https://secure2.authorize.net/gateway/transact.dll'; //Authnet URL |
31 | 31 | |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | * @param EEG_Aim $gateway_object |
158 | 158 | * @return string |
159 | 159 | */ |
160 | - public function possibly_use_deprecated_aim_server( $url, EEG_Aim $gateway_object ) { |
|
161 | - if( $gateway_object->_server === 'authorize.net' |
|
162 | - && ! $gateway_object->_debug_mode ) { |
|
160 | + public function possibly_use_deprecated_aim_server($url, EEG_Aim $gateway_object) { |
|
161 | + if ($gateway_object->_server === 'authorize.net' |
|
162 | + && ! $gateway_object->_debug_mode) { |
|
163 | 163 | return 'https://secure.authorize.net/gateway/transact.dll'; |
164 | 164 | } else { |
165 | 165 | return $url; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | |
184 | 184 | public function do_direct_payment($payment, $billing_info = null) { |
185 | - add_filter( 'FHEE__EEG_Aim___get_server_url', array( $this, 'possibly_use_deprecated_aim_server' ), 10, 2 ); |
|
185 | + add_filter('FHEE__EEG_Aim___get_server_url', array($this, 'possibly_use_deprecated_aim_server'), 10, 2); |
|
186 | 186 | // Enable test mode if needed |
187 | 187 | //4007000000027 <-- test successful visa |
188 | 188 | //4222222222222 <-- test failure card number |
@@ -193,21 +193,21 @@ discard block |
||
193 | 193 | $primary_registrant = $transaction->primary_registration(); |
194 | 194 | //if we're are charging for the full amount, show the normal line items |
195 | 195 | //and the itemized total adds up properly |
196 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
196 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
197 | 197 | $total_line_item = $transaction->total_line_item(); |
198 | 198 | foreach ($total_line_item->get_items() as $line_item) { |
199 | 199 | //ignore line items with a quantity of 0 |
200 | - if( $line_item->quantity() == 0 ){ |
|
200 | + if ($line_item->quantity() == 0) { |
|
201 | 201 | continue; |
202 | 202 | } |
203 | 203 | $this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N'); |
204 | 204 | $order_description .= $line_item->desc().', '; |
205 | 205 | } |
206 | - foreach($total_line_item->tax_descendants() as $tax_line_item){ |
|
206 | + foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
207 | 207 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
208 | 208 | } |
209 | - }else{//partial payment |
|
210 | - $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
209 | + } else {//partial payment |
|
210 | + $order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -216,18 +216,18 @@ discard block |
||
216 | 216 | //start transaction |
217 | 217 | //if in debug mode, use authorize.net's sandbox id; otherwise use the Event Espresso partner id |
218 | 218 | $partner_id = $this->_debug_mode ? 'AAA100302' : 'AAA105363'; |
219 | - $this->setField( 'solution_id', $partner_id ); |
|
219 | + $this->setField('solution_id', $partner_id); |
|
220 | 220 | $this->setField('amount', $this->format_currency($payment->amount())); |
221 | - $this->setField('description',substr(rtrim($order_description, ', '), 0, 255)); |
|
222 | - $this->_set_sensitive_billing_data( $billing_info ); |
|
221 | + $this->setField('description', substr(rtrim($order_description, ', '), 0, 255)); |
|
222 | + $this->_set_sensitive_billing_data($billing_info); |
|
223 | 223 | $this->setField('first_name', $billing_info['first_name']); |
224 | 224 | $this->setField('last_name', $billing_info['last_name']); |
225 | 225 | $this->setField('email', $billing_info['email']); |
226 | 226 | $this->setField('company', $billing_info['company']); |
227 | 227 | $this->setField('address', $billing_info['address'].' '.$billing_info['address2']); |
228 | 228 | $this->setField('city', $billing_info['city']); |
229 | - $this->setField('state', $billing_info['state'] ); |
|
230 | - $this->setField('country', $billing_info['country'] ); |
|
229 | + $this->setField('state', $billing_info['state']); |
|
230 | + $this->setField('country', $billing_info['country']); |
|
231 | 231 | $this->setField('zip', $billing_info['zip']); |
232 | 232 | $this->setField('fax', $billing_info['fax']); |
233 | 233 | $this->setField('cust_id', $primary_registrant->ID()); |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | //invoice_num would be nice to have it be unique per SPCO page-load, that way if users |
236 | 236 | //press back, they don't submit a duplicate. However, we may be keeping the user on teh same spco page |
237 | 237 | //in which case, we need to generate teh invoice num per request right here... |
238 | - $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
238 | + $this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
239 | 239 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
240 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
240 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS); |
|
241 | 241 | |
242 | 242 | |
243 | 243 | if ($this->_test_transactions) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | //Capture response |
248 | 248 | $this->type = "AUTH_CAPTURE"; |
249 | 249 | $response = $this->_sendRequest($payment); |
250 | - if (!empty($response)){ |
|
250 | + if ( ! empty($response)) { |
|
251 | 251 | if ($this->_debug_mode) { |
252 | 252 | $txn_id = $response->invoice_number; |
253 | 253 | } else { |
@@ -256,15 +256,15 @@ discard block |
||
256 | 256 | $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status(); |
257 | 257 | $payment->set_status($payment_status); |
258 | 258 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators) |
259 | - $payment->set_amount( (float) $response->amount ); |
|
260 | - $payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code)); |
|
261 | - $payment->set_txn_id_chq_nmbr( $txn_id ); |
|
259 | + $payment->set_amount((float) $response->amount); |
|
260 | + $payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code)); |
|
261 | + $payment->set_txn_id_chq_nmbr($txn_id); |
|
262 | 262 | $payment->set_extra_accntng($primary_registrant->reg_code()); |
263 | - $payment->set_details(print_r($response,true)); |
|
263 | + $payment->set_details(print_r($response, true)); |
|
264 | 264 | } else { |
265 | 265 | $payment->set_status($this->_pay_model->failed_status()); |
266 | 266 | $payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso')); |
267 | - $payment->set_details(print_r($response,true)); |
|
267 | + $payment->set_details(print_r($response, true)); |
|
268 | 268 | } |
269 | 269 | return $payment; |
270 | 270 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * what billing data gets sent |
276 | 276 | * @param array $billing_info |
277 | 277 | */ |
278 | - protected function _set_sensitive_billing_data( $billing_info ) { |
|
278 | + protected function _set_sensitive_billing_data($billing_info) { |
|
279 | 279 | $this->setField('card_num', $billing_info['credit_card']); |
280 | 280 | $this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']); |
281 | 281 | $this->setField('card_code', $billing_info['cvv']); |
@@ -334,22 +334,22 @@ discard block |
||
334 | 334 | $this->_x_post_fields['tran_key'] = $this->_transaction_key; |
335 | 335 | $x_keys = array(); |
336 | 336 | foreach ($this->_x_post_fields as $key => $value) { |
337 | - $x_keys[] = "x_$key=" . urlencode($value); |
|
337 | + $x_keys[] = "x_$key=".urlencode($value); |
|
338 | 338 | } |
339 | 339 | // Add line items |
340 | 340 | foreach ($this->_additional_line_items as $key => $value) { |
341 | - $x_keys[] = "x_line_item=" . urlencode($value); |
|
341 | + $x_keys[] = "x_line_item=".urlencode($value); |
|
342 | 342 | } |
343 | 343 | $this->_log_clean_request($x_keys, $payment); |
344 | 344 | $post_url = $this->_get_server_url(); |
345 | 345 | $curl_request = curl_init($post_url); |
346 | - curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys)); |
|
346 | + curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys)); |
|
347 | 347 | curl_setopt($curl_request, CURLOPT_HEADER, 0); |
348 | 348 | curl_setopt($curl_request, CURLOPT_TIMEOUT, 45); |
349 | 349 | curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); |
350 | 350 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2); |
351 | 351 | if ($this->VERIFY_PEER) { |
352 | - curl_setopt($curl_request, CURLOPT_CAINFO, dirname( __DIR__ ) . '/ssl/cert.pem'); |
|
352 | + curl_setopt($curl_request, CURLOPT_CAINFO, dirname(__DIR__).'/ssl/cert.pem'); |
|
353 | 353 | } else { |
354 | 354 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); |
355 | 355 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $response = curl_exec($curl_request); |
362 | 362 | |
363 | 363 | curl_close($curl_request); |
364 | - $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
364 | + $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
365 | 365 | |
366 | 366 | return $this->_log_and_clean_response($response_obj, $payment); |
367 | 367 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | * @param array $request_array |
371 | 371 | * @param EEI_Payment $payment |
372 | 372 | */ |
373 | - protected function _log_clean_request($request_array,$payment){ |
|
374 | - $keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' ); |
|
375 | - foreach($request_array as $index => $keyvaltogether ) { |
|
376 | - foreach( $keys_to_filter_out as $key ) { |
|
377 | - if( strpos( $keyvaltogether, $key ) === 0 ){ |
|
373 | + protected function _log_clean_request($request_array, $payment) { |
|
374 | + $keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date'); |
|
375 | + foreach ($request_array as $index => $keyvaltogether) { |
|
376 | + foreach ($keys_to_filter_out as $key) { |
|
377 | + if (strpos($keyvaltogether, $key) === 0) { |
|
378 | 378 | //found it at the first character |
379 | 379 | //so its one of them |
380 | - unset( $request_array[ $index ] ); |
|
380 | + unset($request_array[$index]); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | } |
384 | - $this->log(array('AIM Request sent:'=>$request_array, 'Server URL' => $this->_get_server_url() ),$payment); |
|
384 | + $this->log(array('AIM Request sent:'=>$request_array, 'Server URL' => $this->_get_server_url()), $payment); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -393,9 +393,9 @@ discard block |
||
393 | 393 | * @param EE_Payment $payment |
394 | 394 | * @return \EE_AuthorizeNetAIM_Response |
395 | 395 | */ |
396 | - private function _log_and_clean_response($response_obj,$payment){ |
|
396 | + private function _log_and_clean_response($response_obj, $payment) { |
|
397 | 397 | $response_obj->account_number = ''; |
398 | - $this->log(array('AIM Response received:'=>$response_obj),$payment); |
|
398 | + $this->log(array('AIM Response received:'=>$response_obj), $payment); |
|
399 | 399 | return $response_obj; |
400 | 400 | } |
401 | 401 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | // Split Array |
495 | 495 | $this->response = $response; |
496 | 496 | if ($encap_char) { |
497 | - $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1)); |
|
497 | + $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1)); |
|
498 | 498 | } else { |
499 | 499 | $this->_response_array = explode($delimiter, $response); |
500 | 500 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $this->held = ($this->response_code === self::HELD); |
565 | 565 | |
566 | 566 | if ($this->error || $this->declined || $this->held) { |
567 | - $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
567 | + $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
568 | 568 | |
569 | 569 | |
570 | 570 | /* $this->error_message = "AuthorizeNet Error: |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | |
584 | 584 | } |
585 | 585 | |
586 | -if ( ! class_exists( 'AuthorizeNetException' ) ) { |
|
586 | +if ( ! class_exists('AuthorizeNetException')) { |
|
587 | 587 | /** |
588 | 588 | * Class AuthorizeNetException |
589 | 589 | * |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | * @param Exception $previous [optional] The previous exception used for the exception chaining. Since 5.3.0 |
600 | 600 | * @since 5.1.0 |
601 | 601 | */ |
602 | - public function __construct( $message = "", $code = 0, Exception $previous = null ) { |
|
603 | - parent::__construct( $message, $code, $previous ); |
|
602 | + public function __construct($message = "", $code = 0, Exception $previous = null) { |
|
603 | + parent::__construct($message, $code, $previous); |
|
604 | 604 | } |
605 | 605 | } |
606 | 606 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @final |
481 | 481 | * @access protected |
482 | - * @return void |
|
482 | + * @return false|null |
|
483 | 483 | */ |
484 | 484 | final protected function _page_setup() { |
485 | 485 | |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | * All this method does is verify the incoming request and make sure that routes exist for it. We do this early so we know if we need to drop out. |
754 | 754 | * |
755 | 755 | * @access protected |
756 | - * @return void |
|
756 | + * @return false|null |
|
757 | 757 | */ |
758 | 758 | protected function _verify_routes() { |
759 | 759 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | /** |
816 | 816 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
817 | 817 | * @param string $route the route name we're verifying |
818 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
818 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
819 | 819 | */ |
820 | 820 | protected function _verify_route( $route ) { |
821 | 821 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -3368,7 +3368,7 @@ discard block |
||
3368 | 3368 | |
3369 | 3369 | |
3370 | 3370 | /** |
3371 | - * @return mixed |
|
3371 | + * @return string[] |
|
3372 | 3372 | */ |
3373 | 3373 | public function default_espresso_metaboxes() { |
3374 | 3374 | return $this->_default_espresso_metaboxes; |
@@ -3386,7 +3386,7 @@ discard block |
||
3386 | 3386 | |
3387 | 3387 | |
3388 | 3388 | /** |
3389 | - * @return mixed |
|
3389 | + * @return string |
|
3390 | 3390 | */ |
3391 | 3391 | public function wp_page_slug() { |
3392 | 3392 | return $this->_wp_page_slug; |
@@ -3399,7 +3399,6 @@ discard block |
||
3399 | 3399 | * |
3400 | 3400 | * @access protected |
3401 | 3401 | * @param string $tab |
3402 | - * @param array $data |
|
3403 | 3402 | * @param string $file file where error occurred |
3404 | 3403 | * @param string $func function where error occurred |
3405 | 3404 | * @param string $line line no where error occurred |
@@ -1311,8 +1311,8 @@ discard block |
||
1311 | 1311 | * verifies user access for this admin page |
1312 | 1312 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | - * @return BOOL|wp_die() |
|
1315 | - */ |
|
1314 | + * @return BOOL|wp_die() |
|
1315 | + */ |
|
1316 | 1316 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1317 | 1317 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1318 | 1318 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1698,11 +1698,11 @@ discard block |
||
1698 | 1698 | |
1699 | 1699 | |
1700 | 1700 | /** |
1701 | - * admin_footer_scripts_eei18n_js_strings |
|
1702 | - * |
|
1703 | - * @access public |
|
1704 | - * @return void |
|
1705 | - */ |
|
1701 | + * admin_footer_scripts_eei18n_js_strings |
|
1702 | + * |
|
1703 | + * @access public |
|
1704 | + * @return void |
|
1705 | + */ |
|
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | |
1760 | 1760 | /** |
1761 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | - * |
|
1763 | - * @access public |
|
1764 | - * @return void |
|
1765 | - */ |
|
1761 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | + * |
|
1763 | + * @access public |
|
1764 | + * @return void |
|
1765 | + */ |
|
1766 | 1766 | public function add_xdebug_style() { |
1767 | 1767 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1768 | 1768 | } |
@@ -1819,9 +1819,9 @@ discard block |
||
1819 | 1819 | |
1820 | 1820 | /** |
1821 | 1821 | * set current view for List Table |
1822 | - * @access public |
|
1823 | - * @return array |
|
1824 | - */ |
|
1822 | + * @access public |
|
1823 | + * @return array |
|
1824 | + */ |
|
1825 | 1825 | protected function _set_list_table_view() { |
1826 | 1826 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1827 | 1827 | |
@@ -1910,7 +1910,7 @@ discard block |
||
1910 | 1910 | * @access protected |
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | - */ |
|
1913 | + */ |
|
1914 | 1914 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1915 | 1915 | |
1916 | 1916 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1955,9 +1955,9 @@ discard block |
||
1955 | 1955 | |
1956 | 1956 | /** |
1957 | 1957 | * _set_search_attributes |
1958 | - * @access protected |
|
1959 | - * @return void |
|
1960 | - */ |
|
1958 | + * @access protected |
|
1959 | + * @return void |
|
1960 | + */ |
|
1961 | 1961 | public function _set_search_attributes() { |
1962 | 1962 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1963 | 1963 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
1978 | 1978 | * @access private |
1979 | 1979 | * @return void |
1980 | - */ |
|
1980 | + */ |
|
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | 1982 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1983 | 1983 | |
@@ -2209,7 +2209,6 @@ discard block |
||
2209 | 2209 | * Note: currently there is no validation for this. However if you want the delete button, the |
2210 | 2210 | * save, and save and close buttons to work properly, then you will want to include a |
2211 | 2211 | * values for the name and id arguments. |
2212 | - |
|
2213 | 2212 | * |
2214 | 2213 | *@todo Add in validation for name/id arguments. |
2215 | 2214 | * @param string $name key used for the action ID (i.e. event_id) |
@@ -2268,9 +2267,9 @@ discard block |
||
2268 | 2267 | |
2269 | 2268 | /** |
2270 | 2269 | * displays an error message to ppl who have javascript disabled |
2271 | - * @access private |
|
2272 | - * @return string |
|
2273 | - */ |
|
2270 | + * @access private |
|
2271 | + * @return string |
|
2272 | + */ |
|
2274 | 2273 | private function _display_no_javascript_warning() { |
2275 | 2274 | ?> |
2276 | 2275 | <noscript> |
@@ -2293,9 +2292,9 @@ discard block |
||
2293 | 2292 | |
2294 | 2293 | /** |
2295 | 2294 | * displays espresso success and/or error notices |
2296 | - * @access private |
|
2297 | - * @return string |
|
2298 | - */ |
|
2295 | + * @access private |
|
2296 | + * @return string |
|
2297 | + */ |
|
2299 | 2298 | private function _display_espresso_notices() { |
2300 | 2299 | $notices = $this->_get_transient( TRUE ); |
2301 | 2300 | echo stripslashes($notices); |
@@ -2307,10 +2306,10 @@ discard block |
||
2307 | 2306 | |
2308 | 2307 | |
2309 | 2308 | /** |
2310 | - * spinny things pacify the masses |
|
2311 | - * @access private |
|
2312 | - * @return string |
|
2313 | - */ |
|
2309 | + * spinny things pacify the masses |
|
2310 | + * @access private |
|
2311 | + * @return string |
|
2312 | + */ |
|
2314 | 2313 | protected function _add_admin_page_ajax_loading_img() { |
2315 | 2314 | ?> |
2316 | 2315 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2324,10 +2323,10 @@ discard block |
||
2324 | 2323 | |
2325 | 2324 | |
2326 | 2325 | /** |
2327 | - * add admin page overlay for modal boxes |
|
2328 | - * @access private |
|
2329 | - * @return string |
|
2330 | - */ |
|
2326 | + * add admin page overlay for modal boxes |
|
2327 | + * @access private |
|
2328 | + * @return string |
|
2329 | + */ |
|
2331 | 2330 | protected function _add_admin_page_overlay() { |
2332 | 2331 | ?> |
2333 | 2332 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2389,10 +2388,10 @@ discard block |
||
2389 | 2388 | |
2390 | 2389 | |
2391 | 2390 | /** |
2392 | - * generates HTML wrapper for an admin details page |
|
2393 | - * @access public |
|
2394 | - * @return void |
|
2395 | - */ |
|
2391 | + * generates HTML wrapper for an admin details page |
|
2392 | + * @access public |
|
2393 | + * @return void |
|
2394 | + */ |
|
2396 | 2395 | public function display_admin_page_with_sidebar() { |
2397 | 2396 | |
2398 | 2397 | $this->_display_admin_page(TRUE); |
@@ -2402,10 +2401,10 @@ discard block |
||
2402 | 2401 | |
2403 | 2402 | |
2404 | 2403 | /** |
2405 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2406 | - * @access public |
|
2407 | - * @return void |
|
2408 | - */ |
|
2404 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2405 | + * @access public |
|
2406 | + * @return void |
|
2407 | + */ |
|
2409 | 2408 | public function display_admin_page_with_no_sidebar() { |
2410 | 2409 | $this->_display_admin_page(); |
2411 | 2410 | } |
@@ -2662,11 +2661,11 @@ discard block |
||
2662 | 2661 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2663 | 2662 | if ( NULL === error_get_last() || ! headers_sent() ) |
2664 | 2663 | header('Content-Type: application/json; charset=UTF-8'); |
2665 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2666 | - echo wp_json_encode( $json ); |
|
2667 | - } else { |
|
2668 | - echo json_encode( $json ); |
|
2669 | - } |
|
2664 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2665 | + echo wp_json_encode( $json ); |
|
2666 | + } else { |
|
2667 | + echo json_encode( $json ); |
|
2668 | + } |
|
2670 | 2669 | exit(); |
2671 | 2670 | } |
2672 | 2671 | |
@@ -2705,11 +2704,11 @@ discard block |
||
2705 | 2704 | |
2706 | 2705 | |
2707 | 2706 | /** |
2708 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2709 | - * @access public |
|
2710 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2711 | - * @return void |
|
2712 | - */ |
|
2707 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2708 | + * @access public |
|
2709 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2710 | + * @return void |
|
2711 | + */ |
|
2713 | 2712 | public function admin_page_wrapper($about = FALSE) { |
2714 | 2713 | |
2715 | 2714 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2766,9 +2765,9 @@ discard block |
||
2766 | 2765 | */ |
2767 | 2766 | private function _sort_nav_tabs( $a, $b ) { |
2768 | 2767 | if ($a['order'] == $b['order']) { |
2769 | - return 0; |
|
2770 | - } |
|
2771 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2768 | + return 0; |
|
2769 | + } |
|
2770 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2772 | 2771 | } |
2773 | 2772 | |
2774 | 2773 |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
159 | 159 | * @access public |
160 | 160 | */ |
161 | - public function __construct( $routing = TRUE ) { |
|
161 | + public function __construct($routing = TRUE) { |
|
162 | 162 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
163 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
164 | 164 | $this->_is_caf = TRUE; |
165 | 165 | |
166 | 166 | $this->_yes_no_values = array( |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | //set the _req_data property. |
174 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
174 | + $this->_req_data = array_merge($_GET, $_POST); |
|
175 | 175 | |
176 | 176 | |
177 | 177 | //routing enabled? |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $this->_do_other_page_hooks(); |
193 | 193 | |
194 | 194 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
195 | + if (method_exists($this, '_before_page_setup')) |
|
196 | 196 | $this->_before_page_setup(); |
197 | 197 | |
198 | 198 | //set up page dependencies |
@@ -462,16 +462,16 @@ discard block |
||
462 | 462 | */ |
463 | 463 | protected function _global_ajax_hooks() { |
464 | 464 | //for lazy loading of metabox content |
465 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
465 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
469 | 469 | |
470 | 470 | public function ajax_metabox_content() { |
471 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
472 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
471 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
472 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
473 | 473 | |
474 | - self::cached_rss_display( $contentid, $url ); |
|
474 | + self::cached_rss_display($contentid, $url); |
|
475 | 475 | wp_die(); |
476 | 476 | } |
477 | 477 | |
@@ -490,87 +490,87 @@ discard block |
||
490 | 490 | //requires? |
491 | 491 | |
492 | 492 | //admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can. But keep in mind, not everything is available from the EE_Admin Page object at this point. |
493 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
493 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
494 | 494 | |
495 | 495 | |
496 | 496 | //next verify if we need to load anything... |
497 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; |
|
498 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
497 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : ''; |
|
498 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
499 | 499 | |
500 | 500 | global $ee_menu_slugs; |
501 | 501 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 502 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
503 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
504 | 504 | |
505 | 505 | |
506 | 506 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
507 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
508 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
507 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
508 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
509 | 509 | } |
510 | 510 | // then set blank or -1 action values to 'default' |
511 | - $this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default'; |
|
511 | + $this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default'; |
|
512 | 512 | |
513 | 513 | //if action is 'default' after the above BUT we have 'route' var set, then let's use the route as the action. This covers cases where we're coming in from a list table that isn't on the default route. |
514 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
514 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
515 | 515 | |
516 | 516 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
517 | 517 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
518 | 518 | |
519 | 519 | $this->_current_view = $this->_req_action; |
520 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
520 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
521 | 521 | $this->_define_page_props(); |
522 | 522 | |
523 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
523 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
524 | 524 | |
525 | 525 | //default things |
526 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
526 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
527 | 527 | |
528 | 528 | //set page configs |
529 | 529 | $this->_set_page_routes(); |
530 | 530 | $this->_set_page_config(); |
531 | 531 | |
532 | 532 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
533 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
533 | + if (isset($this->_req_data['wp_referer'])) { |
|
534 | 534 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
535 | 535 | } |
536 | 536 | |
537 | 537 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config')) |
|
539 | 539 | $this->_extend_page_config(); |
540 | 540 | |
541 | 541 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
542 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
543 | 543 | $this->_extend_page_config_for_cpt(); |
544 | 544 | |
545 | 545 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
547 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
546 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
547 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action |
551 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
552 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
551 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
552 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
556 | 556 | //next route only if routing enabled |
557 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
557 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
558 | 558 | |
559 | 559 | $this->_verify_routes(); |
560 | 560 | |
561 | 561 | //next let's just check user_access and kill if no access |
562 | 562 | $this->check_user_access(); |
563 | 563 | |
564 | - if ( $this->_is_UI_request ) { |
|
564 | + if ($this->_is_UI_request) { |
|
565 | 565 | //admin_init stuff - global, all views for this page class, specific view |
566 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
567 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
568 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
566 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
567 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
568 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | } else { |
572 | 572 | //hijack regular WP loading and route admin request immediately |
573 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
573 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
574 | 574 | $this->route_admin_request(); |
575 | 575 | } |
576 | 576 | } |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | * @return void |
588 | 588 | */ |
589 | 589 | private function _do_other_page_hooks() { |
590 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
590 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
591 | 591 | |
592 | - foreach ( $registered_pages as $page ) { |
|
592 | + foreach ($registered_pages as $page) { |
|
593 | 593 | |
594 | 594 | //now let's setup the file name and class that should be present |
595 | 595 | $classname = str_replace('.class.php', '', $page); |
596 | 596 | |
597 | 597 | //autoloaders should take care of loading file |
598 | - if ( !class_exists( $classname ) ) { |
|
599 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
600 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname ); |
|
601 | - throw new EE_Error( implode( '||', $error_msg )); |
|
598 | + if ( ! class_exists($classname)) { |
|
599 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
600 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname); |
|
601 | + throw new EE_Error(implode('||', $error_msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | $a = new ReflectionClass($classname); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function load_page_dependencies() { |
614 | 614 | try { |
615 | 615 | $this->_load_page_dependencies(); |
616 | - } catch ( EE_Error $e ) { |
|
616 | + } catch (EE_Error $e) { |
|
617 | 617 | $e->get_error(); |
618 | 618 | } |
619 | 619 | } |
@@ -631,16 +631,16 @@ discard block |
||
631 | 631 | $this->_current_screen = get_current_screen(); |
632 | 632 | |
633 | 633 | //load admin_notices - global, page class, and view specific |
634 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
635 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
636 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
637 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
634 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
635 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
636 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
637 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | //load network admin_notices - global, page class, and view specific |
641 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
642 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
643 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
641 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
642 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
643 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | //this will save any per_page screen options if they are present |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | //add screen options - global, page child class, and view specific |
657 | 657 | $this->_add_global_screen_options(); |
658 | 658 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
659 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
660 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
661 | 661 | |
662 | 662 | |
663 | 663 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,33 +668,33 @@ discard block |
||
668 | 668 | //add feature_pointers - global, page child class, and view specific |
669 | 669 | $this->_add_feature_pointers(); |
670 | 670 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
671 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
672 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
673 | 673 | |
674 | 674 | //enqueue scripts/styles - global, page class, and view specific |
675 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
676 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
675 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
677 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
678 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
679 | 679 | |
680 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
680 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
681 | 681 | |
682 | 682 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
683 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
684 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
683 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
684 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
685 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
686 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
687 | 687 | |
688 | 688 | //admin footer scripts |
689 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
690 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
689 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
690 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
691 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
692 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
693 | 693 | |
694 | 694 | |
695 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
695 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
696 | 696 | //targeted hook |
697 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
697 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | private function _set_defaults() { |
710 | 710 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
711 | 711 | |
712 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
712 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
713 | 713 | |
714 | 714 | $this->default_nav_tab_name = 'overview'; |
715 | 715 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | public function route_admin_request() { |
737 | 737 | try { |
738 | 738 | $this->_route_admin_request(); |
739 | - } catch ( EE_Error $e ) { |
|
739 | + } catch (EE_Error $e) { |
|
740 | 740 | $e->get_error(); |
741 | 741 | } |
742 | 742 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $this->_wp_page_slug = $wp_page_slug; |
748 | 748 | |
749 | 749 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
750 | - if ( is_network_admin() ) { |
|
750 | + if (is_network_admin()) { |
|
751 | 751 | $this->_wp_page_slug .= '-network'; |
752 | 752 | } |
753 | 753 | } |
@@ -760,53 +760,53 @@ discard block |
||
760 | 760 | * @return void |
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
763 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
764 | 764 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
765 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
766 | 766 | |
767 | 767 | $this->_route = FALSE; |
768 | 768 | $func = FALSE; |
769 | 769 | $args = array(); |
770 | 770 | |
771 | 771 | // check that the page_routes array is not empty |
772 | - if ( empty( $this->_page_routes )) { |
|
772 | + if (empty($this->_page_routes)) { |
|
773 | 773 | // user error msg |
774 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
774 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
775 | 775 | // developer error msg |
776 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
777 | - throw new EE_Error( $error_msg ); |
|
776 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
777 | + throw new EE_Error($error_msg); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | // and that the requested page route exists |
781 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
782 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
781 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
782 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
783 | 783 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
784 | 784 | } else { |
785 | 785 | // user error msg |
786 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
786 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
787 | 787 | // developer error msg |
788 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action ); |
|
789 | - throw new EE_Error( $error_msg ); |
|
788 | + $error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action); |
|
789 | + throw new EE_Error($error_msg); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // and that a default route exists |
793 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
793 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
794 | 794 | // user error msg |
795 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
795 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
796 | 796 | // developer error msg |
797 | - $error_msg .= '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' ); |
|
798 | - throw new EE_Error( $error_msg ); |
|
797 | + $error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso'); |
|
798 | + throw new EE_Error($error_msg); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
802 | 802 | //first lets' catch if the UI request has EVER been set. |
803 | - if ( $this->_is_UI_request === NULL ) { |
|
803 | + if ($this->_is_UI_request === NULL) { |
|
804 | 804 | //lets set if this is a UI request or not. |
805 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
805 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
806 | 806 | |
807 | 807 | |
808 | 808 | //wait a minute... we might have a noheader in the route array |
809 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
809 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->_set_current_labels(); |
@@ -821,15 +821,15 @@ discard block |
||
821 | 821 | * @param string $route the route name we're verifying |
822 | 822 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
823 | 823 | */ |
824 | - protected function _verify_route( $route ) { |
|
825 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
824 | + protected function _verify_route($route) { |
|
825 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
826 | 826 | return true; |
827 | 827 | } else { |
828 | 828 | // user error msg |
829 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
829 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
830 | 830 | // developer error msg |
831 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route ); |
|
832 | - throw new EE_Error( $error_msg ); |
|
831 | + $error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route); |
|
832 | + throw new EE_Error($error_msg); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
@@ -843,18 +843,18 @@ discard block |
||
843 | 843 | * @param string $nonce_ref The nonce reference string (name0) |
844 | 844 | * @return mixed (bool|die) |
845 | 845 | */ |
846 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
846 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
847 | 847 | // verify nonce against expected value |
848 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
848 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
849 | 849 | // these are not the droids you are looking for !!! |
850 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
851 | - if ( WP_DEBUG ) { |
|
852 | - $msg .= "\n " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__ ); |
|
850 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
851 | + if (WP_DEBUG) { |
|
852 | + $msg .= "\n ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__); |
|
853 | 853 | } |
854 | - if ( ! defined( 'DOING_AJAX' )) { |
|
855 | - wp_die( $msg ); |
|
854 | + if ( ! defined('DOING_AJAX')) { |
|
855 | + wp_die($msg); |
|
856 | 856 | } else { |
857 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
858 | 858 | $this->_return_json(); |
859 | 859 | } |
860 | 860 | } |
@@ -872,63 +872,63 @@ discard block |
||
872 | 872 | * @return void |
873 | 873 | */ |
874 | 874 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
875 | + if ( ! $this->_is_UI_request) |
|
876 | 876 | $this->_verify_routes(); |
877 | 877 | |
878 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
878 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
879 | 879 | |
880 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
880 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
881 | 881 | // set nonce from post data |
882 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
883 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
882 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
883 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
884 | 884 | } |
885 | 885 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
886 | + if ($this->_is_UI_request) |
|
887 | 887 | $this->_set_nav_tabs(); |
888 | 888 | |
889 | 889 | // grab callback function |
890 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
890 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
891 | 891 | |
892 | 892 | // check if callback has args |
893 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
893 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
894 | 894 | |
895 | 895 | $error_msg = ''; |
896 | 896 | |
897 | 897 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
898 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
898 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | //right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
903 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
903 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
904 | 904 | |
905 | - if ( ! empty( $func )) { |
|
905 | + if ( ! empty($func)) { |
|
906 | 906 | $base_call = $addon_call = FALSE; |
907 | 907 | //try to access page route via this class |
908 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
908 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
909 | 909 | // user error msg |
910 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
910 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
911 | 911 | // developer error msg |
912 | - $error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func ); |
|
912 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | //for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method) |
916 | 916 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
917 | 917 | |
918 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
919 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
920 | - $error_msg .= '||' . sprintf( __('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func ); |
|
918 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
919 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
920 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
924 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
925 | + throw new EE_Error($error_msg); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
929 | 929 | //now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent. |
930 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
931 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
930 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
931 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * @param string $new_route New (non header) route to redirect to. |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - protected function _reset_routing_properties( $new_route ) { |
|
947 | + protected function _reset_routing_properties($new_route) { |
|
948 | 948 | $this->_is_UI_request = TRUE; |
949 | 949 | //now we set the current route to whatever the headers_sent_route is set at |
950 | 950 | $this->_req_data['action'] = $new_route; |
@@ -990,23 +990,23 @@ discard block |
||
990 | 990 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
991 | 991 | * @return string |
992 | 992 | */ |
993 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
993 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
994 | 994 | |
995 | 995 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
996 | - if ( $sticky ) { |
|
996 | + if ($sticky) { |
|
997 | 997 | $request = $_REQUEST; |
998 | - unset( $request['_wp_http_referer'] ); |
|
999 | - unset( $request['wp_referer'] ); |
|
1000 | - foreach ( $request as $key => $value ) { |
|
998 | + unset($request['_wp_http_referer']); |
|
999 | + unset($request['wp_referer']); |
|
1000 | + foreach ($request as $key => $value) { |
|
1001 | 1001 | //do not add nonces |
1002 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1002 | + if (strpos($key, 'nonce') !== false) { |
|
1003 | 1003 | continue; |
1004 | 1004 | } |
1005 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1005 | + $args['wp_referer['.$key.']'] = $value; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1009 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | * @uses EEH_Template::get_help_tab_link() |
1023 | 1023 | * @return string generated link |
1024 | 1024 | */ |
1025 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1026 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1025 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1026 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
@@ -1040,30 +1040,30 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | protected function _add_help_tabs() { |
1042 | 1042 | $tour_buttons = ''; |
1043 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1043 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1044 | 1044 | $config = $this->_page_config[$this->_req_action]; |
1045 | 1045 | |
1046 | 1046 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1047 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1047 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1048 | 1048 | $tb = array(); |
1049 | 1049 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1050 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1051 | 1051 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1052 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1053 | 1053 | continue; |
1054 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1054 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1055 | 1055 | } |
1056 | 1056 | $tour_buttons .= implode('<br />', $tb); |
1057 | 1057 | $tour_buttons .= '</div></div>'; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1061 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1062 | 1062 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1063 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1064 | + throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this))); |
|
1065 | 1065 | |
1066 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1066 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1067 | 1067 | |
1068 | 1068 | $content .= $tour_buttons; //add help tour buttons. |
1069 | 1069 | |
@@ -1072,49 +1072,49 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1075 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1075 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1076 | 1076 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1080 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1080 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1081 | 1081 | $_ht['id'] = $this->page_slug; |
1082 | 1082 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1083 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1083 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1084 | 1084 | $this->_current_screen->add_help_tab($_ht); |
1085 | 1085 | }/**/ |
1086 | 1086 | |
1087 | 1087 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1088 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1089 | 1089 | |
1090 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1090 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1091 | 1091 | //we're here so there ARE help tabs! |
1092 | 1092 | |
1093 | 1093 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1094 | + if ( ! isset($cfg['title'])) |
|
1095 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1098 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1099 | + throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso')); |
|
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | |
1103 | 1103 | //first priority goes to content. |
1104 | - if ( !empty($cfg['content'] ) ) { |
|
1105 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1104 | + if ( ! empty($cfg['content'])) { |
|
1105 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1106 | 1106 | |
1107 | 1107 | //second priority goes to filename |
1108 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1109 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1108 | + } else if ( ! empty($cfg['filename'])) { |
|
1109 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | //it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too) |
1113 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1113 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1114 | 1114 | |
1115 | 1115 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1116 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1117 | - EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1116 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1117 | + EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__); |
|
1118 | 1118 | return; |
1119 | 1119 | } |
1120 | 1120 | $template_args['admin_page_obj'] = $this; |
@@ -1125,21 +1125,21 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | |
1127 | 1127 | //check if callback is valid |
1128 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1129 | - EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1128 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1129 | + EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__); |
|
1130 | 1130 | return; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | //setup config array for help tab method |
1134 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1134 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1135 | 1135 | $_ht = array( |
1136 | 1136 | 'id' => $id, |
1137 | 1137 | 'title' => $cfg['title'], |
1138 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1138 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1139 | 1139 | 'content' => $content |
1140 | 1140 | ); |
1141 | 1141 | |
1142 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1142 | + $this->_current_screen->add_help_tab($_ht); |
|
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1159,49 +1159,49 @@ discard block |
||
1159 | 1159 | $this->_help_tour = array(); |
1160 | 1160 | |
1161 | 1161 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1162 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1163 | 1163 | return; |
1164 | 1164 | |
1165 | 1165 | //loop through _page_config to find any help_tour defined |
1166 | - foreach ( $this->_page_config as $route => $config ) { |
|
1166 | + foreach ($this->_page_config as $route => $config) { |
|
1167 | 1167 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1168 | + if ($route !== $this->_req_action) |
|
1169 | 1169 | continue; |
1170 | 1170 | |
1171 | - if ( isset( $config['help_tour'] ) ) { |
|
1171 | + if (isset($config['help_tour'])) { |
|
1172 | 1172 | |
1173 | - foreach( $config['help_tour'] as $tour ) { |
|
1174 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1173 | + foreach ($config['help_tour'] as $tour) { |
|
1174 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1175 | 1175 | //let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent |
1176 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1176 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1177 | 1177 | |
1178 | 1178 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1179 | - if ( !is_readable($file_path) ) { |
|
1180 | - EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1179 | + if ( ! is_readable($file_path)) { |
|
1180 | + EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__); |
|
1181 | 1181 | return; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | require_once $file_path; |
1185 | - if ( !class_exists( $tour ) ) { |
|
1186 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1187 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) ); |
|
1188 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1185 | + if ( ! class_exists($tour)) { |
|
1186 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1187 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this)); |
|
1188 | + throw new EE_Error(implode('||', $error_msg)); |
|
1189 | 1189 | } |
1190 | 1190 | $a = new ReflectionClass($tour); |
1191 | 1191 | $tour_obj = $a->newInstance($this->_is_caf); |
1192 | 1192 | |
1193 | 1193 | $tours[] = $tour_obj; |
1194 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1194 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1198 | 1198 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1199 | 1199 | $tours[] = $end_stop_tour; |
1200 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1200 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - if ( !empty( $tours ) ) |
|
1204 | + if ( ! empty($tours)) |
|
1205 | 1205 | $this->_help_tour['tours'] = $tours; |
1206 | 1206 | |
1207 | 1207 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1217,12 +1217,12 @@ discard block |
||
1217 | 1217 | * @return void |
1218 | 1218 | */ |
1219 | 1219 | protected function _add_qtips() { |
1220 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1220 | + if (isset($this->_route_config['qtips'])) { |
|
1221 | 1221 | $qtips = (array) $this->_route_config['qtips']; |
1222 | 1222 | //load qtip loader |
1223 | 1223 | $path = array( |
1224 | - $this->_get_dir() . '/qtips/', |
|
1225 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1224 | + $this->_get_dir().'/qtips/', |
|
1225 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1226 | 1226 | ); |
1227 | 1227 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1228 | 1228 | } |
@@ -1239,41 +1239,41 @@ discard block |
||
1239 | 1239 | * @return void |
1240 | 1240 | */ |
1241 | 1241 | protected function _set_nav_tabs() { |
1242 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1242 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1243 | 1243 | $i = 0; |
1244 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1244 | + foreach ($this->_page_config as $slug => $config) { |
|
1245 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1246 | 1246 | continue; //no nav tab for this config |
1247 | 1247 | |
1248 | 1248 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1249 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1250 | 1250 | continue; //nav tab is only to appear when route requested. |
1251 | 1251 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1252 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1253 | 1253 | continue; //no nav tab becasue current user does not have access. |
1254 | 1254 | |
1255 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1255 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1256 | 1256 | $this->_nav_tabs[$slug] = array( |
1257 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1258 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1259 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1260 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1257 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1258 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1259 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1260 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1261 | 1261 | ); |
1262 | 1262 | $i++; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | //if $this->_nav_tabs is empty then lets set the default |
1266 | - if ( empty( $this->_nav_tabs ) ) { |
|
1266 | + if (empty($this->_nav_tabs)) { |
|
1267 | 1267 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1268 | 1268 | 'url' => $this->admin_base_url, |
1269 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1269 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1270 | 1270 | 'css_class' => 'nav-tab-active', |
1271 | 1271 | 'order' => 10 |
1272 | 1272 | ); |
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | //now let's sort the tabs according to order |
1276 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1276 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,10 +1289,10 @@ discard block |
||
1289 | 1289 | * @return void |
1290 | 1290 | */ |
1291 | 1291 | private function _set_current_labels() { |
1292 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1293 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1294 | - if ( is_array($text) ) { |
|
1295 | - foreach ( $text as $sublabel => $subtext ) { |
|
1292 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1293 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1294 | + if (is_array($text)) { |
|
1295 | + foreach ($text as $sublabel => $subtext) { |
|
1296 | 1296 | $this->_labels[$label][$sublabel] = $subtext; |
1297 | 1297 | } |
1298 | 1298 | } else { |
@@ -1313,24 +1313,24 @@ discard block |
||
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | 1314 | * @return BOOL|wp_die() |
1315 | 1315 | */ |
1316 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1317 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1318 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1319 | - $capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1316 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1317 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1318 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1319 | + $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1320 | 1320 | |
1321 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1322 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1321 | + if (empty($capability) && empty($route_to_check)) { |
|
1322 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1323 | 1323 | } else { |
1324 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1324 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1327 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1328 | 1328 | |
1329 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1330 | - if ( $verify_only ) { |
|
1329 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1330 | + if ($verify_only) { |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } else { |
1333 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1333 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | return TRUE; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | $this->_add_admin_page_overlay(); |
1408 | 1408 | |
1409 | 1409 | //if metaboxes are present we need to add the nonce field |
1410 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1410 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1411 | 1411 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1412 | 1412 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1413 | 1413 | } |
@@ -1426,19 +1426,19 @@ discard block |
||
1426 | 1426 | */ |
1427 | 1427 | public function admin_footer_global() { |
1428 | 1428 | //dialog container for dialog helper |
1429 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1429 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1430 | 1430 | $d_cont .= '<div class="ee-notices"></div>'; |
1431 | 1431 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1432 | 1432 | $d_cont .= '</div>'; |
1433 | 1433 | echo $d_cont; |
1434 | 1434 | |
1435 | 1435 | //help tour stuff? |
1436 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1436 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1437 | 1437 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | //current set timezone for timezone js |
1441 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1441 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | |
@@ -1462,18 +1462,18 @@ discard block |
||
1462 | 1462 | * @access protected |
1463 | 1463 | * @return string content |
1464 | 1464 | */ |
1465 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1465 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1466 | 1466 | $content = ''; |
1467 | 1467 | |
1468 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1469 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1468 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1469 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1470 | 1470 | |
1471 | 1471 | |
1472 | 1472 | //loop through the array and setup content |
1473 | - foreach ( $help_array as $trigger => $help ) { |
|
1473 | + foreach ($help_array as $trigger => $help) { |
|
1474 | 1474 | //make sure the array is setup properly |
1475 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1476 | - throw new EE_Error( __('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') ); |
|
1475 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1476 | + throw new EE_Error(__('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso')); |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1483,10 +1483,10 @@ discard block |
||
1483 | 1483 | 'help_popup_content' => $help['content'] |
1484 | 1484 | ); |
1485 | 1485 | |
1486 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1486 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | - if ( $display ) |
|
1489 | + if ($display) |
|
1490 | 1490 | echo $content; |
1491 | 1491 | else |
1492 | 1492 | return $content; |
@@ -1503,18 +1503,18 @@ discard block |
||
1503 | 1503 | */ |
1504 | 1504 | private function _get_help_content() { |
1505 | 1505 | //what is the method we're looking for? |
1506 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1506 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1507 | 1507 | |
1508 | 1508 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1509 | + if ( ! method_exists($this, $method_name)) |
|
1510 | 1510 | return array(); |
1511 | 1511 | |
1512 | 1512 | //k we're good to go let's retrieve the help array |
1513 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1513 | + $help_array = call_user_func(array($this, $method_name)); |
|
1514 | 1514 | |
1515 | 1515 | //make sure we've got an array! |
1516 | - if ( !is_array($help_array) ) { |
|
1517 | - throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) ); |
|
1516 | + if ( ! is_array($help_array)) { |
|
1517 | + throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso')); |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | return $help_array; |
@@ -1536,27 +1536,27 @@ discard block |
||
1536 | 1536 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1539 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1540 | 1540 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1541 | + if (defined('DOING_AJAX')) return; |
|
1542 | 1542 | |
1543 | 1543 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1544 | 1544 | $help_array = $this->_get_help_content(); |
1545 | 1545 | $help_content = ''; |
1546 | 1546 | |
1547 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1547 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1548 | 1548 | $help_array[$trigger_id] = array( |
1549 | 1549 | 'title' => __('Missing Content', 'event_espresso'), |
1550 | 1550 | 'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso') |
1551 | 1551 | ); |
1552 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1552 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1553 | 1553 | } |
1554 | 1554 | |
1555 | 1555 | //let's setup the trigger |
1556 | - $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1557 | - $content = $content . $help_content; |
|
1556 | + $content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1557 | + $content = $content.$help_content; |
|
1558 | 1558 | |
1559 | - if ( $display ) |
|
1559 | + if ($display) |
|
1560 | 1560 | echo $content; |
1561 | 1561 | else |
1562 | 1562 | return $content; |
@@ -1613,15 +1613,15 @@ discard block |
||
1613 | 1613 | public function load_global_scripts_styles() { |
1614 | 1614 | /** STYLES **/ |
1615 | 1615 | // add debugging styles |
1616 | - if ( WP_DEBUG ) { |
|
1617 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1616 | + if (WP_DEBUG) { |
|
1617 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | //register all styles |
1621 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION ); |
|
1622 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1622 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1623 | 1623 | //helpers styles |
1624 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1624 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1625 | 1625 | //enqueue global styles |
1626 | 1626 | wp_enqueue_style('ee-admin-css'); |
1627 | 1627 | |
@@ -1629,66 +1629,66 @@ discard block |
||
1629 | 1629 | /** SCRIPTS **/ |
1630 | 1630 | |
1631 | 1631 | //register all scripts |
1632 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1633 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1634 | - wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true ); |
|
1632 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1633 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | + wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1635 | 1635 | |
1636 | - wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true ); |
|
1636 | + wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true); |
|
1637 | 1637 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1638 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1638 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1639 | 1639 | add_filter('FHEE_load_joyride', '__return_true'); |
1640 | 1640 | |
1641 | 1641 | //script for sorting tables |
1642 | - wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1642 | + wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1643 | 1643 | //script for parsing uri's |
1644 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | 1645 | //and parsing associative serialized form elements |
1646 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | 1647 | //helpers scripts |
1648 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1649 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1650 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1651 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1648 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1649 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1650 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1651 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1652 | 1652 | |
1653 | 1653 | //google charts |
1654 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1654 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1655 | 1655 | |
1656 | 1656 | //enqueue global scripts |
1657 | 1657 | |
1658 | 1658 | //taking care of metaboxes |
1659 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1659 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1660 | 1660 | wp_enqueue_script('dashboard'); |
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | //enqueue thickbox for ee help popups. default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups |
1664 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1664 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1665 | 1665 | wp_enqueue_script('ee_admin_js'); |
1666 | 1666 | wp_enqueue_style('ee-admin-css'); |
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | //localize script for ajax lazy loading |
1671 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1672 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1671 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1672 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | /** |
1676 | 1676 | * help tour stuff |
1677 | 1677 | */ |
1678 | - if ( !empty( $this->_help_tour ) ) { |
|
1678 | + if ( ! empty($this->_help_tour)) { |
|
1679 | 1679 | |
1680 | 1680 | //register the js for kicking things off |
1681 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1681 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1682 | 1682 | |
1683 | 1683 | //setup tours for the js tour object |
1684 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1684 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1685 | 1685 | $tours[] = array( |
1686 | 1686 | 'id' => $tour->get_slug(), |
1687 | 1687 | 'options' => $tour->get_options() |
1688 | 1688 | ); |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1691 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1692 | 1692 | |
1693 | 1693 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1694 | 1694 | } |
@@ -1706,52 +1706,52 @@ discard block |
||
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1709 | - EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' ); |
|
1710 | - |
|
1711 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1735 | - |
|
1736 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1748 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1749 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1709 | + EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso'); |
|
1710 | + |
|
1711 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1735 | + |
|
1736 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1748 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1749 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1750 | 1750 | |
1751 | 1751 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1752 | 1752 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1753 | 1753 | //espresso_core is listed as a dependency of ee_admin_js. |
1754 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1754 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1755 | 1755 | |
1756 | 1756 | } |
1757 | 1757 | |
@@ -1785,23 +1785,23 @@ discard block |
||
1785 | 1785 | protected function _set_list_table() { |
1786 | 1786 | |
1787 | 1787 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1788 | + if ( ! isset($this->_route_config['list_table'])) |
|
1789 | 1789 | return; //not a list_table view so get out. |
1790 | 1790 | |
1791 | 1791 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1792 | |
1793 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1793 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1794 | 1794 | //user error msg |
1795 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1795 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1796 | 1796 | //developer error msg |
1797 | - $error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action ); |
|
1798 | - throw new EE_Error( $error_msg ); |
|
1797 | + $error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action); |
|
1798 | + throw new EE_Error($error_msg); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1802 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1803 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1804 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1802 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1803 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1804 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1805 | 1805 | |
1806 | 1806 | $this->_set_list_table_view(); |
1807 | 1807 | $this->_set_list_table_object(); |
@@ -1823,14 +1823,14 @@ discard block |
||
1823 | 1823 | * @return array |
1824 | 1824 | */ |
1825 | 1825 | protected function _set_list_table_view() { |
1826 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1826 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1827 | 1827 | |
1828 | 1828 | |
1829 | 1829 | // looking at active items or dumpster diving ? |
1830 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1831 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1830 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1831 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1832 | 1832 | } else { |
1833 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1833 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1843,8 +1843,8 @@ discard block |
||
1843 | 1843 | * @throws \EE_Error |
1844 | 1844 | */ |
1845 | 1845 | protected function _set_list_table_object() { |
1846 | - if ( isset( $this->_route_config['list_table'] ) ) { |
|
1847 | - if ( ! class_exists( $this->_route_config['list_table'] ) ) { |
|
1846 | + if (isset($this->_route_config['list_table'])) { |
|
1847 | + if ( ! class_exists($this->_route_config['list_table'])) { |
|
1848 | 1848 | throw new EE_Error( |
1849 | 1849 | sprintf( |
1850 | 1850 | __( |
@@ -1852,12 +1852,12 @@ discard block |
||
1852 | 1852 | 'event_espresso' |
1853 | 1853 | ), |
1854 | 1854 | $this->_route_config['list_table'], |
1855 | - get_class( $this ) |
|
1855 | + get_class($this) |
|
1856 | 1856 | ) |
1857 | 1857 | ); |
1858 | 1858 | } |
1859 | 1859 | $list_table = $this->_route_config['list_table']; |
1860 | - $this->_list_table_object = new $list_table( $this ); |
|
1860 | + $this->_list_table_object = new $list_table($this); |
|
1861 | 1861 | } |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1874,27 +1874,27 @@ discard block |
||
1874 | 1874 | * |
1875 | 1875 | * @return array |
1876 | 1876 | */ |
1877 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1877 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1878 | 1878 | |
1879 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1879 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1880 | 1880 | |
1881 | - if ( empty( $this->_views )) { |
|
1881 | + if (empty($this->_views)) { |
|
1882 | 1882 | $this->_views = array(); |
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | // cycle thru views |
1886 | - foreach ( $this->_views as $key => $view ) { |
|
1886 | + foreach ($this->_views as $key => $view) { |
|
1887 | 1887 | $query_args = array(); |
1888 | 1888 | // check for current view |
1889 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1889 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1890 | 1890 | $query_args['action'] = $this->_req_action; |
1891 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1891 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1892 | 1892 | $query_args['status'] = $view['slug']; |
1893 | 1893 | //merge any other arguments sent in. |
1894 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1895 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1894 | + if (isset($extra_query_args[$view['slug']])) { |
|
1895 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1896 | 1896 | } |
1897 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1897 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1898 | 1898 | } |
1899 | 1899 | |
1900 | 1900 | return $this->_views; |
@@ -1911,15 +1911,15 @@ discard block |
||
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | 1913 | */ |
1914 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1914 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1915 | 1915 | |
1916 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1917 | - $values = array( 10, 25, 50, 100 ); |
|
1918 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1916 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1917 | + $values = array(10, 25, 50, 100); |
|
1918 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1919 | 1919 | |
1920 | - if ( $max_entries ) { |
|
1920 | + if ($max_entries) { |
|
1921 | 1921 | $values[] = $max_entries; |
1922 | - sort( $values ); |
|
1922 | + sort($values); |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | $entries_per_page_dropdown = ' |
@@ -1928,15 +1928,15 @@ discard block |
||
1928 | 1928 | Show |
1929 | 1929 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1930 | 1930 | |
1931 | - foreach ( $values as $value ) { |
|
1932 | - if ( $value < $max_entries ) { |
|
1933 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1931 | + foreach ($values as $value) { |
|
1932 | + if ($value < $max_entries) { |
|
1933 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1934 | 1934 | $entries_per_page_dropdown .= ' |
1935 | 1935 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1936 | 1936 | } |
1937 | 1937 | } |
1938 | 1938 | |
1939 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1939 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1940 | 1940 | $entries_per_page_dropdown .= ' |
1941 | 1941 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1942 | 1942 | |
@@ -1959,8 +1959,8 @@ discard block |
||
1959 | 1959 | * @return void |
1960 | 1960 | */ |
1961 | 1961 | public function _set_search_attributes() { |
1962 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1963 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1962 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1963 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1964 | 1964 | } |
1965 | 1965 | |
1966 | 1966 | /*** END LIST TABLE METHODS **/ |
@@ -1979,10 +1979,10 @@ discard block |
||
1979 | 1979 | * @return void |
1980 | 1980 | */ |
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1982 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1983 | 1983 | |
1984 | 1984 | //we only add meta boxes if the page_route calls for it |
1985 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
1985 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
1986 | 1986 | && is_array( |
1987 | 1987 | $this->_route_config['metaboxes'] |
1988 | 1988 | ) |
@@ -1990,27 +1990,27 @@ discard block |
||
1990 | 1990 | // this simply loops through the callbacks provided |
1991 | 1991 | // and checks if there is a corresponding callback registered by the child |
1992 | 1992 | // if there is then we go ahead and process the metabox loader. |
1993 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1993 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1994 | 1994 | // first check for Closures |
1995 | - if ( $metabox_callback instanceof Closure ) { |
|
1995 | + if ($metabox_callback instanceof Closure) { |
|
1996 | 1996 | $result = $metabox_callback(); |
1997 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
1998 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
1997 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
1998 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
1999 | 1999 | } else { |
2000 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
2000 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
2001 | 2001 | } |
2002 | - if ( $result === FALSE ) { |
|
2002 | + if ($result === FALSE) { |
|
2003 | 2003 | // user error msg |
2004 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
2004 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
2005 | 2005 | // developer error msg |
2006 | - $error_msg .= '||' . sprintf( |
|
2006 | + $error_msg .= '||'.sprintf( |
|
2007 | 2007 | __( |
2008 | 2008 | 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', |
2009 | 2009 | 'event_espresso' |
2010 | 2010 | ), |
2011 | 2011 | $metabox_callback |
2012 | 2012 | ); |
2013 | - throw new EE_Error( $error_msg ); |
|
2013 | + throw new EE_Error($error_msg); |
|
2014 | 2014 | } |
2015 | 2015 | } |
2016 | 2016 | } |
@@ -2027,17 +2027,17 @@ discard block |
||
2027 | 2027 | * @return void |
2028 | 2028 | */ |
2029 | 2029 | private function _add_screen_columns() { |
2030 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
2030 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
2031 | 2031 | |
2032 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2032 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2033 | 2033 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2034 | 2034 | $screen_id = $this->_current_screen->id; |
2035 | 2035 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2036 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2037 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2036 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2037 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2038 | 2038 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2039 | 2039 | $this->_template_args['screen'] = $this->_current_screen; |
2040 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2040 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2041 | 2041 | |
2042 | 2042 | //finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded. |
2043 | 2043 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2054,11 +2054,11 @@ discard block |
||
2054 | 2054 | */ |
2055 | 2055 | |
2056 | 2056 | private function _espresso_news_post_box() { |
2057 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2058 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2057 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2058 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2059 | 2059 | $this, |
2060 | 2060 | 'espresso_news_post_box' |
2061 | - ), $this->_wp_page_slug, 'side' ); |
|
2061 | + ), $this->_wp_page_slug, 'side'); |
|
2062 | 2062 | } |
2063 | 2063 | |
2064 | 2064 | |
@@ -2066,14 +2066,14 @@ discard block |
||
2066 | 2066 | * Code for setting up espresso ratings request metabox. |
2067 | 2067 | */ |
2068 | 2068 | protected function _espresso_ratings_request() { |
2069 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2069 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2070 | 2070 | return ''; |
2071 | 2071 | } |
2072 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2073 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2072 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2073 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2074 | 2074 | $this, |
2075 | 2075 | 'espresso_ratings_request' |
2076 | - ), $this->_wp_page_slug, 'side' ); |
|
2076 | + ), $this->_wp_page_slug, 'side'); |
|
2077 | 2077 | } |
2078 | 2078 | |
2079 | 2079 | |
@@ -2081,34 +2081,34 @@ discard block |
||
2081 | 2081 | * Code for setting up espresso ratings request metabox content. |
2082 | 2082 | */ |
2083 | 2083 | public function espresso_ratings_request() { |
2084 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2085 | - EEH_Template::display_template( $template_path, array() ); |
|
2084 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2085 | + EEH_Template::display_template($template_path, array()); |
|
2086 | 2086 | } |
2087 | 2087 | |
2088 | 2088 | |
2089 | 2089 | |
2090 | 2090 | |
2091 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2092 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2093 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2094 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2095 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2096 | - $post = '</div>' . "\n"; |
|
2091 | + public static function cached_rss_display($rss_id, $url) { |
|
2092 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2093 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2094 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2095 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2096 | + $post = '</div>'."\n"; |
|
2097 | 2097 | |
2098 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2099 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2100 | - echo $pre . $output . $post; |
|
2098 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2099 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2100 | + echo $pre.$output.$post; |
|
2101 | 2101 | return TRUE; |
2102 | 2102 | } |
2103 | 2103 | |
2104 | - if ( ! $doing_ajax ) { |
|
2105 | - echo $pre . $loading . $post; |
|
2104 | + if ( ! $doing_ajax) { |
|
2105 | + echo $pre.$loading.$post; |
|
2106 | 2106 | return FALSE; |
2107 | 2107 | } |
2108 | 2108 | |
2109 | 2109 | ob_start(); |
2110 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2111 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2110 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2111 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2112 | 2112 | return TRUE; |
2113 | 2113 | |
2114 | 2114 | } |
@@ -2120,13 +2120,13 @@ discard block |
||
2120 | 2120 | <div id="espresso_news_post_box_content" class="infolinks"> |
2121 | 2121 | <?php |
2122 | 2122 | // Get RSS Feed(s) |
2123 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2123 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2124 | 2124 | $url = urlencode($feed_url); |
2125 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2125 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2126 | 2126 | |
2127 | 2127 | ?> |
2128 | 2128 | </div> |
2129 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2129 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2130 | 2130 | </div> |
2131 | 2131 | <?php |
2132 | 2132 | } |
@@ -2147,32 +2147,32 @@ discard block |
||
2147 | 2147 | |
2148 | 2148 | protected function _espresso_sponsors_post_box() { |
2149 | 2149 | |
2150 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2151 | - if ( $show_sponsors ) |
|
2152 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2150 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2151 | + if ($show_sponsors) |
|
2152 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2153 | 2153 | } |
2154 | 2154 | |
2155 | 2155 | |
2156 | 2156 | public function espresso_sponsors_post_box() { |
2157 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2158 | - EEH_Template::display_template( $templatepath ); |
|
2157 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2158 | + EEH_Template::display_template($templatepath); |
|
2159 | 2159 | } |
2160 | 2160 | |
2161 | 2161 | |
2162 | 2162 | |
2163 | 2163 | private function _publish_post_box() { |
2164 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2164 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2165 | 2165 | |
2166 | 2166 | //if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label. Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes) |
2167 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2168 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2167 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2168 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2169 | 2169 | } else { |
2170 | 2170 | $box_label = __('Publish', 'event_espresso'); |
2171 | 2171 | } |
2172 | 2172 | |
2173 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2173 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2174 | 2174 | |
2175 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2175 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2176 | 2176 | |
2177 | 2177 | } |
2178 | 2178 | |
@@ -2180,9 +2180,9 @@ discard block |
||
2180 | 2180 | |
2181 | 2181 | public function editor_overview() { |
2182 | 2182 | //if we have extra content set let's add it in if not make sure its empty |
2183 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2184 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2185 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2183 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2184 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2185 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2186 | 2186 | } |
2187 | 2187 | |
2188 | 2188 | |
@@ -2198,8 +2198,8 @@ discard block |
||
2198 | 2198 | * @see $this->_set_publish_post_box_vars for param details |
2199 | 2199 | * @since 4.6.0 |
2200 | 2200 | */ |
2201 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2202 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2201 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2202 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2203 | 2203 | } |
2204 | 2204 | |
2205 | 2205 | |
@@ -2227,17 +2227,17 @@ discard block |
||
2227 | 2227 | $both_btns = true |
2228 | 2228 | ) { |
2229 | 2229 | // if Save & Close, use a custom redirect URL or default to the main page? |
2230 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2230 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2231 | 2231 | // create the Save & Close and Save buttons |
2232 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2232 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2233 | 2233 | //if we have extra content set let's add it in if not make sure its empty |
2234 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2234 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2235 | 2235 | |
2236 | 2236 | |
2237 | - if ( $delete && ! empty( $id ) ) { |
|
2237 | + if ($delete && ! empty($id)) { |
|
2238 | 2238 | //make sure we have a default if just true is sent. |
2239 | 2239 | $delete = ! empty($delete) ? $delete : 'delete'; |
2240 | - $delete_link_args = array( $name => $id ); |
|
2240 | + $delete_link_args = array($name => $id); |
|
2241 | 2241 | $delete = $this->get_action_link_or_button( |
2242 | 2242 | $delete, |
2243 | 2243 | $delete, |
@@ -2248,8 +2248,8 @@ discard block |
||
2248 | 2248 | ); |
2249 | 2249 | } |
2250 | 2250 | |
2251 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2252 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2251 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2252 | + if ( ! empty($name) && ! empty($id)) { |
|
2253 | 2253 | $hidden_field_arr[$name] = array( |
2254 | 2254 | 'type' => 'hidden', |
2255 | 2255 | 'value' => $id |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | $hf = ''; |
2260 | 2260 | } |
2261 | 2261 | // add hidden field |
2262 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2262 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2263 | 2263 | |
2264 | 2264 | } |
2265 | 2265 | |
@@ -2276,8 +2276,8 @@ discard block |
||
2276 | 2276 | <noscript> |
2277 | 2277 | <div id="no-js-message" class="error"> |
2278 | 2278 | <p style="font-size:1.3em;"> |
2279 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2280 | - <?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?> |
|
2279 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2280 | + <?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?> |
|
2281 | 2281 | </p> |
2282 | 2282 | </div> |
2283 | 2283 | </noscript> |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | * @return string |
2298 | 2298 | */ |
2299 | 2299 | private function _display_espresso_notices() { |
2300 | - $notices = $this->_get_transient( TRUE ); |
|
2300 | + $notices = $this->_get_transient(TRUE); |
|
2301 | 2301 | echo stripslashes($notices); |
2302 | 2302 | } |
2303 | 2303 | |
@@ -2349,11 +2349,11 @@ discard block |
||
2349 | 2349 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2350 | 2350 | * @param boolean $create_func default is true. Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box. |
2351 | 2351 | */ |
2352 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2353 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2352 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2353 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2354 | 2354 | |
2355 | 2355 | //if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated. |
2356 | - if ( empty( $callback_args ) && $create_func ) { |
|
2356 | + if (empty($callback_args) && $create_func) { |
|
2357 | 2357 | $callback_args = array( |
2358 | 2358 | 'template_path' => $this->_template_path, |
2359 | 2359 | 'template_args' => $this->_template_args, |
@@ -2363,7 +2363,7 @@ discard block |
||
2363 | 2363 | //if $create_func is true (default) then we automatically create the function for displaying the actual meta box. If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish) |
2364 | 2364 | $call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback; |
2365 | 2365 | |
2366 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2366 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2367 | 2367 | } |
2368 | 2368 | |
2369 | 2369 | |
@@ -2376,7 +2376,7 @@ discard block |
||
2376 | 2376 | */ |
2377 | 2377 | public function display_admin_page_with_metabox_columns() { |
2378 | 2378 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2379 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2379 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2380 | 2380 | |
2381 | 2381 | //the final wrapper |
2382 | 2382 | $this->admin_page_wrapper(); |
@@ -2419,7 +2419,7 @@ discard block |
||
2419 | 2419 | * @return void |
2420 | 2420 | */ |
2421 | 2421 | public function display_about_admin_page() { |
2422 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2422 | + $this->_display_admin_page(FALSE, TRUE); |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | |
@@ -2435,26 +2435,26 @@ discard block |
||
2435 | 2435 | * @return void |
2436 | 2436 | */ |
2437 | 2437 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2438 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2438 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2439 | 2439 | |
2440 | 2440 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2441 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2441 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2442 | 2442 | |
2443 | 2443 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2444 | 2444 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2445 | 2445 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2446 | 2446 | |
2447 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2447 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2448 | 2448 | |
2449 | - if ( defined('DOING_AJAX' ) ) |
|
2450 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2449 | + if (defined('DOING_AJAX')) |
|
2450 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2451 | 2451 | |
2452 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2452 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2453 | 2453 | |
2454 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2454 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2455 | 2455 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2456 | 2456 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2457 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2457 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2458 | 2458 | |
2459 | 2459 | |
2460 | 2460 | // the final template wrapper |
@@ -2472,7 +2472,7 @@ discard block |
||
2472 | 2472 | * @return void |
2473 | 2473 | * @throws \EE_Error |
2474 | 2474 | */ |
2475 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2475 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2476 | 2476 | //let's generate a default preview action button if there isn't one already present. |
2477 | 2477 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2478 | 2478 | $buy_now_url = add_query_arg( |
@@ -2485,7 +2485,7 @@ discard block |
||
2485 | 2485 | ), |
2486 | 2486 | 'http://eventespresso.com/pricing/' |
2487 | 2487 | ); |
2488 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) |
|
2488 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) |
|
2489 | 2489 | ? $this->get_action_link_or_button( |
2490 | 2490 | '', |
2491 | 2491 | 'buy_now', |
@@ -2495,13 +2495,13 @@ discard block |
||
2495 | 2495 | true |
2496 | 2496 | ) |
2497 | 2497 | : $this->_template_args['preview_action_button']; |
2498 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2498 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2499 | 2499 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2500 | 2500 | $template_path, |
2501 | 2501 | $this->_template_args, |
2502 | 2502 | true |
2503 | 2503 | ); |
2504 | - $this->_display_admin_page( $display_sidebar ); |
|
2504 | + $this->_display_admin_page($display_sidebar); |
|
2505 | 2505 | } |
2506 | 2506 | |
2507 | 2507 | |
@@ -2535,49 +2535,49 @@ discard block |
||
2535 | 2535 | * @param boolean $sidebar whether to display with sidebar or not. |
2536 | 2536 | * @return void |
2537 | 2537 | */ |
2538 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2538 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2539 | 2539 | //setup search attributes |
2540 | 2540 | $this->_set_search_attributes(); |
2541 | 2541 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2542 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2542 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2543 | 2543 | |
2544 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') |
|
2545 | - ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) |
|
2546 | - : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2544 | + $this->_template_args['table_url'] = defined('DOING_AJAX') |
|
2545 | + ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) |
|
2546 | + : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2547 | 2547 | $this->_template_args['list_table'] = $this->_list_table_object; |
2548 | 2548 | $this->_template_args['current_route'] = $this->_req_action; |
2549 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2549 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2550 | 2550 | |
2551 | 2551 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2552 | - if( ! empty( $ajax_sorting_callback )) { |
|
2552 | + if ( ! empty($ajax_sorting_callback)) { |
|
2553 | 2553 | $sortable_list_table_form_fields = wp_nonce_field( |
2554 | - $ajax_sorting_callback . '_nonce', |
|
2555 | - $ajax_sorting_callback . '_nonce', |
|
2554 | + $ajax_sorting_callback.'_nonce', |
|
2555 | + $ajax_sorting_callback.'_nonce', |
|
2556 | 2556 | FALSE, |
2557 | 2557 | FALSE |
2558 | 2558 | ); |
2559 | 2559 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2560 | 2560 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2561 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2562 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2561 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2562 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2563 | 2563 | } else { |
2564 | 2564 | $sortable_list_table_form_fields = ''; |
2565 | 2565 | } |
2566 | 2566 | |
2567 | 2567 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2568 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2569 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2570 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2568 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2569 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2570 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2571 | 2571 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2572 | 2572 | |
2573 | 2573 | //display message about search results? |
2574 | 2574 | $this->_template_args['before_list_table'] .= apply_filters( |
2575 | 2575 | 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', |
2576 | - ! empty( $this->_req_data['s'] ) |
|
2577 | - ? '<p class="ee-search-results">' . sprintf( |
|
2578 | - __( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ), |
|
2579 | - trim( $this->_req_data['s'], '%' ) |
|
2580 | - ) . '</p>' |
|
2576 | + ! empty($this->_req_data['s']) |
|
2577 | + ? '<p class="ee-search-results">'.sprintf( |
|
2578 | + __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), |
|
2579 | + trim($this->_req_data['s'], '%') |
|
2580 | + ).'</p>' |
|
2581 | 2581 | : '', |
2582 | 2582 | $this->page_slug, |
2583 | 2583 | $this->_req_data, |
@@ -2589,7 +2589,7 @@ discard block |
||
2589 | 2589 | true |
2590 | 2590 | ); |
2591 | 2591 | // the final template wrapper |
2592 | - if ( $sidebar ) |
|
2592 | + if ($sidebar) |
|
2593 | 2593 | $this->display_admin_page_with_sidebar(); |
2594 | 2594 | else |
2595 | 2595 | $this->display_admin_page_with_no_sidebar(); |
@@ -2612,9 +2612,9 @@ discard block |
||
2612 | 2612 | * @param array $items see above for format of array |
2613 | 2613 | * @return string html string of legend |
2614 | 2614 | */ |
2615 | - protected function _display_legend( $items ) { |
|
2616 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2617 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2615 | + protected function _display_legend($items) { |
|
2616 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2617 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2618 | 2618 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2619 | 2619 | } |
2620 | 2620 | |
@@ -2639,33 +2639,33 @@ discard block |
||
2639 | 2639 | * |
2640 | 2640 | * @return void |
2641 | 2641 | */ |
2642 | - protected function _return_json( $sticky_notices = false ) { |
|
2642 | + protected function _return_json($sticky_notices = false) { |
|
2643 | 2643 | |
2644 | 2644 | //make sure any EE_Error notices have been handled. |
2645 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2645 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2646 | 2646 | |
2647 | 2647 | |
2648 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2648 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2649 | 2649 | unset($this->_template_args['data']); |
2650 | 2650 | $json = array( |
2651 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2652 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2653 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2654 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2651 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2652 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2653 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2654 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2655 | 2655 | 'notices' => EE_Error::get_notices(), |
2656 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2657 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2656 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2657 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2658 | 2658 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2659 | 2659 | ); |
2660 | 2660 | |
2661 | 2661 | |
2662 | 2662 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2663 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2663 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2664 | 2664 | header('Content-Type: application/json; charset=UTF-8'); |
2665 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2666 | - echo wp_json_encode( $json ); |
|
2665 | + if (function_exists('wp_json_encode')) { |
|
2666 | + echo wp_json_encode($json); |
|
2667 | 2667 | } else { |
2668 | - echo json_encode( $json ); |
|
2668 | + echo json_encode($json); |
|
2669 | 2669 | } |
2670 | 2670 | exit(); |
2671 | 2671 | } |
@@ -2679,11 +2679,11 @@ discard block |
||
2679 | 2679 | * @throws EE_Error |
2680 | 2680 | */ |
2681 | 2681 | public function return_json() { |
2682 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2682 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2683 | 2683 | $this->_return_json(); |
2684 | 2684 | |
2685 | 2685 | else { |
2686 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2686 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2687 | 2687 | } |
2688 | 2688 | } |
2689 | 2689 | |
@@ -2696,7 +2696,7 @@ discard block |
||
2696 | 2696 | * |
2697 | 2697 | * @access public |
2698 | 2698 | */ |
2699 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2699 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2700 | 2700 | $this->_hook_obj = $hook_obj; |
2701 | 2701 | } |
2702 | 2702 | |
@@ -2712,33 +2712,33 @@ discard block |
||
2712 | 2712 | */ |
2713 | 2713 | public function admin_page_wrapper($about = FALSE) { |
2714 | 2714 | |
2715 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2715 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2716 | 2716 | |
2717 | 2717 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2718 | 2718 | |
2719 | 2719 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2720 | 2720 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2721 | 2721 | |
2722 | - $this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2723 | - $this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2722 | + $this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2723 | + $this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2724 | 2724 | |
2725 | 2725 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2726 | 2726 | |
2727 | 2727 | |
2728 | 2728 | |
2729 | 2729 | // load settings page wrapper template |
2730 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2730 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2731 | 2731 | |
2732 | 2732 | //about page? |
2733 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2733 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2734 | 2734 | |
2735 | 2735 | |
2736 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2737 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2736 | + if (defined('DOING_AJAX')) { |
|
2737 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2738 | 2738 | |
2739 | 2739 | $this->_return_json(); |
2740 | 2740 | } else { |
2741 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2741 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2742 | 2742 | } |
2743 | 2743 | |
2744 | 2744 | } |
@@ -2764,7 +2764,7 @@ discard block |
||
2764 | 2764 | * @param $b |
2765 | 2765 | * @return int |
2766 | 2766 | */ |
2767 | - private function _sort_nav_tabs( $a, $b ) { |
|
2767 | + private function _sort_nav_tabs($a, $b) { |
|
2768 | 2768 | if ($a['order'] == $b['order']) { |
2769 | 2769 | return 0; |
2770 | 2770 | } |
@@ -2784,7 +2784,7 @@ discard block |
||
2784 | 2784 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2785 | 2785 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2786 | 2786 | */ |
2787 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2787 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2788 | 2788 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2789 | 2789 | return $content; |
2790 | 2790 | } |
@@ -2806,25 +2806,25 @@ discard block |
||
2806 | 2806 | * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button). We can also use this to just dump default actions by submitting some other value. |
2807 | 2807 | * @param bool|string|null $referrer if false then we just do the default action on save and close. Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling). |
2808 | 2808 | */ |
2809 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2809 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2810 | 2810 | //make sure $text and $actions are in an array |
2811 | 2811 | $text = (array) $text; |
2812 | 2812 | $actions = (array) $actions; |
2813 | 2813 | $referrer_url = empty($referrer) ? '' : $referrer; |
2814 | - $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />'; |
|
2814 | + $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />'; |
|
2815 | 2815 | |
2816 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2817 | - $default_names = array( 'save', 'save_and_close' ); |
|
2816 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2817 | + $default_names = array('save', 'save_and_close'); |
|
2818 | 2818 | |
2819 | 2819 | //add in a hidden index for the current page (so save and close redirects properly) |
2820 | 2820 | $this->_template_args['save_buttons'] = $referrer_url; |
2821 | 2821 | |
2822 | - foreach ( $button_text as $key => $button ) { |
|
2822 | + foreach ($button_text as $key => $button) { |
|
2823 | 2823 | $ref = $default_names[$key]; |
2824 | - $id = $this->_current_view . '_' . $ref; |
|
2825 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2826 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2827 | - if ( !$both ) break; |
|
2824 | + $id = $this->_current_view.'_'.$ref; |
|
2825 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2826 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2827 | + if ( ! $both) break; |
|
2828 | 2828 | } |
2829 | 2829 | |
2830 | 2830 | } |
@@ -2839,8 +2839,8 @@ discard block |
||
2839 | 2839 | * @param string $route |
2840 | 2840 | * @param array $additional_hidden_fields |
2841 | 2841 | */ |
2842 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2843 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2842 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2843 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2844 | 2844 | } |
2845 | 2845 | |
2846 | 2846 | |
@@ -2853,30 +2853,30 @@ discard block |
||
2853 | 2853 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2854 | 2854 | * @return void |
2855 | 2855 | */ |
2856 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2856 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2857 | 2857 | |
2858 | - if ( empty( $route )) { |
|
2858 | + if (empty($route)) { |
|
2859 | 2859 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2860 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2861 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2860 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2861 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2862 | 2862 | } |
2863 | 2863 | // open form |
2864 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2864 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2865 | 2865 | // add nonce |
2866 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2866 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2867 | 2867 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2868 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2868 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2869 | 2869 | // add REQUIRED form action |
2870 | 2870 | $hidden_fields = array( |
2871 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2871 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2872 | 2872 | ); |
2873 | 2873 | // merge arrays |
2874 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2874 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2875 | 2875 | // generate form fields |
2876 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2876 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2877 | 2877 | // add fields to form |
2878 | - foreach ( (array)$form_fields as $field_name => $form_field ) { |
|
2879 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2878 | + foreach ((array) $form_fields as $field_name => $form_field) { |
|
2879 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2880 | 2880 | } |
2881 | 2881 | |
2882 | 2882 | // close form |
@@ -2893,8 +2893,8 @@ discard block |
||
2893 | 2893 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2894 | 2894 | * @since 4.5.0 |
2895 | 2895 | */ |
2896 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2897 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2896 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2897 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2898 | 2898 | } |
2899 | 2899 | |
2900 | 2900 | |
@@ -2910,38 +2910,38 @@ discard block |
||
2910 | 2910 | * @access protected |
2911 | 2911 | * @return void |
2912 | 2912 | */ |
2913 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2913 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2914 | 2914 | |
2915 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2915 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2916 | 2916 | |
2917 | 2917 | //class name for actions/filters. |
2918 | 2918 | $classname = get_class($this); |
2919 | 2919 | |
2920 | 2920 | //set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url |
2921 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2922 | - $notices = EE_Error::get_notices( FALSE ); |
|
2921 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2922 | + $notices = EE_Error::get_notices(FALSE); |
|
2923 | 2923 | |
2924 | 2924 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2925 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2925 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2926 | 2926 | EE_Error::overwrite_success(); |
2927 | 2927 | } |
2928 | - if ( ! empty( $what ) && ! empty( $action_desc ) ) { |
|
2928 | + if ( ! empty($what) && ! empty($action_desc)) { |
|
2929 | 2929 | // how many records affected ? more than one record ? or just one ? |
2930 | - if ( $success > 1 && empty( $notices[ 'errors' ] ) ) { |
|
2930 | + if ($success > 1 && empty($notices['errors'])) { |
|
2931 | 2931 | // set plural msg |
2932 | 2932 | EE_Error::add_success( |
2933 | 2933 | sprintf( |
2934 | - __( 'The "%s" have been successfully %s.', 'event_espresso' ), |
|
2934 | + __('The "%s" have been successfully %s.', 'event_espresso'), |
|
2935 | 2935 | $what, |
2936 | 2936 | $action_desc |
2937 | 2937 | ), |
2938 | 2938 | __FILE__, __FUNCTION__, __LINE__ |
2939 | 2939 | ); |
2940 | - } else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) { |
|
2940 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2941 | 2941 | // set singular msg |
2942 | 2942 | EE_Error::add_success( |
2943 | 2943 | sprintf( |
2944 | - __( 'The "%s" has been successfully %s.', 'event_espresso' ), |
|
2944 | + __('The "%s" has been successfully %s.', 'event_espresso'), |
|
2945 | 2945 | $what, |
2946 | 2946 | $action_desc |
2947 | 2947 | ), |
@@ -2950,7 +2950,7 @@ discard block |
||
2950 | 2950 | } |
2951 | 2951 | } |
2952 | 2952 | // check that $query_args isn't something crazy |
2953 | - if ( ! is_array( $query_args )) { |
|
2953 | + if ( ! is_array($query_args)) { |
|
2954 | 2954 | $query_args = array(); |
2955 | 2955 | } |
2956 | 2956 | |
@@ -2963,36 +2963,36 @@ discard block |
||
2963 | 2963 | * @param array $query_args The original query_args array coming into the |
2964 | 2964 | * method. |
2965 | 2965 | */ |
2966 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2966 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2967 | 2967 | |
2968 | 2968 | //calculate where we're going (if we have a "save and close" button pushed) |
2969 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2969 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2970 | 2970 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2971 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2971 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2972 | 2972 | // regenerate query args array from referrer URL |
2973 | - parse_str( $parsed_url['query'], $query_args ); |
|
2973 | + parse_str($parsed_url['query'], $query_args); |
|
2974 | 2974 | // correct page and action will be in the query args now |
2975 | - $redirect_url = admin_url( 'admin.php' ); |
|
2975 | + $redirect_url = admin_url('admin.php'); |
|
2976 | 2976 | } |
2977 | 2977 | |
2978 | 2978 | //merge any default query_args set in _default_route_query_args property |
2979 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2979 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2980 | 2980 | $args_to_merge = array(); |
2981 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2981 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2982 | 2982 | //is there a wp_referer array in our _default_route_query_args property? |
2983 | - if ( $query_param == 'wp_referer' ) { |
|
2983 | + if ($query_param == 'wp_referer') { |
|
2984 | 2984 | $query_value = (array) $query_value; |
2985 | - foreach ( $query_value as $reference => $value ) { |
|
2986 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2985 | + foreach ($query_value as $reference => $value) { |
|
2986 | + if (strpos($reference, 'nonce') !== false) { |
|
2987 | 2987 | continue; |
2988 | 2988 | } |
2989 | 2989 | |
2990 | 2990 | //finally we will override any arguments in the referer with |
2991 | 2991 | //what might be set on the _default_route_query_args array. |
2992 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2993 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2992 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2993 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2994 | 2994 | } else { |
2995 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2995 | + $args_to_merge[$reference] = urlencode($value); |
|
2996 | 2996 | } |
2997 | 2997 | } |
2998 | 2998 | continue; |
@@ -3003,7 +3003,7 @@ discard block |
||
3003 | 3003 | |
3004 | 3004 | //now let's merge these arguments but override with what was specifically sent in to the |
3005 | 3005 | //redirect. |
3006 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
3006 | + $query_args = array_merge($args_to_merge, $query_args); |
|
3007 | 3007 | } |
3008 | 3008 | |
3009 | 3009 | $this->_process_notices($query_args); |
@@ -3012,19 +3012,19 @@ discard block |
||
3012 | 3012 | // generate redirect url |
3013 | 3013 | |
3014 | 3014 | // if redirecting to anything other than the main page, add a nonce |
3015 | - if ( isset( $query_args['action'] )) { |
|
3015 | + if (isset($query_args['action'])) { |
|
3016 | 3016 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
3017 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
3017 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
3018 | 3018 | } |
3019 | 3019 | |
3020 | 3020 | //we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that). |
3021 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
3021 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
3022 | 3022 | |
3023 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
3023 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
3024 | 3024 | |
3025 | 3025 | |
3026 | 3026 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
3027 | - if ( defined('DOING_AJAX' ) ) { |
|
3027 | + if (defined('DOING_AJAX')) { |
|
3028 | 3028 | $default_data = array( |
3029 | 3029 | 'close' => TRUE, |
3030 | 3030 | 'redirect_url' => $redirect_url, |
@@ -3033,11 +3033,11 @@ discard block |
||
3033 | 3033 | ); |
3034 | 3034 | |
3035 | 3035 | $this->_template_args['success'] = $success; |
3036 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
3036 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
3037 | 3037 | $this->_return_json(); |
3038 | 3038 | } |
3039 | 3039 | |
3040 | - wp_safe_redirect( $redirect_url ); |
|
3040 | + wp_safe_redirect($redirect_url); |
|
3041 | 3041 | exit(); |
3042 | 3042 | } |
3043 | 3043 | |
@@ -3053,30 +3053,30 @@ discard block |
||
3053 | 3053 | * @param bool $sticky_notices This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice. |
3054 | 3054 | * @return void |
3055 | 3055 | */ |
3056 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
3056 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
3057 | 3057 | |
3058 | 3058 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
3059 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
3060 | - $notices = EE_Error::get_notices( false ); |
|
3061 | - if ( empty( $this->_template_args['success'] ) ) { |
|
3062 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
3059 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
3060 | + $notices = EE_Error::get_notices(false); |
|
3061 | + if (empty($this->_template_args['success'])) { |
|
3062 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
3063 | 3063 | } |
3064 | 3064 | |
3065 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
3066 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
3065 | + if (empty($this->_template_args['errors'])) { |
|
3066 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
3067 | 3067 | } |
3068 | 3068 | |
3069 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
3070 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
3069 | + if (empty($this->_template_args['attention'])) { |
|
3070 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
3071 | 3071 | } |
3072 | 3072 | } |
3073 | 3073 | |
3074 | 3074 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3075 | 3075 | |
3076 | 3076 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3077 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3078 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3079 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3077 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3078 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3079 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3080 | 3080 | } |
3081 | 3081 | } |
3082 | 3082 | |
@@ -3106,7 +3106,7 @@ discard block |
||
3106 | 3106 | $exclude_nonce = false |
3107 | 3107 | ) { |
3108 | 3108 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3109 | - if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) { |
|
3109 | + if (empty($base_url) && ! isset($this->_page_routes[$action])) { |
|
3110 | 3110 | throw new EE_Error( |
3111 | 3111 | sprintf( |
3112 | 3112 | __( |
@@ -3117,7 +3117,7 @@ discard block |
||
3117 | 3117 | ) |
3118 | 3118 | ); |
3119 | 3119 | } |
3120 | - if ( ! isset( $this->_labels['buttons'][ $type ] ) ) { |
|
3120 | + if ( ! isset($this->_labels['buttons'][$type])) { |
|
3121 | 3121 | throw new EE_Error( |
3122 | 3122 | sprintf( |
3123 | 3123 | __( |
@@ -3129,8 +3129,8 @@ discard block |
||
3129 | 3129 | ); |
3130 | 3130 | } |
3131 | 3131 | //finally check user access for this button. |
3132 | - $has_access = $this->check_user_access( $action, true ); |
|
3133 | - if ( ! $has_access ) { |
|
3132 | + $has_access = $this->check_user_access($action, true); |
|
3133 | + if ( ! $has_access) { |
|
3134 | 3134 | return ''; |
3135 | 3135 | } |
3136 | 3136 | $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
@@ -3138,11 +3138,11 @@ discard block |
||
3138 | 3138 | 'action' => $action |
3139 | 3139 | ); |
3140 | 3140 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3141 | - if ( ! empty( $extra_request ) ) { |
|
3142 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3141 | + if ( ! empty($extra_request)) { |
|
3142 | + $query_args = array_merge($extra_request, $query_args); |
|
3143 | 3143 | } |
3144 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3145 | - return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class ); |
|
3144 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3145 | + return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3146 | 3146 | } |
3147 | 3147 | |
3148 | 3148 | |
@@ -3157,11 +3157,11 @@ discard block |
||
3157 | 3157 | $args = array( |
3158 | 3158 | 'label' => $this->_admin_page_title, |
3159 | 3159 | 'default' => 10, |
3160 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3160 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3161 | 3161 | ); |
3162 | 3162 | //ONLY add the screen option if the user has access to it. |
3163 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3164 | - add_screen_option( $option, $args ); |
|
3163 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3164 | + add_screen_option($option, $args); |
|
3165 | 3165 | } |
3166 | 3166 | } |
3167 | 3167 | |
@@ -3177,36 +3177,36 @@ discard block |
||
3177 | 3177 | * @return void |
3178 | 3178 | */ |
3179 | 3179 | private function _set_per_page_screen_options() { |
3180 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3181 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3180 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3181 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3182 | 3182 | |
3183 | - if ( !$user = wp_get_current_user() ) |
|
3183 | + if ( ! $user = wp_get_current_user()) |
|
3184 | 3184 | return; |
3185 | 3185 | $option = $_POST['wp_screen_options']['option']; |
3186 | 3186 | $value = $_POST['wp_screen_options']['value']; |
3187 | 3187 | |
3188 | - if ( $option != sanitize_key( $option ) ) |
|
3188 | + if ($option != sanitize_key($option)) |
|
3189 | 3189 | return; |
3190 | 3190 | |
3191 | 3191 | $map_option = $option; |
3192 | 3192 | |
3193 | 3193 | $option = str_replace('-', '_', $option); |
3194 | 3194 | |
3195 | - switch ( $map_option ) { |
|
3196 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3195 | + switch ($map_option) { |
|
3196 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3197 | 3197 | $value = (int) $value; |
3198 | - if ( $value < 1 || $value > 999 ) |
|
3198 | + if ($value < 1 || $value > 999) |
|
3199 | 3199 | return; |
3200 | 3200 | break; |
3201 | 3201 | default: |
3202 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3203 | - if ( false === $value ) |
|
3202 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3203 | + if (false === $value) |
|
3204 | 3204 | return; |
3205 | 3205 | break; |
3206 | 3206 | } |
3207 | 3207 | |
3208 | 3208 | update_user_meta($user->ID, $option, $value); |
3209 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3209 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3210 | 3210 | exit; |
3211 | 3211 | } |
3212 | 3212 | } |
@@ -3217,8 +3217,8 @@ discard block |
||
3217 | 3217 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3218 | 3218 | * @param array $data array that will be assigned to template args. |
3219 | 3219 | */ |
3220 | - public function set_template_args( $data ) { |
|
3221 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3220 | + public function set_template_args($data) { |
|
3221 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3222 | 3222 | } |
3223 | 3223 | |
3224 | 3224 | |
@@ -3234,26 +3234,26 @@ discard block |
||
3234 | 3234 | * @param bool $skip_route_verify Used to indicate we want to skip route verification. This is usually ONLY used when we are adding a transient before page_routes have been defined. |
3235 | 3235 | * @return void |
3236 | 3236 | */ |
3237 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3237 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3238 | 3238 | $user_id = get_current_user_id(); |
3239 | 3239 | |
3240 | - if ( !$skip_route_verify ) |
|
3240 | + if ( ! $skip_route_verify) |
|
3241 | 3241 | $this->_verify_route($route); |
3242 | 3242 | |
3243 | 3243 | |
3244 | 3244 | //now let's set the string for what kind of transient we're setting |
3245 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3246 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3245 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3246 | + $data = $notices ? array('notices' => $data) : $data; |
|
3247 | 3247 | //is there already a transient for this route? If there is then let's ADD to that transient |
3248 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3249 | - if ( $existing ) { |
|
3250 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3248 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3249 | + if ($existing) { |
|
3250 | + $data = array_merge((array) $data, (array) $existing); |
|
3251 | 3251 | } |
3252 | 3252 | |
3253 | - if ( is_multisite() && is_network_admin() ) { |
|
3254 | - set_site_transient( $transient, $data, 8 ); |
|
3253 | + if (is_multisite() && is_network_admin()) { |
|
3254 | + set_site_transient($transient, $data, 8); |
|
3255 | 3255 | } else { |
3256 | - set_transient( $transient, $data, 8 ); |
|
3256 | + set_transient($transient, $data, 8); |
|
3257 | 3257 | } |
3258 | 3258 | } |
3259 | 3259 | |
@@ -3265,18 +3265,18 @@ discard block |
||
3265 | 3265 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3266 | 3266 | * @return mixed data |
3267 | 3267 | */ |
3268 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3268 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3269 | 3269 | $user_id = get_current_user_id(); |
3270 | - $route = !$route ? $this->_req_action : $route; |
|
3271 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3272 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3270 | + $route = ! $route ? $this->_req_action : $route; |
|
3271 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3272 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3273 | 3273 | //delete transient after retrieval (just in case it hasn't expired); |
3274 | - if ( is_multisite() && is_network_admin() ) { |
|
3275 | - delete_site_transient( $transient ); |
|
3274 | + if (is_multisite() && is_network_admin()) { |
|
3275 | + delete_site_transient($transient); |
|
3276 | 3276 | } else { |
3277 | - delete_transient( $transient ); |
|
3277 | + delete_transient($transient); |
|
3278 | 3278 | } |
3279 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3279 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3280 | 3280 | } |
3281 | 3281 | |
3282 | 3282 | |
@@ -3293,12 +3293,12 @@ discard block |
||
3293 | 3293 | |
3294 | 3294 | //retrieve all existing transients |
3295 | 3295 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3296 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3297 | - foreach ( $results as $result ) { |
|
3298 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3299 | - get_transient( $transient ); |
|
3300 | - if ( is_multisite() && is_network_admin() ) { |
|
3301 | - get_site_transient( $transient ); |
|
3296 | + if ($results = $wpdb->get_results($query)) { |
|
3297 | + foreach ($results as $result) { |
|
3298 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3299 | + get_transient($transient); |
|
3300 | + if (is_multisite() && is_network_admin()) { |
|
3301 | + get_site_transient($transient); |
|
3302 | 3302 | } |
3303 | 3303 | } |
3304 | 3304 | } |
@@ -3448,23 +3448,23 @@ discard block |
||
3448 | 3448 | * @param string $line line no where error occurred |
3449 | 3449 | * @return boolean |
3450 | 3450 | */ |
3451 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3451 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3452 | 3452 | |
3453 | 3453 | //remove any options that are NOT going to be saved with the config settings. |
3454 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3454 | + if (isset($config->core->ee_ueip_optin)) { |
|
3455 | 3455 | $config->core->ee_ueip_has_notified = TRUE; |
3456 | 3456 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3457 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3458 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3457 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3458 | + update_option('ee_ueip_has_notified', TRUE); |
|
3459 | 3459 | } |
3460 | 3460 | // and save it (note we're also doing the network save here) |
3461 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3462 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3463 | - if ( $config_saved && $net_saved ) { |
|
3464 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3461 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3462 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3463 | + if ($config_saved && $net_saved) { |
|
3464 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3465 | 3465 | return TRUE; |
3466 | 3466 | } else { |
3467 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3467 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3468 | 3468 | return FALSE; |
3469 | 3469 | } |
3470 | 3470 | } |
@@ -3477,7 +3477,7 @@ discard block |
||
3477 | 3477 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3478 | 3478 | * @return array |
3479 | 3479 | */ |
3480 | - public function get_yes_no_values(){ |
|
3480 | + public function get_yes_no_values() { |
|
3481 | 3481 | return $this->_yes_no_values; |
3482 | 3482 | } |
3483 | 3483 | |
@@ -3499,8 +3499,8 @@ discard block |
||
3499 | 3499 | * |
3500 | 3500 | * @return string |
3501 | 3501 | */ |
3502 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3503 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3502 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3503 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3504 | 3504 | } |
3505 | 3505 | |
3506 | 3506 | |
@@ -3514,8 +3514,8 @@ discard block |
||
3514 | 3514 | * |
3515 | 3515 | * @return string |
3516 | 3516 | */ |
3517 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3518 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3517 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3518 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3519 | 3519 | } |
3520 | 3520 | |
3521 | 3521 | |
@@ -3534,8 +3534,8 @@ discard block |
||
3534 | 3534 | * @return bool success/fail |
3535 | 3535 | */ |
3536 | 3536 | protected function _process_resend_registration() { |
3537 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3538 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3537 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3538 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3539 | 3539 | return $this->_template_args['success']; |
3540 | 3540 | } |
3541 | 3541 | |
@@ -3548,11 +3548,11 @@ discard block |
||
3548 | 3548 | * @param \EE_Payment $payment |
3549 | 3549 | * @return bool success/fail |
3550 | 3550 | */ |
3551 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3552 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3553 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3554 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3555 | - return $this->_template_args[ 'success' ]; |
|
3551 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3552 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3553 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3554 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3555 | + return $this->_template_args['success']; |
|
3556 | 3556 | } |
3557 | 3557 | |
3558 | 3558 |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @access private |
117 | 117 | * @param EE_Transaction $transaction |
118 | 118 | * @param bool $update_txn |
119 | - * @return bool true if TXN total was updated, false if not |
|
119 | + * @return boolean|null true if TXN total was updated, false if not |
|
120 | 120 | * @throws \EE_Error |
121 | 121 | */ |
122 | 122 | public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @param EE_Transaction $transaction |
189 | 189 | * @param string $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved). |
190 | 190 | * By default, searches for approved payments |
191 | - * @return float|false float on success, false on fail |
|
191 | + * @return double float on success, false on fail |
|
192 | 192 | * @throws \EE_Error |
193 | 193 | */ |
194 | 194 | public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Payments |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | 46 | // check if class object is instantiated |
47 | - if ( ! self::$_instance instanceof EE_Transaction_Payments ) { |
|
47 | + if ( ! self::$_instance instanceof EE_Transaction_Payments) { |
|
48 | 48 | self::$_instance = new self(); |
49 | 49 | } |
50 | 50 | return self::$_instance; |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param string $old_txn_status |
74 | 74 | */ |
75 | - public function set_old_txn_status( $old_txn_status ) { |
|
75 | + public function set_old_txn_status($old_txn_status) { |
|
76 | 76 | // only set the first time |
77 | - if ( $this->_old_txn_status === null ) { |
|
77 | + if ($this->_old_txn_status === null) { |
|
78 | 78 | $this->_old_txn_status = $old_txn_status; |
79 | 79 | } |
80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $new_txn_status |
95 | 95 | */ |
96 | - public function set_new_txn_status( $new_txn_status ) { |
|
96 | + public function set_new_txn_status($new_txn_status) { |
|
97 | 97 | $this->_new_txn_status = $new_txn_status; |
98 | 98 | } |
99 | 99 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return bool |
106 | 106 | */ |
107 | 107 | public function txn_status_updated() { |
108 | - return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
108 | + return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -119,18 +119,18 @@ discard block |
||
119 | 119 | * @return bool true if TXN total was updated, false if not |
120 | 120 | * @throws \EE_Error |
121 | 121 | */ |
122 | - public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) { |
|
122 | + public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) { |
|
123 | 123 | $total_line_item = $transaction->total_line_item(); |
124 | - if ( ! $total_line_item instanceof EE_Line_Item ) { |
|
124 | + if ( ! $total_line_item instanceof EE_Line_Item) { |
|
125 | 125 | EE_Error::add_error( |
126 | - sprintf( __( 'The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso' ), $transaction->ID() ), |
|
126 | + sprintf(__('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), $transaction->ID()), |
|
127 | 127 | __FILE__, __FUNCTION__, __LINE__ |
128 | 128 | ); |
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | $new_total = $total_line_item->recalculate_total_including_taxes(); |
132 | - $transaction->set_total( $new_total ); |
|
133 | - if ( $update_txn ) { |
|
132 | + $transaction->set_total($new_total); |
|
133 | + if ($update_txn) { |
|
134 | 134 | return $transaction->save() ? true : false; |
135 | 135 | } |
136 | 136 | } |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | * @return boolean whether the TXN was saved |
153 | 153 | * @throws \EE_Error |
154 | 154 | */ |
155 | - public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){ |
|
155 | + public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) { |
|
156 | 156 | // verify transaction |
157 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
158 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
157 | + if ( ! $transaction instanceof EE_Transaction) { |
|
158 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
159 | 159 | return false; |
160 | 160 | } |
161 | 161 | // set incoming TXN_Status |
162 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
162 | + $this->set_old_txn_status($transaction->status_ID()); |
|
163 | 163 | // calculate total paid |
164 | - $total_paid = $this->recalculate_total_payments_for_transaction( $transaction ); |
|
164 | + $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
165 | 165 | // if total paid has changed |
166 | - if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) { |
|
167 | - $transaction->set_paid( $total_paid ); |
|
166 | + if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) { |
|
167 | + $transaction->set_paid($total_paid); |
|
168 | 168 | // maybe update status, and make sure to save transaction if not done already |
169 | - if ( ! $transaction->update_status_based_on_total_paid( $update_txn ) ) { |
|
170 | - if ( $update_txn ) { |
|
169 | + if ( ! $transaction->update_status_based_on_total_paid($update_txn)) { |
|
170 | + if ($update_txn) { |
|
171 | 171 | return $transaction->save() ? true : false; |
172 | 172 | } |
173 | 173 | } else { |
@@ -191,18 +191,18 @@ discard block |
||
191 | 191 | * @return float|false float on success, false on fail |
192 | 192 | * @throws \EE_Error |
193 | 193 | */ |
194 | - public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
|
194 | + public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) { |
|
195 | 195 | // verify transaction |
196 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
197 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
196 | + if ( ! $transaction instanceof EE_Transaction) { |
|
197 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | // ensure Payment model is loaded |
201 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
201 | + EE_Registry::instance()->load_model('Payment'); |
|
202 | 202 | // calls EEM_Base::sum() |
203 | 203 | return EEM_Payment::instance()->sum( |
204 | 204 | // query params |
205 | - array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )), |
|
205 | + array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
206 | 206 | // field to sum |
207 | 207 | 'PAY_amount' |
208 | 208 | ); |
@@ -220,17 +220,17 @@ discard block |
||
220 | 220 | * @return boolean |
221 | 221 | * @throws \EE_Error |
222 | 222 | */ |
223 | - public function delete_payment_and_update_transaction( EE_Payment $payment ) { |
|
223 | + public function delete_payment_and_update_transaction(EE_Payment $payment) { |
|
224 | 224 | // verify payment |
225 | - if ( ! $payment instanceof EE_Payment ) { |
|
226 | - EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
225 | + if ( ! $payment instanceof EE_Payment) { |
|
226 | + EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
227 | 227 | return false; |
228 | 228 | } |
229 | - if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) { |
|
229 | + if ( ! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
230 | 230 | return false; |
231 | 231 | } |
232 | - if ( ! $payment->delete() ) { |
|
233 | - EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
232 | + if ( ! $payment->delete()) { |
|
233 | + EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
234 | 234 | return false; |
235 | 235 | } |
236 | 236 | |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | || $TXN_status === EEM_Transaction::failed_status_code |
242 | 242 | || $payment->amount() === 0 |
243 | 243 | ) { |
244 | - EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) ); |
|
244 | + EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso')); |
|
245 | 245 | return true; |
246 | 246 | } |
247 | 247 | |
248 | 248 | |
249 | 249 | //if this fails, that just means that the transaction didn't get its status changed and/or updated. |
250 | 250 | //however the payment was still deleted. |
251 | - if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) { |
|
251 | + if ( ! $this->calculate_total_payments_and_update_status($transaction)) { |
|
252 | 252 | |
253 | 253 | EE_Error::add_attention( |
254 | 254 | __( |
@@ -282,28 +282,28 @@ discard block |
||
282 | 282 | * @return bool |
283 | 283 | * @throws \EE_Error |
284 | 284 | */ |
285 | - public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) { |
|
285 | + public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) { |
|
286 | 286 | $save_payment = false; |
287 | - $reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) ); |
|
288 | - $registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params ); |
|
289 | - if ( ! empty( $registration_payments )) { |
|
290 | - foreach ( $registration_payments as $registration_payment ) { |
|
291 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
287 | + $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID())); |
|
288 | + $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
|
289 | + if ( ! empty($registration_payments)) { |
|
290 | + foreach ($registration_payments as $registration_payment) { |
|
291 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
292 | 292 | $amount_paid = $registration_payment->amount(); |
293 | 293 | $registration = $registration_payment->registration(); |
294 | - if ( $registration instanceof EE_Registration ) { |
|
295 | - $registration->set_paid( $registration->paid() - $amount_paid ); |
|
296 | - if ( $registration->save() ) { |
|
297 | - if ( $registration_payment->delete() ) { |
|
298 | - $registration->_remove_relation_to( $payment, 'Payment' ); |
|
299 | - $payment->_remove_relation_to( $registration, 'Registration' ); |
|
294 | + if ($registration instanceof EE_Registration) { |
|
295 | + $registration->set_paid($registration->paid() - $amount_paid); |
|
296 | + if ($registration->save()) { |
|
297 | + if ($registration_payment->delete()) { |
|
298 | + $registration->_remove_relation_to($payment, 'Payment'); |
|
299 | + $payment->_remove_relation_to($registration, 'Registration'); |
|
300 | 300 | } |
301 | 301 | $save_payment = true; |
302 | 302 | } |
303 | 303 | } else { |
304 | 304 | EE_Error::add_error( |
305 | 305 | sprintf( |
306 | - __( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ), |
|
306 | + __('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'), |
|
307 | 307 | $registration_payment->ID() |
308 | 308 | ), |
309 | 309 | __FILE__, __FUNCTION__, __LINE__ |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } else { |
314 | 314 | EE_Error::add_error( |
315 | 315 | sprintf( |
316 | - __( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ), |
|
316 | + __('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'), |
|
317 | 317 | $payment->ID() |
318 | 318 | ), |
319 | 319 | __FILE__, __FUNCTION__, __LINE__ |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |
325 | - if ( $save_payment ) { |
|
325 | + if ($save_payment) { |
|
326 | 326 | $payment->save(); |
327 | 327 | } |
328 | 328 | return true; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true) |
343 | 343 | { |
344 | 344 | EE_Error::doing_it_wrong( |
345 | - __CLASS__ . '::' . __FUNCTION__, |
|
345 | + __CLASS__.'::'.__FUNCTION__, |
|
346 | 346 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
347 | 347 | 'EE_Transaction::update_status_based_on_total_paid()'), |
348 | 348 | '4.9.1', |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | |
164 | 164 | /** |
165 | 165 | * grab url requests and route them |
166 | - * @access private |
|
167 | - * @return void |
|
168 | - */ |
|
166 | + * @access private |
|
167 | + * @return void |
|
168 | + */ |
|
169 | 169 | public function _set_page_routes() { |
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'title' => __('Registrations Other', 'event_espresso'), |
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | - ), |
|
440 | + ), |
|
441 | 441 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | : $this->_admin_base_url, |
457 | 457 | 'persistent' => FALSE |
458 | 458 | ), |
459 | - 'help_tabs' => array( |
|
459 | + 'help_tabs' => array( |
|
460 | 460 | 'registrations_details_help_tab' => array( |
461 | 461 | 'title' => __('Registration Details', 'event_espresso'), |
462 | 462 | 'filename' => 'registrations_details' |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | 'order' => 20 |
521 | 521 | ), |
522 | 522 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
523 | - 'help_tabs' => array( |
|
523 | + 'help_tabs' => array( |
|
524 | 524 | 'registrations_contact_list_help_tab' => array( |
525 | 525 | 'title' => __('Registrations Contact List', 'event_espresso'), |
526 | 526 | 'filename' => 'registrations_contact_list' |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | 'title' => __('Contact List Other', 'event_espresso'), |
538 | 538 | 'filename' => 'registrations_contact_list_other' |
539 | 539 | ) |
540 | - ), |
|
540 | + ), |
|
541 | 541 | 'help_tour' => array( 'Contact_List_Help_Tour' ), |
542 | 542 | 'metaboxes' => array(), |
543 | 543 | 'require_nonce' => FALSE |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | |
572 | 572 | /** |
573 | 573 | * get list of registration statuses |
574 | - * @access private |
|
575 | - * @return void |
|
576 | - */ |
|
574 | + * @access private |
|
575 | + * @return void |
|
576 | + */ |
|
577 | 577 | private function _get_registration_status_array() { |
578 | 578 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
579 | 579 | } |
@@ -865,8 +865,8 @@ discard block |
||
865 | 865 | |
866 | 866 | |
867 | 867 | /** |
868 | - * @throws \EE_Error |
|
869 | - */ |
|
868 | + * @throws \EE_Error |
|
869 | + */ |
|
870 | 870 | protected function _registrations_overview_list_table() { |
871 | 871 | $this->_template_args['admin_page_header'] = ''; |
872 | 872 | $EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0; |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | return TRUE; |
927 | 927 | } |
928 | 928 | |
929 | - $REG = EEM_Registration::instance(); |
|
929 | + $REG = EEM_Registration::instance(); |
|
930 | 930 | |
931 | 931 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
932 | 932 | |
@@ -1150,9 +1150,9 @@ discard block |
||
1150 | 1150 | |
1151 | 1151 | /** |
1152 | 1152 | * generates HTML for the View Registration Details Admin page |
1153 | - * @access protected |
|
1154 | - * @return void |
|
1155 | - */ |
|
1153 | + * @access protected |
|
1154 | + * @return void |
|
1155 | + */ |
|
1156 | 1156 | protected function _registration_details() { |
1157 | 1157 | |
1158 | 1158 | $this->_template_args = array(); |
@@ -1325,16 +1325,16 @@ discard block |
||
1325 | 1325 | // 'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ), |
1326 | 1326 | //); |
1327 | 1327 | //Approved |
1328 | - //An approved registration allows payments and may have a transaction status of incomplete or complete . The registration is marked as active and a space is reserved for the registrant . |
|
1328 | + //An approved registration allows payments and may have a transaction status of incomplete or complete . The registration is marked as active and a space is reserved for the registrant . |
|
1329 | 1329 | //Cancelled |
1330 | 1330 | // A { |
1331 | 1331 | // cancelled} registration is performed by the registrant . Payments are not allowed, the registration is inactive, and no space is reserved . |
1332 | 1332 | //Declined |
1333 | - //A declined registration is performed by the event admin . Payments are not allowed, the registration is inactive, and not space is reserved . |
|
1333 | + //A declined registration is performed by the event admin . Payments are not allowed, the registration is inactive, and not space is reserved . |
|
1334 | 1334 | //Not Approved |
1335 | - //A not approved registration is performed by the event admin . Payments are not allowed, the registration is active, and no space is reserved . |
|
1335 | + //A not approved registration is performed by the event admin . Payments are not allowed, the registration is active, and no space is reserved . |
|
1336 | 1336 | //Pending Payment |
1337 | - //A pending registration allows payments . The status will be automatically toggled to approved if the { |
|
1337 | + //A pending registration allows payments . The status will be automatically toggled to approved if the { |
|
1338 | 1338 | // payment} is made in full by registrant . |
1339 | 1339 | |
1340 | 1340 | } |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | */ |
1442 | 1442 | protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
1443 | 1443 | $result = ! empty( $STS_ID ) |
1444 | - ? $this->_set_registration_status_from_request( $STS_ID, $notify ) |
|
1445 | - : array( 'success' => false ); |
|
1444 | + ? $this->_set_registration_status_from_request( $STS_ID, $notify ) |
|
1445 | + : array( 'success' => false ); |
|
1446 | 1446 | $success = isset( $result['success'] ) && $result['success']; |
1447 | 1447 | //setup success message |
1448 | 1448 | if ( $success ) { |
@@ -1624,9 +1624,9 @@ discard block |
||
1624 | 1624 | |
1625 | 1625 | /** |
1626 | 1626 | * generates HTML for the Registration main meta box |
1627 | - * @access public |
|
1628 | - * @return void |
|
1629 | - */ |
|
1627 | + * @access public |
|
1628 | + * @return void |
|
1629 | + */ |
|
1630 | 1630 | public function _reg_details_meta_box() { |
1631 | 1631 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1632 | 1632 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -1760,7 +1760,7 @@ discard block |
||
1760 | 1760 | * |
1761 | 1761 | * @access public |
1762 | 1762 | * @return void |
1763 | - */ |
|
1763 | + */ |
|
1764 | 1764 | public function _reg_questions_meta_box() { |
1765 | 1765 | //allow someone to override this method entirely |
1766 | 1766 | if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
@@ -1962,12 +1962,12 @@ discard block |
||
1962 | 1962 | |
1963 | 1963 | /** |
1964 | 1964 | * generates HTML for the Registration main meta box |
1965 | - * @access public |
|
1966 | - * @return void |
|
1967 | - */ |
|
1965 | + * @access public |
|
1966 | + * @return void |
|
1967 | + */ |
|
1968 | 1968 | public function _reg_attendees_meta_box() { |
1969 | 1969 | |
1970 | - $REG = EEM_Registration::instance(); |
|
1970 | + $REG = EEM_Registration::instance(); |
|
1971 | 1971 | //get all other registrations on this transaction, and cache |
1972 | 1972 | //the attendees for them so we don't have to run another query using force_join |
1973 | 1973 | $registrations = $REG->get_all(array( |
@@ -2019,9 +2019,9 @@ discard block |
||
2019 | 2019 | |
2020 | 2020 | /** |
2021 | 2021 | * generates HTML for the Edit Registration side meta box |
2022 | - * @access public |
|
2023 | - * @return void |
|
2024 | - */ |
|
2022 | + * @access public |
|
2023 | + * @return void |
|
2024 | + */ |
|
2025 | 2025 | public function _reg_registrant_side_meta_box() { |
2026 | 2026 | |
2027 | 2027 | /*@var $attendee EE_Attendee */ |
@@ -2402,9 +2402,9 @@ discard block |
||
2402 | 2402 | |
2403 | 2403 | /** |
2404 | 2404 | * set_reg_event |
2405 | - * @access private |
|
2406 | - * @return boolean |
|
2407 | - */ |
|
2405 | + * @access private |
|
2406 | + * @return boolean |
|
2407 | + */ |
|
2408 | 2408 | private function _set_reg_event() { |
2409 | 2409 | if ( is_object( $this->_reg_event )) { |
2410 | 2410 | return TRUE; |
@@ -2544,9 +2544,9 @@ discard block |
||
2544 | 2544 | |
2545 | 2545 | /** |
2546 | 2546 | * generates HTML for the Attendee Contact List |
2547 | - * @access protected |
|
2548 | - * @return void |
|
2549 | - */ |
|
2547 | + * @access protected |
|
2548 | + * @return void |
|
2549 | + */ |
|
2550 | 2550 | protected function _attendee_contact_list_table() { |
2551 | 2551 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2552 | 2552 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
@@ -2560,9 +2560,9 @@ discard block |
||
2560 | 2560 | /** |
2561 | 2561 | * get_attendees |
2562 | 2562 | * @param bool $count whether to return count or data. |
2563 | - * @access public |
|
2564 | - * @return array |
|
2565 | - */ |
|
2563 | + * @access public |
|
2564 | + * @return array |
|
2565 | + */ |
|
2566 | 2566 | public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
2567 | 2567 | |
2568 | 2568 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2894,9 +2894,9 @@ discard block |
||
2894 | 2894 | |
2895 | 2895 | /** |
2896 | 2896 | * _attendee_details |
2897 | - * @access protected |
|
2898 | - * @return void |
|
2899 | - */ |
|
2897 | + * @access protected |
|
2898 | + * @return void |
|
2899 | + */ |
|
2900 | 2900 | public function attendee_registrations_meta_box( $post ) { |
2901 | 2901 | |
2902 | 2902 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
@@ -2929,10 +2929,10 @@ discard block |
||
2929 | 2929 | |
2930 | 2930 | /** |
2931 | 2931 | * _trash_or_restore_attendee |
2932 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2933 | - * @access protected |
|
2934 | - * @return void |
|
2935 | - */ |
|
2932 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2933 | + * @access protected |
|
2934 | + * @return void |
|
2935 | + */ |
|
2936 | 2936 | protected function _trash_or_restore_attendees( $trash = TRUE ) { |
2937 | 2937 | |
2938 | 2938 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | 440 | ), |
441 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
441 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
444 | 444 | 'require_nonce' => FALSE |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | 'order' => 15, |
451 | 451 | 'url' => isset($this->_req_data['_REG_ID']) |
452 | 452 | ? add_query_arg( |
453 | - array('_REG_ID' => $this->_req_data['_REG_ID'] ), |
|
453 | + array('_REG_ID' => $this->_req_data['_REG_ID']), |
|
454 | 454 | $this->_current_page_view_url |
455 | 455 | ) |
456 | 456 | : $this->_admin_base_url, |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | 'filename' => 'registrations_details_registrant_details' |
475 | 475 | ) |
476 | 476 | ), |
477 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
478 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
477 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
478 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
479 | 479 | 'require_nonce' => FALSE |
480 | 480 | ), |
481 | 481 | |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'order' => 15, |
500 | 500 | 'persistent' => FALSE |
501 | 501 | ), |
502 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
502 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
503 | 503 | 'require_nonce' => FALSE |
504 | 504 | ), |
505 | 505 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | 'label' => __('Edit Contact', 'event_espresso'), |
509 | 509 | 'order' => 15, |
510 | 510 | 'persistent' => FALSE, |
511 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
511 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
512 | 512 | ), |
513 | 513 | 'metaboxes' => array('attendee_editor_metaboxes'), |
514 | 514 | 'require_nonce' => FALSE |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | 'filename' => 'registrations_contact_list_other' |
539 | 539 | ) |
540 | 540 | ), |
541 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
541 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
542 | 542 | 'metaboxes' => array(), |
543 | 543 | 'require_nonce' => FALSE |
544 | 544 | ), |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | protected function _add_screen_options() {} |
558 | 558 | protected function _add_feature_pointers() {} |
559 | 559 | public function admin_init() { |
560 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
560 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
561 | 561 | } |
562 | 562 | public function admin_notices() {} |
563 | 563 | public function admin_footer_scripts() {} |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @return void |
576 | 576 | */ |
577 | 577 | private function _get_registration_status_array() { |
578 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
578 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | public function load_scripts_styles() { |
599 | 599 | //style |
600 | 600 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
601 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
601 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
602 | 602 | wp_enqueue_style('espresso_reg'); |
603 | 603 | |
604 | 604 | //script |
605 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
605 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
606 | 606 | wp_enqueue_script('espresso_reg'); |
607 | 607 | } |
608 | 608 | |
@@ -611,9 +611,9 @@ discard block |
||
611 | 611 | public function load_scripts_styles_edit_attendee() { |
612 | 612 | //stuff to only show up on our attendee edit details page. |
613 | 613 | $attendee_details_translations = array( |
614 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
614 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
615 | 615 | ); |
616 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
616 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
617 | 617 | wp_enqueue_script('jquery-validate'); |
618 | 618 | } |
619 | 619 | |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | //styles |
623 | 623 | wp_enqueue_style('espresso-ui-theme'); |
624 | 624 | //scripts |
625 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
626 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
625 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
626 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | |
634 | 634 | public function load_scripts_styles_contact_list() { |
635 | 635 | wp_deregister_style('espresso_reg'); |
636 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
636 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
637 | 637 | wp_enqueue_style('espresso_att'); |
638 | 638 | } |
639 | 639 | |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | |
643 | 643 | |
644 | 644 | public function load_scripts_styles_new_registration() { |
645 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
645 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
646 | 646 | wp_enqueue_script('ee-spco-for-admin'); |
647 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
647 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
648 | 648 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
649 | 649 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
650 | 650 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | //for notification related bulk actions we need to make sure only active messengers have an option. |
672 | 672 | EED_Messages::set_autoloaders(); |
673 | 673 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
674 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
674 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
675 | 675 | $active_mts = $message_resource_manager->list_of_active_message_types(); |
676 | 676 | //key= bulk_action_slug, value= message type. |
677 | 677 | $match_array = array( |
@@ -684,23 +684,23 @@ discard block |
||
684 | 684 | |
685 | 685 | /** setup reg status bulk actions **/ |
686 | 686 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
687 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
687 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
688 | 688 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
689 | 689 | } |
690 | 690 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
691 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
691 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
692 | 692 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
693 | 693 | } |
694 | 694 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
695 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
695 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
696 | 696 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
697 | 697 | } |
698 | 698 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
699 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
699 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
700 | 700 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
701 | 701 | } |
702 | 702 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
703 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
703 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
704 | 704 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
705 | 705 | } |
706 | 706 | |
@@ -709,29 +709,29 @@ discard block |
||
709 | 709 | 'slug' => 'all', |
710 | 710 | 'label' => __('View All Registrations', 'event_espresso'), |
711 | 711 | 'count' => 0, |
712 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
712 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
713 | 713 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
714 | - ) ) |
|
714 | + )) |
|
715 | 715 | ), |
716 | 716 | 'month' => array( |
717 | 717 | 'slug' => 'month', |
718 | 718 | 'label' => __('This Month', 'event_espresso'), |
719 | 719 | 'count' => 0, |
720 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
720 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
721 | 721 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
722 | 722 | )) |
723 | 723 | ), |
724 | 724 | 'today' => array( |
725 | 725 | 'slug' => 'today', |
726 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
726 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
727 | 727 | 'count' => 0, |
728 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
728 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
729 | 729 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
730 | 730 | )) |
731 | 731 | ) |
732 | 732 | ); |
733 | 733 | |
734 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
734 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
735 | 735 | $this->_views['incomplete'] = array( |
736 | 736 | 'slug' => 'incomplete', |
737 | 737 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | ) |
768 | 768 | ); |
769 | 769 | |
770 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
770 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
771 | 771 | $this->_views['trash'] = array( |
772 | 772 | 'slug' => 'trash', |
773 | 773 | 'label' => __('Trash', 'event_espresso'), |
@@ -806,18 +806,18 @@ discard block |
||
806 | 806 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
807 | 807 | ), |
808 | 808 | ); |
809 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
809 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
810 | 810 | $fc_items['resend_registration'] = array( |
811 | 811 | 'class' => 'dashicons dashicons-email-alt', |
812 | 812 | 'desc' => __('Resend Registration Details', 'event_espresso') |
813 | 813 | ); |
814 | 814 | } else { |
815 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
815 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
816 | 816 | } |
817 | 817 | |
818 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
819 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
820 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
818 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
819 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
820 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
821 | 821 | $fc_items['view_related_messages'] = array( |
822 | 822 | 'class' => $related_for_icon['css_class'], |
823 | 823 | 'desc' => $related_for_icon['label'], |
@@ -827,35 +827,35 @@ discard block |
||
827 | 827 | |
828 | 828 | $sc_items = array( |
829 | 829 | 'approved_status' => array( |
830 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
831 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
830 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
831 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
832 | 832 | ), |
833 | 833 | 'pending_status' => array( |
834 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
835 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
834 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
835 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
836 | 836 | ), |
837 | 837 | 'wait_list' => array( |
838 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
|
839 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) |
|
838 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list, |
|
839 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') |
|
840 | 840 | ), |
841 | 841 | 'incomplete_status' => array( |
842 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
843 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
842 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
843 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
844 | 844 | ), |
845 | 845 | 'not_approved' => array( |
846 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
847 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
846 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
847 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
848 | 848 | ), |
849 | 849 | 'declined_status' => array( |
850 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
851 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
850 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
851 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
852 | 852 | ), |
853 | 853 | 'cancelled_status' => array( |
854 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
855 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
854 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
855 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
856 | 856 | ) |
857 | 857 | ); |
858 | - return array_merge( $fc_items, $sc_items ); |
|
858 | + return array_merge($fc_items, $sc_items); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | |
@@ -869,45 +869,45 @@ discard block |
||
869 | 869 | */ |
870 | 870 | protected function _registrations_overview_list_table() { |
871 | 871 | $this->_template_args['admin_page_header'] = ''; |
872 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0; |
|
873 | - if ( $EVT_ID ) { |
|
874 | - if ( EE_Registry::instance()->CAP->current_user_can( |
|
872 | + $EVT_ID = ! empty($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : 0; |
|
873 | + if ($EVT_ID) { |
|
874 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
875 | 875 | 'ee_edit_registrations', |
876 | 876 | 'espresso_registrations_new_registration', |
877 | 877 | $EVT_ID |
878 | 878 | ) |
879 | 879 | ) { |
880 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
880 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
881 | 881 | 'new_registration', |
882 | 882 | 'add-registrant', |
883 | - array( 'event_id' => $EVT_ID ), |
|
883 | + array('event_id' => $EVT_ID), |
|
884 | 884 | 'add-new-h2' |
885 | 885 | ); |
886 | 886 | } |
887 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
888 | - if ( $event instanceof EE_Event ) { |
|
887 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
888 | + if ($event instanceof EE_Event) { |
|
889 | 889 | $this->_template_args['admin_page_header'] = sprintf( |
890 | - __( '%s Viewing registrations for the event: %s%s', 'event_espresso' ), |
|
890 | + __('%s Viewing registrations for the event: %s%s', 'event_espresso'), |
|
891 | 891 | '<h3 style="line-height:1.5em;">', |
892 | - '<br /><a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
893 | - array( 'action' => 'edit', 'post' => $event->ID() ), |
|
892 | + '<br /><a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
893 | + array('action' => 'edit', 'post' => $event->ID()), |
|
894 | 894 | EVENTS_ADMIN_URL |
895 | - ) . '"> ' . $event->get( 'EVT_name' ) . ' </a> ', |
|
895 | + ).'"> '.$event->get('EVT_name').' </a> ', |
|
896 | 896 | '</h3>' |
897 | 897 | ); |
898 | 898 | } |
899 | - $DTT_ID = ! empty( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : 0; |
|
900 | - $datetime = EEM_Datetime::instance()->get_one_by_ID( $DTT_ID ); |
|
901 | - if ( $datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '' ) { |
|
902 | - $this->_template_args['admin_page_header'] = substr( $this->_template_args['admin_page_header'], 0, -5 ); |
|
899 | + $DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0; |
|
900 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID); |
|
901 | + if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') { |
|
902 | + $this->_template_args['admin_page_header'] = substr($this->_template_args['admin_page_header'], 0, -5); |
|
903 | 903 | $this->_template_args['admin_page_header'] .= ' <span class="drk-grey-text">'; |
904 | 904 | $this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>'; |
905 | 905 | $this->_template_args['admin_page_header'] .= $datetime->name(); |
906 | - $this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )'; |
|
906 | + $this->_template_args['admin_page_header'] .= ' ( '.$datetime->start_date().' )'; |
|
907 | 907 | $this->_template_args['admin_page_header'] .= '</span></h3>'; |
908 | 908 | } |
909 | 909 | } |
910 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
910 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
911 | 911 | $this->display_admin_list_table_page_with_no_sidebar(); |
912 | 912 | } |
913 | 913 | |
@@ -922,19 +922,19 @@ discard block |
||
922 | 922 | */ |
923 | 923 | private function _set_registration_object() { |
924 | 924 | //get out if we've already set the object |
925 | - if ( is_object( $this->_registration )) { |
|
925 | + if (is_object($this->_registration)) { |
|
926 | 926 | return TRUE; |
927 | 927 | } |
928 | 928 | |
929 | 929 | $REG = EEM_Registration::instance(); |
930 | 930 | |
931 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
931 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
932 | 932 | |
933 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
933 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
934 | 934 | return TRUE; |
935 | 935 | else { |
936 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
937 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
936 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
937 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
938 | 938 | $this->_registration = NULL; |
939 | 939 | return FALSE; |
940 | 940 | } |
@@ -952,25 +952,25 @@ discard block |
||
952 | 952 | * @throws \EE_Error |
953 | 953 | * @return mixed (int|array) int = count || array of registration objects |
954 | 954 | */ |
955 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
956 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
957 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
958 | - $DTT_ID = isset( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : null; |
|
959 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
960 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
961 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
962 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
955 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
956 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
957 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
958 | + $DTT_ID = isset($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : null; |
|
959 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
960 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
961 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
962 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
963 | 963 | $start_date = FALSE; |
964 | 964 | $end_date = FALSE; |
965 | 965 | $_where = array(); |
966 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
967 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
966 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
967 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
968 | 968 | |
969 | 969 | //set orderby |
970 | 970 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
971 | 971 | |
972 | 972 | |
973 | - switch ( $this->_req_data['orderby'] ) { |
|
973 | + switch ($this->_req_data['orderby']) { |
|
974 | 974 | case '_REG_ID': |
975 | 975 | $orderby = 'REG_ID'; |
976 | 976 | break; |
@@ -990,30 +990,30 @@ discard block |
||
990 | 990 | $orderby = 'REG_date'; |
991 | 991 | } |
992 | 992 | |
993 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
994 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
995 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
993 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
994 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
995 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
996 | 996 | |
997 | 997 | |
998 | - $offset = ($current_page-1)*$per_page; |
|
999 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
998 | + $offset = ($current_page - 1) * $per_page; |
|
999 | + $limit = $count ? NULL : array($offset, $per_page); |
|
1000 | 1000 | |
1001 | - if($EVT_ID){ |
|
1002 | - $_where['EVT_ID']=$EVT_ID; |
|
1001 | + if ($EVT_ID) { |
|
1002 | + $_where['EVT_ID'] = $EVT_ID; |
|
1003 | 1003 | } |
1004 | - if($CAT_ID){ |
|
1004 | + if ($CAT_ID) { |
|
1005 | 1005 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
1006 | 1006 | } |
1007 | 1007 | //if DTT is included we filter by that datetime. |
1008 | - if ( $DTT_ID ) { |
|
1008 | + if ($DTT_ID) { |
|
1009 | 1009 | $_where['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
1010 | 1010 | } |
1011 | - if ( $incomplete ) { |
|
1011 | + if ($incomplete) { |
|
1012 | 1012 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
1013 | 1013 | } else if ( ! $trash) { |
1014 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
1014 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
1015 | 1015 | } |
1016 | - if($reg_status){ |
|
1016 | + if ($reg_status) { |
|
1017 | 1017 | $_where['STS_ID'] = $reg_status; |
1018 | 1018 | } |
1019 | 1019 | |
@@ -1025,103 +1025,103 @@ discard block |
||
1025 | 1025 | $time_start = ' 00:00:00'; |
1026 | 1026 | $time_end = ' 23:59:59'; |
1027 | 1027 | |
1028 | - if($today_a || $today ){ |
|
1028 | + if ($today_a || $today) { |
|
1029 | 1029 | $curdate = date('Y-m-d', current_time('timestamp')); |
1030 | - $_where['REG_date']= array('BETWEEN', |
|
1030 | + $_where['REG_date'] = array('BETWEEN', |
|
1031 | 1031 | array( |
1032 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
1033 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
1032 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
1033 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
1034 | 1034 | )); |
1035 | - }elseif($this_month_a || $this_month){ |
|
1035 | + }elseif ($this_month_a || $this_month) { |
|
1036 | 1036 | $this_month_r = date('m', current_time('timestamp')); |
1037 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
1038 | - $_where['REG_date']= array('BETWEEN', |
|
1037 | + $days_this_month = date('t', current_time('timestamp')); |
|
1038 | + $_where['REG_date'] = array('BETWEEN', |
|
1039 | 1039 | array( |
1040 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
1041 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
1040 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
1041 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
1042 | 1042 | )); |
1043 | - }elseif($month_range){ |
|
1043 | + }elseif ($month_range) { |
|
1044 | 1044 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1045 | - $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
|
1046 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1047 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
1048 | - $_where['REG_date']= array('BETWEEN', |
|
1049 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
1050 | - }elseif($start_date && $end_date){ |
|
1045 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : ''; |
|
1046 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1047 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
1048 | + $_where['REG_date'] = array('BETWEEN', |
|
1049 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
1050 | + }elseif ($start_date && $end_date) { |
|
1051 | 1051 | throw new EE_Error("not yet supported"); |
1052 | - }elseif($start_date){ |
|
1052 | + }elseif ($start_date) { |
|
1053 | 1053 | throw new EE_Error("not yet supported"); |
1054 | - }elseif($end_date){ |
|
1054 | + }elseif ($end_date) { |
|
1055 | 1055 | throw new EE_Error("not yet supported"); |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1059 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1058 | + if ( ! empty($this->_req_data['s'])) { |
|
1059 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1060 | 1060 | $_where['OR'] = array( |
1061 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1062 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1063 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1064 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1065 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1066 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1067 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1068 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1069 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1070 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1071 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1072 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1073 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1074 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1075 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1076 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1077 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1078 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1061 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1062 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1063 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1064 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1065 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1066 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1067 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1068 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1069 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1070 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1071 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1072 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1073 | + 'REG_code' => array('LIKE', $sstr), |
|
1074 | + 'REG_count' => array('LIKE', $sstr), |
|
1075 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1076 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1077 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1078 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1079 | 1079 | ); |
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | //capability checks |
1083 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1083 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1084 | 1084 | $_where['AND'] = array( |
1085 | 1085 | 'Event.EVT_wp_user' => get_current_user_id() |
1086 | 1086 | ); |
1087 | 1087 | } |
1088 | 1088 | |
1089 | - if( $count ){ |
|
1090 | - if ( $trash ) { |
|
1091 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1092 | - } else if ( $incomplete ) { |
|
1093 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1089 | + if ($count) { |
|
1090 | + if ($trash) { |
|
1091 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1092 | + } else if ($incomplete) { |
|
1093 | + return EEM_Registration::instance()->count(array($_where)); |
|
1094 | 1094 | } else { |
1095 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1095 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1096 | 1096 | } |
1097 | 1097 | } else { |
1098 | 1098 | //make sure we remove default where conditions cause all registrations matching query are returned |
1099 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1100 | - if ( $per_page !== -1 ) { |
|
1099 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1100 | + if ($per_page !== -1) { |
|
1101 | 1101 | $query_params['limit'] = $limit; |
1102 | 1102 | } |
1103 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1103 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1104 | 1104 | |
1105 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1105 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1106 | 1106 | $first_registration = $registrations[0]; |
1107 | 1107 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1108 | 1108 | $event_name = $first_registration->event_obj()->name(); |
1109 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1109 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1110 | 1110 | // edit event link |
1111 | - if ( $event_name != '' ) { |
|
1112 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1113 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1114 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1111 | + if ($event_name != '') { |
|
1112 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1113 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1114 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1115 | 1115 | } |
1116 | 1116 | |
1117 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1118 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1117 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1118 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1119 | 1119 | |
1120 | 1120 | $this->_template_args['before_admin_page_content'] = ' |
1121 | 1121 | <div id="admin-page-header"> |
1122 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1123 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1124 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1122 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1123 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1124 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1125 | 1125 | </div> |
1126 | 1126 | '; |
1127 | 1127 | |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | |
1160 | 1160 | $this->_set_registration_object(); |
1161 | 1161 | |
1162 | - if ( is_object( $this->_registration )) { |
|
1162 | + if (is_object($this->_registration)) { |
|
1163 | 1163 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1164 | 1164 | $this->_session = $transaction->session_data(); |
1165 | 1165 | |
@@ -1167,10 +1167,10 @@ discard block |
||
1167 | 1167 | |
1168 | 1168 | |
1169 | 1169 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1170 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1170 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1171 | 1171 | |
1172 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime( 'REG_date' ); |
|
1173 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1172 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
1173 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1174 | 1174 | |
1175 | 1175 | $this->_template_args['grand_total'] = $transaction->total(); |
1176 | 1176 | |
@@ -1178,19 +1178,19 @@ discard block |
||
1178 | 1178 | // link back to overview |
1179 | 1179 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1180 | 1180 | $this->_template_args['registration'] = $this->_registration; |
1181 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1182 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1183 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1181 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1182 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1183 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1184 | 1184 | |
1185 | 1185 | //next and previous links |
1186 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1187 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1188 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1189 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1186 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1187 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1188 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1189 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1190 | 1190 | |
1191 | 1191 | // grab header |
1192 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1193 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1192 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1193 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1194 | 1194 | |
1195 | 1195 | } else { |
1196 | 1196 | |
@@ -1209,17 +1209,17 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | protected function _registration_details_metaboxes() { |
1212 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1212 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1213 | 1213 | $this->_set_registration_object(); |
1214 | 1214 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1215 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1216 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1217 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1218 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1215 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1216 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1217 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1218 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1219 | 1219 | } |
1220 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1221 | - if ( $this->_registration->group_size() > 1 ) { |
|
1222 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1220 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1221 | + if ($this->_registration->group_size() > 1) { |
|
1222 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | |
@@ -1261,25 +1261,25 @@ discard block |
||
1261 | 1261 | 'html_id' => 'reg-status-change-form', |
1262 | 1262 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
1263 | 1263 | 'subsections' => array( |
1264 | - 'return' => new EE_Hidden_Input( array( |
|
1264 | + 'return' => new EE_Hidden_Input(array( |
|
1265 | 1265 | 'name' => 'return', |
1266 | 1266 | 'default' => 'view_registration' |
1267 | - ) ), |
|
1268 | - 'REG_ID' => new EE_Hidden_Input( array( |
|
1267 | + )), |
|
1268 | + 'REG_ID' => new EE_Hidden_Input(array( |
|
1269 | 1269 | 'name' => 'REG_ID', |
1270 | 1270 | 'default' => $this->_registration->ID() |
1271 | - ) ), |
|
1271 | + )), |
|
1272 | 1272 | 'current_status' => new EE_Form_Section_HTML( |
1273 | 1273 | EEH_HTML::tr( |
1274 | 1274 | EEH_HTML::th( |
1275 | 1275 | EEH_HTML::label( |
1276 | - EEH_HTML::strong( __( 'Current Registration Status', 'event_espresso' ) ) |
|
1276 | + EEH_HTML::strong(__('Current Registration Status', 'event_espresso')) |
|
1277 | 1277 | ) |
1278 | - ) . |
|
1278 | + ). |
|
1279 | 1279 | EEH_HTML::td( |
1280 | 1280 | EEH_HTML::strong( |
1281 | 1281 | $this->_registration->pretty_status(), |
1282 | - '', 'status-' . $this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;' |
|
1282 | + '', 'status-'.$this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;' |
|
1283 | 1283 | ) |
1284 | 1284 | ) |
1285 | 1285 | ) |
@@ -1287,22 +1287,22 @@ discard block |
||
1287 | 1287 | 'reg_status' => new EE_Select_Input( |
1288 | 1288 | $this->_get_reg_statuses(), |
1289 | 1289 | array( |
1290 | - 'html_label_text' => __( 'Change Registration Status to', 'event_espresso' ), |
|
1290 | + 'html_label_text' => __('Change Registration Status to', 'event_espresso'), |
|
1291 | 1291 | 'default' => $this->_registration->status_ID(), |
1292 | 1292 | ) |
1293 | 1293 | ), |
1294 | 1294 | 'send_notifications' => new EE_Yes_No_Input( |
1295 | 1295 | array( |
1296 | - 'html_label_text' => __( 'Send Related Messages', 'event_espresso' ), |
|
1296 | + 'html_label_text' => __('Send Related Messages', 'event_espresso'), |
|
1297 | 1297 | 'default' => false, |
1298 | - 'html_help_text' => __( 'If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso' ), |
|
1298 | + 'html_help_text' => __('If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso'), |
|
1299 | 1299 | ) |
1300 | 1300 | ), |
1301 | - 'submit' => new EE_Submit_Input( array( |
|
1301 | + 'submit' => new EE_Submit_Input(array( |
|
1302 | 1302 | 'html_class' => 'button-primary', |
1303 | 1303 | 'html_label_text' => ' ', |
1304 | - 'default' => __( 'Update Registration Status', 'event_espresso' ) |
|
1305 | - ) ), |
|
1304 | + 'default' => __('Update Registration Status', 'event_espresso') |
|
1305 | + )), |
|
1306 | 1306 | ), |
1307 | 1307 | ) |
1308 | 1308 | ); |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | * Returns an array of all the buttons for the various statuses and switch status actions |
1316 | 1316 | * @return string |
1317 | 1317 | */ |
1318 | - protected function _get_current_reg_status_help_text( $STS_ID = '' ) { |
|
1318 | + protected function _get_current_reg_status_help_text($STS_ID = '') { |
|
1319 | 1319 | //$reg_status_help_text = array( |
1320 | 1320 | // 'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ), |
1321 | 1321 | // 'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ), |
@@ -1348,14 +1348,14 @@ discard block |
||
1348 | 1348 | */ |
1349 | 1349 | protected function _get_reg_statuses() { |
1350 | 1350 | $reg_status_array = EEM_Registration::instance()->reg_status_array(); |
1351 | - unset ( $reg_status_array[ EEM_Registration::status_id_incomplete ] ); |
|
1351 | + unset ($reg_status_array[EEM_Registration::status_id_incomplete]); |
|
1352 | 1352 | // get current reg status |
1353 | 1353 | $current_status = $this->_registration->status_ID(); |
1354 | 1354 | // is registration for free event? This will determine whether to display the pending payment option |
1355 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free() ) { |
|
1356 | - unset( $reg_status_array[ EEM_Registration::status_id_pending_payment ] ); |
|
1355 | + if ($current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free()) { |
|
1356 | + unset($reg_status_array[EEM_Registration::status_id_pending_payment]); |
|
1357 | 1357 | } |
1358 | - return EEM_Status::instance()->localized_status( $reg_status_array, false, 'sentence' ); |
|
1358 | + return EEM_Status::instance()->localized_status($reg_status_array, false, 'sentence'); |
|
1359 | 1359 | } |
1360 | 1360 | |
1361 | 1361 | |
@@ -1368,15 +1368,15 @@ discard block |
||
1368 | 1368 | * |
1369 | 1369 | * @return array (array with reg_id(s) updated and whether update was successful. |
1370 | 1370 | */ |
1371 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1372 | - if ( isset( $this->_req_data[ 'reg_status_change_form' ] ) ) { |
|
1373 | - $REG_IDs = isset( $this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] ) |
|
1374 | - ? (array)$this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] |
|
1371 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1372 | + if (isset($this->_req_data['reg_status_change_form'])) { |
|
1373 | + $REG_IDs = isset($this->_req_data['reg_status_change_form']['REG_ID']) |
|
1374 | + ? (array) $this->_req_data['reg_status_change_form']['REG_ID'] |
|
1375 | 1375 | : array(); |
1376 | 1376 | } else { |
1377 | - $REG_IDs = isset( $this->_req_data[ '_REG_ID' ] ) ? (array)$this->_req_data[ '_REG_ID' ] : array(); |
|
1377 | + $REG_IDs = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1378 | 1378 | } |
1379 | - $success = $this->_set_registration_status( $REG_IDs, $status ); |
|
1379 | + $success = $this->_set_registration_status($REG_IDs, $status); |
|
1380 | 1380 | //notify? |
1381 | 1381 | if ( |
1382 | 1382 | $success |
@@ -1403,21 +1403,21 @@ discard block |
||
1403 | 1403 | * @param bool $status |
1404 | 1404 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1405 | 1405 | */ |
1406 | - protected function _set_registration_status( $REG_IDs = array(), $status = false ) { |
|
1406 | + protected function _set_registration_status($REG_IDs = array(), $status = false) { |
|
1407 | 1407 | $success = false; |
1408 | 1408 | // typecast $REG_IDs |
1409 | - $REG_IDs = (array)$REG_IDs; |
|
1410 | - if ( ! empty( $REG_IDs ) ) { |
|
1409 | + $REG_IDs = (array) $REG_IDs; |
|
1410 | + if ( ! empty($REG_IDs)) { |
|
1411 | 1411 | $success = true; |
1412 | 1412 | // set default status if none is passed |
1413 | 1413 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1414 | 1414 | // sanitize $REG_IDs |
1415 | - $REG_IDs = array_filter( $REG_IDs, 'absint' ); |
|
1415 | + $REG_IDs = array_filter($REG_IDs, 'absint'); |
|
1416 | 1416 | //loop through REG_ID's and change status |
1417 | - foreach ( $REG_IDs as $REG_ID ) { |
|
1418 | - $registration = EEM_Registration::instance()->get_one_by_ID( $REG_ID ); |
|
1419 | - if ( $registration instanceof EE_Registration ) { |
|
1420 | - $registration->set_status( $status ); |
|
1417 | + foreach ($REG_IDs as $REG_ID) { |
|
1418 | + $registration = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
|
1419 | + if ($registration instanceof EE_Registration) { |
|
1420 | + $registration->set_status($status); |
|
1421 | 1421 | $result = $registration->save(); |
1422 | 1422 | // verifying explicit fails because update *may* just return 0 for 0 rows affected |
1423 | 1423 | $success = $result !== false ? $success : false; |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | //reset _req_data['_REG_ID'] for any potential future messages notifications |
1428 | 1428 | $this->_req_data['_REG_ID'] = $REG_IDs; |
1429 | 1429 | //return $success and processed registrations |
1430 | - return array( 'REG_ID' => $REG_IDs, 'success' => $success ); |
|
1430 | + return array('REG_ID' => $REG_IDs, 'success' => $success); |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | |
@@ -1439,49 +1439,49 @@ discard block |
||
1439 | 1439 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1440 | 1440 | * @return void |
1441 | 1441 | */ |
1442 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1443 | - $result = ! empty( $STS_ID ) |
|
1444 | - ? $this->_set_registration_status_from_request( $STS_ID, $notify ) |
|
1445 | - : array( 'success' => false ); |
|
1446 | - $success = isset( $result['success'] ) && $result['success']; |
|
1442 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1443 | + $result = ! empty($STS_ID) |
|
1444 | + ? $this->_set_registration_status_from_request($STS_ID, $notify) |
|
1445 | + : array('success' => false); |
|
1446 | + $success = isset($result['success']) && $result['success']; |
|
1447 | 1447 | //setup success message |
1448 | - if ( $success ) { |
|
1449 | - if ( is_array( $result[ 'REG_ID' ] ) && count( $result[ 'REG_ID' ] ) === 1 ) { |
|
1448 | + if ($success) { |
|
1449 | + if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) { |
|
1450 | 1450 | $msg = sprintf( |
1451 | - __( 'Registration status has been set to %s', 'event_espresso' ), |
|
1452 | - EEH_Template::pretty_status( $STS_ID, false, 'lower' ) |
|
1451 | + __('Registration status has been set to %s', 'event_espresso'), |
|
1452 | + EEH_Template::pretty_status($STS_ID, false, 'lower') |
|
1453 | 1453 | ); |
1454 | 1454 | } else { |
1455 | 1455 | $msg = sprintf( |
1456 | - __( 'Registrations have been set to %s.', 'event_espresso' ), |
|
1457 | - EEH_Template::pretty_status( $STS_ID, false, 'lower' ) |
|
1456 | + __('Registrations have been set to %s.', 'event_espresso'), |
|
1457 | + EEH_Template::pretty_status($STS_ID, false, 'lower') |
|
1458 | 1458 | ); |
1459 | 1459 | } |
1460 | - EE_Error::add_success( $msg ); |
|
1460 | + EE_Error::add_success($msg); |
|
1461 | 1461 | } else { |
1462 | 1462 | EE_Error::add_error( |
1463 | - __( 'Something went wrong, and the status was not changed', 'event_espresso' ), |
|
1463 | + __('Something went wrong, and the status was not changed', 'event_espresso'), |
|
1464 | 1464 | __FILE__, __LINE__, __FUNCTION__ |
1465 | 1465 | ); |
1466 | 1466 | } |
1467 | - if ( isset( $this->_req_data[ 'return' ] ) && $this->_req_data[ 'return' ] == 'view_registration' ) { |
|
1468 | - $route = array( 'action' => 'view_registration', '_REG_ID' => reset( $result[ 'REG_ID' ] ) ); |
|
1467 | + if (isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration') { |
|
1468 | + $route = array('action' => 'view_registration', '_REG_ID' => reset($result['REG_ID'])); |
|
1469 | 1469 | } else { |
1470 | - $route = array( 'action' => 'default' ); |
|
1470 | + $route = array('action' => 'default'); |
|
1471 | 1471 | } |
1472 | 1472 | //unset nonces |
1473 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1474 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1475 | - unset( $this->_req_data[$ref] ); |
|
1473 | + foreach ($this->_req_data as $ref => $value) { |
|
1474 | + if (strpos($ref, 'nonce') !== false) { |
|
1475 | + unset($this->_req_data[$ref]); |
|
1476 | 1476 | continue; |
1477 | 1477 | } |
1478 | 1478 | |
1479 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1479 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1480 | 1480 | $this->_req_data[$ref] = $value; |
1481 | 1481 | } |
1482 | 1482 | //merge request vars so that the reloaded list table contains any existing filter query params |
1483 | - $route = array_merge( $this->_req_data, $route ); |
|
1484 | - $this->_redirect_after_action( $success, '', '', $route, true ); |
|
1483 | + $route = array_merge($this->_req_data, $route); |
|
1484 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
1485 | 1485 | } |
1486 | 1486 | |
1487 | 1487 | |
@@ -1492,51 +1492,51 @@ discard block |
||
1492 | 1492 | protected function _change_reg_status() { |
1493 | 1493 | $this->_req_data['return'] = 'view_registration'; |
1494 | 1494 | //set notify based on whether the send notifications toggle is set or not |
1495 | - $notify = ! empty( $this->_req_data['reg_status_change_form']['send_notifications'] ); |
|
1495 | + $notify = ! empty($this->_req_data['reg_status_change_form']['send_notifications']); |
|
1496 | 1496 | //$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
1497 | - $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] = isset( |
|
1498 | - $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] |
|
1497 | + $this->_req_data['reg_status_change_form']['reg_status'] = isset( |
|
1498 | + $this->_req_data['reg_status_change_form']['reg_status'] |
|
1499 | 1499 | ) |
1500 | - ? $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] |
|
1500 | + ? $this->_req_data['reg_status_change_form']['reg_status'] |
|
1501 | 1501 | : ''; |
1502 | 1502 | |
1503 | - switch ( $this->_req_data[ 'reg_status_change_form' ]['reg_status'] ) { |
|
1503 | + switch ($this->_req_data['reg_status_change_form']['reg_status']) { |
|
1504 | 1504 | |
1505 | 1505 | case EEM_Registration::status_id_approved : |
1506 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1507 | - $this->approve_registration( $notify ); |
|
1506 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1507 | + $this->approve_registration($notify); |
|
1508 | 1508 | break; |
1509 | 1509 | |
1510 | 1510 | case EEM_Registration::status_id_pending_payment : |
1511 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1512 | - $this->pending_registration( $notify ); |
|
1511 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1512 | + $this->pending_registration($notify); |
|
1513 | 1513 | break; |
1514 | 1514 | |
1515 | 1515 | case EEM_Registration::status_id_not_approved : |
1516 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1517 | - $this->not_approve_registration( $notify ); |
|
1516 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1517 | + $this->not_approve_registration($notify); |
|
1518 | 1518 | break; |
1519 | 1519 | |
1520 | 1520 | case EEM_Registration::status_id_declined : |
1521 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1522 | - $this->decline_registration( $notify ); |
|
1521 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1522 | + $this->decline_registration($notify); |
|
1523 | 1523 | break; |
1524 | 1524 | |
1525 | 1525 | case EEM_Registration::status_id_cancelled : |
1526 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1527 | - $this->cancel_registration( $notify ); |
|
1526 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1527 | + $this->cancel_registration($notify); |
|
1528 | 1528 | break; |
1529 | 1529 | |
1530 | 1530 | case EEM_Registration::status_id_wait_list : |
1531 | - case EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) : |
|
1532 | - $this->waitlist_registration( $notify ); |
|
1531 | + case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') : |
|
1532 | + $this->waitlist_registration($notify); |
|
1533 | 1533 | break; |
1534 | 1534 | |
1535 | 1535 | case EEM_Registration::status_id_incomplete : |
1536 | 1536 | default : |
1537 | 1537 | $result['success'] = false; |
1538 | - unset( $this->_req_data['return'] ); |
|
1539 | - $this->_reg_status_change_return( '', false ); |
|
1538 | + unset($this->_req_data['return']); |
|
1539 | + $this->_reg_status_change_return('', false); |
|
1540 | 1540 | break; |
1541 | 1541 | } |
1542 | 1542 | } |
@@ -1550,8 +1550,8 @@ discard block |
||
1550 | 1550 | * @param bool $notify whether or not to notify the registrant about their approval. |
1551 | 1551 | * @return void |
1552 | 1552 | */ |
1553 | - protected function approve_registration( $notify = false ) { |
|
1554 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1553 | + protected function approve_registration($notify = false) { |
|
1554 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1555 | 1555 | } |
1556 | 1556 | |
1557 | 1557 | |
@@ -1563,8 +1563,8 @@ discard block |
||
1563 | 1563 | * @param bool $notify whether or not to notify the registrant about their status change. |
1564 | 1564 | * @return void |
1565 | 1565 | */ |
1566 | - protected function decline_registration( $notify = false ) { |
|
1567 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1566 | + protected function decline_registration($notify = false) { |
|
1567 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1568 | 1568 | } |
1569 | 1569 | |
1570 | 1570 | |
@@ -1576,8 +1576,8 @@ discard block |
||
1576 | 1576 | * @param bool $notify whether or not to notify the registrant about their status change. |
1577 | 1577 | * @return void |
1578 | 1578 | */ |
1579 | - protected function cancel_registration( $notify = false ) { |
|
1580 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1579 | + protected function cancel_registration($notify = false) { |
|
1580 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1581 | 1581 | } |
1582 | 1582 | |
1583 | 1583 | |
@@ -1589,8 +1589,8 @@ discard block |
||
1589 | 1589 | * @param bool $notify whether or not to notify the registrant about their status change. |
1590 | 1590 | * @return void |
1591 | 1591 | */ |
1592 | - protected function not_approve_registration( $notify = false ) { |
|
1593 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1592 | + protected function not_approve_registration($notify = false) { |
|
1593 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1594 | 1594 | } |
1595 | 1595 | |
1596 | 1596 | |
@@ -1602,8 +1602,8 @@ discard block |
||
1602 | 1602 | * @param bool $notify whether or not to notify the registrant about their status change. |
1603 | 1603 | * @return void |
1604 | 1604 | */ |
1605 | - protected function pending_registration( $notify = false ) { |
|
1606 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1605 | + protected function pending_registration($notify = false) { |
|
1606 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | 1609 | |
@@ -1615,8 +1615,8 @@ discard block |
||
1615 | 1615 | * @param bool $notify whether or not to notify the registrant about their status change. |
1616 | 1616 | * @return void |
1617 | 1617 | */ |
1618 | - protected function waitlist_registration( $notify = false ) { |
|
1619 | - $this->_reg_status_change_return( EEM_Registration::status_id_wait_list, $notify ); |
|
1618 | + protected function waitlist_registration($notify = false) { |
|
1619 | + $this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify); |
|
1620 | 1620 | } |
1621 | 1621 | |
1622 | 1622 | |
@@ -1630,14 +1630,14 @@ discard block |
||
1630 | 1630 | public function _reg_details_meta_box() { |
1631 | 1631 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1632 | 1632 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1633 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
1633 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
1634 | 1634 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1635 | 1635 | $this->_session = $transaction->session_data(); |
1636 | 1636 | |
1637 | 1637 | $filters = new EE_Line_Item_Filter_Collection(); |
1638 | 1638 | //$filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
1639 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1640 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1639 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1640 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1641 | 1641 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1642 | 1642 | $line_item_display = new EE_Line_Item_Display( |
1643 | 1643 | 'reg_admin_table', |
@@ -1645,7 +1645,7 @@ discard block |
||
1645 | 1645 | ); |
1646 | 1646 | $this->_template_args['line_item_table'] = $line_item_display->display_line_item( |
1647 | 1647 | $filtered_line_item_tree, |
1648 | - array( 'EE_Registration' => $this->_registration ) |
|
1648 | + array('EE_Registration' => $this->_registration) |
|
1649 | 1649 | ); |
1650 | 1650 | $attendee = $this->_registration->attendee(); |
1651 | 1651 | |
@@ -1655,7 +1655,7 @@ discard block |
||
1655 | 1655 | 'espresso_transactions_view_transaction' |
1656 | 1656 | ) |
1657 | 1657 | ) { |
1658 | - $this->_template_args[ 'view_transaction_button' ] = EEH_Template::get_button_or_link( |
|
1658 | + $this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link( |
|
1659 | 1659 | EE_Admin_Page::add_query_args_and_nonce( |
1660 | 1660 | array( |
1661 | 1661 | 'action' => 'view_transaction', |
@@ -1663,12 +1663,12 @@ discard block |
||
1663 | 1663 | ), |
1664 | 1664 | TXN_ADMIN_URL |
1665 | 1665 | ), |
1666 | - esc_html__( ' View Transaction' ), |
|
1666 | + esc_html__(' View Transaction'), |
|
1667 | 1667 | 'button secondary-button right', |
1668 | 1668 | 'dashicons dashicons-cart' |
1669 | 1669 | ); |
1670 | 1670 | } else { |
1671 | - $this->_template_args[ 'view_transaction_button' ] = ''; |
|
1671 | + $this->_template_args['view_transaction_button'] = ''; |
|
1672 | 1672 | } |
1673 | 1673 | |
1674 | 1674 | if ( |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | 'espresso_registrations_resend_registration' |
1679 | 1679 | ) |
1680 | 1680 | ) { |
1681 | - $this->_template_args[ 'resend_registration_button' ] = EEH_Template::get_button_or_link( |
|
1681 | + $this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link( |
|
1682 | 1682 | EE_Admin_Page::add_query_args_and_nonce( |
1683 | 1683 | array( |
1684 | 1684 | 'action' => 'resend_registration', |
@@ -1687,55 +1687,55 @@ discard block |
||
1687 | 1687 | ), |
1688 | 1688 | REG_ADMIN_URL |
1689 | 1689 | ), |
1690 | - esc_html__( ' Resend Registration' ), |
|
1690 | + esc_html__(' Resend Registration'), |
|
1691 | 1691 | 'button secondary-button right', |
1692 | 1692 | 'dashicons dashicons-email-alt' |
1693 | 1693 | ); |
1694 | 1694 | } else { |
1695 | - $this->_template_args[ 'resend_registration_button' ] = ''; |
|
1695 | + $this->_template_args['resend_registration_button'] = ''; |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1699 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1699 | + $payment = $transaction->get_first_related('Payment'); |
|
1700 | 1700 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1701 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1701 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1702 | 1702 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1703 | 1703 | |
1704 | 1704 | $reg_details = array( |
1705 | 1705 | 'payment_method' => $payment_method->name(), |
1706 | 1706 | 'response_msg' => $payment->gateway_response(), |
1707 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1707 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1708 | 1708 | 'registration_session' => $this->_registration->session_ID(), |
1709 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1710 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1709 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1710 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1711 | 1711 | ); |
1712 | 1712 | |
1713 | 1713 | |
1714 | - if ( isset( $reg_details['registration_id'] )) { |
|
1714 | + if (isset($reg_details['registration_id'])) { |
|
1715 | 1715 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1716 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1716 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1717 | 1717 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1718 | 1718 | } |
1719 | 1719 | |
1720 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1720 | + if (isset($reg_details['payment_method'])) { |
|
1721 | 1721 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1722 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1722 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1723 | 1723 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1724 | 1724 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1725 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1725 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1726 | 1726 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1727 | 1727 | } |
1728 | 1728 | |
1729 | 1729 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1730 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1730 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1731 | 1731 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1732 | 1732 | |
1733 | 1733 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1734 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1734 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1735 | 1735 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1736 | 1736 | |
1737 | 1737 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1738 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1738 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1739 | 1739 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1740 | 1740 | |
1741 | 1741 | $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( |
@@ -1748,8 +1748,8 @@ discard block |
||
1748 | 1748 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1749 | 1749 | $this->_template_args['event_id'] = $this->_registration->event_ID(); |
1750 | 1750 | |
1751 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1752 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1751 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1752 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1753 | 1753 | |
1754 | 1754 | } |
1755 | 1755 | |
@@ -1763,14 +1763,14 @@ discard block |
||
1763 | 1763 | */ |
1764 | 1764 | public function _reg_questions_meta_box() { |
1765 | 1765 | //allow someone to override this method entirely |
1766 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1767 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1768 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1766 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1767 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1768 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1769 | 1769 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1770 | 1770 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1771 | 1771 | |
1772 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1773 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1772 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1773 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1774 | 1774 | } |
1775 | 1775 | } |
1776 | 1776 | |
@@ -1784,12 +1784,12 @@ discard block |
||
1784 | 1784 | * @param string $output |
1785 | 1785 | * @return string |
1786 | 1786 | */ |
1787 | - public function form_before_question_group( $output ) { |
|
1787 | + public function form_before_question_group($output) { |
|
1788 | 1788 | EE_Error::doing_it_wrong( |
1789 | - __CLASS__ . '::' . __FUNCTION__, |
|
1790 | - __( 'This method would have been protected but was used on a filter callback' |
|
1789 | + __CLASS__.'::'.__FUNCTION__, |
|
1790 | + __('This method would have been protected but was used on a filter callback' |
|
1791 | 1791 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1792 | - 'event_espresso' ), |
|
1792 | + 'event_espresso'), |
|
1793 | 1793 | '4.8.32.rc.000' |
1794 | 1794 | ); |
1795 | 1795 | return ' |
@@ -1808,20 +1808,20 @@ discard block |
||
1808 | 1808 | * @param string $output |
1809 | 1809 | * @return string |
1810 | 1810 | */ |
1811 | - public function form_after_question_group( $output ) { |
|
1811 | + public function form_after_question_group($output) { |
|
1812 | 1812 | EE_Error::doing_it_wrong( |
1813 | - __CLASS__ . '::' . __FUNCTION__, |
|
1814 | - __( 'This method would have been protected but was used on a filter callback' |
|
1813 | + __CLASS__.'::'.__FUNCTION__, |
|
1814 | + __('This method would have been protected but was used on a filter callback' |
|
1815 | 1815 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1816 | - 'event_espresso' ), |
|
1816 | + 'event_espresso'), |
|
1817 | 1817 | '4.8.32.rc.000' |
1818 | 1818 | ); |
1819 | 1819 | return ' |
1820 | 1820 | <tr class="hide-if-no-js"> |
1821 | 1821 | <th> </th> |
1822 | 1822 | <td class="reg-admin-edit-attendee-question-td"> |
1823 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1824 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1823 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1824 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1825 | 1825 | <div class="dashicons dashicons-edit"></div> |
1826 | 1826 | </a> |
1827 | 1827 | </td> |
@@ -1841,18 +1841,18 @@ discard block |
||
1841 | 1841 | * @param string $label |
1842 | 1842 | * @return string |
1843 | 1843 | */ |
1844 | - public function form_form_field_label_wrap( $label ) { |
|
1844 | + public function form_form_field_label_wrap($label) { |
|
1845 | 1845 | EE_Error::doing_it_wrong( |
1846 | - __CLASS__ . '::' . __FUNCTION__, |
|
1847 | - __( 'This method would have been protected but was used on a filter callback' |
|
1846 | + __CLASS__.'::'.__FUNCTION__, |
|
1847 | + __('This method would have been protected but was used on a filter callback' |
|
1848 | 1848 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1849 | - 'event_espresso' ), |
|
1849 | + 'event_espresso'), |
|
1850 | 1850 | '4.8.32.rc.000' |
1851 | 1851 | ); |
1852 | 1852 | return ' |
1853 | 1853 | <tr> |
1854 | 1854 | <th> |
1855 | - ' . $label . ' |
|
1855 | + ' . $label.' |
|
1856 | 1856 | </th>'; |
1857 | 1857 | } |
1858 | 1858 | |
@@ -1866,17 +1866,17 @@ discard block |
||
1866 | 1866 | * @param string $input |
1867 | 1867 | * @return string |
1868 | 1868 | */ |
1869 | - public function form_form_field_input__wrap( $input ) { |
|
1869 | + public function form_form_field_input__wrap($input) { |
|
1870 | 1870 | EE_Error::doing_it_wrong( |
1871 | - __CLASS__ . '::' . __FUNCTION__, |
|
1872 | - __( 'This method would have been protected but was used on a filter callback' |
|
1871 | + __CLASS__.'::'.__FUNCTION__, |
|
1872 | + __('This method would have been protected but was used on a filter callback' |
|
1873 | 1873 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1874 | - 'event_espresso' ), |
|
1874 | + 'event_espresso'), |
|
1875 | 1875 | '4.8.32.rc.000' |
1876 | 1876 | ); |
1877 | 1877 | return ' |
1878 | 1878 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1879 | - ' . $input . ' |
|
1879 | + ' . $input.' |
|
1880 | 1880 | </td> |
1881 | 1881 | </tr>'; |
1882 | 1882 | } |
@@ -1890,14 +1890,14 @@ discard block |
||
1890 | 1890 | * @return void |
1891 | 1891 | */ |
1892 | 1892 | protected function _update_attendee_registration_form() { |
1893 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1894 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1895 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1896 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1897 | - if( $success ) { |
|
1893 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1894 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1895 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1896 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1897 | + if ($success) { |
|
1898 | 1898 | $what = __('Registration Form', 'event_espresso'); |
1899 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1900 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1899 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1900 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1901 | 1901 | } |
1902 | 1902 | } |
1903 | 1903 | } |
@@ -1908,11 +1908,11 @@ discard block |
||
1908 | 1908 | * @param int $REG_ID |
1909 | 1909 | * @return EE_Registration_Custom_Questions_Form |
1910 | 1910 | */ |
1911 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1912 | - if( ! $this->_reg_custom_questions_form ) { |
|
1913 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1914 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1915 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1911 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1912 | + if ( ! $this->_reg_custom_questions_form) { |
|
1913 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1914 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1915 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1916 | 1916 | } |
1917 | 1917 | return $this->_reg_custom_questions_form; |
1918 | 1918 | } |
@@ -1925,17 +1925,17 @@ discard block |
||
1925 | 1925 | * @param bool $REG_ID |
1926 | 1926 | * @return bool |
1927 | 1927 | */ |
1928 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1928 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1929 | 1929 | |
1930 | 1930 | if ( ! $REG_ID) { |
1931 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1931 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1932 | 1932 | } |
1933 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1934 | - $form->receive_form_submission( $this->_req_data ); |
|
1933 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1934 | + $form->receive_form_submission($this->_req_data); |
|
1935 | 1935 | $success = false; |
1936 | - if( $form->is_valid() ) { |
|
1937 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1938 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1936 | + if ($form->is_valid()) { |
|
1937 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1938 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1939 | 1939 | $where_conditions = array( |
1940 | 1940 | 'QST_ID' => $question_id, |
1941 | 1941 | 'REG_ID' => $REG_ID |
@@ -1943,19 +1943,19 @@ discard block |
||
1943 | 1943 | $possibly_new_values = array( |
1944 | 1944 | 'ANS_value' => $input->normalized_value() |
1945 | 1945 | ); |
1946 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1947 | - if( $answer instanceof EE_Answer ) { |
|
1948 | - $success = $answer->save( $possibly_new_values ); |
|
1946 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1947 | + if ($answer instanceof EE_Answer) { |
|
1948 | + $success = $answer->save($possibly_new_values); |
|
1949 | 1949 | } else { |
1950 | 1950 | //insert it then |
1951 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1952 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1951 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1952 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1953 | 1953 | $success = $answer->save(); |
1954 | 1954 | } |
1955 | 1955 | } |
1956 | 1956 | } |
1957 | 1957 | } else { |
1958 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1958 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1959 | 1959 | } |
1960 | 1960 | return $success; |
1961 | 1961 | } |
@@ -1973,31 +1973,31 @@ discard block |
||
1973 | 1973 | $registrations = $REG->get_all(array( |
1974 | 1974 | array( |
1975 | 1975 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1976 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1976 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1977 | 1977 | ), |
1978 | 1978 | 'force_join'=>array('Attendee'))); |
1979 | 1979 | |
1980 | 1980 | $this->_template_args['attendees'] = array(); |
1981 | 1981 | $this->_template_args['attendee_notice'] = ''; |
1982 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1983 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1982 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1983 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1984 | 1984 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1985 | 1985 | } else { |
1986 | 1986 | |
1987 | 1987 | $att_nmbr = 1; |
1988 | - foreach ( $registrations as $registration ) { |
|
1988 | + foreach ($registrations as $registration) { |
|
1989 | 1989 | /* @var $registration EE_Registration */ |
1990 | 1990 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1991 | - $this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID(); |
|
1992 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1993 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1994 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1995 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1991 | + $this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID(); |
|
1992 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1993 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1994 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1995 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1996 | 1996 | |
1997 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1997 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1998 | 1998 | |
1999 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
2000 | - $this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name(); |
|
1999 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
2000 | + $this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name(); |
|
2001 | 2001 | |
2002 | 2002 | $att_nmbr++; |
2003 | 2003 | } |
@@ -2007,8 +2007,8 @@ discard block |
||
2007 | 2007 | |
2008 | 2008 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
2009 | 2009 | } |
2010 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
2011 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2010 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
2011 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2012 | 2012 | |
2013 | 2013 | } |
2014 | 2014 | |
@@ -2029,14 +2029,14 @@ discard block |
||
2029 | 2029 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
2030 | 2030 | |
2031 | 2031 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show create button or not) |
2032 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
2032 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
2033 | 2033 | |
2034 | 2034 | $primary_registration = $this->_registration->get_primary_registration(); |
2035 | 2035 | $primary_attendee = $primary_registration instanceof EE_Registration |
2036 | 2036 | ? $primary_registration->attendee() |
2037 | 2037 | : null; |
2038 | 2038 | |
2039 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
2039 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
2040 | 2040 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
2041 | 2041 | $primary_registration = NULL; |
2042 | 2042 | } |
@@ -2045,27 +2045,27 @@ discard block |
||
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
2048 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
2049 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
2050 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
2048 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
2049 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
2050 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
2051 | 2051 | $this->_template_args['phone'] = $attendee->phone(); |
2052 | 2052 | |
2053 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
2053 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
2054 | 2054 | |
2055 | 2055 | |
2056 | 2056 | //edit link |
2057 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
2057 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
2058 | 2058 | $this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso'); |
2059 | 2059 | |
2060 | 2060 | //create link |
2061 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
2061 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
2062 | 2062 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
2063 | 2063 | |
2064 | 2064 | $this->_template_args['att_check'] = $att_check; |
2065 | 2065 | |
2066 | 2066 | |
2067 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
2068 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2067 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
2068 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2069 | 2069 | } |
2070 | 2070 | |
2071 | 2071 | |
@@ -2078,7 +2078,7 @@ discard block |
||
2078 | 2078 | * @access protected |
2079 | 2079 | * @return void |
2080 | 2080 | */ |
2081 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
2081 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
2082 | 2082 | $REGM = EEM_Registration::instance(); |
2083 | 2083 | |
2084 | 2084 | $success = 1; |
@@ -2088,26 +2088,26 @@ discard block |
||
2088 | 2088 | $dtts = array(); |
2089 | 2089 | |
2090 | 2090 | //if empty _REG_ID then get out because there's nothing to do |
2091 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
2091 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2092 | 2092 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
2093 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
2094 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
2093 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
2094 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
2095 | 2095 | } |
2096 | 2096 | |
2097 | 2097 | //Checkboxes |
2098 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2098 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2099 | 2099 | // if array has more than one element than success message should be plural |
2100 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
2100 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
2101 | 2101 | // cycle thru checkboxes |
2102 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
2102 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
2103 | 2103 | /** @var EE_Registration $REG */ |
2104 | - $REG = $REGM->get_one_by_ID( $REG_ID); |
|
2104 | + $REG = $REGM->get_one_by_ID($REG_ID); |
|
2105 | 2105 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
2106 | - if ( $payment_count > 0 ) { |
|
2107 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
2106 | + if ($payment_count > 0) { |
|
2107 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
2108 | 2108 | $error = 1; |
2109 | 2109 | $success = 0; |
2110 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
2110 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
2111 | 2111 | continue; //can't trash this registration because it has payments. |
2112 | 2112 | } |
2113 | 2113 | $ticket = $REG->get_first_related('Ticket'); |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | $dtts = array_merge($dtts, $dtt); |
2117 | 2117 | |
2118 | 2118 | $updated = $trash ? $REG->delete() : $REG->restore(); |
2119 | - if ( !$updated ) { |
|
2119 | + if ( ! $updated) { |
|
2120 | 2120 | $success = 0; |
2121 | 2121 | } else { |
2122 | 2122 | $success = 2; |
@@ -2131,7 +2131,7 @@ discard block |
||
2131 | 2131 | $tickets[$ticket->ID()] = $ticket; |
2132 | 2132 | $dtts = $ticket->get_many_related('Datetime'); |
2133 | 2133 | $updated = $trash ? $REG->delete() : $REG->restore(); |
2134 | - if ( ! $updated ) { |
|
2134 | + if ( ! $updated) { |
|
2135 | 2135 | $success = 0; |
2136 | 2136 | } |
2137 | 2137 | |
@@ -2141,10 +2141,10 @@ discard block |
||
2141 | 2141 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
2142 | 2142 | EEM_Datetime::instance()->update_sold($dtts); |
2143 | 2143 | |
2144 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
2145 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2144 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
2145 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2146 | 2146 | $overwrite_msgs = $error ? TRUE : FALSE; |
2147 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
2147 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
2148 | 2148 | } |
2149 | 2149 | |
2150 | 2150 | |
@@ -2168,16 +2168,16 @@ discard block |
||
2168 | 2168 | $success = 1; |
2169 | 2169 | |
2170 | 2170 | //Checkboxes |
2171 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2171 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
2172 | 2172 | // if array has more than one element than success message should be plural |
2173 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
2173 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
2174 | 2174 | // cycle thru checkboxes |
2175 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
2175 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
2176 | 2176 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
2177 | - if ( ! $REG instanceof EE_Registration ) |
|
2177 | + if ( ! $REG instanceof EE_Registration) |
|
2178 | 2178 | continue; |
2179 | 2179 | $deleted = $this->_delete_registration($REG); |
2180 | - if ( !$deleted ) { |
|
2180 | + if ( ! $deleted) { |
|
2181 | 2181 | $success = 0; |
2182 | 2182 | } |
2183 | 2183 | } |
@@ -2187,15 +2187,15 @@ discard block |
||
2187 | 2187 | $REG_ID = $this->_req_data['_REG_ID']; |
2188 | 2188 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
2189 | 2189 | $deleted = $this->_delete_registration($REG); |
2190 | - if ( ! $deleted ) { |
|
2190 | + if ( ! $deleted) { |
|
2191 | 2191 | $success = 0; |
2192 | 2192 | } |
2193 | 2193 | |
2194 | 2194 | } |
2195 | 2195 | |
2196 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
2197 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
2198 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
2196 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
2197 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
2198 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
2199 | 2199 | } |
2200 | 2200 | |
2201 | 2201 | |
@@ -2207,31 +2207,31 @@ discard block |
||
2207 | 2207 | * @param EE_Registration $REG registration to be deleted permenantly |
2208 | 2208 | * @return boolean true = successful deletion, false = fail. |
2209 | 2209 | */ |
2210 | - protected function _delete_registration( EE_Registration $REG ) { |
|
2210 | + protected function _delete_registration(EE_Registration $REG) { |
|
2211 | 2211 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
2212 | 2212 | $TXN = $REG->get_first_related('Transaction'); |
2213 | 2213 | $REGS = $TXN->get_many_related('Registration'); |
2214 | 2214 | |
2215 | 2215 | $all_trashed = TRUE; |
2216 | - foreach ( $REGS as $registration ) { |
|
2217 | - if ( ! $registration->get('REG_deleted') ) |
|
2216 | + foreach ($REGS as $registration) { |
|
2217 | + if ( ! $registration->get('REG_deleted')) |
|
2218 | 2218 | $all_trashed = FALSE; |
2219 | 2219 | } |
2220 | 2220 | |
2221 | - if ( ! $all_trashed ) { |
|
2222 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2221 | + if ( ! $all_trashed) { |
|
2222 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2223 | 2223 | return false; |
2224 | 2224 | } |
2225 | 2225 | |
2226 | 2226 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
2227 | - foreach ( $REGS as $registration ) { |
|
2227 | + foreach ($REGS as $registration) { |
|
2228 | 2228 | |
2229 | 2229 | //delete related answers |
2230 | 2230 | $registration->delete_related_permanently('Answer'); |
2231 | 2231 | |
2232 | 2232 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
2233 | 2233 | $attendee = $registration->get_first_related('Attendee'); |
2234 | - if ( $attendee instanceof EE_Attendee ) { |
|
2234 | + if ($attendee instanceof EE_Attendee) { |
|
2235 | 2235 | $registration->_remove_relation_to($attendee, 'Attendee'); |
2236 | 2236 | } |
2237 | 2237 | |
@@ -2241,7 +2241,7 @@ discard block |
||
2241 | 2241 | //now delete permanently the checkins related to this registration. |
2242 | 2242 | $registration->delete_related_permanently('Checkin'); |
2243 | 2243 | |
2244 | - if ( $registration->ID() === $REG->ID() ) |
|
2244 | + if ($registration->ID() === $REG->ID()) |
|
2245 | 2245 | continue; //we don't want to delete permanently the existing registration just yet. |
2246 | 2246 | |
2247 | 2247 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2278,35 +2278,35 @@ discard block |
||
2278 | 2278 | * @return void |
2279 | 2279 | */ |
2280 | 2280 | public function new_registration() { |
2281 | - if ( ! $this->_set_reg_event() ) { |
|
2282 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2281 | + if ( ! $this->_set_reg_event()) { |
|
2282 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2283 | 2283 | } |
2284 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2284 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2285 | 2285 | // gotta start with a clean slate if we're not coming here via ajax |
2286 | 2286 | if ( |
2287 | - ! defined('DOING_AJAX' ) |
|
2288 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2287 | + ! defined('DOING_AJAX') |
|
2288 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2289 | 2289 | ) { |
2290 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2290 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2291 | 2291 | } |
2292 | 2292 | |
2293 | - $this->_template_args['event_name'] = '' ; |
|
2293 | + $this->_template_args['event_name'] = ''; |
|
2294 | 2294 | // event name |
2295 | - if ( $this->_reg_event ) { |
|
2295 | + if ($this->_reg_event) { |
|
2296 | 2296 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2297 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2298 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2299 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2297 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2298 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2299 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2300 | 2300 | } |
2301 | 2301 | |
2302 | 2302 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2303 | 2303 | |
2304 | - if ( defined('DOING_AJAX' ) ) { |
|
2304 | + if (defined('DOING_AJAX')) { |
|
2305 | 2305 | $this->_return_json(); |
2306 | 2306 | } |
2307 | 2307 | // grab header |
2308 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2309 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2308 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2309 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2310 | 2310 | |
2311 | 2311 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2312 | 2312 | // the details template wrapper |
@@ -2323,7 +2323,7 @@ discard block |
||
2323 | 2323 | * @return string html |
2324 | 2324 | */ |
2325 | 2325 | protected function _get_registration_step_content() { |
2326 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2326 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2327 | 2327 | $warning_msg = sprintf( |
2328 | 2328 | __( |
2329 | 2329 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2339,7 +2339,7 @@ discard block |
||
2339 | 2339 | '</b>' |
2340 | 2340 | ); |
2341 | 2341 | return ' |
2342 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2342 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2343 | 2343 | <script > |
2344 | 2344 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2345 | 2345 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2374,16 +2374,16 @@ discard block |
||
2374 | 2374 | $cart = EE_Registry::instance()->SSN->cart(); |
2375 | 2375 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2376 | 2376 | |
2377 | - switch ( $step ) { |
|
2377 | + switch ($step) { |
|
2378 | 2378 | case 'ticket' : |
2379 | 2379 | $hidden_fields['processing_registration']['value'] = 1; |
2380 | 2380 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2381 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2381 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2382 | 2382 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2383 | 2383 | $template_args['show_notification_toggle'] = FALSE; |
2384 | 2384 | break; |
2385 | 2385 | case 'questions' : |
2386 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2386 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2387 | 2387 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2388 | 2388 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2389 | 2389 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2392,10 +2392,10 @@ discard block |
||
2392 | 2392 | break; |
2393 | 2393 | } |
2394 | 2394 | |
2395 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2395 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2396 | 2396 | |
2397 | 2397 | return EEH_Template::display_template( |
2398 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2398 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2399 | 2399 | ); |
2400 | 2400 | } |
2401 | 2401 | |
@@ -2410,11 +2410,11 @@ discard block |
||
2410 | 2410 | * @return boolean |
2411 | 2411 | */ |
2412 | 2412 | private function _set_reg_event() { |
2413 | - if ( is_object( $this->_reg_event )) { |
|
2413 | + if (is_object($this->_reg_event)) { |
|
2414 | 2414 | return TRUE; |
2415 | 2415 | } |
2416 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2417 | - if ( ! $EVT_ID ) { |
|
2416 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2417 | + if ( ! $EVT_ID) { |
|
2418 | 2418 | return FALSE; |
2419 | 2419 | } |
2420 | 2420 | |
@@ -2435,82 +2435,82 @@ discard block |
||
2435 | 2435 | public function process_reg_step() { |
2436 | 2436 | EE_System::do_not_cache(); |
2437 | 2437 | $this->_set_reg_event(); |
2438 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2438 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2439 | 2439 | |
2440 | 2440 | //what step are we on? |
2441 | 2441 | $cart = EE_Registry::instance()->SSN->cart(); |
2442 | 2442 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2443 | 2443 | |
2444 | 2444 | //if doing ajax then we need to verify the nonce |
2445 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2446 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2447 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2445 | + if (defined('DOING_AJAX')) { |
|
2446 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2447 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2448 | 2448 | } |
2449 | 2449 | |
2450 | - switch ( $step ) { |
|
2450 | + switch ($step) { |
|
2451 | 2451 | |
2452 | 2452 | case 'ticket' : |
2453 | 2453 | //process ticket selection |
2454 | 2454 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2455 | - if ( $success ) { |
|
2456 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2455 | + if ($success) { |
|
2456 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2457 | 2457 | } else { |
2458 | 2458 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2459 | 2459 | } |
2460 | - if ( defined('DOING_AJAX') ) { |
|
2460 | + if (defined('DOING_AJAX')) { |
|
2461 | 2461 | $this->new_registration(); //display next step |
2462 | 2462 | } else { |
2463 | 2463 | $query_args['action'] = 'new_registration'; |
2464 | 2464 | $query_args['processing_registration'] = 1; |
2465 | 2465 | $query_args['event_id'] = $this->_reg_event->ID(); |
2466 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2466 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2467 | 2467 | } |
2468 | 2468 | break; |
2469 | 2469 | |
2470 | 2470 | case 'questions' : |
2471 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2472 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2471 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2472 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2473 | 2473 | } |
2474 | 2474 | //process registration |
2475 | 2475 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2476 | - if ( $cart instanceof EE_Cart ) { |
|
2476 | + if ($cart instanceof EE_Cart) { |
|
2477 | 2477 | $grand_total = $cart->get_cart_grand_total(); |
2478 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2478 | + if ($grand_total instanceof EE_Line_Item) { |
|
2479 | 2479 | $grand_total->save_this_and_descendants_to_txn(); |
2480 | 2480 | } |
2481 | 2481 | } |
2482 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2482 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2483 | 2483 | $query_args = array( |
2484 | 2484 | 'action' => 'new_registration', |
2485 | 2485 | 'processing_registration' => 2, |
2486 | 2486 | 'event_id' => $this->_reg_event->ID() |
2487 | 2487 | ); |
2488 | 2488 | |
2489 | - if ( defined('DOING_AJAX' )) { |
|
2489 | + if (defined('DOING_AJAX')) { |
|
2490 | 2490 | //display registration form again because there are errors (maybe validation?) |
2491 | 2491 | $this->new_registration(); |
2492 | 2492 | return; |
2493 | 2493 | } else { |
2494 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2494 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2495 | 2495 | return; |
2496 | 2496 | } |
2497 | 2497 | } |
2498 | 2498 | /** @type EE_Transaction_Payments $transaction_payments */ |
2499 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2499 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2500 | 2500 | // maybe update status, and make sure to save transaction if not done already |
2501 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2501 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2502 | 2502 | $transaction->save(); |
2503 | 2503 | } |
2504 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2504 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2505 | 2505 | $this->_req_data = array(); |
2506 | 2506 | $query_args = array( |
2507 | 2507 | 'action' => 'redirect_to_txn', |
2508 | 2508 | 'TXN_ID' => $transaction->ID(), |
2509 | 2509 | 'EVT_ID' => $this->_reg_event->ID(), |
2510 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2510 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2511 | 2511 | 'redirect_from' => 'new_registration' |
2512 | 2512 | ); |
2513 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2513 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2514 | 2514 | break; |
2515 | 2515 | } |
2516 | 2516 | |
@@ -2527,21 +2527,21 @@ discard block |
||
2527 | 2527 | */ |
2528 | 2528 | public function redirect_to_txn() { |
2529 | 2529 | EE_System::do_not_cache(); |
2530 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2530 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2531 | 2531 | $query_args = array( |
2532 | 2532 | 'action' => 'view_transaction', |
2533 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2533 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2534 | 2534 | 'page' => 'espresso_transactions' |
2535 | 2535 | ); |
2536 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2537 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2538 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2539 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2536 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2537 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2538 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2539 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2540 | 2540 | } |
2541 | 2541 | EE_Error::add_success( |
2542 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2542 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2543 | 2543 | ); |
2544 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2544 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2545 | 2545 | } |
2546 | 2546 | |
2547 | 2547 | |
@@ -2552,7 +2552,7 @@ discard block |
||
2552 | 2552 | * @return void |
2553 | 2553 | */ |
2554 | 2554 | protected function _attendee_contact_list_table() { |
2555 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2555 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2556 | 2556 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2557 | 2557 | $this->display_admin_list_table_page_with_no_sidebar(); |
2558 | 2558 | } |
@@ -2567,10 +2567,10 @@ discard block |
||
2567 | 2567 | * @access public |
2568 | 2568 | * @return array |
2569 | 2569 | */ |
2570 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2570 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2571 | 2571 | |
2572 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2573 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2572 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2573 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2574 | 2574 | $ATT_MDL = EEM_Attendee::instance(); |
2575 | 2575 | |
2576 | 2576 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2598,47 +2598,47 @@ discard block |
||
2598 | 2598 | $orderby = 'ATT_lname'; |
2599 | 2599 | } |
2600 | 2600 | |
2601 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2601 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2602 | 2602 | |
2603 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2604 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2605 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2603 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2604 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2605 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2606 | 2606 | |
2607 | 2607 | $_where = array(); |
2608 | 2608 | |
2609 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
2610 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2609 | + if ( ! empty($this->_req_data['s'])) { |
|
2610 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2611 | 2611 | $_where['OR'] = array( |
2612 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2613 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2614 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2615 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2616 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2617 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2618 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2619 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2620 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2621 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2622 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2623 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2624 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2625 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2626 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2627 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2628 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2612 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2613 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2614 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2615 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2616 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2617 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2618 | + 'ATT_email' => array('LIKE', $sstr), |
|
2619 | + 'ATT_address' => array('LIKE', $sstr), |
|
2620 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2621 | + 'ATT_city' => array('LIKE', $sstr), |
|
2622 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2623 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2624 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2625 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2626 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2627 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2628 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2629 | 2629 | ); |
2630 | 2630 | } |
2631 | 2631 | |
2632 | 2632 | |
2633 | - $offset = ($current_page-1)*$per_page; |
|
2634 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2633 | + $offset = ($current_page - 1) * $per_page; |
|
2634 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2635 | 2635 | |
2636 | - if ( $trash ) { |
|
2637 | - $_where['status'] = array( '!=', 'publish' ); |
|
2638 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true ): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2636 | + if ($trash) { |
|
2637 | + $_where['status'] = array('!=', 'publish'); |
|
2638 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2639 | 2639 | } else { |
2640 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2641 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit ), 'ATT_ID' , true ) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2640 | + $_where['status'] = array('IN', array('publish')); |
|
2641 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2642 | 2642 | } |
2643 | 2643 | |
2644 | 2644 | return $all_attendees; |
@@ -2655,10 +2655,10 @@ discard block |
||
2655 | 2655 | */ |
2656 | 2656 | protected function _resend_registration() { |
2657 | 2657 | $this->_process_resend_registration(); |
2658 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2658 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2659 | 2659 | 'action' => 'default' |
2660 | 2660 | ); |
2661 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2661 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2662 | 2662 | } |
2663 | 2663 | |
2664 | 2664 | |
@@ -2666,26 +2666,26 @@ discard block |
||
2666 | 2666 | |
2667 | 2667 | |
2668 | 2668 | |
2669 | - public function _registrations_report(){ |
|
2670 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2671 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2669 | + public function _registrations_report() { |
|
2670 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2671 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2672 | 2672 | array( |
2673 | 2673 | 'page' => 'espresso_batch', |
2674 | 2674 | 'batch' => 'file', |
2675 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2676 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2677 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2678 | - )) ); |
|
2675 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2676 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2677 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2678 | + ))); |
|
2679 | 2679 | } else { |
2680 | 2680 | $new_request_args = array( |
2681 | 2681 | 'export' => 'report', |
2682 | 2682 | 'action' => 'registrations_report_for_event', |
2683 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2683 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2684 | 2684 | ); |
2685 | 2685 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2686 | 2686 | |
2687 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2688 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2687 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2688 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2689 | 2689 | $EE_Export = EE_Export::instance($this->_req_data); |
2690 | 2690 | $EE_Export->export(); |
2691 | 2691 | } |
@@ -2694,26 +2694,26 @@ discard block |
||
2694 | 2694 | |
2695 | 2695 | |
2696 | 2696 | |
2697 | - public function _contact_list_export(){ |
|
2698 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2699 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2697 | + public function _contact_list_export() { |
|
2698 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2699 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2700 | 2700 | $EE_Export = EE_Export::instance($this->_req_data); |
2701 | 2701 | $EE_Export->export_attendees(); |
2702 | 2702 | } |
2703 | 2703 | } |
2704 | 2704 | |
2705 | - public function _contact_list_report(){ |
|
2706 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2707 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2705 | + public function _contact_list_report() { |
|
2706 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2707 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2708 | 2708 | array( |
2709 | 2709 | 'page' => 'espresso_batch', |
2710 | 2710 | 'batch' => 'file', |
2711 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2712 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2713 | - )) ); |
|
2711 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2712 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2713 | + ))); |
|
2714 | 2714 | } else { |
2715 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2716 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2715 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2716 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2717 | 2717 | $EE_Export = EE_Export::instance($this->_req_data); |
2718 | 2718 | $EE_Export->report_attendees(); |
2719 | 2719 | } |
@@ -2732,73 +2732,73 @@ discard block |
||
2732 | 2732 | * @return void |
2733 | 2733 | */ |
2734 | 2734 | protected function _duplicate_attendee() { |
2735 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2735 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2736 | 2736 | //verify we have necessary info |
2737 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2738 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2739 | - $query_args = array( 'action' => $action ); |
|
2737 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2738 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2739 | + $query_args = array('action' => $action); |
|
2740 | 2740 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2741 | 2741 | } |
2742 | 2742 | |
2743 | 2743 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2744 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2744 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2745 | 2745 | $attendee = $registration->attendee(); |
2746 | 2746 | |
2747 | 2747 | //remove relation of existing attendee on registration |
2748 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2748 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2749 | 2749 | //new attendee |
2750 | 2750 | $new_attendee = clone $attendee; |
2751 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2751 | + $new_attendee->set('ATT_ID', 0); |
|
2752 | 2752 | $new_attendee->save(); |
2753 | 2753 | |
2754 | 2754 | //add new attendee to reg |
2755 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2755 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2756 | 2756 | |
2757 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2757 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2758 | 2758 | |
2759 | 2759 | //redirect to edit page for attendee |
2760 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2760 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2761 | 2761 | |
2762 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2762 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2763 | 2763 | } |
2764 | 2764 | |
2765 | 2765 | |
2766 | 2766 | //related to cpt routes |
2767 | 2767 | protected function _insert_update_cpt_item($post_id, $post) { |
2768 | 2768 | $success = true; |
2769 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2769 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2770 | 2770 | //for attendee updates |
2771 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2771 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2772 | 2772 | //note we should only be UPDATING attendees at this point. |
2773 | 2773 | $updated_fields = array( |
2774 | 2774 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2775 | 2775 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2776 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2776 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2777 | 2777 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2778 | 2778 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2779 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2780 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2781 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2782 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2783 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2784 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2779 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2780 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2781 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2782 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2783 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2784 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2785 | 2785 | ); |
2786 | - foreach ( $updated_fields as $field => $value ) { |
|
2786 | + foreach ($updated_fields as $field => $value) { |
|
2787 | 2787 | $attendee->set($field, $value); |
2788 | 2788 | } |
2789 | 2789 | |
2790 | 2790 | $success = $attendee->save(); |
2791 | 2791 | |
2792 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2793 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2794 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2795 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2792 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2793 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2794 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2795 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2796 | 2796 | } |
2797 | 2797 | } |
2798 | 2798 | } |
2799 | 2799 | |
2800 | - if ( $success === FALSE ) |
|
2801 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2800 | + if ($success === FALSE) |
|
2801 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2802 | 2802 | |
2803 | 2803 | } |
2804 | 2804 | |
@@ -2818,17 +2818,17 @@ discard block |
||
2818 | 2818 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2819 | 2819 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2820 | 2820 | |
2821 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2822 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2821 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2822 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2823 | 2823 | } |
2824 | 2824 | |
2825 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2825 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2826 | 2826 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2827 | 2827 | } |
2828 | 2828 | |
2829 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2830 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2831 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2829 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2830 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2831 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2832 | 2832 | } |
2833 | 2833 | |
2834 | 2834 | |
@@ -2837,10 +2837,10 @@ discard block |
||
2837 | 2837 | * @param WP_Post $post wp post object |
2838 | 2838 | * @return string attendee contact info ( and form ) |
2839 | 2839 | */ |
2840 | - public function attendee_contact_info( $post ) { |
|
2840 | + public function attendee_contact_info($post) { |
|
2841 | 2841 | //get attendee object ( should already have it ) |
2842 | 2842 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2843 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2843 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2844 | 2844 | EEH_Template::display_template($template, $this->_template_args); |
2845 | 2845 | } |
2846 | 2846 | |
@@ -2856,12 +2856,12 @@ discard block |
||
2856 | 2856 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2857 | 2857 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2858 | 2858 | new EE_Question_Form_Input( |
2859 | - EE_Question::new_instance( array( |
|
2859 | + EE_Question::new_instance(array( |
|
2860 | 2860 | 'QST_ID' => 0, |
2861 | 2861 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2862 | 2862 | 'QST_system' => 'admin-state' |
2863 | 2863 | )), |
2864 | - EE_Answer::new_instance( array( |
|
2864 | + EE_Answer::new_instance(array( |
|
2865 | 2865 | 'ANS_ID' => 0, |
2866 | 2866 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2867 | 2867 | )), |
@@ -2874,12 +2874,12 @@ discard block |
||
2874 | 2874 | )); |
2875 | 2875 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2876 | 2876 | new EE_Question_Form_Input( |
2877 | - EE_Question::new_instance( array( |
|
2877 | + EE_Question::new_instance(array( |
|
2878 | 2878 | 'QST_ID' => 0, |
2879 | 2879 | 'QST_display_text' => __('Country', 'event_espresso'), |
2880 | 2880 | 'QST_system' => 'admin-country' |
2881 | 2881 | )), |
2882 | - EE_Answer::new_instance( array( |
|
2882 | + EE_Answer::new_instance(array( |
|
2883 | 2883 | 'ANS_ID' => 0, |
2884 | 2884 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2885 | 2885 | )), |
@@ -2890,8 +2890,8 @@ discard block |
||
2890 | 2890 | 'append_qstn_id' => FALSE |
2891 | 2891 | ) |
2892 | 2892 | )); |
2893 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2894 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2893 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2894 | + EEH_Template::display_template($template, $this->_template_args); |
|
2895 | 2895 | |
2896 | 2896 | } |
2897 | 2897 | |
@@ -2901,11 +2901,11 @@ discard block |
||
2901 | 2901 | * @access protected |
2902 | 2902 | * @return void |
2903 | 2903 | */ |
2904 | - public function attendee_registrations_meta_box( $post ) { |
|
2904 | + public function attendee_registrations_meta_box($post) { |
|
2905 | 2905 | |
2906 | 2906 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2907 | 2907 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2908 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2908 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2909 | 2909 | EEH_Template::display_template($template, $this->_template_args); |
2910 | 2910 | |
2911 | 2911 | } |
@@ -2919,8 +2919,8 @@ discard block |
||
2919 | 2919 | * @return string html for new form. |
2920 | 2920 | */ |
2921 | 2921 | public function after_title_form_fields($post) { |
2922 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2923 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2922 | + if ($post->post_type == 'espresso_attendees') { |
|
2923 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2924 | 2924 | $template_args['attendee'] = $this->_cpt_model_obj; |
2925 | 2925 | EEH_Template::display_template($template, $template_args); |
2926 | 2926 | } |
@@ -2937,21 +2937,21 @@ discard block |
||
2937 | 2937 | * @access protected |
2938 | 2938 | * @return void |
2939 | 2939 | */ |
2940 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2940 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2941 | 2941 | |
2942 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2942 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2943 | 2943 | |
2944 | 2944 | $ATT_MDL = EEM_Attendee::instance(); |
2945 | 2945 | |
2946 | 2946 | $success = 1; |
2947 | 2947 | //Checkboxes |
2948 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2948 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2949 | 2949 | // if array has more than one element than success message should be plural |
2950 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2950 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2951 | 2951 | // cycle thru checkboxes |
2952 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2953 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2954 | - if ( !$updated ) { |
|
2952 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2953 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2954 | + if ( ! $updated) { |
|
2955 | 2955 | $success = 0; |
2956 | 2956 | } |
2957 | 2957 | } |
@@ -2960,18 +2960,18 @@ discard block |
||
2960 | 2960 | // grab single id and delete |
2961 | 2961 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2962 | 2962 | //get attendee |
2963 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2963 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2964 | 2964 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2965 | 2965 | $updated = $att->save(); |
2966 | - if ( ! $updated ) { |
|
2966 | + if ( ! $updated) { |
|
2967 | 2967 | $success = 0; |
2968 | 2968 | } |
2969 | 2969 | |
2970 | 2970 | } |
2971 | 2971 | |
2972 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2973 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2974 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2972 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2973 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2974 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2975 | 2975 | |
2976 | 2976 | } |
2977 | 2977 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Processor |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * @param array $registration_query_params |
53 | 53 | *@return EE_Transaction_Processor instance |
54 | 54 | */ |
55 | - public static function instance( $registration_query_params = array() ) { |
|
55 | + public static function instance($registration_query_params = array()) { |
|
56 | 56 | // check if class object is instantiated |
57 | - if ( ! self::$_instance instanceof EE_Transaction_Processor ) { |
|
58 | - self::$_instance = new self( $registration_query_params ); |
|
57 | + if ( ! self::$_instance instanceof EE_Transaction_Processor) { |
|
58 | + self::$_instance = new self($registration_query_params); |
|
59 | 59 | } |
60 | 60 | return self::$_instance; |
61 | 61 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * @param array $registration_query_params |
67 | 67 | * @return EE_Transaction_Processor |
68 | 68 | */ |
69 | - private function __construct( $registration_query_params = array() ) { |
|
69 | + private function __construct($registration_query_params = array()) { |
|
70 | 70 | // make sure some query params are set for retrieving registrations |
71 | - $this->_set_registration_query_params( $registration_query_params ); |
|
71 | + $this->_set_registration_query_params($registration_query_params); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * @access private |
78 | 78 | * @param array $registration_query_params |
79 | 79 | */ |
80 | - private function _set_registration_query_params( $registration_query_params ) { |
|
81 | - $this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
80 | + private function _set_registration_query_params($registration_query_params) { |
|
81 | + $this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC')); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * @param string $old_txn_status |
97 | 97 | */ |
98 | - public function set_old_txn_status( $old_txn_status ) { |
|
98 | + public function set_old_txn_status($old_txn_status) { |
|
99 | 99 | // only set the first time |
100 | - if ( $this->_old_txn_status === null ) { |
|
100 | + if ($this->_old_txn_status === null) { |
|
101 | 101 | $this->_old_txn_status = $old_txn_status; |
102 | 102 | } |
103 | 103 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | /** |
117 | 117 | * @param string $new_txn_status |
118 | 118 | */ |
119 | - public function set_new_txn_status( $new_txn_status ) { |
|
119 | + public function set_new_txn_status($new_txn_status) { |
|
120 | 120 | $this->_new_txn_status = $new_txn_status; |
121 | 121 | } |
122 | 122 | |
@@ -147,17 +147,17 @@ discard block |
||
147 | 147 | * @param bool $check_all |
148 | 148 | * @return boolean | int |
149 | 149 | */ |
150 | - private function _reg_steps_completed( EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE ) { |
|
150 | + private function _reg_steps_completed(EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE) { |
|
151 | 151 | $reg_steps = $transaction->reg_steps(); |
152 | - if ( ! is_array( $reg_steps ) || empty( $reg_steps )) { |
|
152 | + if ( ! is_array($reg_steps) || empty($reg_steps)) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | // loop thru reg steps array) |
156 | - foreach ( $reg_steps as $slug => $reg_step_completed ) { |
|
156 | + foreach ($reg_steps as $slug => $reg_step_completed) { |
|
157 | 157 | // if NOT checking ALL steps (only checking one step) |
158 | - if ( ! $check_all ) { |
|
158 | + if ( ! $check_all) { |
|
159 | 159 | // and this is the one |
160 | - if ( $slug === $reg_step_slug ) { |
|
160 | + if ($slug === $reg_step_slug) { |
|
161 | 161 | return $reg_step_completed; |
162 | 162 | } else { |
163 | 163 | // skip to next reg step in loop |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | // $check_all must be true, else we would never have gotten to this point |
168 | - if ( $slug === $reg_step_slug ) { |
|
168 | + if ($slug === $reg_step_slug) { |
|
169 | 169 | // if we reach this point, then we are testing either: |
170 | 170 | // all_reg_steps_completed_except() or |
171 | 171 | // all_reg_steps_completed_except_final_step(), |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // ie: "is everything completed except the final step?" |
175 | 175 | // "that is correct... the final step is not completed, but all others are." |
176 | 176 | return $reg_step_completed !== true ? true : false; |
177 | - } else if ( $reg_step_completed !== true ) { |
|
177 | + } else if ($reg_step_completed !== true) { |
|
178 | 178 | // if any reg step is NOT completed, then ALL steps are not completed |
179 | 179 | return false; |
180 | 180 | } |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | * @param EE_Transaction $transaction |
196 | 196 | * @return boolean |
197 | 197 | */ |
198 | - public function all_reg_steps_completed( EE_Transaction $transaction ) { |
|
199 | - return $this->_reg_steps_completed( $transaction ); |
|
198 | + public function all_reg_steps_completed(EE_Transaction $transaction) { |
|
199 | + return $this->_reg_steps_completed($transaction); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | * @param string $exception |
214 | 214 | * @return boolean |
215 | 215 | */ |
216 | - public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) { |
|
217 | - return $this->_reg_steps_completed( $transaction, $exception ); |
|
216 | + public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') { |
|
217 | + return $this->_reg_steps_completed($transaction, $exception); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | * @param EE_Transaction $transaction |
231 | 231 | * @return boolean |
232 | 232 | */ |
233 | - public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) { |
|
234 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration' ); |
|
233 | + public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) { |
|
234 | + return $this->_reg_steps_completed($transaction, 'finalize_registration'); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | * @param string $reg_step_slug |
249 | 249 | * @return boolean | int |
250 | 250 | */ |
251 | - public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
252 | - return $this->_reg_steps_completed( $transaction, $reg_step_slug, FALSE ); |
|
251 | + public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
252 | + return $this->_reg_steps_completed($transaction, $reg_step_slug, FALSE); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | * @param EE_Transaction $transaction |
266 | 266 | * @return boolean | int |
267 | 267 | */ |
268 | - public function final_reg_step_completed( EE_Transaction $transaction ) { |
|
269 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration', FALSE ); |
|
268 | + public function final_reg_step_completed(EE_Transaction $transaction) { |
|
269 | + return $this->_reg_steps_completed($transaction, 'finalize_registration', FALSE); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @return boolean |
282 | 282 | * @throws \EE_Error |
283 | 283 | */ |
284 | - public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) { |
|
285 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, time() ); |
|
284 | + public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) { |
|
285 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, time()); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @return boolean |
298 | 298 | * @throws \EE_Error |
299 | 299 | */ |
300 | - public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
301 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, true ); |
|
300 | + public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
301 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, true); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | * @return boolean |
314 | 314 | * @throws \EE_Error |
315 | 315 | */ |
316 | - public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
317 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, false ); |
|
316 | + public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
317 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, false); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -330,37 +330,37 @@ discard block |
||
330 | 330 | * @return boolean |
331 | 331 | * @throws \EE_Error |
332 | 332 | */ |
333 | - private function _set_reg_step_completed_status( EE_Transaction $transaction, $reg_step_slug, $status ) { |
|
333 | + private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status) { |
|
334 | 334 | // validate status |
335 | - $status = is_bool( $status ) || is_int( $status ) ? $status : false; |
|
335 | + $status = is_bool($status) || is_int($status) ? $status : false; |
|
336 | 336 | // get reg steps array |
337 | 337 | $txn_reg_steps = $transaction->reg_steps(); |
338 | 338 | // if reg step does NOT exist |
339 | - if ( ! isset( $txn_reg_steps[ $reg_step_slug ] )) { |
|
339 | + if ( ! isset($txn_reg_steps[$reg_step_slug])) { |
|
340 | 340 | return false; |
341 | 341 | } |
342 | 342 | // if we're trying to complete a step that is already completed |
343 | - if ( $txn_reg_steps[ $reg_step_slug ] === true ) { |
|
343 | + if ($txn_reg_steps[$reg_step_slug] === true) { |
|
344 | 344 | return true; |
345 | 345 | } |
346 | 346 | // if we're trying to complete a step that hasn't even started |
347 | - if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) { |
|
347 | + if ($status === true && $txn_reg_steps[$reg_step_slug] === false) { |
|
348 | 348 | return false; |
349 | 349 | } |
350 | 350 | // if current status value matches the incoming value (no change) |
351 | 351 | // type casting as int means values should collapse to either 0, 1, or a timestamp like 1234567890 |
352 | - if ( (int)$txn_reg_steps[ $reg_step_slug ] === (int)$status ) { |
|
352 | + if ((int) $txn_reg_steps[$reg_step_slug] === (int) $status) { |
|
353 | 353 | // this will happen in cases where multiple AJAX requests occur during the same step |
354 | 354 | return true; |
355 | 355 | } |
356 | 356 | // if we're trying to set a start time, but it has already been set... |
357 | - if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] )) { |
|
357 | + if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) { |
|
358 | 358 | // skip the update below, but don't return FALSE so that errors won't be displayed |
359 | 359 | return true; |
360 | 360 | } |
361 | 361 | // update completed status |
362 | - $txn_reg_steps[ $reg_step_slug ] = $status; |
|
363 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
362 | + $txn_reg_steps[$reg_step_slug] = $status; |
|
363 | + $transaction->set_reg_steps($txn_reg_steps); |
|
364 | 364 | $transaction->save(); |
365 | 365 | // DEBUG LOG |
366 | 366 | //$this->log( |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | * @param string $reg_step_slug |
387 | 387 | * @return void |
388 | 388 | */ |
389 | - public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) { |
|
389 | + public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) { |
|
390 | 390 | // get reg steps array |
391 | 391 | $txn_reg_steps = $transaction->reg_steps(); |
392 | - unset( $txn_reg_steps[ $reg_step_slug ] ); |
|
393 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
392 | + unset($txn_reg_steps[$reg_step_slug]); |
|
393 | + $transaction->set_reg_steps($txn_reg_steps); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | * @return boolean |
406 | 406 | * @throws \EE_Error |
407 | 407 | */ |
408 | - public function toggle_failed_transaction_status( EE_Transaction $transaction ) { |
|
408 | + public function toggle_failed_transaction_status(EE_Transaction $transaction) { |
|
409 | 409 | $existing_txn_status = $transaction->status_ID(); |
410 | 410 | // set incoming TXN_Status |
411 | - $this->set_old_txn_status( $existing_txn_status ); |
|
411 | + $this->set_old_txn_status($existing_txn_status); |
|
412 | 412 | // if TXN status is still set as "failed"... |
413 | - if ( $existing_txn_status === EEM_Transaction::failed_status_code ) { |
|
413 | + if ($existing_txn_status === EEM_Transaction::failed_status_code) { |
|
414 | 414 | // set incoming TXN_Status |
415 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
416 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
415 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
416 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
417 | 417 | $transaction->save(); |
418 | 418 | return TRUE; |
419 | 419 | } |
@@ -430,27 +430,27 @@ discard block |
||
430 | 430 | * @param EE_Transaction $transaction |
431 | 431 | * @return boolean |
432 | 432 | */ |
433 | - public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) { |
|
433 | + public function toggle_abandoned_transaction_status(EE_Transaction $transaction) { |
|
434 | 434 | // set incoming TXN_Status |
435 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
435 | + $this->set_old_txn_status($transaction->status_ID()); |
|
436 | 436 | // if TXN status has not been updated already due to a payment, and is still set as "failed" or "abandoned"... |
437 | 437 | $txn_status = $transaction->status_ID(); |
438 | 438 | if ( |
439 | 439 | $txn_status === EEM_Transaction::failed_status_code |
440 | 440 | || $txn_status === EEM_Transaction::abandoned_status_code |
441 | 441 | ) { |
442 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
442 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
443 | 443 | // if a contact record for the primary registrant has been created |
444 | 444 | if ( |
445 | 445 | $transaction->primary_registration() instanceof EE_Registration |
446 | 446 | && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
447 | 447 | ) { |
448 | - $transaction->set_status( EEM_Transaction::incomplete_status_code ); |
|
449 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
448 | + $transaction->set_status(EEM_Transaction::incomplete_status_code); |
|
449 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
450 | 450 | } else { |
451 | 451 | // no contact record? yer abandoned! |
452 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
453 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
452 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
453 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
454 | 454 | } |
455 | 455 | return TRUE; |
456 | 456 | } |
@@ -483,10 +483,10 @@ discard block |
||
483 | 483 | ); |
484 | 484 | // send messages |
485 | 485 | /** @type EE_Registration_Processor $registration_processor */ |
486 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
486 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
487 | 487 | $registration_processor->trigger_registration_update_notifications( |
488 | 488 | $transaction->primary_registration(), |
489 | - array( 'manually_updated' => true ) |
|
489 | + array('manually_updated' => true) |
|
490 | 490 | ); |
491 | 491 | do_action( |
492 | 492 | 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', |
@@ -573,15 +573,15 @@ discard block |
||
573 | 573 | $registration_query_params = array() |
574 | 574 | ) { |
575 | 575 | // set incoming TXN_Status, and consider it new since old status should have been set |
576 | - $this->set_new_txn_status( $transaction->status_ID() ); |
|
576 | + $this->set_new_txn_status($transaction->status_ID()); |
|
577 | 577 | // make sure some query params are set for retrieving registrations |
578 | - $this->_set_registration_query_params( $registration_query_params ); |
|
578 | + $this->_set_registration_query_params($registration_query_params); |
|
579 | 579 | // get final reg step status |
580 | - $finalized = $this->final_reg_step_completed( $transaction ); |
|
580 | + $finalized = $this->final_reg_step_completed($transaction); |
|
581 | 581 | // if the 'finalize_registration' step has been initiated (has a timestamp) |
582 | 582 | // but has not yet been fully completed (TRUE) |
583 | - if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) { |
|
584 | - $this->set_reg_step_completed( $transaction, 'finalize_registration' ); |
|
583 | + if (is_int($finalized) && $finalized !== false && $finalized !== true) { |
|
584 | + $this->set_reg_step_completed($transaction, 'finalize_registration'); |
|
585 | 585 | $finalized = true; |
586 | 586 | } |
587 | 587 | $transaction->save(); |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | |
605 | 605 | // send messages |
606 | 606 | /** @type EE_Registration_Processor $registration_processor */ |
607 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
607 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
608 | 608 | $registration_processor->trigger_registration_update_notifications( |
609 | 609 | $transaction->primary_registration(), |
610 | 610 | $update_params |
@@ -635,22 +635,22 @@ discard block |
||
635 | 635 | $update_txn = true |
636 | 636 | ) { |
637 | 637 | // these reg statuses should not be considered in any calculations involving monies owing |
638 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
639 | - if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
638 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
639 | + if (in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
640 | 640 | return false; |
641 | 641 | } |
642 | 642 | try { |
643 | - $transaction = $this->get_transaction_for_registration( $registration ); |
|
643 | + $transaction = $this->get_transaction_for_registration($registration); |
|
644 | 644 | $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( |
645 | 645 | $transaction, |
646 | 646 | $registration |
647 | 647 | ); |
648 | 648 | // un-cancel the ticket |
649 | - $success = EEH_Line_Item::reinstate_canceled_ticket_line_item( $ticket_line_item ); |
|
650 | - } catch ( EE_Error $e ) { |
|
649 | + $success = EEH_Line_Item::reinstate_canceled_ticket_line_item($ticket_line_item); |
|
650 | + } catch (EE_Error $e) { |
|
651 | 651 | EE_Error::add_error( |
652 | 652 | sprintf( |
653 | - __( 'The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso' ), |
|
653 | + __('The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso'), |
|
654 | 654 | $registration->ID(), |
655 | 655 | '<br />', |
656 | 656 | $e->getMessage() |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | ); |
660 | 660 | return false; |
661 | 661 | } |
662 | - if ( $update_txn ) { |
|
662 | + if ($update_txn) { |
|
663 | 663 | return $transaction->save() ? $success : false; |
664 | 664 | } |
665 | 665 | return $success; |
@@ -683,18 +683,18 @@ discard block |
||
683 | 683 | $update_txn = true |
684 | 684 | ) { |
685 | 685 | // these reg statuses should not be considered in any calculations involving monies owing |
686 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
687 | - if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
686 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
687 | + if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
688 | 688 | return false; |
689 | 689 | } |
690 | 690 | try { |
691 | - $transaction = $this->get_transaction_for_registration( $registration ); |
|
692 | - $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( $transaction, $registration ); |
|
693 | - EEH_Line_Item::cancel_ticket_line_item( $ticket_line_item ); |
|
694 | - } catch ( EE_Error $e ) { |
|
691 | + $transaction = $this->get_transaction_for_registration($registration); |
|
692 | + $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration($transaction, $registration); |
|
693 | + EEH_Line_Item::cancel_ticket_line_item($ticket_line_item); |
|
694 | + } catch (EE_Error $e) { |
|
695 | 695 | EE_Error::add_error( |
696 | 696 | sprintf( |
697 | - __( 'The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso' ), |
|
697 | + __('The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso'), |
|
698 | 698 | $registration->ID(), |
699 | 699 | '<br />', |
700 | 700 | $e->getMessage() |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | ); |
704 | 704 | return false; |
705 | 705 | } |
706 | - if ( $update_txn ) { |
|
706 | + if ($update_txn) { |
|
707 | 707 | return $transaction->save() ? true : false; |
708 | 708 | } |
709 | 709 | return true; |
@@ -719,12 +719,12 @@ discard block |
||
719 | 719 | * @return EE_Transaction |
720 | 720 | * @throws EE_Error |
721 | 721 | */ |
722 | - public function get_transaction_for_registration( EE_Registration $registration ) { |
|
722 | + public function get_transaction_for_registration(EE_Registration $registration) { |
|
723 | 723 | $transaction = $registration->transaction(); |
724 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
724 | + if ( ! $transaction instanceof EE_Transaction) { |
|
725 | 725 | throw new EE_Error( |
726 | 726 | sprintf( |
727 | - __( 'The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso' ), |
|
727 | + __('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'), |
|
728 | 728 | $registration->ID() |
729 | 729 | ) |
730 | 730 | ); |
@@ -747,16 +747,16 @@ discard block |
||
747 | 747 | EE_Transaction $transaction, |
748 | 748 | EE_Registration $registration |
749 | 749 | ) { |
750 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
750 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
751 | 751 | $ticket_line_item = EEM_Line_Item::instance()->get_ticket_line_item_for_transaction( |
752 | 752 | $transaction->ID(), |
753 | 753 | $registration->ticket_ID() |
754 | 754 | ); |
755 | - if ( ! $ticket_line_item instanceof EE_Line_Item ) { |
|
755 | + if ( ! $ticket_line_item instanceof EE_Line_Item) { |
|
756 | 756 | throw new EE_Error( |
757 | 757 | sprintf( |
758 | - __( 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.', |
|
759 | - 'event_espresso' ), |
|
758 | + __('The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.', |
|
759 | + 'event_espresso'), |
|
760 | 760 | $transaction->ID(), |
761 | 761 | $registration->ticket_ID() |
762 | 762 | ) |
@@ -789,26 +789,26 @@ discard block |
||
789 | 789 | $update_txn = true |
790 | 790 | ) { |
791 | 791 | // make sure some query params are set for retrieving registrations |
792 | - $this->_set_registration_query_params( $registration_query_params ); |
|
792 | + $this->_set_registration_query_params($registration_query_params); |
|
793 | 793 | // these reg statuses should not be considered in any calculations involving monies owing |
794 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
794 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
795 | 795 | // loop through cached registrations |
796 | - foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) { |
|
796 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
797 | 797 | if ( |
798 | 798 | $registration instanceof EE_Registration |
799 | - && ! in_array( $registration->status_ID(), $closed_reg_statuses ) |
|
799 | + && ! in_array($registration->status_ID(), $closed_reg_statuses) |
|
800 | 800 | ) { |
801 | 801 | return false; |
802 | 802 | } |
803 | 803 | } |
804 | - if ( in_array( $new_TXN_status, EEM_Transaction::txn_status_array() ) ) { |
|
804 | + if (in_array($new_TXN_status, EEM_Transaction::txn_status_array())) { |
|
805 | 805 | // set incoming TXN_Status |
806 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
807 | - $transaction->set_status( $new_TXN_status ); |
|
806 | + $this->set_old_txn_status($transaction->status_ID()); |
|
807 | + $transaction->set_status($new_TXN_status); |
|
808 | 808 | // set new TXN_Status |
809 | - $this->set_new_txn_status( $new_TXN_status ); |
|
809 | + $this->set_new_txn_status($new_TXN_status); |
|
810 | 810 | } |
811 | - if ( $update_txn ) { |
|
811 | + if ($update_txn) { |
|
812 | 812 | return $transaction->save() ? true : false; |
813 | 813 | } |
814 | 814 | return true; |
@@ -837,22 +837,22 @@ discard block |
||
837 | 837 | ) { |
838 | 838 | $response = false; |
839 | 839 | /** @type EE_Registration_Processor $registration_processor */ |
840 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
840 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
841 | 841 | // check that method exists |
842 | - if ( ! method_exists( $registration_processor, $method_name )) { |
|
843 | - throw new EE_Error( __( 'Method does not exist.', 'event_espresso' )); |
|
842 | + if ( ! method_exists($registration_processor, $method_name)) { |
|
843 | + throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
|
844 | 844 | } |
845 | 845 | // make sure some query params are set for retrieving registrations |
846 | - $this->_set_registration_query_params( $registration_query_params ); |
|
846 | + $this->_set_registration_query_params($registration_query_params); |
|
847 | 847 | // loop through cached registrations |
848 | - foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) { |
|
849 | - if ( $registration instanceof EE_Registration ) { |
|
850 | - if ( $additional_param ) { |
|
851 | - $response = $registration_processor->{$method_name}( $registration, $additional_param ) |
|
848 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
849 | + if ($registration instanceof EE_Registration) { |
|
850 | + if ($additional_param) { |
|
851 | + $response = $registration_processor->{$method_name}($registration, $additional_param) |
|
852 | 852 | ? true |
853 | 853 | : $response; |
854 | 854 | } else { |
855 | - $response = $registration_processor->{$method_name}( $registration ) |
|
855 | + $response = $registration_processor->{$method_name}($registration) |
|
856 | 856 | ? true |
857 | 857 | : $response; |
858 | 858 | } |
@@ -879,28 +879,28 @@ discard block |
||
879 | 879 | public function set_transaction_payment_method_based_on_registration_statuses( |
880 | 880 | EE_Registration $edited_registration |
881 | 881 | ) { |
882 | - if ( $edited_registration instanceof EE_Registration ) { |
|
882 | + if ($edited_registration instanceof EE_Registration) { |
|
883 | 883 | $transaction = $edited_registration->transaction(); |
884 | - if ( $transaction instanceof EE_Transaction ) { |
|
884 | + if ($transaction instanceof EE_Transaction) { |
|
885 | 885 | $all_not_approved = true; |
886 | - foreach ( $transaction->registrations() as $registration ) { |
|
887 | - if ( $registration instanceof EE_Registration ) { |
|
886 | + foreach ($transaction->registrations() as $registration) { |
|
887 | + if ($registration instanceof EE_Registration) { |
|
888 | 888 | // if any REG != "Not Approved" then toggle to false |
889 | 889 | $all_not_approved = $registration->is_not_approved() ? $all_not_approved : false; |
890 | 890 | } |
891 | 891 | } |
892 | 892 | // if ALL Registrations are "Not Approved" |
893 | - if ( $all_not_approved ) { |
|
894 | - $transaction->set_payment_method_ID( null ); |
|
893 | + if ($all_not_approved) { |
|
894 | + $transaction->set_payment_method_ID(null); |
|
895 | 895 | $transaction->save(); |
896 | 896 | } else { |
897 | 897 | $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
898 | 898 | $transaction, |
899 | 899 | EEM_Payment_Method::scope_cart |
900 | 900 | ); |
901 | - if ( ! empty( $available_payment_methods ) ) { |
|
901 | + if ( ! empty($available_payment_methods)) { |
|
902 | 902 | $PMD_ID = 0; |
903 | - foreach ( $available_payment_methods as $available_payment_method ) { |
|
903 | + foreach ($available_payment_methods as $available_payment_method) { |
|
904 | 904 | if ( |
905 | 905 | $available_payment_method instanceof EE_Payment_Method |
906 | 906 | && $available_payment_method->open_by_default() |
@@ -909,22 +909,22 @@ discard block |
||
909 | 909 | break; |
910 | 910 | } |
911 | 911 | } |
912 | - if ( ! $PMD_ID ) { |
|
913 | - $first_payment_method = reset( $available_payment_methods ); |
|
914 | - if ( $first_payment_method instanceof EE_Payment_Method ) { |
|
912 | + if ( ! $PMD_ID) { |
|
913 | + $first_payment_method = reset($available_payment_methods); |
|
914 | + if ($first_payment_method instanceof EE_Payment_Method) { |
|
915 | 915 | $PMD_ID = $first_payment_method->ID(); |
916 | 916 | } else { |
917 | 917 | EE_Error::add_error( |
918 | - __( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ), |
|
918 | + __('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'), |
|
919 | 919 | __FILE__, __LINE__, __FUNCTION__ |
920 | 920 | ); |
921 | 921 | } |
922 | 922 | } |
923 | - $transaction->set_payment_method_ID( $PMD_ID ); |
|
923 | + $transaction->set_payment_method_ID($PMD_ID); |
|
924 | 924 | $transaction->save(); |
925 | 925 | } else { |
926 | 926 | EE_Error::add_error( |
927 | - __( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ), |
|
927 | + __('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'), |
|
928 | 928 | __FILE__, __LINE__, __FUNCTION__ |
929 | 929 | ); |
930 | 930 | } |