@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | * the registration's share of the transaction total, so that the |
665 | 665 | * sum of all the transaction's REG_final_prices equal the transaction's total |
666 | 666 | * @access public |
667 | - * @return float |
|
667 | + * @return boolean |
|
668 | 668 | */ |
669 | 669 | public function final_price() { |
670 | 670 | return $this->get( 'REG_final_price' ); |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | /** |
687 | 687 | * get paid (yeah) |
688 | 688 | * @access public |
689 | - * @return float |
|
689 | + * @return boolean |
|
690 | 690 | */ |
691 | 691 | public function paid() { |
692 | 692 | return $this->get( 'REG_paid' ); |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | /** |
899 | 899 | * Sets deleted |
900 | 900 | * @param boolean $deleted |
901 | - * @return boolean |
|
901 | + * @return boolean|null |
|
902 | 902 | */ |
903 | 903 | public function set_deleted($deleted) { |
904 | 904 | $this->set( 'REG_deleted', $deleted ); |
@@ -942,6 +942,7 @@ discard block |
||
942 | 942 | * |
943 | 943 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
944 | 944 | * @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. |
945 | + * @param integer $DTT_OR_ID |
|
945 | 946 | * |
946 | 947 | * @return bool |
947 | 948 | */ |
@@ -1179,7 +1180,7 @@ discard block |
||
1179 | 1180 | |
1180 | 1181 | |
1181 | 1182 | /** |
1182 | - * @return int |
|
1183 | + * @return boolean |
|
1183 | 1184 | */ |
1184 | 1185 | public function ticket_ID() { |
1185 | 1186 | return $this->get( 'TKT_ID' ); |
@@ -1302,7 +1303,7 @@ discard block |
||
1302 | 1303 | * This grabs the payment method corresponding to the last payment made for the amount owing on the registration. |
1303 | 1304 | * Note: if there are no payments on the registration there will be no payment method returned. |
1304 | 1305 | * |
1305 | - * @return EE_Payment_Method|null |
|
1306 | + * @return EE_Base_Class|null |
|
1306 | 1307 | */ |
1307 | 1308 | public function payment_method() { |
1308 | 1309 | return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_Registration class |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * date_format and the second value is the time format |
42 | 42 | * @return EE_Registration |
43 | 43 | */ |
44 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
45 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
46 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
44 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
45 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
46 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * the website will be used. |
55 | 55 | * @return EE_Registration |
56 | 56 | */ |
57 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
58 | - return new self( $props_n_values, TRUE, $timezone ); |
|
57 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
58 | + return new self($props_n_values, TRUE, $timezone); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @access public |
67 | 67 | * @param int $EVT_ID Event ID |
68 | 68 | */ |
69 | - public function set_event( $EVT_ID = 0 ) { |
|
70 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
69 | + public function set_event($EVT_ID = 0) { |
|
70 | + $this->set('EVT_ID', $EVT_ID); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | * @param mixed $field_value |
79 | 79 | * @param bool $use_default |
80 | 80 | */ |
81 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
82 | - switch( $field_name ) { |
|
81 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
82 | + switch ($field_name) { |
|
83 | 83 | case 'REG_code' : |
84 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
85 | - $this->set_reg_code( $field_value, $use_default ); |
|
84 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
85 | + $this->set_reg_code($field_value, $use_default); |
|
86 | 86 | } |
87 | 87 | break; |
88 | 88 | case 'STS_ID' : |
89 | - $this->set_status( $field_value, $use_default ); |
|
89 | + $this->set_status($field_value, $use_default); |
|
90 | 90 | break; |
91 | 91 | default : |
92 | - parent::set( $field_name, $field_value, $use_default ); |
|
92 | + parent::set($field_name, $field_value, $use_default); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -106,30 +106,30 @@ discard block |
||
106 | 106 | * @param boolean $use_default |
107 | 107 | * @return bool |
108 | 108 | */ |
109 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
109 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
110 | 110 | // get current REG_Status |
111 | 111 | $old_STS_ID = $this->status_ID(); |
112 | 112 | // if status has changed |
113 | - if ( $old_STS_ID != $new_STS_ID && $this->ID() ) { |
|
113 | + if ($old_STS_ID != $new_STS_ID && $this->ID()) { |
|
114 | 114 | // TO approved |
115 | - if ( $new_STS_ID == EEM_Registration::status_id_approved ) { |
|
115 | + if ($new_STS_ID == EEM_Registration::status_id_approved) { |
|
116 | 116 | // reserve a space by incrementing ticket and datetime sold values |
117 | 117 | $this->_reserve_registration_space(); |
118 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
118 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
119 | 119 | // OR FROM approved |
120 | - } else if ( $old_STS_ID == EEM_Registration::status_id_approved ) { |
|
120 | + } else if ($old_STS_ID == EEM_Registration::status_id_approved) { |
|
121 | 121 | // release a space by decrementing ticket and datetime sold values |
122 | 122 | $this->_release_registration_space(); |
123 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
123 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
124 | 124 | } |
125 | 125 | // update status |
126 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
127 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
126 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
127 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
128 | 128 | return TRUE; |
129 | - }else{ |
|
129 | + } else { |
|
130 | 130 | //even though the old value matches the new value, it's still good to |
131 | 131 | //allow the parent set method to have a say |
132 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
132 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
133 | 133 | return TRUE; |
134 | 134 | } |
135 | 135 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @access public |
142 | 142 | */ |
143 | 143 | public function status_ID() { |
144 | - return $this->get( 'STS_ID' ); |
|
144 | + return $this->get('STS_ID'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * @param boolean $include_archived whether to include archived tickets or not. |
167 | 167 | * @return EE_Ticket |
168 | 168 | */ |
169 | - public function ticket( $include_archived = TRUE ) { |
|
169 | + public function ticket($include_archived = TRUE) { |
|
170 | 170 | $query_params = array(); |
171 | - if ( $include_archived ) { |
|
172 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
171 | + if ($include_archived) { |
|
172 | + $query_params['default_where_conditions'] = 'none'; |
|
173 | 173 | } |
174 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
174 | + return $this->get_first_related('Ticket', $query_params); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return EE_Event |
182 | 182 | */ |
183 | 183 | public function event() { |
184 | - return $this->get_first_related( 'Event' ); |
|
184 | + return $this->get_first_related('Event'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function wp_user() { |
197 | 197 | $event = $this->event(); |
198 | - if ( $event instanceof EE_Event ) { |
|
198 | + if ($event instanceof EE_Event) { |
|
199 | 199 | return $event->wp_user(); |
200 | 200 | } |
201 | 201 | return 0; |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | * @access public |
222 | 222 | * @param int $ATT_ID Attendee ID |
223 | 223 | */ |
224 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
225 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
224 | + public function set_attendee_id($ATT_ID = 0) { |
|
225 | + $this->set('ATT_ID', $ATT_ID); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @access public |
234 | 234 | * @param int $TXN_ID Transaction ID |
235 | 235 | */ |
236 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
237 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
236 | + public function set_transaction_id($TXN_ID = 0) { |
|
237 | + $this->set('TXN_ID', $TXN_ID); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @access public |
246 | 246 | * @param string $REG_session PHP Session ID |
247 | 247 | */ |
248 | - public function set_session( $REG_session = '' ) { |
|
249 | - $this->set( 'REG_session', $REG_session ); |
|
248 | + public function set_session($REG_session = '') { |
|
249 | + $this->set('REG_session', $REG_session); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | * @access public |
258 | 258 | * @param string $REG_url_link Registration URL Link |
259 | 259 | */ |
260 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
261 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
260 | + public function set_reg_url_link($REG_url_link = '') { |
|
261 | + $this->set('REG_url_link', $REG_url_link); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @access public |
270 | 270 | * @param int $REG_count Primary Attendee |
271 | 271 | */ |
272 | - public function set_count( $REG_count = 1 ) { |
|
273 | - $this->set( 'REG_count', $REG_count ); |
|
272 | + public function set_count($REG_count = 1) { |
|
273 | + $this->set('REG_count', $REG_count); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @access public |
282 | 282 | * @param boolean $REG_group_size Group Registration |
283 | 283 | */ |
284 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
285 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
284 | + public function set_group_size($REG_group_size = FALSE) { |
|
285 | + $this->set('REG_group_size', $REG_group_size); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @access public |
366 | 366 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
367 | 367 | */ |
368 | - public function set_reg_date( $REG_date = FALSE ) { |
|
369 | - $this->set( 'REG_date', $REG_date ); |
|
368 | + public function set_reg_date($REG_date = FALSE) { |
|
369 | + $this->set('REG_date', $REG_date); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | * @access public |
378 | 378 | * @param float $REG_final_price |
379 | 379 | */ |
380 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
381 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
380 | + public function set_final_price($REG_final_price = 0.00) { |
|
381 | + $this->set('REG_final_price', $REG_final_price); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | * @access public |
390 | 390 | * @param float $REG_paid |
391 | 391 | */ |
392 | - public function set_paid( $REG_paid = 0.00 ) { |
|
393 | - $this->set( 'REG_paid', $REG_paid ); |
|
392 | + public function set_paid($REG_paid = 0.00) { |
|
393 | + $this->set('REG_paid', $REG_paid); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | * @access public |
402 | 402 | * @param boolean $REG_att_is_going Attendee Is Going |
403 | 403 | */ |
404 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
405 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
404 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
405 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return EE_Attendee |
413 | 413 | */ |
414 | 414 | public function attendee() { |
415 | - return $this->get_first_related( 'Attendee' ); |
|
415 | + return $this->get_first_related('Attendee'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @access public |
423 | 423 | */ |
424 | 424 | public function event_ID() { |
425 | - return $this->get( 'EVT_ID' ); |
|
425 | + return $this->get('EVT_ID'); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function event_name() { |
435 | 435 | $event = $this->event_obj(); |
436 | - if ( $event ) { |
|
436 | + if ($event) { |
|
437 | 437 | return $event->name(); |
438 | 438 | } else { |
439 | 439 | return NULL; |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @return EE_Event |
448 | 448 | */ |
449 | 449 | public function event_obj() { |
450 | - return $this->get_first_related( 'Event' ); |
|
450 | + return $this->get_first_related('Event'); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @access public |
458 | 458 | */ |
459 | 459 | public function attendee_ID() { |
460 | - return $this->get( 'ATT_ID' ); |
|
460 | + return $this->get('ATT_ID'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * @access public |
468 | 468 | */ |
469 | 469 | public function session_ID() { |
470 | - return $this->get( 'REG_session' ); |
|
470 | + return $this->get('REG_session'); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
478 | 478 | * @return string |
479 | 479 | */ |
480 | - public function receipt_url( $messenger = 'html' ) { |
|
480 | + public function receipt_url($messenger = 'html') { |
|
481 | 481 | |
482 | 482 | /** |
483 | 483 | * 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. |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | */ |
487 | 487 | EE_Registry::instance()->load_helper('Template'); |
488 | 488 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
489 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
489 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
490 | 490 | |
491 | - if ( $has_custom ) { |
|
492 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
491 | + if ($has_custom) { |
|
492 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
493 | 493 | } |
494 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
494 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
503 | 503 | * @return string |
504 | 504 | */ |
505 | - public function invoice_url( $messenger = 'html' ) { |
|
505 | + public function invoice_url($messenger = 'html') { |
|
506 | 506 | /** |
507 | 507 | * 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. |
508 | 508 | * |
@@ -510,21 +510,21 @@ discard block |
||
510 | 510 | */ |
511 | 511 | EE_Registry::instance()->load_helper('Template'); |
512 | 512 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
513 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
513 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
514 | 514 | |
515 | - if ( $has_custom ) { |
|
516 | - if ( $messenger == 'html' ) { |
|
517 | - return $this->invoice_url( 'launch' ); |
|
515 | + if ($has_custom) { |
|
516 | + if ($messenger == 'html') { |
|
517 | + return $this->invoice_url('launch'); |
|
518 | 518 | } |
519 | 519 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
520 | 520 | |
521 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
522 | - if ( $messenger == 'html' ) { |
|
521 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
522 | + if ($messenger == 'html') { |
|
523 | 523 | $query_args['html'] = TRUE; |
524 | 524 | } |
525 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
525 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
526 | 526 | } |
527 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
527 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @access public |
535 | 535 | */ |
536 | 536 | public function reg_url_link() { |
537 | - return $this->get( 'REG_url_link' ); |
|
537 | + return $this->get('REG_url_link'); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public function e_invoice_url( $type = 'launch' ) { |
|
548 | - echo $this->invoice_url( $type ); |
|
547 | + public function e_invoice_url($type = 'launch') { |
|
548 | + echo $this->invoice_url($type); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @return string |
566 | 566 | */ |
567 | 567 | public function payment_overview_url() { |
568 | - 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() ); |
|
568 | + 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()); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * @return string |
577 | 577 | */ |
578 | 578 | public function edit_attendee_information_url() { |
579 | - 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() ); |
|
579 | + 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()); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | * @return string |
587 | 587 | */ |
588 | 588 | public function get_admin_edit_url() { |
589 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
590 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
589 | + EE_Registry::instance()->load_helper('URL'); |
|
590 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @access public |
598 | 598 | */ |
599 | 599 | public function is_primary_registrant() { |
600 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
600 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -606,12 +606,12 @@ discard block |
||
606 | 606 | * This returns the primary registration object for this registration group (which may be this object). |
607 | 607 | * @return EE_Registration |
608 | 608 | */ |
609 | - public function get_primary_registration() { |
|
610 | - if ( $this->is_primary_registrant() ) |
|
609 | + public function get_primary_registration() { |
|
610 | + if ($this->is_primary_registrant()) |
|
611 | 611 | return $this; |
612 | 612 | |
613 | 613 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
614 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
614 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
615 | 615 | return $primary_registrant; |
616 | 616 | } |
617 | 617 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * @access public |
623 | 623 | */ |
624 | 624 | public function count() { |
625 | - return $this->get( 'REG_count' ); |
|
625 | + return $this->get('REG_count'); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @access public |
633 | 633 | */ |
634 | 634 | public function group_size() { |
635 | - return $this->get( 'REG_group_size' ); |
|
635 | + return $this->get('REG_group_size'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * @access public |
643 | 643 | */ |
644 | 644 | public function date() { |
645 | - return $this->get( 'REG_date' ); |
|
645 | + return $this->get('REG_date'); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -653,8 +653,8 @@ discard block |
||
653 | 653 | * @param string $time_format |
654 | 654 | * @return string |
655 | 655 | */ |
656 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
657 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
656 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
657 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * @return float |
668 | 668 | */ |
669 | 669 | public function final_price() { |
670 | - return $this->get( 'REG_final_price' ); |
|
670 | + return $this->get('REG_final_price'); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @return string |
679 | 679 | */ |
680 | 680 | public function pretty_final_price() { |
681 | - return $this->get_pretty( 'REG_final_price' ); |
|
681 | + return $this->get_pretty('REG_final_price'); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | * @return float |
690 | 690 | */ |
691 | 691 | public function paid() { |
692 | - return $this->get( 'REG_paid' ); |
|
692 | + return $this->get('REG_paid'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * @return float |
701 | 701 | */ |
702 | 702 | public function pretty_paid() { |
703 | - return $this->get_pretty( 'REG_paid' ); |
|
703 | + return $this->get_pretty('REG_paid'); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | * @param array $requires_payment |
713 | 713 | * @return bool |
714 | 714 | */ |
715 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
715 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
716 | 716 | // these reg statuses require payment (if event is not free) |
717 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
717 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
718 | 718 | if ( |
719 | - in_array( $this->status_ID(), $requires_payment ) && |
|
719 | + in_array($this->status_ID(), $requires_payment) && |
|
720 | 720 | $this->final_price() != 0 && |
721 | 721 | $this->final_price() != $this->paid() |
722 | 722 | ) { |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | * @param bool $show_icons |
734 | 734 | * @return void |
735 | 735 | */ |
736 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
737 | - echo $this->pretty_status( $show_icons ); |
|
736 | + public function e_pretty_status($show_icons = FALSE) { |
|
737 | + echo $this->pretty_status($show_icons); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
@@ -745,10 +745,10 @@ discard block |
||
745 | 745 | * @param bool $show_icons |
746 | 746 | * @return string |
747 | 747 | */ |
748 | - public function pretty_status( $show_icons = FALSE ) { |
|
749 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
748 | + public function pretty_status($show_icons = FALSE) { |
|
749 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
750 | 750 | $icon = ''; |
751 | - switch ( $this->status_ID() ) { |
|
751 | + switch ($this->status_ID()) { |
|
752 | 752 | case EEM_Registration::status_id_approved: |
753 | 753 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
754 | 754 | break; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
769 | 769 | break; |
770 | 770 | } |
771 | - return $icon . $status[ $this->status_ID() ]; |
|
771 | + return $icon.$status[$this->status_ID()]; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | * @access public |
779 | 779 | */ |
780 | 780 | public function att_is_going() { |
781 | - return $this->get( 'REG_att_is_going' ); |
|
781 | + return $this->get('REG_att_is_going'); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | * @param array $query_params like EEM_Base::get_all |
789 | 789 | * @return EE_Answer[] |
790 | 790 | */ |
791 | - public function answers( $query_params = NULL ) { |
|
792 | - return $this->get_many_related( 'Answer', $query_params ); |
|
791 | + public function answers($query_params = NULL) { |
|
792 | + return $this->get_many_related('Answer', $query_params); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | |
@@ -803,9 +803,9 @@ discard block |
||
803 | 803 | * (because the answer might be an array of answer values, so passing pretty_value=true |
804 | 804 | * will convert it into some kind of string) |
805 | 805 | */ |
806 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
806 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
807 | 807 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
808 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
808 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | |
@@ -818,13 +818,13 @@ discard block |
||
818 | 818 | */ |
819 | 819 | public function question_groups() { |
820 | 820 | $question_groups = array(); |
821 | - if ( $this->event() instanceof EE_Event ) { |
|
821 | + if ($this->event() instanceof EE_Event) { |
|
822 | 822 | $question_groups = $this->event()->question_groups( |
823 | 823 | array( |
824 | 824 | array( |
825 | 825 | 'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false |
826 | 826 | ), |
827 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
827 | + 'order_by' => array('QSG_order' => 'ASC') |
|
828 | 828 | ) |
829 | 829 | ); |
830 | 830 | } |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | */ |
842 | 842 | public function count_question_groups() { |
843 | 843 | $qg_count = 0; |
844 | - if ( $this->event() instanceof EE_Event ) { |
|
844 | + if ($this->event() instanceof EE_Event) { |
|
845 | 845 | $qg_count = $this->event()->count_related( |
846 | 846 | 'Question_Group', |
847 | 847 | array( |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * @return string |
863 | 863 | */ |
864 | 864 | public function reg_date() { |
865 | - return $this->get_datetime( 'REG_date' ); |
|
865 | + return $this->get_datetime('REG_date'); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @return EE_Datetime_Ticket |
875 | 875 | */ |
876 | 876 | public function datetime_ticket() { |
877 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
877 | + return $this->get_first_related('Datetime_Ticket'); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | |
@@ -884,15 +884,15 @@ discard block |
||
884 | 884 | * @param EE_Datetime_Ticket $datetime_ticket |
885 | 885 | * @return EE_Datetime_Ticket |
886 | 886 | */ |
887 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
888 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
887 | + public function set_datetime_ticket($datetime_ticket) { |
|
888 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
889 | 889 | } |
890 | 890 | /** |
891 | 891 | * Gets deleted |
892 | 892 | * @return boolean |
893 | 893 | */ |
894 | 894 | public function deleted() { |
895 | - return $this->get( 'REG_deleted' ); |
|
895 | + return $this->get('REG_deleted'); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | /** |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * @return boolean |
902 | 902 | */ |
903 | 903 | public function set_deleted($deleted) { |
904 | - $this->set( 'REG_deleted', $deleted ); |
|
904 | + $this->set('REG_deleted', $deleted); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | * @return EE_Status |
912 | 912 | */ |
913 | 913 | public function status_obj() { |
914 | - return $this->get_first_related( 'Status' ); |
|
914 | + return $this->get_first_related('Status'); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * @return int |
923 | 923 | */ |
924 | 924 | public function count_checkins() { |
925 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
925 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | * @return int |
933 | 933 | */ |
934 | 934 | public function count_checkins_not_checkedout() { |
935 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
935 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | |
@@ -945,20 +945,20 @@ discard block |
||
945 | 945 | * |
946 | 946 | * @return bool |
947 | 947 | */ |
948 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
949 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
948 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
949 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
950 | 950 | |
951 | 951 | //first check registration status |
952 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
952 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
953 | 953 | return false; |
954 | 954 | } |
955 | 955 | //is there a datetime ticket that matches this dtt_ID? |
956 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
956 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
957 | 957 | return false; |
958 | 958 | } |
959 | 959 | |
960 | 960 | //final check is against TKT_uses |
961 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
961 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | |
@@ -971,10 +971,10 @@ discard block |
||
971 | 971 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
972 | 972 | * @return bool true means can checkin. false means cannot checkin. |
973 | 973 | */ |
974 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
975 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
974 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
975 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
976 | 976 | |
977 | - if ( ! $DTT_ID ) { |
|
977 | + if ( ! $DTT_ID) { |
|
978 | 978 | return false; |
979 | 979 | } |
980 | 980 | |
@@ -982,23 +982,23 @@ discard block |
||
982 | 982 | |
983 | 983 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
984 | 984 | // or not. |
985 | - if ( ! $max_uses || $max_uses === EE_INF ) { |
|
985 | + if ( ! $max_uses || $max_uses === EE_INF) { |
|
986 | 986 | return true; |
987 | 987 | } |
988 | 988 | |
989 | 989 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
990 | 990 | //go ahead and toggle. |
991 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
991 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
992 | 992 | return true; |
993 | 993 | } |
994 | 994 | |
995 | 995 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
996 | 996 | //disallows further check-ins. |
997 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
997 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
998 | 998 | // checkins have already reached their max number of uses |
999 | 999 | // so registrant can NOT checkin |
1000 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
1001 | - 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__ ); |
|
1000 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
1001 | + 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__); |
|
1002 | 1002 | return false; |
1003 | 1003 | } |
1004 | 1004 | return true; |
@@ -1019,15 +1019,15 @@ discard block |
||
1019 | 1019 | * @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. |
1020 | 1020 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
1021 | 1021 | */ |
1022 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
1023 | - if ( empty( $DTT_ID ) ) { |
|
1022 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
1023 | + if (empty($DTT_ID)) { |
|
1024 | 1024 | $datetime = $this->get_related_primary_datetime(); |
1025 | 1025 | $DTT_ID = $datetime->ID(); |
1026 | 1026 | // verify the registration can checkin for the given DTT_ID |
1027 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
1027 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
1028 | 1028 | EE_Error::add_error( |
1029 | 1029 | sprintf( |
1030 | - __( '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'), |
|
1030 | + __('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'), |
|
1031 | 1031 | $this->ID(), |
1032 | 1032 | $DTT_ID |
1033 | 1033 | ), |
@@ -1041,8 +1041,8 @@ discard block |
||
1041 | 1041 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
1042 | 1042 | ); |
1043 | 1043 | //start by getting the current status so we know what status we'll be changing to. |
1044 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
1045 | - $status_to = $status_paths[ $cur_status ]; |
|
1044 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
1045 | + $status_to = $status_paths[$cur_status]; |
|
1046 | 1046 | // database only records true for checked IN or false for checked OUT |
1047 | 1047 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
1048 | 1048 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1050,24 +1050,24 @@ discard block |
||
1050 | 1050 | // because we are keeping track of Check-ins over time. |
1051 | 1051 | // Eventually we'll probably want to show a list table |
1052 | 1052 | // for the individual Check-ins so that they can be managed. |
1053 | - $checkin = EE_Checkin::new_instance( array( |
|
1053 | + $checkin = EE_Checkin::new_instance(array( |
|
1054 | 1054 | 'REG_ID' => $this->ID(), |
1055 | 1055 | 'DTT_ID' => $DTT_ID, |
1056 | 1056 | 'CHK_in' => $new_status |
1057 | - ) ); |
|
1057 | + )); |
|
1058 | 1058 | // if the record could not be saved then return false |
1059 | - if ( $checkin->save() === 0 ) { |
|
1060 | - if ( WP_DEBUG ) { |
|
1059 | + if ($checkin->save() === 0) { |
|
1060 | + if (WP_DEBUG) { |
|
1061 | 1061 | global $wpdb; |
1062 | 1062 | $error = sprintf( |
1063 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
1063 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
1064 | 1064 | '<br />', |
1065 | 1065 | $wpdb->last_error |
1066 | 1066 | ); |
1067 | 1067 | } else { |
1068 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
1068 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
1069 | 1069 | } |
1070 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
1071 | 1071 | return false; |
1072 | 1072 | } |
1073 | 1073 | return $status_to; |
@@ -1091,19 +1091,19 @@ discard block |
||
1091 | 1091 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
1092 | 1092 | * @return int Integer representing Check-in status. |
1093 | 1093 | */ |
1094 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
1095 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
1094 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
1095 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
1096 | 1096 | $datetime = $this->get_related_primary_datetime(); |
1097 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1097 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1098 | 1098 | return 0; |
1099 | 1099 | } |
1100 | 1100 | $DTT_ID = $datetime->ID(); |
1101 | 1101 | //verify the registration can checkin for the given DTT_ID |
1102 | 1102 | } |
1103 | 1103 | //get checkin object (if exists) |
1104 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
1105 | - if ( $checkin instanceof EE_Checkin ) { |
|
1106 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
1104 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
1105 | + if ($checkin instanceof EE_Checkin) { |
|
1106 | + if ($checkin->get('CHK_in')) { |
|
1107 | 1107 | return EE_Registration::checkin_status_in; //checked in |
1108 | 1108 | } else { |
1109 | 1109 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1121,28 +1121,28 @@ discard block |
||
1121 | 1121 | * @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. |
1122 | 1122 | * @return string internationalized message |
1123 | 1123 | */ |
1124 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
1124 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
1125 | 1125 | //let's get the attendee first so we can include the name of the attendee |
1126 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
1127 | - if ( $attendee instanceof EE_Attendee ) { |
|
1128 | - if ( $error ) { |
|
1129 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
1126 | + $attendee = $this->get_first_related('Attendee'); |
|
1127 | + if ($attendee instanceof EE_Attendee) { |
|
1128 | + if ($error) { |
|
1129 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
1130 | 1130 | } |
1131 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
1131 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
1132 | 1132 | //what is the status message going to be? |
1133 | - switch ( $cur_status ) { |
|
1133 | + switch ($cur_status) { |
|
1134 | 1134 | case EE_Registration::checkin_status_never : |
1135 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
1135 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
1136 | 1136 | break; |
1137 | 1137 | case EE_Registration::checkin_status_in : |
1138 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
1138 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
1139 | 1139 | break; |
1140 | 1140 | case EE_Registration::checkin_status_out : |
1141 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
1141 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
1142 | 1142 | break; |
1143 | 1143 | } |
1144 | 1144 | } |
1145 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
1145 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | * @return EE_Transaction |
1153 | 1153 | */ |
1154 | 1154 | public function transaction() { |
1155 | - return $this->get_first_related( 'Transaction' ); |
|
1155 | + return $this->get_first_related('Transaction'); |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @access public |
1164 | 1164 | */ |
1165 | 1165 | public function reg_code() { |
1166 | - return $this->get( 'REG_code' ); |
|
1166 | + return $this->get('REG_code'); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | * @access public |
1174 | 1174 | */ |
1175 | 1175 | public function transaction_ID() { |
1176 | - return $this->get( 'TXN_ID' ); |
|
1176 | + return $this->get('TXN_ID'); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | * @return int |
1183 | 1183 | */ |
1184 | 1184 | public function ticket_ID() { |
1185 | - return $this->get( 'TKT_ID' ); |
|
1185 | + return $this->get('TKT_ID'); |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | |
@@ -1194,17 +1194,17 @@ discard block |
||
1194 | 1194 | * @param string $REG_code Registration Code |
1195 | 1195 | * @param boolean $use_default |
1196 | 1196 | */ |
1197 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
1198 | - if ( empty( $REG_code )) { |
|
1199 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1197 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
1198 | + if (empty($REG_code)) { |
|
1199 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1200 | 1200 | return; |
1201 | 1201 | } |
1202 | - if ( ! $this->reg_code() ) { |
|
1203 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
1202 | + if ( ! $this->reg_code()) { |
|
1203 | + parent::set('REG_code', $REG_code, $use_default); |
|
1204 | 1204 | } else { |
1205 | 1205 | EE_Error::doing_it_wrong( |
1206 | - __CLASS__ . '::' . __FUNCTION__, |
|
1207 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
1206 | + __CLASS__.'::'.__FUNCTION__, |
|
1207 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
1208 | 1208 | '4.6.0' |
1209 | 1209 | ); |
1210 | 1210 | } |
@@ -1224,17 +1224,17 @@ discard block |
||
1224 | 1224 | * @return EE_Registration[] or empty array if this isn't a group registration. |
1225 | 1225 | */ |
1226 | 1226 | public function get_all_other_registrations_in_group() { |
1227 | - if ( $this->group_size() < 2 ) { |
|
1227 | + if ($this->group_size() < 2) { |
|
1228 | 1228 | return array(); |
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | $query[0] = array( |
1232 | 1232 | 'TXN_ID' => $this->transaction_ID(), |
1233 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
1233 | + 'REG_ID' => array('!=', $this->ID()), |
|
1234 | 1234 | 'TKT_ID' => $this->ticket_ID() |
1235 | 1235 | ); |
1236 | 1236 | |
1237 | - $registrations = $this->get_model()->get_all( $query ); |
|
1237 | + $registrations = $this->get_model()->get_all($query); |
|
1238 | 1238 | return $registrations; |
1239 | 1239 | } |
1240 | 1240 | |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | * @param array $query_params |
1245 | 1245 | * @return \EE_Registration[] |
1246 | 1246 | */ |
1247 | - public function payments( $query_params = array() ) { |
|
1248 | - return $this->get_many_related( 'Payment', $query_params ); |
|
1247 | + public function payments($query_params = array()) { |
|
1248 | + return $this->get_many_related('Payment', $query_params); |
|
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | |
@@ -1254,8 +1254,8 @@ discard block |
||
1254 | 1254 | * @param array $query_params |
1255 | 1255 | * @return \EE_Registration[] |
1256 | 1256 | */ |
1257 | - public function registration_payments( $query_params = array() ) { |
|
1258 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
1257 | + public function registration_payments($query_params = array()) { |
|
1258 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | * @access public |
1267 | 1267 | */ |
1268 | 1268 | public function price_paid() { |
1269 | - EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1269 | + EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1270 | 1270 | return $this->final_price(); |
1271 | 1271 | } |
1272 | 1272 | |
@@ -1278,9 +1278,9 @@ discard block |
||
1278 | 1278 | * @access public |
1279 | 1279 | * @param float $REG_final_price |
1280 | 1280 | */ |
1281 | - public function set_price_paid( $REG_final_price = 0.00 ) { |
|
1282 | - EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1283 | - $this->set_final_price( $REG_final_price ); |
|
1281 | + public function set_price_paid($REG_final_price = 0.00) { |
|
1282 | + EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1283 | + $this->set_final_price($REG_final_price); |
|
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | * @return string |
1292 | 1292 | */ |
1293 | 1293 | public function pretty_price_paid() { |
1294 | - EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1294 | + EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1295 | 1295 | return $this->pretty_final_price(); |
1296 | 1296 | } |
1297 | 1297 | |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | * @return EE_Payment_Method|null |
1306 | 1306 | */ |
1307 | 1307 | public function payment_method() { |
1308 | - return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
|
1308 | + return EEM_Payment_Method::instance()->get_last_used_for_registration($this); |
|
1309 | 1309 | } |
1310 | 1310 | |
1311 | 1311 |
@@ -167,7 +167,7 @@ |
||
167 | 167 | /** |
168 | 168 | * @param EE_Event $item |
169 | 169 | * |
170 | - * @return mixed|string |
|
170 | + * @return string |
|
171 | 171 | */ |
172 | 172 | public function column_id( EE_Event $item ) { |
173 | 173 | $content = $item->ID(); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -209,8 +210,9 @@ discard block |
||
209 | 210 | */ |
210 | 211 | protected function _column_name_action_setup( EE_Event $item ) { |
211 | 212 | //todo: remove when attendees is active |
212 | - if ( !defined('REG_ADMIN_URL') ) |
|
213 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
213 | + if ( !defined('REG_ADMIN_URL') ) { |
|
214 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
215 | + } |
|
214 | 216 | |
215 | 217 | $actions = array(); |
216 | 218 | |
@@ -368,8 +370,9 @@ discard block |
||
368 | 370 | */ |
369 | 371 | public function column_actions( EE_Event $item ) { |
370 | 372 | //todo: remove when attendees is active |
371 | - if ( !defined('REG_ADMIN_URL') ) |
|
372 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
373 | + if ( !defined('REG_ADMIN_URL') ) { |
|
374 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
375 | + } |
|
373 | 376 | $actionlinks = array(); |
374 | 377 | |
375 | 378 | $view_link = get_permalink($item->ID()); |
@@ -157,8 +157,8 @@ |
||
157 | 157 | $regs = $item->count_related('Registration'); |
158 | 158 | return $regs > 0 && $this->_view == 'trash' ? '<span class="ee-lock-icon"></span>' : sprintf( |
159 | 159 | '<input type="checkbox" name="EVT_IDs[]" value="%s" />', $item->ID() |
160 | - ); |
|
161 | - } |
|
160 | + ); |
|
161 | + } |
|
162 | 162 | |
163 | 163 | |
164 | 164 | /** |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param EE_Admin_Page $admin_page |
45 | 45 | */ |
46 | - public function __construct( $admin_page ) { |
|
46 | + public function __construct($admin_page) { |
|
47 | 47 | parent::__construct($admin_page); |
48 | - require_once( EE_HELPERS . 'EEH_DTT_Helper.helper.php' ); |
|
48 | + require_once(EE_HELPERS.'EEH_DTT_Helper.helper.php'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function _setup_data() { |
56 | 56 | $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
57 | - $this->_all_data_count = $this->_admin_page->get_events(0,0, TRUE); |
|
57 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, TRUE); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | $this->_sortable_columns = array( |
88 | - 'id' => array( 'EVT_ID' => true ), |
|
89 | - 'name' => array( 'EVT_name' => false ), |
|
90 | - 'author' => array( 'EVT_wp_user' => false ), |
|
91 | - 'venue' => array( 'Venue.VNU_name' => false ), |
|
88 | + 'id' => array('EVT_ID' => true), |
|
89 | + 'name' => array('EVT_name' => false), |
|
90 | + 'author' => array('EVT_wp_user' => false), |
|
91 | + 'venue' => array('Venue.VNU_name' => false), |
|
92 | 92 | 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
93 | 93 | 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
94 | 94 | ); |
95 | 95 | |
96 | 96 | $this->_primary_column = 'id'; |
97 | 97 | |
98 | - $this->_hidden_columns = array( 'author' ); |
|
98 | + $this->_hidden_columns = array('author'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | protected function _add_view_counts() { |
114 | 114 | $this->_views['all']['count'] = $this->_admin_page->total_events(); |
115 | 115 | $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
116 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
116 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
117 | 117 | $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
118 | 118 | } |
119 | 119 | } |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return string |
126 | 126 | */ |
127 | - protected function _get_row_class( EE_Event $item ) { |
|
128 | - $class = parent::_get_row_class( $item ); |
|
127 | + protected function _get_row_class(EE_Event $item) { |
|
128 | + $class = parent::_get_row_class($item); |
|
129 | 129 | //add status class |
130 | - $class .= ' ee-status-strip event-status-' . $item->get_active_status(); |
|
131 | - if ( $this->_has_checkbox_column ) { |
|
130 | + $class .= ' ee-status-strip event-status-'.$item->get_active_status(); |
|
131 | + if ($this->_has_checkbox_column) { |
|
132 | 132 | $class .= ' has-checkbox-column'; |
133 | 133 | } |
134 | 134 | return $class; |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return string |
142 | 142 | */ |
143 | - public function column_status( EE_Event $item ) { |
|
144 | - return '<span class="ee-status-strip ee-status-strip-td event-status-' . $item->get_active_status() . '"></span>'; |
|
143 | + public function column_status(EE_Event $item) { |
|
144 | + return '<span class="ee-status-strip ee-status-strip-td event-status-'.$item->get_active_status().'"></span>'; |
|
145 | 145 | }/**/ |
146 | 146 | |
147 | 147 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function column_cb( $item ) { |
|
153 | + public function column_cb($item) { |
|
154 | 154 | $this->_dtt = $item->primary_datetime(); //set this for use in other columns |
155 | 155 | |
156 | 156 | //does event have any attached registrations? |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return mixed|string |
168 | 168 | */ |
169 | - public function column_id( EE_Event $item ) { |
|
169 | + public function column_id(EE_Event $item) { |
|
170 | 170 | $content = $item->ID(); |
171 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
171 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
172 | 172 | return $content; |
173 | 173 | } |
174 | 174 | |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string |
180 | 180 | */ |
181 | - public function column_name( EE_Event $item ) { |
|
181 | + public function column_name(EE_Event $item) { |
|
182 | 182 | $edit_query_args = array( |
183 | 183 | 'action' => 'edit', |
184 | 184 | 'post' => $item->ID() |
185 | 185 | ); |
186 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
187 | - $actions = $this->_column_name_action_setup( $item ); |
|
186 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
187 | + $actions = $this->_column_name_action_setup($item); |
|
188 | 188 | $status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
189 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' . $status; |
|
190 | - $content .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->get_active_status(), false, 'sentence' ) . '</span>'; |
|
189 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>'.$status; |
|
190 | + $content .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->get_active_status(), false, 'sentence').'</span>'; |
|
191 | 191 | $content .= $this->row_actions($actions); |
192 | 192 | return $content; |
193 | 193 | |
@@ -204,72 +204,72 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return array array of actions |
206 | 206 | */ |
207 | - protected function _column_name_action_setup( EE_Event $item ) { |
|
207 | + protected function _column_name_action_setup(EE_Event $item) { |
|
208 | 208 | //todo: remove when attendees is active |
209 | - if ( !defined('REG_ADMIN_URL') ) |
|
209 | + if ( ! defined('REG_ADMIN_URL')) |
|
210 | 210 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
211 | 211 | |
212 | 212 | $actions = array(); |
213 | 213 | |
214 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
214 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
215 | 215 | $edit_query_args = array( |
216 | 216 | 'action' => 'edit', |
217 | 217 | 'post' => $item->ID() |
218 | 218 | ); |
219 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
220 | - $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'; |
|
219 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
220 | + $actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
221 | 221 | |
222 | 222 | } |
223 | 223 | |
224 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
224 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
225 | 225 | $attendees_query_args = array( |
226 | 226 | 'action' => 'default', |
227 | 227 | 'event_id' => $item->ID() |
228 | 228 | ); |
229 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
230 | - $actions['attendees'] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrations', 'event_espresso') . '">' . __('Registrations', 'event_espresso') . '</a>'; |
|
229 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
230 | + $actions['attendees'] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrations', 'event_espresso').'">'.__('Registrations', 'event_espresso').'</a>'; |
|
231 | 231 | } |
232 | 232 | |
233 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
233 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
234 | 234 | $trash_event_query_args = array( |
235 | 235 | 'action' => 'trash_event', |
236 | 236 | 'EVT_ID' => $item->ID() |
237 | 237 | ); |
238 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( $trash_event_query_args, EVENTS_ADMIN_URL ); |
|
238 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_args, EVENTS_ADMIN_URL); |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
241 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
242 | 242 | $restore_event_query_args = array( |
243 | 243 | 'action' => 'restore_event', |
244 | 244 | 'EVT_ID' => $item->ID() |
245 | 245 | ); |
246 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( $restore_event_query_args, EVENTS_ADMIN_URL ); |
|
246 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce($restore_event_query_args, EVENTS_ADMIN_URL); |
|
247 | 247 | } |
248 | 248 | |
249 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
249 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
250 | 250 | $delete_event_query_args = array( |
251 | 251 | 'action' => 'delete_event', |
252 | 252 | 'EVT_ID' => $item->ID() |
253 | 253 | ); |
254 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( $delete_event_query_args, EVENTS_ADMIN_URL ); |
|
254 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce($delete_event_query_args, EVENTS_ADMIN_URL); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | $view_link = get_permalink($item->ID()); |
258 | 258 | |
259 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>'; |
|
259 | + $actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
260 | 260 | |
261 | - switch ( $item->get( 'status' ) ) { |
|
261 | + switch ($item->get('status')) { |
|
262 | 262 | case 'trash' : |
263 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
264 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" title="' . esc_attr__('Restore from Trash', 'event_espresso') . '">' . __('Restore from Trash', 'event_espresso') . '</a>'; |
|
263 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
264 | + $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'" title="'.esc_attr__('Restore from Trash', 'event_espresso').'">'.__('Restore from Trash', 'event_espresso').'</a>'; |
|
265 | 265 | } |
266 | - if ( $item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
267 | - $actions['delete'] = '<a href="' . $delete_event_link . '" title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
266 | + if ($item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
267 | + $actions['delete'] = '<a href="'.$delete_event_link.'" title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
268 | 268 | } |
269 | 269 | break; |
270 | 270 | default : |
271 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
272 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '" title="' . esc_attr__('Trash Event', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
271 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
272 | + $actions['move to trash'] = '<a href="'.$trash_event_link.'" title="'.esc_attr__('Trash Event', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | return $actions; |
@@ -281,17 +281,17 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return string |
283 | 283 | */ |
284 | - public function column_author( EE_Event $item ) { |
|
284 | + public function column_author(EE_Event $item) { |
|
285 | 285 | //user author info |
286 | - $event_author = get_userdata( $item->wp_user() ); |
|
287 | - $gravatar = get_avatar( $item->wp_user(), '15' ); |
|
286 | + $event_author = get_userdata($item->wp_user()); |
|
287 | + $gravatar = get_avatar($item->wp_user(), '15'); |
|
288 | 288 | //filter link |
289 | 289 | $query_args = array( |
290 | 290 | 'action' => 'default', |
291 | 291 | 'EVT_wp_user' => $item->wp_user() |
292 | 292 | ); |
293 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce( $query_args, EVENTS_ADMIN_URL ); |
|
294 | - return $gravatar . ' <a href="' . $filter_url . '" title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' . $event_author->display_name . '</a>'; |
|
293 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
294 | + return $gravatar.' <a href="'.$filter_url.'" title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'.$event_author->display_name.'</a>'; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - public function column_venue( EE_Event $item ) { |
|
304 | - $venue = $item->get_first_related( 'Venue' ); |
|
305 | - return !empty( $venue ) ? $venue->name() : ''; |
|
303 | + public function column_venue(EE_Event $item) { |
|
304 | + $venue = $item->get_first_related('Venue'); |
|
305 | + return ! empty($venue) ? $venue->name() : ''; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @throws EE_Error |
313 | 313 | */ |
314 | - public function column_start_date_time( EE_Event $item ) { |
|
315 | - echo !empty( $this->_dtt ) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
314 | + public function column_start_date_time(EE_Event $item) { |
|
315 | + echo ! empty($this->_dtt) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
316 | 316 | //display in user's timezone? |
317 | - echo !empty( $this->_dtt ) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ' ) : ''; |
|
317 | + echo ! empty($this->_dtt) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ') : ''; |
|
318 | 318 | |
319 | 319 | } |
320 | 320 | |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @throws EE_Error |
326 | 326 | */ |
327 | - public function column_reg_begins( EE_Event $item ) { |
|
327 | + public function column_reg_begins(EE_Event $item) { |
|
328 | 328 | $reg_start = $item->get_ticket_with_earliest_start_time(); |
329 | - echo !empty( $reg_start ) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
329 | + echo ! empty($reg_start) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
330 | 330 | //display in user's timezone? |
331 | - echo !empty( $reg_start ) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ' ) : '';/**/ |
|
331 | + echo ! empty($reg_start) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ') : ''; /**/ |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @return int|string |
339 | 339 | */ |
340 | - public function column_attendees( EE_Event $item ) { |
|
340 | + public function column_attendees(EE_Event $item) { |
|
341 | 341 | $attendees_query_args = array( |
342 | 342 | 'action' => 'default', |
343 | 343 | 'event_id' => $item->ID() |
344 | 344 | ); |
345 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
346 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count( $item->ID() ); |
|
347 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' : $registered_attendees; |
|
345 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
346 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
347 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>' : $registered_attendees; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return float |
355 | 355 | */ |
356 | - public function column_tkts_sold( EE_Event $item ) { |
|
357 | - return EEM_Ticket::instance()->sum(array( array('Datetime.EVT_ID' => $item->ID() )), 'TKT_sold' ); |
|
356 | + public function column_tkts_sold(EE_Event $item) { |
|
357 | + return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -363,38 +363,38 @@ discard block |
||
363 | 363 | * |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - public function column_actions( EE_Event $item ) { |
|
366 | + public function column_actions(EE_Event $item) { |
|
367 | 367 | //todo: remove when attendees is active |
368 | - if ( !defined('REG_ADMIN_URL') ) |
|
368 | + if ( ! defined('REG_ADMIN_URL')) |
|
369 | 369 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
370 | 370 | $actionlinks = array(); |
371 | 371 | |
372 | 372 | $view_link = get_permalink($item->ID()); |
373 | 373 | |
374 | - $actionlinks[] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
374 | + $actionlinks[] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">'; |
|
375 | 375 | $actionlinks[] = '<div class="dashicons dashicons-search"></div></a>'; |
376 | 376 | |
377 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
377 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
378 | 378 | $edit_query_args = array( |
379 | 379 | 'action' => 'edit', |
380 | 380 | 'post' => $item->ID() |
381 | 381 | ); |
382 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
383 | - $actionlinks[] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
382 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
383 | + $actionlinks[] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
384 | 384 | } |
385 | 385 | |
386 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
386 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
387 | 387 | $attendees_query_args = array( |
388 | 388 | 'action' => 'default', |
389 | 389 | 'event_id' => $item->ID() |
390 | 390 | ); |
391 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
392 | - $actionlinks[] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrants', 'event_espresso') . '"><div class="dashicons dashicons-groups"></div></a>'; |
|
391 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
392 | + $actionlinks[] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrants', 'event_espresso').'"><div class="dashicons dashicons-groups"></div></a>'; |
|
393 | 393 | } |
394 | 394 | |
395 | - $actionlinks = apply_filters( 'FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item ); |
|
395 | + $actionlinks = apply_filters('FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item); |
|
396 | 396 | |
397 | - return $this->_action_string( implode( "\n\t", $actionlinks ), $item, 'div' ); |
|
397 | + return $this->_action_string(implode("\n\t", $actionlinks), $item, 'div'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Event_Single_Caff |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -50,34 +50,34 @@ discard block |
||
50 | 50 | * @return void |
51 | 51 | */ |
52 | 52 | public static function set_hooks_admin() { |
53 | - define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
54 | - define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
53 | + define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
54 | + define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
55 | 55 | add_action( |
56 | 56 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings', |
57 | - array( 'EED_Event_Single_Caff', 'load_scripts_styles' ), |
|
57 | + array('EED_Event_Single_Caff', 'load_scripts_styles'), |
|
58 | 58 | 10 |
59 | 59 | ); |
60 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 ); |
|
61 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 ); |
|
60 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10); |
|
61 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2); |
|
62 | 62 | // AJAX |
63 | - add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
64 | - add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
63 | + add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
64 | + add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | 70 | public static function load_scripts_styles() { |
71 | - add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 ); |
|
71 | + add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | |
76 | 76 | public static function enqueue_scripts_styles() { |
77 | - wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION ); |
|
78 | - wp_enqueue_style( 'eed-event-single-sortable' ); |
|
79 | - wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true ); |
|
80 | - wp_enqueue_script( 'eed-event-single-sortable' ); |
|
77 | + wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION); |
|
78 | + wp_enqueue_style('eed-event-single-sortable'); |
|
79 | + wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
80 | + wp_enqueue_script('eed-event-single-sortable'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function template_settings_form() { |
93 | 93 | $config = EE_Registry::instance()->CFG->template_settings; |
94 | - $config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false; |
|
96 | - $config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config ); |
|
94 | + $config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
96 | + $config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config); |
|
97 | 97 | |
98 | 98 | $event_single_order_array = array(); |
99 | - $event_single_order_array[ $config->display_order_tickets ] = 'tickets'; |
|
100 | - $event_single_order_array[ $config->display_order_datetimes ] = 'datetimes'; |
|
101 | - $event_single_order_array[ $config->display_order_event ] = 'event'; |
|
102 | - $event_single_order_array[ $config->display_order_venue ] = 'venue'; |
|
99 | + $event_single_order_array[$config->display_order_tickets] = 'tickets'; |
|
100 | + $event_single_order_array[$config->display_order_datetimes] = 'datetimes'; |
|
101 | + $event_single_order_array[$config->display_order_event] = 'event'; |
|
102 | + $event_single_order_array[$config->display_order_venue] = 'venue'; |
|
103 | 103 | // get template parts |
104 | - $template_parts = EED_Event_Single::instance()->initialize_template_parts( $config ); |
|
104 | + $template_parts = EED_Event_Single::instance()->initialize_template_parts($config); |
|
105 | 105 | // convert to array so that we can add more properties |
106 | - $config = get_object_vars( $config ); |
|
107 | - $config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' ); |
|
108 | - EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config ); |
|
106 | + $config = get_object_vars($config); |
|
107 | + $config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js'); |
|
108 | + EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param array $REQ |
119 | 119 | * @return EE_Event_Single_Config |
120 | 120 | */ |
121 | - public static function update_template_settings( $CFG, $REQ ) { |
|
122 | - $display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
|
123 | - $display_order_datetimes = isset( $CFG->EED_Event_Single->display_order_datetimes ) ? $CFG->EED_Event_Single->display_order_datetimes : 110; |
|
124 | - $display_order_event = isset( $CFG->EED_Event_Single->display_order_event ) ? $CFG->EED_Event_Single->display_order_event : 120; |
|
125 | - $display_order_venue = isset( $CFG->EED_Event_Single->display_order_venue ) ? $CFG->EED_Event_Single->display_order_venue : 130; |
|
121 | + public static function update_template_settings($CFG, $REQ) { |
|
122 | + $display_order_tickets = isset($CFG->EED_Event_Single->display_order_tickets) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
|
123 | + $display_order_datetimes = isset($CFG->EED_Event_Single->display_order_datetimes) ? $CFG->EED_Event_Single->display_order_datetimes : 110; |
|
124 | + $display_order_event = isset($CFG->EED_Event_Single->display_order_event) ? $CFG->EED_Event_Single->display_order_event : 120; |
|
125 | + $display_order_venue = isset($CFG->EED_Event_Single->display_order_venue) ? $CFG->EED_Event_Single->display_order_venue : 130; |
|
126 | 126 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
127 | - $CFG->EED_Event_Single->display_status_banner_single = !empty( $REQ['display_status_banner_single'] ) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
128 | - $CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'] ? TRUE : FALSE; |
|
129 | - $CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) : 0; |
|
127 | + $CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
128 | + $CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'] ? TRUE : FALSE; |
|
129 | + $CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) ? absint($REQ['EED_Events_Single_use_sortable_display_order']) : 0; |
|
130 | 130 | $CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_tickets : 100; |
131 | 131 | $CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_datetimes : 110; |
132 | 132 | $CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_event : 120; |
133 | 133 | $CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_venue : 130; |
134 | - do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ ); |
|
134 | + do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ); |
|
135 | 135 | return $CFG; |
136 | 136 | } |
137 | 137 | |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public static function update_event_single_order() { |
147 | 147 | $config_saved = false; |
148 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
149 | - if ( ! empty( $template_parts ) ) { |
|
150 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
151 | - foreach ( $template_parts as $key => $template_part ) { |
|
148 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
149 | + if ( ! empty($template_parts)) { |
|
150 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
151 | + foreach ($template_parts as $key => $template_part) { |
|
152 | 152 | $template_part = "display_order_$template_part"; |
153 | - $priority = ( $key * 10 ) + 100; |
|
153 | + $priority = ($key * 10) + 100; |
|
154 | 154 | EE_Registry::instance()->CFG->template_settings->EED_Event_Single->{$template_part} = $priority; |
155 | - do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority ); |
|
155 | + do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority); |
|
156 | 156 | } |
157 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
157 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
158 | 158 | } |
159 | - if ( $config_saved ) { |
|
160 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
159 | + if ($config_saved) { |
|
160 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
161 | 161 | } else { |
162 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
162 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
163 | 163 | } |
164 | - echo wp_json_encode( EE_Error::get_notices( false )); |
|
164 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
165 | 165 | exit(); |
166 | 166 | } |
167 | 167 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param WP $WP |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - public function run( $WP ) { |
|
177 | + public function run($WP) { |
|
178 | 178 | } |
179 | 179 | |
180 | 180 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EED_Events_Archive_Caff |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - return parent::get_instance( __CLASS__ ); |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_hooks_admin() { |
52 | - define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
53 | - define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
54 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 ); |
|
55 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 ); |
|
52 | + define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
54 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10); |
|
55 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2); |
|
56 | 56 | // AJAX |
57 | - add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
58 | - add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
57 | + add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
58 | + add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param WP $WP |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function run( $WP ) { |
|
71 | + public function run($WP) { |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,33 +83,33 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function template_settings_form() { |
85 | 85 | // grab general settings admin page and remove the existing hook callback |
86 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
|
87 | - if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
|
88 | - remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 ); |
|
86 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
87 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
88 | + remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100); |
|
89 | 89 | } |
90 | 90 | // first just grab the template settings |
91 | 91 | $config = EE_Registry::instance()->CFG->template_settings; |
92 | 92 | // then if the Event Archive config is valid, use that, else create a new one |
93 | - $config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | - $config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config ); |
|
95 | - $config->display_status_banner = isset( $config->display_status_banner ) ? $config->display_status_banner : 0; |
|
96 | - $config->display_description = isset( $config->display_description ) ? $config->display_description : 1; |
|
97 | - $config->display_ticket_selector = isset( $config->display_ticket_selector ) ? $config->display_ticket_selector : 0; |
|
98 | - $config->display_datetimes = isset( $config->display_datetimes ) ? $config->display_datetimes : 1; |
|
99 | - $config->display_venue = isset( $config->display_venue ) ? $config->display_venue : 0; |
|
100 | - $config->display_expired_events = isset( $config->display_expired_events ) ? $config->display_expired_events : 0; |
|
93 | + $config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | + $config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config); |
|
95 | + $config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0; |
|
96 | + $config->display_description = isset($config->display_description) ? $config->display_description : 1; |
|
97 | + $config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0; |
|
98 | + $config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1; |
|
99 | + $config->display_venue = isset($config->display_venue) ? $config->display_venue : 0; |
|
100 | + $config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0; |
|
101 | 101 | // display order options |
102 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order )? $config->use_sortable_display_order : false; |
|
103 | - $config->display_order_tickets = isset( $config->display_order_tickets )? $config->display_order_tickets : 100; |
|
104 | - $config->display_order_datetimes = isset( $config->display_order_datetimes )? $config->display_order_datetimes : 110; |
|
105 | - $config->display_order_event = isset( $config->display_order_event )? $config->display_order_event : 120; |
|
106 | - $config->display_order_venue = isset( $config->display_order_venue )? $config->display_order_venue : 130; |
|
102 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
103 | + $config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100; |
|
104 | + $config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110; |
|
105 | + $config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120; |
|
106 | + $config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130; |
|
107 | 107 | // get template parts |
108 | - $template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config ); |
|
108 | + $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
109 | 109 | // convert to array so that we can add more properties |
110 | - $config = get_object_vars( $config ); |
|
111 | - $config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' ); |
|
112 | - EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config ); |
|
110 | + $config = get_object_vars($config); |
|
111 | + $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js'); |
|
112 | + EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | * @param array $REQ |
126 | 126 | * @return EE_Events_Archive_Config |
127 | 127 | */ |
128 | - public static function update_template_settings( $CFG, $REQ ) { |
|
128 | + public static function update_template_settings($CFG, $REQ) { |
|
129 | 129 | $config = new EE_Events_Archive_Config(); |
130 | 130 | // unless we are resetting the config... |
131 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
132 | - $config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
133 | - $config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
134 | - $config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
135 | - $config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
136 | - $config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
137 | - $config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; |
|
138 | - $config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0; |
|
139 | - $config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | - $config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | - $config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | - $config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
131 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
132 | + $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
133 | + $config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
134 | + $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
135 | + $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
136 | + $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
137 | + $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; |
|
138 | + $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0; |
|
139 | + $config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | + $config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | + $config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | + $config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
143 | 143 | } |
144 | 144 | $CFG->EED_Events_Archive = $config; |
145 | - do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ ); |
|
145 | + do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
146 | 146 | return $CFG; |
147 | 147 | } |
148 | 148 | |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function update_event_archive_order() { |
158 | 158 | $config_saved = false; |
159 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
160 | - if ( ! empty( $template_parts ) ) { |
|
161 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
162 | - foreach ( $template_parts as $key => $template_part ) { |
|
159 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
160 | + if ( ! empty($template_parts)) { |
|
161 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
162 | + foreach ($template_parts as $key => $template_part) { |
|
163 | 163 | $template_part = "display_order_$template_part"; |
164 | - $priority = ( $key * 10 ) + 100; |
|
164 | + $priority = ($key * 10) + 100; |
|
165 | 165 | if ( |
166 | 166 | property_exists( |
167 | 167 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive, |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ) { |
171 | 171 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->{$template_part} = $priority; |
172 | 172 | } |
173 | - do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority ); |
|
173 | + do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
174 | 174 | } |
175 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
175 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
176 | 176 | } |
177 | - if ( $config_saved ) { |
|
178 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
177 | + if ($config_saved) { |
|
178 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
179 | 179 | } else { |
180 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
180 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
181 | 181 | } |
182 | - echo wp_json_encode( EE_Error::get_notices( false ) ); |
|
182 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
183 | 183 | exit(); |
184 | 184 | } |
185 | 185 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | <?php _e('Adjust the settings for the PayPal Pro payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Pro.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Pro.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <p><strong><?php _e('PayPal Pro Settings', 'event_espresso'); ?></strong></p> |
9 | 9 | <ul> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * _migration_step() (ie, it its a count of rows in the old attendees table in _count_records_to_migrate(), it should also be OLD attendee rows migrated |
35 | 35 | * on each call to _migration_step(). |
36 | 36 | */ |
37 | -abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base{ |
|
37 | +abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base { |
|
38 | 38 | /** |
39 | 39 | * The migration script this is a stage of |
40 | 40 | * @var EE_Data_Migration_Script_Base |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to |
48 | 48 | * @param EE_Data_Migration_Script_Base $migration_script |
49 | 49 | */ |
50 | - public function _construct_finalize($migration_script){ |
|
50 | + public function _construct_finalize($migration_script) { |
|
51 | 51 | $this->_migration_script = $migration_script; |
52 | 52 | } |
53 | 53 | |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | * @param int $num_items_to_migrate |
59 | 59 | * @return int |
60 | 60 | */ |
61 | - public function migration_step($num_items_to_migrate=50){ |
|
61 | + public function migration_step($num_items_to_migrate = 50) { |
|
62 | 62 | //before we run the migration step, we want ot take note of warnings that get outputted |
63 | 63 | ob_start(); |
64 | 64 | $items_migrated = $this->_migration_step($num_items_to_migrate); |
65 | 65 | $output = ob_get_contents(); |
66 | 66 | ob_end_clean(); |
67 | - if( $output ){ |
|
67 | + if ($output) { |
|
68 | 68 | $this->add_error($output); |
69 | 69 | } |
70 | 70 | $this->_records_migrated += $items_migrated; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param int $num_items_to_migrate |
83 | 83 | * @return int number of items ACTUALLY migrated |
84 | 84 | */ |
85 | - abstract protected function _migration_step($num_items_to_migrate=50); |
|
85 | + abstract protected function _migration_step($num_items_to_migrate = 50); |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Counts the records that have been migrated so far |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * returns an array of strings describing errors |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - public function get_errors(){ |
|
99 | + public function get_errors() { |
|
100 | 100 | return $this->_errors; |
101 | 101 | } |
102 | 102 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * to have been made from the properties_as_array() function. |
107 | 107 | * @param array $array_of_properties like what's produced from properties_as_array() method |
108 | 108 | */ |
109 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
109 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
110 | 110 | unset($array_of_properties['class']); |
111 | - foreach($array_of_properties as $property_name => $property_value){ |
|
111 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
112 | 112 | $this->{$property_name} = $property_value; |
113 | 113 | } |
114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * Gets the script this is a stage of |
118 | 118 | * @return EE_Data_Migration_Script_Base |
119 | 119 | */ |
120 | - protected function get_migration_script(){ |
|
120 | + protected function get_migration_script() { |
|
121 | 121 | return $this->_migration_script; |
122 | 122 | } |
123 | 123 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | -require_once( EE_HELPERS . 'EEH_Base.helper.php' ); |
|
31 | +require_once(EE_HELPERS.'EEH_Base.helper.php'); |
|
32 | 32 | class EEH_Sideloader extends EEH_Base { |
33 | 33 | |
34 | 34 | private $_upload_to; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @access public |
44 | 44 | * @param array $init array fo initializing the sideloader if keys match the properties. |
45 | 45 | */ |
46 | - public function __construct( $init = array() ) { |
|
47 | - $this->_init( $init ); |
|
46 | + public function __construct($init = array()) { |
|
47 | + $this->_init($init); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -55,24 +55,24 @@ discard block |
||
55 | 55 | * @param array $init array on init (keys match properties others ignored) |
56 | 56 | * @return void |
57 | 57 | */ |
58 | - private function _init( $init ) { |
|
58 | + private function _init($init) { |
|
59 | 59 | $defaults = array( |
60 | 60 | '_upload_to' => $this->_get_wp_uploads_dir(), |
61 | 61 | '_upload_from' => '', |
62 | 62 | '_permissions' => 0644, |
63 | - '_new_file_name' => 'EE_Sideloader_' . uniqid() . '.default' |
|
63 | + '_new_file_name' => 'EE_Sideloader_'.uniqid().'.default' |
|
64 | 64 | ); |
65 | 65 | |
66 | - $props = array_merge( $defaults, $init ); |
|
66 | + $props = array_merge($defaults, $init); |
|
67 | 67 | |
68 | - foreach ( $props as $key => $val ) { |
|
69 | - if ( EEH_Class_Tools::has_property( $this, $key ) ) { |
|
68 | + foreach ($props as $key => $val) { |
|
69 | + if (EEH_Class_Tools::has_property($this, $key)) { |
|
70 | 70 | $this->{$key} = $val; |
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | 74 | //make sure we include the required wp file for needed functions |
75 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
75 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | private function _get_wp_uploads_dir() {} |
81 | 81 | |
82 | 82 | //setters |
83 | - public function set_upload_to( $upload_to_folder ) { |
|
83 | + public function set_upload_to($upload_to_folder) { |
|
84 | 84 | $this->_upload_to = $upload_to_folder; |
85 | 85 | } |
86 | - public function set_upload_from( $upload_from_folder ) { |
|
86 | + public function set_upload_from($upload_from_folder) { |
|
87 | 87 | $this->_upload_from_folder = $upload_from_folder; |
88 | 88 | } |
89 | - public function set_permissions( $permissions ) { |
|
89 | + public function set_permissions($permissions) { |
|
90 | 90 | $this->_permissions = $permissions; |
91 | 91 | } |
92 | - public function set_new_file_name( $new_file_name ) { |
|
92 | + public function set_new_file_name($new_file_name) { |
|
93 | 93 | $this->_new_file_name = $new_file_name; |
94 | 94 | } |
95 | 95 | |
@@ -111,34 +111,34 @@ discard block |
||
111 | 111 | //upload methods |
112 | 112 | public function sideload() { |
113 | 113 | //setup temp dir |
114 | - $temp_file = wp_tempnam( $this->_upload_from ); |
|
114 | + $temp_file = wp_tempnam($this->_upload_from); |
|
115 | 115 | |
116 | - if ( !$temp_file ) { |
|
117 | - EE_Error::add_error( __('Something went wrong with the upload. Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
116 | + if ( ! $temp_file) { |
|
117 | + EE_Error::add_error(__('Something went wrong with the upload. Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | - do_action( 'AHEE__EEH_Sideloader__sideload__before', $this, $temp_file ); |
|
121 | + do_action('AHEE__EEH_Sideloader__sideload__before', $this, $temp_file); |
|
122 | 122 | |
123 | - $wp_remote_args = apply_filters( 'FHEE__EEH_Sideloader__sideload__wp_remote_args', array( 'timeout' => 500, 'stream' => true, 'filename' => $temp_file ), $this, $temp_file ); |
|
123 | + $wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array('timeout' => 500, 'stream' => true, 'filename' => $temp_file), $this, $temp_file); |
|
124 | 124 | |
125 | - $response = wp_safe_remote_get( $this->_upload_from, $wp_remote_args ); |
|
125 | + $response = wp_safe_remote_get($this->_upload_from, $wp_remote_args); |
|
126 | 126 | |
127 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
128 | - unlink( $temp_file ); |
|
129 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
130 | - EE_Error::add_error( sprintf( __('Unable to upload the file. Either the path given to upload from is incorrect, or something else happened. Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export( $response, true ), $this->_upload_from ), __FILE__, __FUNCTION__, __LINE__ ); |
|
127 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
128 | + unlink($temp_file); |
|
129 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
130 | + EE_Error::add_error(sprintf(__('Unable to upload the file. Either the path given to upload from is incorrect, or something else happened. Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export($response, true), $this->_upload_from), __FILE__, __FUNCTION__, __LINE__); |
|
131 | 131 | } |
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
135 | 135 | //possible md5 check |
136 | - $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' ); |
|
137 | - if ( $content_md5 ) { |
|
138 | - $md5_check = verify_file_md5( $temp_file, $content_md5 ); |
|
139 | - if ( is_wp_error( $md5_check ) ) { |
|
140 | - unlink( $temp_file ); |
|
141 | - EE_Error::add_error( $md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
136 | + $content_md5 = wp_remote_retrieve_header($response, 'content-md5'); |
|
137 | + if ($content_md5) { |
|
138 | + $md5_check = verify_file_md5($temp_file, $content_md5); |
|
139 | + if (is_wp_error($md5_check)) { |
|
140 | + unlink($temp_file); |
|
141 | + EE_Error::add_error($md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | } |
@@ -146,24 +146,24 @@ discard block |
||
146 | 146 | $file = $temp_file; |
147 | 147 | |
148 | 148 | //now we have the file, let's get it in the right directory with the right name. |
149 | - $path = apply_filters( 'FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to . $this->_new_file_name, $this ); |
|
149 | + $path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to.$this->_new_file_name, $this); |
|
150 | 150 | |
151 | 151 | //move file in |
152 | - if ( false === @ rename( $file, $path ) ) { |
|
153 | - unlink( $temp_file ); |
|
154 | - EE_Error::add_error( sprintf( __('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso' ), $path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
152 | + if (false === @ rename($file, $path)) { |
|
153 | + unlink($temp_file); |
|
154 | + EE_Error::add_error(sprintf(__('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso'), $path), __FILE__, __FUNCTION__, __LINE__); |
|
155 | 155 | return false; |
156 | 156 | } |
157 | 157 | |
158 | 158 | //set permissions |
159 | - $permissions = apply_filters( 'FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this ); |
|
160 | - chmod( $path, $permissions ); |
|
159 | + $permissions = apply_filters('FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this); |
|
160 | + chmod($path, $permissions); |
|
161 | 161 | |
162 | 162 | //that's it. let's allow for actions after file uploaded. |
163 | - do_action( 'AHEE__EE_Sideloader__sideload_after', $this, $path ); |
|
163 | + do_action('AHEE__EE_Sideloader__sideload_after', $this, $path); |
|
164 | 164 | |
165 | 165 | //unlink tempfile |
166 | - @unlink( $temp_file ); |
|
166 | + @unlink($temp_file); |
|
167 | 167 | return true; |
168 | 168 | } |
169 | 169 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -49,54 +49,54 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - protected function _parser( $shortcode ) { |
|
52 | + protected function _parser($shortcode) { |
|
53 | 53 | //make sure we end up with a copy of the EE_Messages_Addressee object |
54 | 54 | $recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
55 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
|
56 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
|
55 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
|
56 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
|
57 | 57 | |
58 | 58 | //now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event. |
59 | 59 | $event = $this->_data instanceof EE_Event ? $this->_data : NULL; |
60 | 60 | |
61 | - if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) |
|
61 | + if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event) |
|
62 | 62 | return ''; |
63 | 63 | |
64 | - switch ( $shortcode ) { |
|
64 | + switch ($shortcode) { |
|
65 | 65 | case '[EVENT_AUTHOR_FNAME]' : |
66 | - $fname = !empty( $recipient ) ? $recipient->fname : NULL; |
|
67 | - if ( empty( $fname ) && !empty( $event ) ) { |
|
68 | - $user = $this->_get_author_for_event( $event ); |
|
66 | + $fname = ! empty($recipient) ? $recipient->fname : NULL; |
|
67 | + if (empty($fname) && ! empty($event)) { |
|
68 | + $user = $this->_get_author_for_event($event); |
|
69 | 69 | $fname = $user->first_name; |
70 | 70 | } |
71 | 71 | return $fname; |
72 | 72 | break; |
73 | 73 | |
74 | 74 | case '[EVENT_AUTHOR_LNAME]' : |
75 | - $lname = !empty( $recipient ) ? $recipient->lname : NULL; |
|
76 | - if ( empty( $lname ) && !empty( $event ) ) { |
|
77 | - $user = $this->_get_author_for_event( $event ); |
|
75 | + $lname = ! empty($recipient) ? $recipient->lname : NULL; |
|
76 | + if (empty($lname) && ! empty($event)) { |
|
77 | + $user = $this->_get_author_for_event($event); |
|
78 | 78 | $lname = $user->last_name; |
79 | 79 | } |
80 | 80 | return $lname; |
81 | 81 | break; |
82 | 82 | |
83 | 83 | case '[EVENT_AUTHOR_FORMATTED_EMAIL]' : |
84 | - if ( !empty( $recipient ) ) { |
|
85 | - $email = !empty( $recipient->fname ) ? $recipient->fname . ' ' . $recipient->lname . '<' . $recipient->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $recipient->admin_email . '>'; |
|
84 | + if ( ! empty($recipient)) { |
|
85 | + $email = ! empty($recipient->fname) ? $recipient->fname.' '.$recipient->lname.'<'.$recipient->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$recipient->admin_email.'>'; |
|
86 | 86 | } else { |
87 | 87 | $email = NULL; |
88 | 88 | } |
89 | - if ( empty( $email ) && ! empty( $event ) ) { |
|
90 | - $user = $this->_get_author_for_event( $event ); |
|
91 | - $email = ! empty( $user->first_name ) ? $user->first_name . ' ' . $user->last_name . '<' . $user->user_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $user->user_email . '>'; |
|
89 | + if (empty($email) && ! empty($event)) { |
|
90 | + $user = $this->_get_author_for_event($event); |
|
91 | + $email = ! empty($user->first_name) ? $user->first_name.' '.$user->last_name.'<'.$user->user_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$user->user_email.'>'; |
|
92 | 92 | } |
93 | 93 | return $email; |
94 | 94 | break; |
95 | 95 | |
96 | 96 | case '[EVENT_AUTHOR_EMAIL]' : |
97 | - $email = ! empty( $recipient ) ? $recipient->admin_email : NULL; |
|
98 | - if ( empty( $email ) && !empty( $event ) ) { |
|
99 | - $user = $this->_get_author_for_event( $event ); |
|
97 | + $email = ! empty($recipient) ? $recipient->admin_email : NULL; |
|
98 | + if (empty($email) && ! empty($event)) { |
|
99 | + $user = $this->_get_author_for_event($event); |
|
100 | 100 | $email = $user->user_email; |
101 | 101 | } |
102 | 102 | return $email; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return WP_User |
119 | 119 | */ |
120 | - private function _get_author_for_event( EE_Event $event ) { |
|
120 | + private function _get_author_for_event(EE_Event $event) { |
|
121 | 121 | $author_id = $event->wp_user(); |
122 | - $user_data = get_userdata( (int) $author_id ); |
|
122 | + $user_data = get_userdata((int) $author_id); |
|
123 | 123 | return $user_data; |
124 | 124 | } |
125 | 125 |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $model_names = $this->models_for_requested_version(); |
232 | 232 | if( isset( $model_names[ $model_name ] ) ) { |
233 | 233 | return true; |
234 | - }else{ |
|
234 | + } else{ |
|
235 | 235 | return false; |
236 | 236 | } |
237 | 237 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | public function load_model( $model_name ) { |
250 | 250 | if( $this->is_model_name_in_this_version( $model_name ) ) { |
251 | 251 | return \EE_Registry::instance()->load_model( $model_name ); |
252 | - }else{ |
|
252 | + } else{ |
|
253 | 253 | throw new \EE_Error( |
254 | 254 | sprintf( |
255 | 255 | __( |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api; |
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 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | protected $_cached_fields_on_models = array(); |
89 | 89 | |
90 | 90 | |
91 | - public function __construct( $requested_version ) { |
|
91 | + public function __construct($requested_version) { |
|
92 | 92 | $this->_requested_version = $requested_version; |
93 | 93 | $this->_model_changes = array( |
94 | 94 | '4.8.29' => array( |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | 'table_column' => 'N/A', |
111 | 111 | 'always_available' => true, |
112 | 112 | ); |
113 | - foreach( $this->_resource_changes as $version => $model_classnames ) { |
|
114 | - foreach( $model_classnames as $model_classname => $extra_fields ) { |
|
115 | - foreach( $extra_fields as $fieldname => $field_data ) { |
|
116 | - $this->_resource_changes[ $model_classname ][ $fieldname ][ 'name' ] = $fieldname; |
|
117 | - foreach( $defaults as $attribute => $default_value ) { |
|
118 | - if( ! isset( $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] ) ) { |
|
119 | - $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] = $default_value; |
|
113 | + foreach ($this->_resource_changes as $version => $model_classnames) { |
|
114 | + foreach ($model_classnames as $model_classname => $extra_fields) { |
|
115 | + foreach ($extra_fields as $fieldname => $field_data) { |
|
116 | + $this->_resource_changes[$model_classname][$fieldname]['name'] = $fieldname; |
|
117 | + foreach ($defaults as $attribute => $default_value) { |
|
118 | + if ( ! isset($this->_resource_changes[$model_classname][$fieldname][$attribute])) { |
|
119 | + $this->_resource_changes[$model_classname][$fieldname][$attribute] = $default_value; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | * @return array |
133 | 133 | */ |
134 | 134 | public function model_changes_between_requested_version_and_current() { |
135 | - if( $this->_cached_model_changes_between_requested_version_and_current === null ) { |
|
135 | + if ($this->_cached_model_changes_between_requested_version_and_current === null) { |
|
136 | 136 | $model_changes = array(); |
137 | - foreach( $this->model_changes() as $version => $models_changed_in_version ) { |
|
138 | - if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) { |
|
139 | - $model_changes[ $version ] = $models_changed_in_version; |
|
137 | + foreach ($this->model_changes() as $version => $models_changed_in_version) { |
|
138 | + if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) { |
|
139 | + $model_changes[$version] = $models_changed_in_version; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | $this->_cached_model_changes_between_requested_version_and_current = $model_changes; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | * @return array |
153 | 153 | */ |
154 | 154 | public function resource_changes_between_requested_version_and_current() { |
155 | - if( $this->_cached_resource_changes_between_requested_version_and_current === null ) { |
|
155 | + if ($this->_cached_resource_changes_between_requested_version_and_current === null) { |
|
156 | 156 | $resource_changes = array(); |
157 | - foreach( $this->resource_changes() as $version => $model_classnames ) { |
|
158 | - if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) { |
|
159 | - $resource_changes[ $version ] = $model_classnames; |
|
157 | + foreach ($this->resource_changes() as $version => $model_classnames) { |
|
158 | + if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) { |
|
159 | + $resource_changes[$version] = $model_classnames; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | $this->_cached_resource_changes_between_requested_version_and_current = $resource_changes; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * If a request was sent to 'wp-json/ee/v4.7/events' this would be '4.7' |
169 | 169 | * @return string like '4.6' |
170 | 170 | */ |
171 | - public function requested_version(){ |
|
171 | + public function requested_version() { |
|
172 | 172 | return $this->_requested_version; |
173 | 173 | } |
174 | 174 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * If a version is missing then we don't know anything about what changes it introduced from the previous version |
183 | 183 | * @return array |
184 | 184 | */ |
185 | - public function model_changes(){ |
|
185 | + public function model_changes() { |
|
186 | 186 | return $this->_model_changes; |
187 | 187 | } |
188 | 188 | |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | * @return array keys are model names, values are their classname |
194 | 194 | */ |
195 | 195 | public function models_for_requested_version() { |
196 | - if( $this->_cached_models_for_requested_version === null ) { |
|
196 | + if ($this->_cached_models_for_requested_version === null) { |
|
197 | 197 | $all_models_in_current_version = \EE_Registry::instance()->non_abstract_db_models; |
198 | - foreach( $this->model_changes_between_requested_version_and_current() as $version => $models_changed ) { |
|
199 | - foreach( $models_changed as $model_name => $new_indicator_or_fields_added ) { |
|
200 | - if( $new_indicator_or_fields_added === Model_Version_Info::model_added ) { |
|
201 | - unset( $all_models_in_current_version[ $model_name ] ); |
|
198 | + foreach ($this->model_changes_between_requested_version_and_current() as $version => $models_changed) { |
|
199 | + foreach ($models_changed as $model_name => $new_indicator_or_fields_added) { |
|
200 | + if ($new_indicator_or_fields_added === Model_Version_Info::model_added) { |
|
201 | + unset($all_models_in_current_version[$model_name]); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * @param string $model_name eg 'Event' |
218 | 218 | * @return boolean |
219 | 219 | */ |
220 | - public function is_model_name_in_this_version( $model_name ) { |
|
220 | + public function is_model_name_in_this_version($model_name) { |
|
221 | 221 | $model_names = $this->models_for_requested_version(); |
222 | - if( isset( $model_names[ $model_name ] ) ) { |
|
222 | + if (isset($model_names[$model_name])) { |
|
223 | 223 | return true; |
224 | - }else{ |
|
224 | + } else { |
|
225 | 225 | return false; |
226 | 226 | } |
227 | 227 | } |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | * @return \EEM_Base |
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | - public function load_model( $model_name ) { |
|
240 | - if( $this->is_model_name_in_this_version( $model_name ) ) { |
|
241 | - return \EE_Registry::instance()->load_model( $model_name ); |
|
242 | - }else{ |
|
239 | + public function load_model($model_name) { |
|
240 | + if ($this->is_model_name_in_this_version($model_name)) { |
|
241 | + return \EE_Registry::instance()->load_model($model_name); |
|
242 | + } else { |
|
243 | 243 | throw new \EE_Error( |
244 | 244 | sprintf( |
245 | 245 | __( |
@@ -261,21 +261,21 @@ discard block |
||
261 | 261 | * @param \EEM_Base $model |
262 | 262 | * @return array|\EE_Model_Field_Base[] |
263 | 263 | */ |
264 | - public function fields_on_model_in_this_version( $model ) { |
|
265 | - if( ! isset( $this->_cached_fields_on_models[ $model->get_this_model_name() ] ) ) { |
|
264 | + public function fields_on_model_in_this_version($model) { |
|
265 | + if ( ! isset($this->_cached_fields_on_models[$model->get_this_model_name()])) { |
|
266 | 266 | //get all model changes between the requested version and current core version |
267 | 267 | $changes = $this->model_changes_between_requested_version_and_current(); |
268 | 268 | //fetch all fields currently on this model |
269 | 269 | $current_fields = $model->field_settings(); |
270 | 270 | //remove all fields that have been added since |
271 | - foreach( $changes as $version => $changes_in_version ) { |
|
272 | - if( |
|
273 | - isset( $changes_in_version[ $model->get_this_model_name() ] ) |
|
274 | - && $changes_in_version[ $model->get_this_model_name() ] !== Model_Version_Info::model_added |
|
271 | + foreach ($changes as $version => $changes_in_version) { |
|
272 | + if ( |
|
273 | + isset($changes_in_version[$model->get_this_model_name()]) |
|
274 | + && $changes_in_version[$model->get_this_model_name()] !== Model_Version_Info::model_added |
|
275 | 275 | ) { |
276 | 276 | $current_fields = array_diff_key( |
277 | 277 | $current_fields, |
278 | - array_flip( $changes_in_version[ $model->get_this_model_name() ] ) |
|
278 | + array_flip($changes_in_version[$model->get_this_model_name()]) |
|
279 | 279 | ); |
280 | 280 | } |
281 | 281 | } |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | * @param array $classnames |
294 | 294 | * @return boolean |
295 | 295 | */ |
296 | - public function is_subclass_of_one( $object, $classnames ) { |
|
297 | - foreach( $classnames as $classname ) { |
|
298 | - if( is_a( $object, $classname ) ) { |
|
296 | + public function is_subclass_of_one($object, $classnames) { |
|
297 | + foreach ($classnames as $classname) { |
|
298 | + if (is_a($object, $classname)) { |
|
299 | 299 | return true; |
300 | 300 | } |
301 | 301 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | * Returns the list of model field classes that that the API basically ignores |
307 | 307 | * @return array |
308 | 308 | */ |
309 | - public function fields_ignored(){ |
|
309 | + public function fields_ignored() { |
|
310 | 310 | return apply_filters( |
311 | 311 | 'FHEE__Controller_Model_Read_fields_ignored', |
312 | - array( 'EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field' ) |
|
312 | + array('EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field') |
|
313 | 313 | ); |
314 | 314 | } |
315 | 315 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * @param EE_Model_Field_Base |
319 | 319 | * @return boolean |
320 | 320 | */ |
321 | - public function field_is_ignored( $field_obj ){ |
|
322 | - return $this->is_subclass_of_one( $field_obj, $this->fields_ignored() ); |
|
321 | + public function field_is_ignored($field_obj) { |
|
322 | + return $this->is_subclass_of_one($field_obj, $this->fields_ignored()); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | public function fields_that_have_rendered_format() { |
331 | 331 | return apply_filters( |
332 | 332 | 'FHEE__Controller_Model_Read__fields_raw', |
333 | - array( 'EE_Post_Content_Field', 'EE_Full_HTML_Field' ) |
|
333 | + array('EE_Post_Content_Field', 'EE_Full_HTML_Field') |
|
334 | 334 | ); |
335 | 335 | } |
336 | 336 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_Model_Field_Base |
340 | 340 | * @return boolean |
341 | 341 | */ |
342 | - public function field_has_rendered_format( $field_obj ){ |
|
343 | - return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_rendered_format() ); |
|
342 | + public function field_has_rendered_format($field_obj) { |
|
343 | + return $this->is_subclass_of_one($field_obj, $this->fields_that_have_rendered_format()); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | public function fields_that_have_pretty_format() { |
353 | 353 | return apply_filters( |
354 | 354 | 'FHEE__Controller_Model_Read__fields_pretty', |
355 | - array( 'EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field' ) |
|
355 | + array('EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field') |
|
356 | 356 | ); |
357 | 357 | } |
358 | 358 | |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | * @param EE_Model_Field_Base |
362 | 362 | * @return boolean |
363 | 363 | */ |
364 | - public function field_has_pretty_format( $field_obj ){ |
|
365 | - return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_pretty_format() ); |
|
364 | + public function field_has_pretty_format($field_obj) { |
|
365 | + return $this->is_subclass_of_one($field_obj, $this->fields_that_have_pretty_format()); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | * @param \EEM_Base $model |
380 | 380 | * @return array |
381 | 381 | */ |
382 | - public function extra_resource_properties_for_model( $model ) { |
|
382 | + public function extra_resource_properties_for_model($model) { |
|
383 | 383 | $extra_properties = array(); |
384 | - foreach( $this->resource_changes_between_requested_version_and_current() as $version => $model_classnames ) { |
|
385 | - foreach( $model_classnames as $model_classname => $properties_added_in_this_version ) { |
|
386 | - if( is_subclass_of( $model, $model_classname ) ) { |
|
387 | - $extra_properties = array_merge( $extra_properties, $properties_added_in_this_version ); |
|
384 | + foreach ($this->resource_changes_between_requested_version_and_current() as $version => $model_classnames) { |
|
385 | + foreach ($model_classnames as $model_classname => $properties_added_in_this_version) { |
|
386 | + if (is_subclass_of($model, $model_classname)) { |
|
387 | + $extra_properties = array_merge($extra_properties, $properties_added_in_this_version); |
|
388 | 388 | } |
389 | 389 | } |
390 | 390 | } |