@@ -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 ) ) ); |
@@ -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 ); |
@@ -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 | - $this->transaction()->update_status_based_on_total_paid( true ); |
|
172 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
170 | + $transaction_payments->recalculate_transaction_total($this->transaction(), false); |
|
171 | + $this->transaction()->update_status_based_on_total_paid(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 |
@@ -9,8 +9,8 @@ |
||
9 | 9 | /** @var string $after_list_table */ |
10 | 10 | ?> |
11 | 11 | <?php echo $before_list_table; ?> |
12 | -<form id="<?php echo $list_table_class; ?>-table-frm" action="<?php echo $table_url;?>" method="get"> |
|
13 | - <?php $list_table->search_box( $search['btn_label'], $current_page ); ?><br /> |
|
12 | +<form id="<?php echo $list_table_class; ?>-table-frm" action="<?php echo $table_url; ?>" method="get"> |
|
13 | + <?php $list_table->search_box($search['btn_label'], $current_page); ?><br /> |
|
14 | 14 | <?php echo $sortable_list_table_form_fields; ?> |
15 | 15 | <?php $list_table->display_views(); ?> |
16 | 16 | <?php $list_table->display(); ?> |
@@ -41,8 +41,8 @@ |
||
41 | 41 | </div> |
42 | 42 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $clone_icon; ?> clickable"></span> |
43 | 43 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $trash_icon; ?> clickable"<?php echo $show_trash; ?>></span> |
44 | - <?php if ( $reg_list_url !== '' ) : ?> |
|
45 | - <a href="<?php echo $reg_list_url; ?>" title="<?php _e( 'View registrations for this datetime.', 'event_espresso' );?>" style="text-decoration: none;"> |
|
44 | + <?php if ($reg_list_url !== '') : ?> |
|
45 | + <a href="<?php echo $reg_list_url; ?>" title="<?php _e('View registrations for this datetime.', 'event_espresso'); ?>" style="text-decoration: none;"> |
|
46 | 46 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="dashicons dashicons-groups clickable"></span> |
47 | 47 | </a> |
48 | 48 | <?php endif; ?> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | /** |
32 | 32 | * REG_date |
33 | - */ |
|
33 | + */ |
|
34 | 34 | function column_REG_date(EE_Registration $item){ |
35 | 35 | |
36 | 36 | //Build row actions |
@@ -60,60 +60,60 @@ discard block |
||
60 | 60 | $remove_defaults = array('default_where_conditions' => 'none'); |
61 | 61 | $ticket = $item->ticket(); |
62 | 62 | $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
63 | - $EVT_ID = $item->event_ID(); |
|
64 | - $datetime_string = ''; |
|
65 | - foreach( $datetimes as $datetime ){ |
|
66 | - if ( |
|
67 | - EE_Registry::instance()->CAP->current_user_can( |
|
68 | - 'ee_read_checkin', |
|
69 | - 'espresso_registrations_registration_checkins', |
|
70 | - $item->ID() |
|
71 | - ) |
|
72 | - ) { |
|
73 | - // open "a" tag and "href" |
|
74 | - $datetime_string .= '<a href="'; |
|
75 | - // checkin URL |
|
76 | - $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
77 | - array( |
|
78 | - 'action' => 'event_registrations', |
|
79 | - 'event_id' => $EVT_ID, |
|
80 | - 'DTT_ID' => $datetime->ID(), |
|
81 | - ), |
|
82 | - REG_ADMIN_URL |
|
83 | - ); |
|
84 | - // close "href" |
|
85 | - $datetime_string .= '"'; |
|
86 | - // open "title" tag |
|
87 | - $datetime_string .= ' title="'; |
|
88 | - // link title text |
|
89 | - $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
90 | - // close "title" tag and end of "a" tag opening |
|
91 | - $datetime_string .= '">'; |
|
92 | - // link text |
|
93 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
94 | - // close "a" tag |
|
95 | - $datetime_string .= '</a>'; |
|
96 | - } else { |
|
97 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
98 | - } |
|
99 | - // add a "View Registrations" link that filters list by event AND datetime |
|
100 | - $datetime_string .= $this->row_actions( |
|
101 | - array( |
|
102 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | - array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
104 | - REG_ADMIN_URL |
|
105 | - ) . '" title="' . sprintf( |
|
106 | - esc_attr__( |
|
107 | - 'Filter this list to only show registrations for this datetime %s', |
|
108 | - 'event_espresso' |
|
109 | - ), |
|
110 | - $datetime->name() |
|
111 | - ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
112 | - ) |
|
113 | - ); |
|
63 | + $EVT_ID = $item->event_ID(); |
|
64 | + $datetime_string = ''; |
|
65 | + foreach( $datetimes as $datetime ){ |
|
66 | + if ( |
|
67 | + EE_Registry::instance()->CAP->current_user_can( |
|
68 | + 'ee_read_checkin', |
|
69 | + 'espresso_registrations_registration_checkins', |
|
70 | + $item->ID() |
|
71 | + ) |
|
72 | + ) { |
|
73 | + // open "a" tag and "href" |
|
74 | + $datetime_string .= '<a href="'; |
|
75 | + // checkin URL |
|
76 | + $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
77 | + array( |
|
78 | + 'action' => 'event_registrations', |
|
79 | + 'event_id' => $EVT_ID, |
|
80 | + 'DTT_ID' => $datetime->ID(), |
|
81 | + ), |
|
82 | + REG_ADMIN_URL |
|
83 | + ); |
|
84 | + // close "href" |
|
85 | + $datetime_string .= '"'; |
|
86 | + // open "title" tag |
|
87 | + $datetime_string .= ' title="'; |
|
88 | + // link title text |
|
89 | + $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
90 | + // close "title" tag and end of "a" tag opening |
|
91 | + $datetime_string .= '">'; |
|
92 | + // link text |
|
93 | + $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
94 | + // close "a" tag |
|
95 | + $datetime_string .= '</a>'; |
|
96 | + } else { |
|
97 | + $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
98 | + } |
|
99 | + // add a "View Registrations" link that filters list by event AND datetime |
|
100 | + $datetime_string .= $this->row_actions( |
|
101 | + array( |
|
102 | + 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | + array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
104 | + REG_ADMIN_URL |
|
105 | + ) . '" title="' . sprintf( |
|
106 | + esc_attr__( |
|
107 | + 'Filter this list to only show registrations for this datetime %s', |
|
108 | + 'event_espresso' |
|
109 | + ), |
|
110 | + $datetime->name() |
|
111 | + ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
112 | + ) |
|
113 | + ); |
|
114 | 114 | } |
115 | 115 | return $datetime_string; |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | 119 |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * REG_date |
33 | 33 | */ |
34 | - function column_REG_date(EE_Registration $item){ |
|
34 | + function column_REG_date(EE_Registration $item) { |
|
35 | 35 | |
36 | 36 | //Build row actions |
37 | 37 | $actions = array(); |
38 | 38 | |
39 | 39 | //Build row actions |
40 | - $check_in_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
41 | - $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID() ) ? ' |
|
42 | - <a href="'.$check_in_url.'" title="' . esc_attr__( 'The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso' ) . '">' . __( 'View Check-ins', 'event_espresso' ) . '</a>' : __( 'View Check-ins', 'event_espresso' ); |
|
40 | + $check_in_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
41 | + $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? ' |
|
42 | + <a href="'.$check_in_url.'" title="'.esc_attr__('The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso').'">'.__('View Check-ins', 'event_espresso').'</a>' : __('View Check-ins', 'event_espresso'); |
|
43 | 43 | |
44 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID() ), TXN_ADMIN_URL ); |
|
45 | - $REG_date = EE_Regisry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
44 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID()), TXN_ADMIN_URL); |
|
45 | + $REG_date = EE_Regisry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
46 | 46 | |
47 | - return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions) ); |
|
47 | + return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions)); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param \EE_Registration $item |
57 | 57 | * @return string |
58 | 58 | */ |
59 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
59 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
60 | 60 | $remove_defaults = array('default_where_conditions' => 'none'); |
61 | 61 | $ticket = $item->ticket(); |
62 | 62 | $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
63 | 63 | $EVT_ID = $item->event_ID(); |
64 | 64 | $datetime_string = ''; |
65 | - foreach( $datetimes as $datetime ){ |
|
65 | + foreach ($datetimes as $datetime) { |
|
66 | 66 | if ( |
67 | 67 | EE_Registry::instance()->CAP->current_user_can( |
68 | 68 | 'ee_read_checkin', |
@@ -86,29 +86,29 @@ discard block |
||
86 | 86 | // open "title" tag |
87 | 87 | $datetime_string .= ' title="'; |
88 | 88 | // link title text |
89 | - $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
89 | + $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso'); |
|
90 | 90 | // close "title" tag and end of "a" tag opening |
91 | 91 | $datetime_string .= '">'; |
92 | 92 | // link text |
93 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
93 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
94 | 94 | // close "a" tag |
95 | 95 | $datetime_string .= '</a>'; |
96 | 96 | } else { |
97 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
97 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
98 | 98 | } |
99 | 99 | // add a "View Registrations" link that filters list by event AND datetime |
100 | 100 | $datetime_string .= $this->row_actions( |
101 | 101 | array( |
102 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | - array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
102 | + 'event_datetime_filter' => '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
103 | + array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
|
104 | 104 | REG_ADMIN_URL |
105 | - ) . '" title="' . sprintf( |
|
105 | + ).'" title="'.sprintf( |
|
106 | 106 | esc_attr__( |
107 | 107 | 'Filter this list to only show registrations for this datetime %s', |
108 | 108 | 'event_espresso' |
109 | 109 | ), |
110 | 110 | $datetime->name() |
111 | - ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
111 | + ).'">'.__('View Registrations', 'event_espresso').'</a>' |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -680,14 +680,12 @@ discard block |
||
680 | 680 | echo '<th scope="row" class="check-column">'; |
681 | 681 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
682 | 682 | echo '</th>'; |
683 | - } |
|
684 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
683 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
685 | 684 | echo "<td $attributes>"; |
686 | 685 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
687 | 686 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
688 | 687 | echo "</td>"; |
689 | - } |
|
690 | - else { |
|
688 | + } else { |
|
691 | 689 | echo "<td $attributes>"; |
692 | 690 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
693 | 691 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
@@ -709,7 +707,7 @@ discard block |
||
709 | 707 | if ( $which === 'top' ) { |
710 | 708 | $this->_filters(); |
711 | 709 | echo $this->_get_hidden_fields(); |
712 | - }else{ |
|
710 | + } else{ |
|
713 | 711 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | 712 | foreach($this->_bottom_buttons as $type => $action){ |
715 | 713 | $route = isset( $action['route'] ) ? $action['route'] : ''; |
@@ -784,19 +784,19 @@ |
||
784 | 784 | $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
785 | 785 | $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
786 | 786 | $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
787 | - try { |
|
788 | - $content .= apply_filters( |
|
789 | - 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
790 | - $action_items, |
|
791 | - $item, |
|
792 | - $this |
|
793 | - ); |
|
794 | - } catch (\Exception $e) { |
|
795 | - if (WP_DEBUG) { |
|
796 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
797 | - } |
|
798 | - $content .= $action_items; |
|
799 | - } |
|
787 | + try { |
|
788 | + $content .= apply_filters( |
|
789 | + 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
790 | + $action_items, |
|
791 | + $item, |
|
792 | + $this |
|
793 | + ); |
|
794 | + } catch (\Exception $e) { |
|
795 | + if (WP_DEBUG) { |
|
796 | + \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
797 | + } |
|
798 | + $content .= $action_items; |
|
799 | + } |
|
800 | 800 | $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
801 | 801 | return $content; |
802 | 802 | } |
@@ -1,9 +1,9 @@ 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 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
6 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
5 | +if ( ! class_exists('WP_List_Table')) { |
|
6 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table |
208 | 208 | */ |
209 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
209 | + public function __construct(EE_Admin_Page $admin_page) { |
|
210 | 210 | $this->_admin_page = $admin_page; |
211 | 211 | $this->_req_data = $this->_admin_page->get_request_data(); |
212 | 212 | $this->_view = $this->_admin_page->get_view(); |
213 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
213 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
214 | 214 | $this->_current_page = $this->get_pagenum(); |
215 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
216 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
215 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
216 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
217 | 217 | |
218 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
218 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
219 | 219 | |
220 | 220 | $this->_setup_data(); |
221 | 221 | $this->_add_view_counts(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $this->_set_properties(); |
226 | 226 | |
227 | 227 | //set primary column |
228 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
228 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
229 | 229 | |
230 | 230 | //set parent defaults |
231 | 231 | parent::__construct($this->_wp_list_args); |
@@ -301,17 +301,17 @@ discard block |
||
301 | 301 | * @return string |
302 | 302 | */ |
303 | 303 | protected function _get_hidden_fields() { |
304 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
305 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
304 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
305 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
306 | 306 | //if action is STILL empty, then we set it to default |
307 | - $action = empty( $action ) ? 'default' : $action; |
|
308 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
309 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
310 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
307 | + $action = empty($action) ? 'default' : $action; |
|
308 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
309 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
310 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
311 | 311 | |
312 | 312 | $bulk_actions = $this->_get_bulk_actions(); |
313 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
314 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
313 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
314 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $field; |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @var array |
343 | 343 | */ |
344 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
344 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
345 | 345 | |
346 | 346 | $sortable = array(); |
347 | - foreach ( $_sortable as $id => $data ) { |
|
348 | - if ( empty( $data ) ) { |
|
347 | + foreach ($_sortable as $id => $data) { |
|
348 | + if (empty($data)) { |
|
349 | 349 | continue; |
350 | 350 | } |
351 | 351 | //fix for offset errors with WP_List_Table default get_columninfo() |
352 | - if ( is_array($data) ) { |
|
352 | + if (is_array($data)) { |
|
353 | 353 | $_data[0] = key($data); |
354 | 354 | $_data[1] = isset($data[1]) ? $data[1] : false; |
355 | 355 | } else { |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | |
359 | 359 | $data = (array) $data; |
360 | 360 | |
361 | - if ( !isset( $data[1] ) ) { |
|
361 | + if ( ! isset($data[1])) { |
|
362 | 362 | $_data[1] = false; |
363 | 363 | } |
364 | 364 | |
365 | 365 | $sortable[$id] = $_data; |
366 | 366 | } |
367 | 367 | $primary = $this->get_primary_column_name(); |
368 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
368 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @return string |
375 | 375 | */ |
376 | 376 | protected function get_primary_column_name() { |
377 | - foreach( class_parents( $this ) as $parent ) { |
|
378 | - if ( $parent === 'WP_List_Table' && method_exists( $parent, 'get_primary_column_name' ) ) { |
|
377 | + foreach (class_parents($this) as $parent) { |
|
378 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) { |
|
379 | 379 | return parent::get_primary_column_name(); |
380 | 380 | } |
381 | 381 | } |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | * @param string $primary |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
396 | - foreach( class_parents( $this ) as $parent ) { |
|
397 | - if ( $parent === 'WP_List_Table' && method_exists( $parent, 'handle_row_actions' ) ) { |
|
398 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
395 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
396 | + foreach (class_parents($this) as $parent) { |
|
397 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) { |
|
398 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | return ''; |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | protected function _get_bulk_actions() { |
414 | 414 | $actions = array(); |
415 | 415 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
416 | - foreach ( $this->_views as $view => $args) { |
|
417 | - if ( $this->_view === $view && isset( $args['bulk_action']) && is_array($args['bulk_action']) ) { |
|
416 | + foreach ($this->_views as $view => $args) { |
|
417 | + if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) { |
|
418 | 418 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
419 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
420 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
419 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
420 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
421 | 421 | $actions[$route] = $label; |
422 | 422 | } |
423 | 423 | } |
@@ -436,18 +436,18 @@ discard block |
||
436 | 436 | */ |
437 | 437 | private function _filters() { |
438 | 438 | $classname = get_class($this); |
439 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
439 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
440 | 440 | |
441 | - if ( empty( $filters )) { |
|
441 | + if (empty($filters)) { |
|
442 | 442 | return; |
443 | 443 | } |
444 | - foreach ( $filters as $filter ) { |
|
444 | + foreach ($filters as $filter) { |
|
445 | 445 | echo $filter; |
446 | 446 | } |
447 | 447 | //add filter button at end |
448 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
448 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
449 | 449 | //add reset filters button at end |
450 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
450 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | * @param string $column_name |
462 | 462 | * @return string |
463 | 463 | */ |
464 | - public function set_primary_column( $column_name ) { |
|
465 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
464 | + public function set_primary_column($column_name) { |
|
465 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | array( |
483 | 483 | 'total_items' => $total_items, |
484 | 484 | 'per_page' => $this->_per_page, |
485 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
485 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
486 | 486 | ) |
487 | 487 | ); |
488 | 488 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @param string $column_name The column being called. |
497 | 497 | * @return string html content for the column |
498 | 498 | */ |
499 | - public function column_default( $item, $column_name ) { |
|
499 | + public function column_default($item, $column_name) { |
|
500 | 500 | /** |
501 | 501 | * Dynamic hook allowing for adding additional column content in this list table. |
502 | 502 | * Note that $this->screen->id is in the format |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * hook prefix ("event-espresso") will be different. |
507 | 507 | * |
508 | 508 | */ |
509 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
509 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @var array |
534 | 534 | */ |
535 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
535 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
536 | 536 | return $columns; |
537 | 537 | } |
538 | 538 | |
@@ -555,18 +555,18 @@ discard block |
||
555 | 555 | $views = $this->get_views(); |
556 | 556 | $assembled_views = ''; |
557 | 557 | |
558 | - if ( empty( $views )) { |
|
558 | + if (empty($views)) { |
|
559 | 559 | return; |
560 | 560 | } |
561 | 561 | echo "<ul class='subsubsub'>\n"; |
562 | - foreach ( $views as $view ) { |
|
563 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
564 | - if ( isset( $view['slug'], $view['class'], $view['url'], $view['label']) ) { |
|
565 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
562 | + foreach ($views as $view) { |
|
563 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
564 | + if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) { |
|
565 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
569 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
569 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
570 | 570 | echo "</ul>"; |
571 | 571 | } |
572 | 572 | |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | * @access public |
579 | 579 | * @param EE_Base_Class $item The current item |
580 | 580 | */ |
581 | - public function single_row( $item ) { |
|
582 | - $row_class = $this->_get_row_class( $item ); |
|
583 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
584 | - $this->single_row_columns( $item ); |
|
581 | + public function single_row($item) { |
|
582 | + $row_class = $this->_get_row_class($item); |
|
583 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
584 | + $this->single_row_columns($item); |
|
585 | 585 | echo '</tr>'; |
586 | 586 | } |
587 | 587 | |
@@ -593,13 +593,13 @@ discard block |
||
593 | 593 | * @param EE_Base_Class $item the current item |
594 | 594 | * @return string |
595 | 595 | */ |
596 | - protected function _get_row_class( $item ) { |
|
596 | + protected function _get_row_class($item) { |
|
597 | 597 | static $row_class = ''; |
598 | - $row_class = ( $row_class === '' ? 'alternate' : '' ); |
|
598 | + $row_class = ($row_class === '' ? 'alternate' : ''); |
|
599 | 599 | |
600 | 600 | $new_row_class = $row_class; |
601 | 601 | |
602 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
602 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
603 | 603 | $new_row_class .= ' rowsortable'; |
604 | 604 | } |
605 | 605 | |
@@ -631,13 +631,13 @@ discard block |
||
631 | 631 | */ |
632 | 632 | public function get_hidden_columns() { |
633 | 633 | $user_id = get_current_user_id(); |
634 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
635 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
636 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
637 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
634 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
635 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
636 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
637 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
638 | 638 | } |
639 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
640 | - return (array) get_user_option( $ref, $user_id ); |
|
639 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
640 | + return (array) get_user_option($ref, $user_id); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | |
@@ -650,47 +650,47 @@ discard block |
||
650 | 650 | * @since 3.1.0 |
651 | 651 | * @param EE_Base_Class $item The current item |
652 | 652 | */ |
653 | - public function single_row_columns( $item ) { |
|
654 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
653 | + public function single_row_columns($item) { |
|
654 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
655 | 655 | |
656 | 656 | global $wp_version; |
657 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
657 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
658 | 658 | |
659 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
659 | + foreach ($columns as $column_name => $column_display_name) { |
|
660 | 660 | |
661 | 661 | /** |
662 | 662 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
663 | 663 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
664 | 664 | */ |
665 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
666 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
665 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
666 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
667 | 667 | |
668 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
669 | - if ( $primary === $column_name ) { |
|
668 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
669 | + if ($primary === $column_name) { |
|
670 | 670 | $classes .= ' has-row-actions column-primary'; |
671 | 671 | } |
672 | 672 | |
673 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
673 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
674 | 674 | |
675 | 675 | $class = "class='$classes'"; |
676 | 676 | |
677 | 677 | $attributes = "$class$style$data"; |
678 | 678 | |
679 | - if ( $column_name === 'cb' ) { |
|
679 | + if ($column_name === 'cb') { |
|
680 | 680 | echo '<th scope="row" class="check-column">'; |
681 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
681 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
682 | 682 | echo '</th>'; |
683 | 683 | } |
684 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
684 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
685 | 685 | echo "<td $attributes>"; |
686 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
687 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
686 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
687 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
688 | 688 | echo "</td>"; |
689 | 689 | } |
690 | 690 | else { |
691 | 691 | echo "<td $attributes>"; |
692 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
693 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
692 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
693 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
694 | 694 | echo "</td>"; |
695 | 695 | } |
696 | 696 | } |
@@ -705,15 +705,15 @@ discard block |
||
705 | 705 | * @param string $which |
706 | 706 | * @throws \EE_Error |
707 | 707 | */ |
708 | - public function extra_tablenav( $which ) { |
|
709 | - if ( $which === 'top' ) { |
|
708 | + public function extra_tablenav($which) { |
|
709 | + if ($which === 'top') { |
|
710 | 710 | $this->_filters(); |
711 | 711 | echo $this->_get_hidden_fields(); |
712 | - }else{ |
|
712 | + } else { |
|
713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | - foreach($this->_bottom_buttons as $type => $action){ |
|
715 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
714 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
715 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
717 | 717 | echo $this->_admin_page->get_action_link_or_button( |
718 | 718 | $route, |
719 | 719 | $type, |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | false |
724 | 724 | ); |
725 | 725 | } |
726 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
726 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
727 | 727 | echo '</div>'; |
728 | 728 | } |
729 | 729 | //echo $this->_entries_per_page_dropdown; |
@@ -779,11 +779,11 @@ discard block |
||
779 | 779 | * the actions. |
780 | 780 | * @return string The assembled action elements container. |
781 | 781 | */ |
782 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
782 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
783 | 783 | $content = ''; |
784 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
785 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
786 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
784 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
785 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
786 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
787 | 787 | try { |
788 | 788 | $content .= apply_filters( |
789 | 789 | 'FHEE__EE_Admin_List_Table___action_string__action_items', |
@@ -793,11 +793,11 @@ discard block |
||
793 | 793 | ); |
794 | 794 | } catch (\Exception $e) { |
795 | 795 | if (WP_DEBUG) { |
796 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
796 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 797 | } |
798 | 798 | $content .= $action_items; |
799 | 799 | } |
800 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
|
800 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
801 | 801 | return $content; |
802 | 802 | } |
803 | 803 | } |
@@ -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 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * @param array $arguments |
36 | 36 | * @return \EE_CPT_Default_Strategy |
37 | 37 | */ |
38 | - public function __construct( $arguments = array() ) { |
|
39 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : null; |
|
38 | + public function __construct($arguments = array()) { |
|
39 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
40 | 40 | // $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : null; |
41 | 41 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
42 | 42 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @param \WP_Query $WP_Query |
53 | 53 | * @return \WP_Query |
54 | 54 | */ |
55 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
55 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
56 | 56 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
57 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
57 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
58 | 58 | return $WP_Query; |
59 | 59 | } |
60 | 60 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param \WP_Query $WP_Query |
73 | 73 | * @return \WP_Post[] |
74 | 74 | */ |
75 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
75 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
76 | 76 | return $posts; |
77 | 77 | } |
78 | 78 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param string $single |
89 | 89 | * @return mixed |
90 | 90 | */ |
91 | - public function get_EE_post_type_metadata( $meta_value = null, $post_id, $meta_key, $single ) { |
|
91 | + public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single) { |
|
92 | 92 | return $meta_value; |
93 | 93 | } |
94 | 94 |
@@ -447,14 +447,14 @@ |
||
447 | 447 | global $wpdb; |
448 | 448 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
449 | 449 | $SQL .= ' LEFT JOIN ' |
450 | - . $this->meta_table->get_table_name() |
|
451 | - . ' ON ( ' |
|
452 | - . $this->meta_table->get_table_name() |
|
453 | - . '.' |
|
454 | - . $this->meta_table->get_fk_on_table() |
|
455 | - . ' = ' |
|
456 | - . $wpdb->posts |
|
457 | - . '.ID ) '; |
|
450 | + . $this->meta_table->get_table_name() |
|
451 | + . ' ON ( ' |
|
452 | + . $this->meta_table->get_table_name() |
|
453 | + . '.' |
|
454 | + . $this->meta_table->get_fk_on_table() |
|
455 | + . ' = ' |
|
456 | + . $wpdb->posts |
|
457 | + . '.ID ) '; |
|
458 | 458 | } |
459 | 459 | remove_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
460 | 460 | return $SQL; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\CPTs; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | \WP_Query $WP_Query, |
81 | 81 | \EE_Request_Handler $request |
82 | 82 | ) { |
83 | - $this->setRequest( $request ); |
|
84 | - $this->setWpQuery( $WP_Query ); |
|
85 | - $this->setPostType( $post_type ); |
|
86 | - $this->setCptDetails( $cpt_details ); |
|
83 | + $this->setRequest($request); |
|
84 | + $this->setWpQuery($WP_Query); |
|
85 | + $this->setPostType($post_type); |
|
86 | + $this->setCptDetails($cpt_details); |
|
87 | 87 | $this->init(); |
88 | 88 | } |
89 | 89 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param string $post_type |
103 | 103 | */ |
104 | - protected function setPostType( $post_type ) { |
|
104 | + protected function setPostType($post_type) { |
|
105 | 105 | $this->post_type = $post_type; |
106 | 106 | } |
107 | 107 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * @param array $cpt_details |
121 | 121 | */ |
122 | - protected function setCptDetails( $cpt_details ) { |
|
122 | + protected function setCptDetails($cpt_details) { |
|
123 | 123 | $this->cpt_details = $cpt_details; |
124 | 124 | } |
125 | 125 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * @param \EE_Table_Base[] $model_tables |
139 | 139 | */ |
140 | - protected function setModelTables( $model_tables ) { |
|
140 | + protected function setModelTables($model_tables) { |
|
141 | 141 | $this->model_tables = $model_tables; |
142 | 142 | } |
143 | 143 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return array |
148 | 148 | */ |
149 | 149 | public function taxonomies() { |
150 | - if ( empty( $this->taxonomies ) ) { |
|
150 | + if (empty($this->taxonomies)) { |
|
151 | 151 | $this->initializeTaxonomies(); |
152 | 152 | } |
153 | 153 | return $this->taxonomies; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * @param array $taxonomies |
160 | 160 | */ |
161 | - protected function setTaxonomies( array $taxonomies ) { |
|
161 | + protected function setTaxonomies(array $taxonomies) { |
|
162 | 162 | $this->taxonomies = $taxonomies; |
163 | 163 | } |
164 | 164 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | /** |
177 | 177 | * @param \EE_Secondary_Table $meta_table |
178 | 178 | */ |
179 | - public function setMetaTable( \EE_Secondary_Table $meta_table ) { |
|
179 | + public function setMetaTable(\EE_Secondary_Table $meta_table) { |
|
180 | 180 | $this->meta_table = $meta_table; |
181 | 181 | } |
182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | /** |
195 | 195 | * @param \EEM_Base $CPT_model |
196 | 196 | */ |
197 | - protected function setModel( \EEM_Base $CPT_model ) { |
|
197 | + protected function setModel(\EEM_Base $CPT_model) { |
|
198 | 198 | $this->model = $CPT_model; |
199 | 199 | } |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | /** |
213 | 213 | * @param \EE_Request_Handler $request |
214 | 214 | */ |
215 | - protected function setRequest( \EE_Request_Handler $request ) { |
|
215 | + protected function setRequest(\EE_Request_Handler $request) { |
|
216 | 216 | $this->request = $request; |
217 | 217 | } |
218 | 218 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | /** |
231 | 231 | * @param \WP_Query $wp_query |
232 | 232 | */ |
233 | - public function setWpQuery( \WP_Query $wp_query ) { |
|
233 | + public function setWpQuery(\WP_Query $wp_query) { |
|
234 | 234 | $this->wp_query = $wp_query; |
235 | 235 | } |
236 | 236 | |
@@ -245,22 +245,22 @@ discard block |
||
245 | 245 | protected function initializeTaxonomies() { |
246 | 246 | // check if taxonomies have already been set and that this CPT has taxonomies registered for it |
247 | 247 | if ( |
248 | - empty( $this->taxonomies ) |
|
249 | - && isset( $this->cpt_details['args'], $this->cpt_details['args']['taxonomies'] ) |
|
248 | + empty($this->taxonomies) |
|
249 | + && isset($this->cpt_details['args'], $this->cpt_details['args']['taxonomies']) |
|
250 | 250 | ) { |
251 | 251 | // if so then grab them, but we want the taxonomy name as the key |
252 | - $taxonomies = array_flip( $this->cpt_details['args']['taxonomies'] ); |
|
252 | + $taxonomies = array_flip($this->cpt_details['args']['taxonomies']); |
|
253 | 253 | // then grab the list of ALL taxonomies |
254 | 254 | $all_taxonomies = \EE_Register_CPTs::get_taxonomies(); |
255 | - foreach ( $taxonomies as $taxonomy => &$details ) { |
|
255 | + foreach ($taxonomies as $taxonomy => &$details) { |
|
256 | 256 | // add details to our taxonomies if they exist |
257 | - $details = isset( $all_taxonomies[ $taxonomy ] ) |
|
258 | - ? $all_taxonomies[ $taxonomy ] |
|
257 | + $details = isset($all_taxonomies[$taxonomy]) |
|
258 | + ? $all_taxonomies[$taxonomy] |
|
259 | 259 | : array(); |
260 | 260 | } |
261 | 261 | // ALWAYS unset() variables that were passed by reference |
262 | - unset( $details ); |
|
263 | - $this->setTaxonomies( $taxonomies ); |
|
262 | + unset($details); |
|
263 | + $this->setTaxonomies($taxonomies); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | $this->setAdditionalCptDetails(); |
271 | 271 | $this->setRequestVarsIfCpt(); |
272 | 272 | // convert post_type to model name |
273 | - $model_name = str_replace( 'EE_', '', $this->cpt_details['class_name'] ); |
|
273 | + $model_name = str_replace('EE_', '', $this->cpt_details['class_name']); |
|
274 | 274 | // load all tables related to CPT |
275 | - $this->setupModelsAndTables( $model_name ); |
|
275 | + $this->setupModelsAndTables($model_name); |
|
276 | 276 | // load and instantiate CPT_*_Strategy |
277 | - $CPT_Strategy = $this->cptStrategyClass( $model_name ); |
|
277 | + $CPT_Strategy = $this->cptStrategyClass($model_name); |
|
278 | 278 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
279 | 279 | // here's the list of available filters in the WP_Query object |
280 | 280 | // 'posts_where_paged' |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | // 'post_limits' |
286 | 286 | // 'posts_fields' |
287 | 287 | // 'posts_join' |
288 | - add_filter( 'posts_fields', array( $this, 'postsFields' ) ); |
|
289 | - add_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
|
288 | + add_filter('posts_fields', array($this, 'postsFields')); |
|
289 | + add_filter('posts_join', array($this, 'postsJoin')); |
|
290 | 290 | add_filter( |
291 | - 'get_' . $this->post_type . '_metadata', |
|
292 | - array( $CPT_Strategy, 'get_EE_post_type_metadata' ), |
|
291 | + 'get_'.$this->post_type.'_metadata', |
|
292 | + array($CPT_Strategy, 'get_EE_post_type_metadata'), |
|
293 | 293 | 1, |
294 | 294 | 4 |
295 | 295 | ); |
296 | - add_filter( 'the_posts', array( $this, 'thePosts' ), 1, 1 ); |
|
297 | - if ( $this->wp_query->is_main_query() ) { |
|
298 | - add_filter( 'get_edit_post_link', array( $this, 'getEditPostLink' ), 10, 2 ); |
|
296 | + add_filter('the_posts', array($this, 'thePosts'), 1, 1); |
|
297 | + if ($this->wp_query->is_main_query()) { |
|
298 | + add_filter('get_edit_post_link', array($this, 'getEditPostLink'), 10, 2); |
|
299 | 299 | $this->addTemplateFilters(); |
300 | 300 | } |
301 | 301 | } |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | // the post or category or term that is triggering EE |
313 | 313 | $this->cpt_details['espresso_page'] = $this->request->is_espresso_page(); |
314 | 314 | // requested post name |
315 | - $this->cpt_details['post_name'] = $this->request->get( 'post_name' ); |
|
315 | + $this->cpt_details['post_name'] = $this->request->get('post_name'); |
|
316 | 316 | // add support for viewing 'private', 'draft', or 'pending' posts |
317 | 317 | if ( |
318 | - isset( $this->wp_query->query_vars['p'] ) |
|
318 | + isset($this->wp_query->query_vars['p']) |
|
319 | 319 | && $this->wp_query->query_vars['p'] !== 0 |
320 | 320 | && is_user_logged_in() |
321 | - && current_user_can( 'edit_post', $this->wp_query->query_vars['p'] ) |
|
321 | + && current_user_can('edit_post', $this->wp_query->query_vars['p']) |
|
322 | 322 | ) { |
323 | 323 | // we can just inject directly into the WP_Query object |
324 | - $this->wp_query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
324 | + $this->wp_query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
325 | 325 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
326 | - $this->request->set( 'ee', $this->cpt_details['singular_slug'] ); |
|
326 | + $this->request->set('ee', $this->cpt_details['singular_slug']); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
@@ -340,15 +340,15 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function setRequestVarsIfCpt() { |
342 | 342 | // check if ee action var has been set |
343 | - if ( ! $this->request->is_set( 'ee' ) ) { |
|
343 | + if ( ! $this->request->is_set('ee')) { |
|
344 | 344 | // check that route exists for CPT archive slug |
345 | - if ( is_archive() && \EE_Config::get_route( $this->cpt_details['plural_slug'] ) ) { |
|
345 | + if (is_archive() && \EE_Config::get_route($this->cpt_details['plural_slug'])) { |
|
346 | 346 | // ie: set "ee" to "events" |
347 | - $this->request->set( 'ee', $this->cpt_details['plural_slug'] ); |
|
347 | + $this->request->set('ee', $this->cpt_details['plural_slug']); |
|
348 | 348 | // or does it match a single page CPT like /event/ |
349 | - } else if ( is_single() && \EE_Config::get_route( $this->cpt_details['singular_slug'] ) ) { |
|
349 | + } else if (is_single() && \EE_Config::get_route($this->cpt_details['singular_slug'])) { |
|
350 | 350 | // ie: set "ee" to "event" |
351 | - $this->request->set( 'ee', $this->cpt_details['singular_slug'] ); |
|
351 | + $this->request->set('ee', $this->cpt_details['singular_slug']); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | } |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | * @param string $model_name |
363 | 363 | * @throws \EE_Error |
364 | 364 | */ |
365 | - protected function setupModelsAndTables( $model_name ) { |
|
365 | + protected function setupModelsAndTables($model_name) { |
|
366 | 366 | // get CPT table data via CPT Model |
367 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
368 | - if ( ! $model instanceof \EEM_Base ) { |
|
369 | - throw new \EE_Error ( |
|
367 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
368 | + if ( ! $model instanceof \EEM_Base) { |
|
369 | + throw new \EE_Error( |
|
370 | 370 | sprintf( |
371 | 371 | __( |
372 | 372 | 'The "%1$s" model could not be loaded.', |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | ) |
377 | 377 | ); |
378 | 378 | } |
379 | - $this->setModel( $model ); |
|
380 | - $this->setModelTables( $this->model->get_tables() ); |
|
379 | + $this->setModel($model); |
|
380 | + $this->setModelTables($this->model->get_tables()); |
|
381 | 381 | // is there a Meta Table for this CPT? |
382 | 382 | if ( |
383 | - isset( $this->cpt_details['tables'][ $model_name . '_Meta' ] ) |
|
384 | - && $this->cpt_details['tables'][ $model_name . '_Meta' ] instanceof \EE_Secondary_Table |
|
383 | + isset($this->cpt_details['tables'][$model_name.'_Meta']) |
|
384 | + && $this->cpt_details['tables'][$model_name.'_Meta'] instanceof \EE_Secondary_Table |
|
385 | 385 | ) { |
386 | - $this->setMetaTable( $this->cpt_details['tables'][ $model_name . '_Meta' ] ); |
|
386 | + $this->setMetaTable($this->cpt_details['tables'][$model_name.'_Meta']); |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | * @param string $model_name |
397 | 397 | * @return string |
398 | 398 | */ |
399 | - protected function cptStrategyClass( $model_name ) { |
|
399 | + protected function cptStrategyClass($model_name) { |
|
400 | 400 | // creates classname like: CPT_Event_Strategy |
401 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
401 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
402 | 402 | // load and instantiate |
403 | 403 | $CPT_Strategy = \EE_Registry::instance()->load_core( |
404 | 404 | $CPT_Strategy_class_name, |
405 | - array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details ) |
|
405 | + array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details) |
|
406 | 406 | ); |
407 | - if ( $CPT_Strategy === null ) { |
|
407 | + if ($CPT_Strategy === null) { |
|
408 | 408 | $CPT_Strategy = \EE_Registry::instance()->load_core( |
409 | 409 | 'CPT_Default_Strategy', |
410 | - array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details ) |
|
410 | + array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details) |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 | return $CPT_Strategy; |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | * @param $SQL |
423 | 423 | * @return string |
424 | 424 | */ |
425 | - public function postsFields( $SQL ) { |
|
425 | + public function postsFields($SQL) { |
|
426 | 426 | // does this CPT have a meta table ? |
427 | - if ( $this->meta_table instanceof \EE_Secondary_Table ) { |
|
427 | + if ($this->meta_table instanceof \EE_Secondary_Table) { |
|
428 | 428 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
429 | - $SQL .= ', ' . $this->meta_table->get_table_name() . '.* '; |
|
429 | + $SQL .= ', '.$this->meta_table->get_table_name().'.* '; |
|
430 | 430 | } |
431 | - remove_filter( 'posts_fields', array( $this, 'postsFields' ) ); |
|
431 | + remove_filter('posts_fields', array($this, 'postsFields')); |
|
432 | 432 | return $SQL; |
433 | 433 | } |
434 | 434 | |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | * @param $SQL |
442 | 442 | * @return string |
443 | 443 | */ |
444 | - public function postsJoin( $SQL ) { |
|
444 | + public function postsJoin($SQL) { |
|
445 | 445 | // does this CPT have a meta table ? |
446 | - if ( $this->meta_table instanceof \EE_Secondary_Table ) { |
|
446 | + if ($this->meta_table instanceof \EE_Secondary_Table) { |
|
447 | 447 | global $wpdb; |
448 | 448 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
449 | 449 | $SQL .= ' LEFT JOIN ' |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | . $wpdb->posts |
457 | 457 | . '.ID ) '; |
458 | 458 | } |
459 | - remove_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
|
459 | + remove_filter('posts_join', array($this, 'postsJoin')); |
|
460 | 460 | return $SQL; |
461 | 461 | } |
462 | 462 | |
@@ -469,17 +469,17 @@ discard block |
||
469 | 469 | * @param \WP_Post[] $posts |
470 | 470 | * @return \WP_Post[] |
471 | 471 | */ |
472 | - public function thePosts( $posts ) { |
|
472 | + public function thePosts($posts) { |
|
473 | 473 | $CPT_class = $this->cpt_details['class_name']; |
474 | 474 | // loop thru posts |
475 | - if ( is_array( $posts ) && $this->model instanceof \EEM_CPT_Base ) { |
|
476 | - foreach ( $posts as $key => $post ) { |
|
477 | - if ( $post->post_type === $this->post_type ) { |
|
478 | - $post->{$CPT_class} = $this->model->instantiate_class_from_post_object( $post ); |
|
475 | + if (is_array($posts) && $this->model instanceof \EEM_CPT_Base) { |
|
476 | + foreach ($posts as $key => $post) { |
|
477 | + if ($post->post_type === $this->post_type) { |
|
478 | + $post->{$CPT_class} = $this->model->instantiate_class_from_post_object($post); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
482 | - remove_filter( 'the_posts', array( $this, 'thePosts' ), 1 ); |
|
482 | + remove_filter('the_posts', array($this, 'thePosts'), 1); |
|
483 | 483 | return $posts; |
484 | 484 | } |
485 | 485 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @param $ID |
491 | 491 | * @return string |
492 | 492 | */ |
493 | - public function getEditPostLink( $url, $ID ) { |
|
493 | + public function getEditPostLink($url, $ID) { |
|
494 | 494 | // need to make sure we only edit links if our cpt |
495 | 495 | global $post; |
496 | 496 | //notice if the cpt is registered with `show_ee_ui` set to false, we take that to mean that the WordPress core ui |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | ! $post instanceof \WP_Post |
500 | 500 | || $post->post_type !== $this->post_type |
501 | 501 | || ( |
502 | - isset( $this->cpt_details['args']['show_ee_ui'] ) |
|
502 | + isset($this->cpt_details['args']['show_ee_ui']) |
|
503 | 503 | && ! $this->cpt_details['args']['show_ee_ui'] |
504 | 504 | ) |
505 | 505 | ) { |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | //k made it here so all is good. |
509 | 509 | return wp_nonce_url( |
510 | 510 | add_query_arg( |
511 | - array( 'page' => $this->post_type, 'post' => $ID, 'action' => 'edit' ), |
|
512 | - admin_url( 'admin.php' ) |
|
511 | + array('page' => $this->post_type, 'post' => $ID, 'action' => 'edit'), |
|
512 | + admin_url('admin.php') |
|
513 | 513 | ), |
514 | 514 | 'edit', |
515 | 515 | 'edit_nonce' |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function addTemplateFilters() { |
528 | 528 | // if requested cpt supports page_templates and it's the main query |
529 | - if ( ! empty( $this->cpt_details['args']['page_templates'] ) && $this->wp_query->is_main_query() ) { |
|
529 | + if ( ! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) { |
|
530 | 530 | // then let's hook into the appropriate query_template hook |
531 | - add_filter( 'single_template', array( $this, 'singleCptTemplate' ) ); |
|
531 | + add_filter('single_template', array($this, 'singleCptTemplate')); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -542,20 +542,20 @@ discard block |
||
542 | 542 | * @param string $current_template Existing default template path derived for this page call. |
543 | 543 | * @return string the path to the full template file. |
544 | 544 | */ |
545 | - public function singleCptTemplate( $current_template ) { |
|
545 | + public function singleCptTemplate($current_template) { |
|
546 | 546 | $object = get_queried_object(); |
547 | 547 | //does this called object HAVE a page template set that is something other than the default. |
548 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
548 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
549 | 549 | //exit early if default or not set or invalid path (accounts for theme changes) |
550 | 550 | if ( |
551 | 551 | $template === 'default' |
552 | - || empty( $template ) |
|
553 | - || ! is_readable( get_stylesheet_directory() . '/' . $template ) |
|
552 | + || empty($template) |
|
553 | + || ! is_readable(get_stylesheet_directory().'/'.$template) |
|
554 | 554 | ) { |
555 | 555 | return $current_template; |
556 | 556 | } |
557 | 557 | //made it here so we SHOULD be able to just locate the template and then return it. |
558 | - return locate_template( array( $template ) ); |
|
558 | + return locate_template(array($template)); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 |
@@ -5,81 +5,81 @@ discard block |
||
5 | 5 | /** @type string $SPCO_attendee_information_url */ |
6 | 6 | ?> |
7 | 7 | <h3 class="ee-registration-details-h3"><?php _e('Registration Details', 'event_espresso'); ?></h3> |
8 | -<?php do_action( 'AHEE__thank_you_page_registration_details_template__after_heading' ); ?> |
|
8 | +<?php do_action('AHEE__thank_you_page_registration_details_template__after_heading'); ?> |
|
9 | 9 | |
10 | 10 | <div class="ee-registration-details-dv"> |
11 | 11 | <?php |
12 | 12 | $registrations = $transaction->registrations(); |
13 | -$registrations = is_array( $registrations ) ? $registrations : array(); |
|
14 | -$reg_count = count( $registrations ); |
|
13 | +$registrations = is_array($registrations) ? $registrations : array(); |
|
14 | +$reg_count = count($registrations); |
|
15 | 15 | $reg_cntr = 0; |
16 | 16 | $event_name = ''; |
17 | 17 | $wait_list = false; |
18 | -foreach ( $registrations as $registration ) { |
|
19 | - if ( $registration instanceof EE_Registration ) { |
|
20 | - if ( $event_name != $registration->event_name() && ! empty( $event_name )) { ?> |
|
18 | +foreach ($registrations as $registration) { |
|
19 | + if ($registration instanceof EE_Registration) { |
|
20 | + if ($event_name != $registration->event_name() && ! empty($event_name)) { ?> |
|
21 | 21 | </tbody> |
22 | 22 | </table> |
23 | 23 | <?php |
24 | 24 | } |
25 | 25 | $reg_cntr++; |
26 | - if ( $event_name != $registration->event_name() ) { |
|
26 | + if ($event_name != $registration->event_name()) { |
|
27 | 27 | ?> |
28 | 28 | <h5> |
29 | - <span class="smaller-text grey-text"><?php _e('for','event_espresso');?>: </span> <?php echo htmlentities( $registration->event_name(), ENT_QUOTES, 'UTF-8' );?> |
|
29 | + <span class="smaller-text grey-text"><?php _e('for', 'event_espresso'); ?>: </span> <?php echo htmlentities($registration->event_name(), ENT_QUOTES, 'UTF-8'); ?> |
|
30 | 30 | </h5> |
31 | 31 | <table class='ee-table ee-registrations-list'> |
32 | 32 | <thead> |
33 | 33 | <tr> |
34 | 34 | <th width="40%"> |
35 | - <?php _e("Registrant Name",'event_espresso')?> |
|
35 | + <?php _e("Registrant Name", 'event_espresso')?> |
|
36 | 36 | </th> |
37 | 37 | <th width="25%" class="jst-left"> |
38 | - <?php _e("REG Code",'event_espresso');?> |
|
38 | + <?php _e("REG Code", 'event_espresso'); ?> |
|
39 | 39 | </th> |
40 | 40 | <th width="35%" class="jst-left"> |
41 | - <?php _e("REG Status",'event_espresso');?> |
|
41 | + <?php _e("REG Status", 'event_espresso'); ?> |
|
42 | 42 | </th> |
43 | 43 | </tr> |
44 | 44 | </thead> |
45 | 45 | <tbody> |
46 | 46 | <?php |
47 | 47 | } |
48 | - if ( $is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link() )) { ?> |
|
48 | + if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?> |
|
49 | 49 | <tr> |
50 | 50 | <td width="40%"> |
51 | 51 | <?php |
52 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
53 | - echo $registration->attendee()->full_name( TRUE ); |
|
52 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
53 | + echo $registration->attendee()->full_name(TRUE); |
|
54 | 54 | } |
55 | 55 | ?> |
56 | 56 | <p class="tiny-text" style="margin: .75em 0 0;"> |
57 | 57 | <?php |
58 | - if ( $registration->count_question_groups() ) { |
|
58 | + if ($registration->count_question_groups()) { |
|
59 | 59 | ?> |
60 | - <a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url();?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso');?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso');?></a> |
|
60 | + <a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url(); ?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso'); ?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso'); ?></a> |
|
61 | 61 | <?php } ?> |
62 | - <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg( array( 'token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true' ), EE_Registry::instance()->CFG->core->thank_you_page_url() );?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso');?>" rel="<?php echo $registration->reg_url_link();?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso');?></a> |
|
62 | + <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg(array('token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true'), EE_Registry::instance()->CFG->core->thank_you_page_url()); ?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso'); ?>" rel="<?php echo $registration->reg_url_link(); ?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso'); ?></a> |
|
63 | 63 | </p> |
64 | 64 | </td> |
65 | 65 | <td width="25%" class="jst-left"> |
66 | 66 | <?php $registration->e('REG_code') ?> |
67 | 67 | </td> |
68 | 68 | <td width="35%" class="jst-left"> |
69 | - <?php $registration->e_pretty_status( TRUE )?> |
|
69 | + <?php $registration->e_pretty_status(TRUE)?> |
|
70 | 70 | <?php |
71 | - if ( $registration->status_ID() === EEM_Registration::status_id_wait_list ) { |
|
71 | + if ($registration->status_ID() === EEM_Registration::status_id_wait_list) { |
|
72 | 72 | $wait_list = true; |
73 | 73 | } |
74 | 74 | ?> |
75 | 75 | </td> |
76 | 76 | </tr> |
77 | - <?php do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration ); ?> |
|
77 | + <?php do_action('AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration); ?> |
|
78 | 78 | <?php |
79 | 79 | $event_name = $registration->event_name(); |
80 | 80 | |
81 | 81 | } |
82 | - if ( $reg_cntr >= $reg_count ) { |
|
82 | + if ($reg_cntr >= $reg_count) { |
|
83 | 83 | ?> |
84 | 84 | </tbody> |
85 | 85 | </table> |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | ?> |
91 | -<?php if ( $is_primary && $SPCO_attendee_information_url ) { ?> |
|
91 | +<?php if ($is_primary && $SPCO_attendee_information_url) { ?> |
|
92 | 92 | <p class="small-text jst-rght"> |
93 | 93 | <a href='<?php echo $SPCO_attendee_information_url?>'><?php _e("Click here to edit All Attendee Information", 'event_espresso'); ?></a> |
94 | 94 | </p> |
95 | 95 | <?php } ?> |
96 | - <?php if ( $wait_list ) { ?> |
|
96 | + <?php if ($wait_list) { ?> |
|
97 | 97 | |
98 | 98 | <?php |
99 | 99 | echo apply_filters( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | <?php } ?> |
114 | 114 | |
115 | 115 | |
116 | - <?php do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_details' ); ?> |
|
116 | + <?php do_action('AHEE__thank_you_page_registration_details_template__after_registration_details'); ?> |
|
117 | 117 | |
118 | 118 | </div> |
119 | 119 | <!-- end of .registration-details --> |