@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php use EventEspresso\core\exceptions\EntityNotFoundException; |
| 2 | 2 | |
| 3 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 4 | - exit( 'No direct script access allowed' ); |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 4 | + exit('No direct script access allowed'); |
|
| 5 | 5 | } |
| 6 | 6 | /** |
| 7 | 7 | * EE_Registration class |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * date_format and the second value is the time format |
| 44 | 44 | * @return EE_Registration |
| 45 | 45 | */ |
| 46 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
| 47 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 48 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 46 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
| 47 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 48 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | * the website will be used. |
| 57 | 57 | * @return EE_Registration |
| 58 | 58 | */ |
| 59 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
| 60 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 59 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
| 60 | + return new self($props_n_values, TRUE, $timezone); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * @access public |
| 69 | 69 | * @param int $EVT_ID Event ID |
| 70 | 70 | */ |
| 71 | - public function set_event( $EVT_ID = 0 ) { |
|
| 72 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
| 71 | + public function set_event($EVT_ID = 0) { |
|
| 72 | + $this->set('EVT_ID', $EVT_ID); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -80,18 +80,18 @@ discard block |
||
| 80 | 80 | * @param mixed $field_value |
| 81 | 81 | * @param bool $use_default |
| 82 | 82 | */ |
| 83 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
| 84 | - switch( $field_name ) { |
|
| 83 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
| 84 | + switch ($field_name) { |
|
| 85 | 85 | case 'REG_code' : |
| 86 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
| 87 | - $this->set_reg_code( $field_value, $use_default ); |
|
| 86 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
| 87 | + $this->set_reg_code($field_value, $use_default); |
|
| 88 | 88 | } |
| 89 | 89 | break; |
| 90 | 90 | case 'STS_ID' : |
| 91 | - $this->set_status( $field_value, $use_default ); |
|
| 91 | + $this->set_status($field_value, $use_default); |
|
| 92 | 92 | break; |
| 93 | 93 | default : |
| 94 | - parent::set( $field_name, $field_value, $use_default ); |
|
| 94 | + parent::set($field_name, $field_value, $use_default); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -109,30 +109,30 @@ discard block |
||
| 109 | 109 | * @return bool |
| 110 | 110 | * @throws \EE_Error |
| 111 | 111 | */ |
| 112 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
| 112 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
| 113 | 113 | // get current REG_Status |
| 114 | 114 | $old_STS_ID = $this->status_ID(); |
| 115 | 115 | // if status has changed |
| 116 | - if ( $old_STS_ID !== $new_STS_ID ) { |
|
| 116 | + if ($old_STS_ID !== $new_STS_ID) { |
|
| 117 | 117 | // TO approved |
| 118 | - if ( $new_STS_ID === EEM_Registration::status_id_approved ) { |
|
| 118 | + if ($new_STS_ID === EEM_Registration::status_id_approved) { |
|
| 119 | 119 | // reserve a space by incrementing ticket and datetime sold values |
| 120 | 120 | $this->_reserve_registration_space(); |
| 121 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
| 121 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
| 122 | 122 | // OR FROM approved |
| 123 | - } else if ( $old_STS_ID === EEM_Registration::status_id_approved ) { |
|
| 123 | + } else if ($old_STS_ID === EEM_Registration::status_id_approved) { |
|
| 124 | 124 | // release a space by decrementing ticket and datetime sold values |
| 125 | 125 | $this->_release_registration_space(); |
| 126 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
| 126 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
| 127 | 127 | } |
| 128 | 128 | // update status |
| 129 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
| 130 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
| 129 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
| 130 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
| 131 | 131 | return TRUE; |
| 132 | - }else{ |
|
| 132 | + } else { |
|
| 133 | 133 | //even though the old value matches the new value, it's still good to |
| 134 | 134 | //allow the parent set method to have a say |
| 135 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
| 135 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
| 136 | 136 | return TRUE; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @access public |
| 145 | 145 | */ |
| 146 | 146 | public function status_ID() { |
| 147 | - return $this->get( 'STS_ID' ); |
|
| 147 | + return $this->get('STS_ID'); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | * @param boolean $include_archived whether to include archived tickets or not. |
| 170 | 170 | * @return EE_Ticket |
| 171 | 171 | */ |
| 172 | - public function ticket( $include_archived = TRUE ) { |
|
| 172 | + public function ticket($include_archived = TRUE) { |
|
| 173 | 173 | $query_params = array(); |
| 174 | - if ( $include_archived ) { |
|
| 175 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
| 174 | + if ($include_archived) { |
|
| 175 | + $query_params['default_where_conditions'] = 'none'; |
|
| 176 | 176 | } |
| 177 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
| 177 | + return $this->get_first_related('Ticket', $query_params); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function wp_user() { |
| 204 | 204 | $event = $this->event(); |
| 205 | - if ( $event instanceof EE_Event ) { |
|
| 205 | + if ($event instanceof EE_Event) { |
|
| 206 | 206 | return $event->wp_user(); |
| 207 | 207 | } |
| 208 | 208 | return 0; |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | * @access public |
| 229 | 229 | * @param int $ATT_ID Attendee ID |
| 230 | 230 | */ |
| 231 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
| 232 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
| 231 | + public function set_attendee_id($ATT_ID = 0) { |
|
| 232 | + $this->set('ATT_ID', $ATT_ID); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | * @access public |
| 241 | 241 | * @param int $TXN_ID Transaction ID |
| 242 | 242 | */ |
| 243 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
| 244 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
| 243 | + public function set_transaction_id($TXN_ID = 0) { |
|
| 244 | + $this->set('TXN_ID', $TXN_ID); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | * @access public |
| 253 | 253 | * @param string $REG_session PHP Session ID |
| 254 | 254 | */ |
| 255 | - public function set_session( $REG_session = '' ) { |
|
| 256 | - $this->set( 'REG_session', $REG_session ); |
|
| 255 | + public function set_session($REG_session = '') { |
|
| 256 | + $this->set('REG_session', $REG_session); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
@@ -264,8 +264,8 @@ discard block |
||
| 264 | 264 | * @access public |
| 265 | 265 | * @param string $REG_url_link Registration URL Link |
| 266 | 266 | */ |
| 267 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
| 268 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
| 267 | + public function set_reg_url_link($REG_url_link = '') { |
|
| 268 | + $this->set('REG_url_link', $REG_url_link); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | * @access public |
| 277 | 277 | * @param int $REG_count Primary Attendee |
| 278 | 278 | */ |
| 279 | - public function set_count( $REG_count = 1 ) { |
|
| 280 | - $this->set( 'REG_count', $REG_count ); |
|
| 279 | + public function set_count($REG_count = 1) { |
|
| 280 | + $this->set('REG_count', $REG_count); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | * @access public |
| 289 | 289 | * @param boolean $REG_group_size Group Registration |
| 290 | 290 | */ |
| 291 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
| 292 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
| 291 | + public function set_group_size($REG_group_size = FALSE) { |
|
| 292 | + $this->set('REG_group_size', $REG_group_size); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | |
@@ -372,8 +372,8 @@ discard block |
||
| 372 | 372 | * @access public |
| 373 | 373 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
| 374 | 374 | */ |
| 375 | - public function set_reg_date( $REG_date = FALSE ) { |
|
| 376 | - $this->set( 'REG_date', $REG_date ); |
|
| 375 | + public function set_reg_date($REG_date = FALSE) { |
|
| 376 | + $this->set('REG_date', $REG_date); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | * @access public |
| 385 | 385 | * @param float $REG_final_price |
| 386 | 386 | */ |
| 387 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
| 388 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
| 387 | + public function set_final_price($REG_final_price = 0.00) { |
|
| 388 | + $this->set('REG_final_price', $REG_final_price); |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | * @access public |
| 397 | 397 | * @param float $REG_paid |
| 398 | 398 | */ |
| 399 | - public function set_paid( $REG_paid = 0.00 ) { |
|
| 400 | - $this->set( 'REG_paid', $REG_paid ); |
|
| 399 | + public function set_paid($REG_paid = 0.00) { |
|
| 400 | + $this->set('REG_paid', $REG_paid); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | |
@@ -408,8 +408,8 @@ discard block |
||
| 408 | 408 | * @access public |
| 409 | 409 | * @param boolean $REG_att_is_going Attendee Is Going |
| 410 | 410 | */ |
| 411 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
| 412 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
| 411 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
| 412 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | * @return EE_Attendee |
| 420 | 420 | */ |
| 421 | 421 | public function attendee() { |
| 422 | - return $this->get_first_related( 'Attendee' ); |
|
| 422 | + return $this->get_first_related('Attendee'); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * @access public |
| 430 | 430 | */ |
| 431 | 431 | public function event_ID() { |
| 432 | - return $this->get( 'EVT_ID' ); |
|
| 432 | + return $this->get('EVT_ID'); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | public function event_name() { |
| 442 | 442 | $event = $this->event_obj(); |
| 443 | - if ( $event ) { |
|
| 443 | + if ($event) { |
|
| 444 | 444 | return $event->name(); |
| 445 | 445 | } else { |
| 446 | 446 | return NULL; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * @return EE_Event |
| 455 | 455 | */ |
| 456 | 456 | public function event_obj() { |
| 457 | - return $this->get_first_related( 'Event' ); |
|
| 457 | + return $this->get_first_related('Event'); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | * @access public |
| 465 | 465 | */ |
| 466 | 466 | public function attendee_ID() { |
| 467 | - return $this->get( 'ATT_ID' ); |
|
| 467 | + return $this->get('ATT_ID'); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | * @access public |
| 475 | 475 | */ |
| 476 | 476 | public function session_ID() { |
| 477 | - return $this->get( 'REG_session' ); |
|
| 477 | + return $this->get('REG_session'); |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
| 485 | 485 | * @return string |
| 486 | 486 | */ |
| 487 | - public function receipt_url( $messenger = 'html' ) { |
|
| 487 | + public function receipt_url($messenger = 'html') { |
|
| 488 | 488 | |
| 489 | 489 | /** |
| 490 | 490 | * 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. |
@@ -492,12 +492,12 @@ discard block |
||
| 492 | 492 | * @since 4.5.0 |
| 493 | 493 | */ |
| 494 | 494 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
| 495 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
| 495 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
| 496 | 496 | |
| 497 | - if ( $has_custom ) { |
|
| 498 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
| 497 | + if ($has_custom) { |
|
| 498 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
| 499 | 499 | } |
| 500 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
| 500 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | |
@@ -508,28 +508,28 @@ discard block |
||
| 508 | 508 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
| 509 | 509 | * @return string |
| 510 | 510 | */ |
| 511 | - public function invoice_url( $messenger = 'html' ) { |
|
| 511 | + public function invoice_url($messenger = 'html') { |
|
| 512 | 512 | /** |
| 513 | 513 | * 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. |
| 514 | 514 | * |
| 515 | 515 | * @since 4.5.0 |
| 516 | 516 | */ |
| 517 | 517 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
| 518 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
| 518 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
| 519 | 519 | |
| 520 | - if ( $has_custom ) { |
|
| 521 | - if ( $messenger == 'html' ) { |
|
| 522 | - return $this->invoice_url( 'launch' ); |
|
| 520 | + if ($has_custom) { |
|
| 521 | + if ($messenger == 'html') { |
|
| 522 | + return $this->invoice_url('launch'); |
|
| 523 | 523 | } |
| 524 | 524 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
| 525 | 525 | |
| 526 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
| 527 | - if ( $messenger == 'html' ) { |
|
| 526 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
| 527 | + if ($messenger == 'html') { |
|
| 528 | 528 | $query_args['html'] = TRUE; |
| 529 | 529 | } |
| 530 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
| 530 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
| 531 | 531 | } |
| 532 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
| 532 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | * @throws \EE_Error |
| 543 | 543 | */ |
| 544 | 544 | public function reg_url_link() { |
| 545 | - return (string)$this->get( 'REG_url_link' ); |
|
| 545 | + return (string) $this->get('REG_url_link'); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | |
@@ -552,8 +552,8 @@ discard block |
||
| 552 | 552 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
| 553 | 553 | * @return void |
| 554 | 554 | */ |
| 555 | - public function e_invoice_url( $type = 'launch' ) { |
|
| 556 | - echo $this->invoice_url( $type ); |
|
| 555 | + public function e_invoice_url($type = 'launch') { |
|
| 556 | + echo $this->invoice_url($type); |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | * @return string |
| 574 | 574 | */ |
| 575 | 575 | public function payment_overview_url() { |
| 576 | - 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() ); |
|
| 576 | + 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()); |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | * @return string |
| 585 | 585 | */ |
| 586 | 586 | public function edit_attendee_information_url() { |
| 587 | - 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() ); |
|
| 587 | + 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()); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | * @return string |
| 595 | 595 | */ |
| 596 | 596 | public function get_admin_edit_url() { |
| 597 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
| 597 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | * @access public |
| 605 | 605 | */ |
| 606 | 606 | public function is_primary_registrant() { |
| 607 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
| 607 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | |
@@ -613,12 +613,12 @@ discard block |
||
| 613 | 613 | * This returns the primary registration object for this registration group (which may be this object). |
| 614 | 614 | * @return EE_Registration |
| 615 | 615 | */ |
| 616 | - public function get_primary_registration() { |
|
| 617 | - if ( $this->is_primary_registrant() ) |
|
| 616 | + public function get_primary_registration() { |
|
| 617 | + if ($this->is_primary_registrant()) |
|
| 618 | 618 | return $this; |
| 619 | 619 | |
| 620 | 620 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
| 621 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
| 621 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
| 622 | 622 | return $primary_registrant; |
| 623 | 623 | } |
| 624 | 624 | |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | * @access public |
| 630 | 630 | */ |
| 631 | 631 | public function count() { |
| 632 | - return $this->get( 'REG_count' ); |
|
| 632 | + return $this->get('REG_count'); |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | * @access public |
| 640 | 640 | */ |
| 641 | 641 | public function group_size() { |
| 642 | - return $this->get( 'REG_group_size' ); |
|
| 642 | + return $this->get('REG_group_size'); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | * @access public |
| 650 | 650 | */ |
| 651 | 651 | public function date() { |
| 652 | - return $this->get( 'REG_date' ); |
|
| 652 | + return $this->get('REG_date'); |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | |
@@ -660,8 +660,8 @@ discard block |
||
| 660 | 660 | * @param string $time_format |
| 661 | 661 | * @return string |
| 662 | 662 | */ |
| 663 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
| 664 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
| 663 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
| 664 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | * @return float |
| 675 | 675 | */ |
| 676 | 676 | public function final_price() { |
| 677 | - return $this->get( 'REG_final_price' ); |
|
| 677 | + return $this->get('REG_final_price'); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | * @return string |
| 686 | 686 | */ |
| 687 | 687 | public function pretty_final_price() { |
| 688 | - return $this->get_pretty( 'REG_final_price' ); |
|
| 688 | + return $this->get_pretty('REG_final_price'); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | * @return float |
| 697 | 697 | */ |
| 698 | 698 | public function paid() { |
| 699 | - return $this->get( 'REG_paid' ); |
|
| 699 | + return $this->get('REG_paid'); |
|
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | * @return float |
| 708 | 708 | */ |
| 709 | 709 | public function pretty_paid() { |
| 710 | - return $this->get_pretty( 'REG_paid' ); |
|
| 710 | + return $this->get_pretty('REG_paid'); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | |
@@ -719,11 +719,11 @@ discard block |
||
| 719 | 719 | * @param array $requires_payment |
| 720 | 720 | * @return bool |
| 721 | 721 | */ |
| 722 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
| 722 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
| 723 | 723 | // these reg statuses require payment (if event is not free) |
| 724 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
| 724 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
| 725 | 725 | if ( |
| 726 | - in_array( $this->status_ID(), $requires_payment ) && |
|
| 726 | + in_array($this->status_ID(), $requires_payment) && |
|
| 727 | 727 | $this->final_price() != 0 && |
| 728 | 728 | $this->final_price() != $this->paid() |
| 729 | 729 | ) { |
@@ -740,8 +740,8 @@ discard block |
||
| 740 | 740 | * @param bool $show_icons |
| 741 | 741 | * @return void |
| 742 | 742 | */ |
| 743 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
| 744 | - echo $this->pretty_status( $show_icons ); |
|
| 743 | + public function e_pretty_status($show_icons = FALSE) { |
|
| 744 | + echo $this->pretty_status($show_icons); |
|
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | |
@@ -752,10 +752,10 @@ discard block |
||
| 752 | 752 | * @param bool $show_icons |
| 753 | 753 | * @return string |
| 754 | 754 | */ |
| 755 | - public function pretty_status( $show_icons = FALSE ) { |
|
| 756 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
| 755 | + public function pretty_status($show_icons = FALSE) { |
|
| 756 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
| 757 | 757 | $icon = ''; |
| 758 | - switch ( $this->status_ID() ) { |
|
| 758 | + switch ($this->status_ID()) { |
|
| 759 | 759 | case EEM_Registration::status_id_approved: |
| 760 | 760 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
| 761 | 761 | break; |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
| 776 | 776 | break; |
| 777 | 777 | } |
| 778 | - return $icon . $status[ $this->status_ID() ]; |
|
| 778 | + return $icon.$status[$this->status_ID()]; |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | * @access public |
| 786 | 786 | */ |
| 787 | 787 | public function att_is_going() { |
| 788 | - return $this->get( 'REG_att_is_going' ); |
|
| 788 | + return $this->get('REG_att_is_going'); |
|
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | |
@@ -795,8 +795,8 @@ discard block |
||
| 795 | 795 | * @param array $query_params like EEM_Base::get_all |
| 796 | 796 | * @return EE_Answer[] |
| 797 | 797 | */ |
| 798 | - public function answers( $query_params = NULL ) { |
|
| 799 | - return $this->get_many_related( 'Answer', $query_params ); |
|
| 798 | + public function answers($query_params = NULL) { |
|
| 799 | + return $this->get_many_related('Answer', $query_params); |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | |
@@ -810,9 +810,9 @@ discard block |
||
| 810 | 810 | * (because the answer might be an array of answer values, so passing pretty_value=true |
| 811 | 811 | * will convert it into some kind of string) |
| 812 | 812 | */ |
| 813 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
| 813 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
| 814 | 814 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
| 815 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
| 815 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | |
@@ -825,13 +825,13 @@ discard block |
||
| 825 | 825 | */ |
| 826 | 826 | public function question_groups() { |
| 827 | 827 | $question_groups = array(); |
| 828 | - if ( $this->event() instanceof EE_Event ) { |
|
| 828 | + if ($this->event() instanceof EE_Event) { |
|
| 829 | 829 | $question_groups = $this->event()->question_groups( |
| 830 | 830 | array( |
| 831 | 831 | array( |
| 832 | 832 | 'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false |
| 833 | 833 | ), |
| 834 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
| 834 | + 'order_by' => array('QSG_order' => 'ASC') |
|
| 835 | 835 | ) |
| 836 | 836 | ); |
| 837 | 837 | } |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | */ |
| 849 | 849 | public function count_question_groups() { |
| 850 | 850 | $qg_count = 0; |
| 851 | - if ( $this->event() instanceof EE_Event ) { |
|
| 851 | + if ($this->event() instanceof EE_Event) { |
|
| 852 | 852 | $qg_count = $this->event()->count_related( |
| 853 | 853 | 'Question_Group', |
| 854 | 854 | array( |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | * @return string |
| 870 | 870 | */ |
| 871 | 871 | public function reg_date() { |
| 872 | - return $this->get_datetime( 'REG_date' ); |
|
| 872 | + return $this->get_datetime('REG_date'); |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | * @return EE_Datetime_Ticket |
| 882 | 882 | */ |
| 883 | 883 | public function datetime_ticket() { |
| 884 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
| 884 | + return $this->get_first_related('Datetime_Ticket'); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | |
@@ -891,15 +891,15 @@ discard block |
||
| 891 | 891 | * @param EE_Datetime_Ticket $datetime_ticket |
| 892 | 892 | * @return EE_Datetime_Ticket |
| 893 | 893 | */ |
| 894 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
| 895 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
| 894 | + public function set_datetime_ticket($datetime_ticket) { |
|
| 895 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
| 896 | 896 | } |
| 897 | 897 | /** |
| 898 | 898 | * Gets deleted |
| 899 | 899 | * @return boolean |
| 900 | 900 | */ |
| 901 | 901 | public function deleted() { |
| 902 | - return $this->get( 'REG_deleted' ); |
|
| 902 | + return $this->get('REG_deleted'); |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | /** |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | * @return boolean |
| 909 | 909 | */ |
| 910 | 910 | public function set_deleted($deleted) { |
| 911 | - $this->set( 'REG_deleted', $deleted ); |
|
| 911 | + $this->set('REG_deleted', $deleted); |
|
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | * @return EE_Status |
| 919 | 919 | */ |
| 920 | 920 | public function status_obj() { |
| 921 | - return $this->get_first_related( 'Status' ); |
|
| 921 | + return $this->get_first_related('Status'); |
|
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | * @return int |
| 930 | 930 | */ |
| 931 | 931 | public function count_checkins() { |
| 932 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
| 932 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | * @return int |
| 940 | 940 | */ |
| 941 | 941 | public function count_checkins_not_checkedout() { |
| 942 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
| 942 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | |
@@ -952,20 +952,20 @@ discard block |
||
| 952 | 952 | * |
| 953 | 953 | * @return bool |
| 954 | 954 | */ |
| 955 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
| 956 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
| 955 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
| 956 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
| 957 | 957 | |
| 958 | 958 | //first check registration status |
| 959 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
| 959 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
| 960 | 960 | return false; |
| 961 | 961 | } |
| 962 | 962 | //is there a datetime ticket that matches this dtt_ID? |
| 963 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
| 963 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
| 964 | 964 | return false; |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | //final check is against TKT_uses |
| 968 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
| 968 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | |
@@ -978,10 +978,10 @@ discard block |
||
| 978 | 978 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
| 979 | 979 | * @return bool true means can checkin. false means cannot checkin. |
| 980 | 980 | */ |
| 981 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
| 982 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
| 981 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
| 982 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
| 983 | 983 | |
| 984 | - if ( ! $DTT_ID ) { |
|
| 984 | + if ( ! $DTT_ID) { |
|
| 985 | 985 | return false; |
| 986 | 986 | } |
| 987 | 987 | |
@@ -989,23 +989,23 @@ discard block |
||
| 989 | 989 | |
| 990 | 990 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
| 991 | 991 | // or not. |
| 992 | - if ( ! $max_uses || $max_uses === EE_INF ) { |
|
| 992 | + if ( ! $max_uses || $max_uses === EE_INF) { |
|
| 993 | 993 | return true; |
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
| 997 | 997 | //go ahead and toggle. |
| 998 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
| 998 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
| 999 | 999 | return true; |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
| 1003 | 1003 | //disallows further check-ins. |
| 1004 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
| 1004 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
| 1005 | 1005 | // checkins have already reached their max number of uses |
| 1006 | 1006 | // so registrant can NOT checkin |
| 1007 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
| 1008 | - 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__ ); |
|
| 1007 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
| 1008 | + 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__); |
|
| 1009 | 1009 | return false; |
| 1010 | 1010 | } |
| 1011 | 1011 | return true; |
@@ -1026,15 +1026,15 @@ discard block |
||
| 1026 | 1026 | * @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. |
| 1027 | 1027 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
| 1028 | 1028 | */ |
| 1029 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
| 1030 | - if ( empty( $DTT_ID ) ) { |
|
| 1029 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
| 1030 | + if (empty($DTT_ID)) { |
|
| 1031 | 1031 | $datetime = $this->get_related_primary_datetime(); |
| 1032 | 1032 | $DTT_ID = $datetime->ID(); |
| 1033 | 1033 | // verify the registration can checkin for the given DTT_ID |
| 1034 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
| 1034 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
| 1035 | 1035 | EE_Error::add_error( |
| 1036 | 1036 | sprintf( |
| 1037 | - __( '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'), |
|
| 1037 | + __('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'), |
|
| 1038 | 1038 | $this->ID(), |
| 1039 | 1039 | $DTT_ID |
| 1040 | 1040 | ), |
@@ -1048,8 +1048,8 @@ discard block |
||
| 1048 | 1048 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
| 1049 | 1049 | ); |
| 1050 | 1050 | //start by getting the current status so we know what status we'll be changing to. |
| 1051 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
| 1052 | - $status_to = $status_paths[ $cur_status ]; |
|
| 1051 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
| 1052 | + $status_to = $status_paths[$cur_status]; |
|
| 1053 | 1053 | // database only records true for checked IN or false for checked OUT |
| 1054 | 1054 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
| 1055 | 1055 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1057,24 +1057,24 @@ discard block |
||
| 1057 | 1057 | // because we are keeping track of Check-ins over time. |
| 1058 | 1058 | // Eventually we'll probably want to show a list table |
| 1059 | 1059 | // for the individual Check-ins so that they can be managed. |
| 1060 | - $checkin = EE_Checkin::new_instance( array( |
|
| 1060 | + $checkin = EE_Checkin::new_instance(array( |
|
| 1061 | 1061 | 'REG_ID' => $this->ID(), |
| 1062 | 1062 | 'DTT_ID' => $DTT_ID, |
| 1063 | 1063 | 'CHK_in' => $new_status |
| 1064 | - ) ); |
|
| 1064 | + )); |
|
| 1065 | 1065 | // if the record could not be saved then return false |
| 1066 | - if ( $checkin->save() === 0 ) { |
|
| 1067 | - if ( WP_DEBUG ) { |
|
| 1066 | + if ($checkin->save() === 0) { |
|
| 1067 | + if (WP_DEBUG) { |
|
| 1068 | 1068 | global $wpdb; |
| 1069 | 1069 | $error = sprintf( |
| 1070 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
| 1070 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
| 1071 | 1071 | '<br />', |
| 1072 | 1072 | $wpdb->last_error |
| 1073 | 1073 | ); |
| 1074 | 1074 | } else { |
| 1075 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
| 1075 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
| 1076 | 1076 | } |
| 1077 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1077 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
| 1078 | 1078 | return false; |
| 1079 | 1079 | } |
| 1080 | 1080 | return $status_to; |
@@ -1098,19 +1098,19 @@ discard block |
||
| 1098 | 1098 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
| 1099 | 1099 | * @return int Integer representing Check-in status. |
| 1100 | 1100 | */ |
| 1101 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
| 1102 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
| 1101 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
| 1102 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
| 1103 | 1103 | $datetime = $this->get_related_primary_datetime(); |
| 1104 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
| 1104 | + if ( ! $datetime instanceof EE_Datetime) { |
|
| 1105 | 1105 | return 0; |
| 1106 | 1106 | } |
| 1107 | 1107 | $DTT_ID = $datetime->ID(); |
| 1108 | 1108 | //verify the registration can checkin for the given DTT_ID |
| 1109 | 1109 | } |
| 1110 | 1110 | //get checkin object (if exists) |
| 1111 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
| 1112 | - if ( $checkin instanceof EE_Checkin ) { |
|
| 1113 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
| 1111 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
| 1112 | + if ($checkin instanceof EE_Checkin) { |
|
| 1113 | + if ($checkin->get('CHK_in')) { |
|
| 1114 | 1114 | return EE_Registration::checkin_status_in; //checked in |
| 1115 | 1115 | } else { |
| 1116 | 1116 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1128,28 +1128,28 @@ discard block |
||
| 1128 | 1128 | * @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. |
| 1129 | 1129 | * @return string internationalized message |
| 1130 | 1130 | */ |
| 1131 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
| 1131 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
| 1132 | 1132 | //let's get the attendee first so we can include the name of the attendee |
| 1133 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
| 1134 | - if ( $attendee instanceof EE_Attendee ) { |
|
| 1135 | - if ( $error ) { |
|
| 1136 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
| 1133 | + $attendee = $this->get_first_related('Attendee'); |
|
| 1134 | + if ($attendee instanceof EE_Attendee) { |
|
| 1135 | + if ($error) { |
|
| 1136 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
| 1137 | 1137 | } |
| 1138 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
| 1138 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
| 1139 | 1139 | //what is the status message going to be? |
| 1140 | - switch ( $cur_status ) { |
|
| 1140 | + switch ($cur_status) { |
|
| 1141 | 1141 | case EE_Registration::checkin_status_never : |
| 1142 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
| 1142 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
| 1143 | 1143 | break; |
| 1144 | 1144 | case EE_Registration::checkin_status_in : |
| 1145 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
| 1145 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
| 1146 | 1146 | break; |
| 1147 | 1147 | case EE_Registration::checkin_status_out : |
| 1148 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
| 1148 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
| 1149 | 1149 | break; |
| 1150 | 1150 | } |
| 1151 | 1151 | } |
| 1152 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
| 1152 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | * @access public |
| 1175 | 1175 | */ |
| 1176 | 1176 | public function reg_code() { |
| 1177 | - return $this->get( 'REG_code' ); |
|
| 1177 | + return $this->get('REG_code'); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | * @access public |
| 1185 | 1185 | */ |
| 1186 | 1186 | public function transaction_ID() { |
| 1187 | - return $this->get( 'TXN_ID' ); |
|
| 1187 | + return $this->get('TXN_ID'); |
|
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | * @return int |
| 1194 | 1194 | */ |
| 1195 | 1195 | public function ticket_ID() { |
| 1196 | - return $this->get( 'TKT_ID' ); |
|
| 1196 | + return $this->get('TKT_ID'); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | |
@@ -1205,17 +1205,17 @@ discard block |
||
| 1205 | 1205 | * @param string $REG_code Registration Code |
| 1206 | 1206 | * @param boolean $use_default |
| 1207 | 1207 | */ |
| 1208 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
| 1209 | - if ( empty( $REG_code )) { |
|
| 1210 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1208 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
| 1209 | + if (empty($REG_code)) { |
|
| 1210 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 1211 | 1211 | return; |
| 1212 | 1212 | } |
| 1213 | - if ( ! $this->reg_code() ) { |
|
| 1214 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
| 1213 | + if ( ! $this->reg_code()) { |
|
| 1214 | + parent::set('REG_code', $REG_code, $use_default); |
|
| 1215 | 1215 | } else { |
| 1216 | 1216 | EE_Error::doing_it_wrong( |
| 1217 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 1218 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
| 1217 | + __CLASS__.'::'.__FUNCTION__, |
|
| 1218 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
| 1219 | 1219 | '4.6.0' |
| 1220 | 1220 | ); |
| 1221 | 1221 | } |
@@ -1235,17 +1235,17 @@ discard block |
||
| 1235 | 1235 | * @return EE_Registration[] or empty array if this isn't a group registration. |
| 1236 | 1236 | */ |
| 1237 | 1237 | public function get_all_other_registrations_in_group() { |
| 1238 | - if ( $this->group_size() < 2 ) { |
|
| 1238 | + if ($this->group_size() < 2) { |
|
| 1239 | 1239 | return array(); |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | $query[0] = array( |
| 1243 | 1243 | 'TXN_ID' => $this->transaction_ID(), |
| 1244 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
| 1244 | + 'REG_ID' => array('!=', $this->ID()), |
|
| 1245 | 1245 | 'TKT_ID' => $this->ticket_ID() |
| 1246 | 1246 | ); |
| 1247 | 1247 | |
| 1248 | - $registrations = $this->get_model()->get_all( $query ); |
|
| 1248 | + $registrations = $this->get_model()->get_all($query); |
|
| 1249 | 1249 | return $registrations; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
@@ -1254,14 +1254,14 @@ discard block |
||
| 1254 | 1254 | * @return string |
| 1255 | 1255 | */ |
| 1256 | 1256 | public function get_admin_details_link() { |
| 1257 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
| 1257 | + EE_Registry::instance()->load_helper('URL'); |
|
| 1258 | 1258 | return EEH_URL::add_query_args_and_nonce( |
| 1259 | 1259 | array( |
| 1260 | 1260 | 'page' => 'espresso_registrations', |
| 1261 | 1261 | 'action' => 'view_registration', |
| 1262 | 1262 | '_REG_ID' => $this->ID() |
| 1263 | 1263 | ), |
| 1264 | - admin_url( 'admin.php' ) |
|
| 1264 | + admin_url('admin.php') |
|
| 1265 | 1265 | ); |
| 1266 | 1266 | } |
| 1267 | 1267 | |
@@ -1286,12 +1286,12 @@ discard block |
||
| 1286 | 1286 | * @return string |
| 1287 | 1287 | */ |
| 1288 | 1288 | public function get_admin_overview_link() { |
| 1289 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
| 1289 | + EE_Registry::instance()->load_helper('URL'); |
|
| 1290 | 1290 | return EEH_URL::add_query_args_and_nonce( |
| 1291 | 1291 | array( |
| 1292 | 1292 | 'page' => 'espresso_registrations' |
| 1293 | 1293 | ), |
| 1294 | - admin_url( 'admin.php' ) |
|
| 1294 | + admin_url('admin.php') |
|
| 1295 | 1295 | ); |
| 1296 | 1296 | } |
| 1297 | 1297 | |
@@ -1302,8 +1302,8 @@ discard block |
||
| 1302 | 1302 | * @return \EE_Registration[] |
| 1303 | 1303 | * @throws \EE_Error |
| 1304 | 1304 | */ |
| 1305 | - public function payments( $query_params = array() ) { |
|
| 1306 | - return $this->get_many_related( 'Payment', $query_params ); |
|
| 1305 | + public function payments($query_params = array()) { |
|
| 1306 | + return $this->get_many_related('Payment', $query_params); |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | |
@@ -1313,8 +1313,8 @@ discard block |
||
| 1313 | 1313 | * @return \EE_Registration_Payment[] |
| 1314 | 1314 | * @throws \EE_Error |
| 1315 | 1315 | */ |
| 1316 | - public function registration_payments( $query_params = array() ) { |
|
| 1317 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
| 1316 | + public function registration_payments($query_params = array()) { |
|
| 1317 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | 1320 | |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | * @return EE_Payment_Method|null |
| 1328 | 1328 | */ |
| 1329 | 1329 | public function payment_method() { |
| 1330 | - return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
|
| 1330 | + return EEM_Payment_Method::instance()->get_last_used_for_registration($this); |
|
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | 34 | if ( ! class_exists( 'WP_List_Table' )) { |
| 35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 35 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -771,19 +771,19 @@ discard block |
||
| 771 | 771 | $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
| 772 | 772 | $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
| 773 | 773 | $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
| 774 | - try { |
|
| 775 | - $content .= apply_filters( |
|
| 776 | - 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
| 777 | - $action_items, |
|
| 778 | - $item, |
|
| 779 | - $this |
|
| 780 | - ); |
|
| 781 | - } catch (\Exception $e) { |
|
| 782 | - if (WP_DEBUG) { |
|
| 783 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 784 | - } |
|
| 785 | - $content .= $action_items; |
|
| 786 | - } |
|
| 774 | + try { |
|
| 775 | + $content .= apply_filters( |
|
| 776 | + 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
| 777 | + $action_items, |
|
| 778 | + $item, |
|
| 779 | + $this |
|
| 780 | + ); |
|
| 781 | + } catch (\Exception $e) { |
|
| 782 | + if (WP_DEBUG) { |
|
| 783 | + \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 784 | + } |
|
| 785 | + $content .= $action_items; |
|
| 786 | + } |
|
| 787 | 787 | $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
| 788 | 788 | return $content; |
| 789 | 789 | } |
@@ -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 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | * ------------------------------------------------------------------------ |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | -if ( ! class_exists( 'WP_List_Table' )) { |
|
| 35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 34 | +if ( ! class_exists('WP_List_Table')) { |
|
| 35 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -244,16 +244,16 @@ discard block |
||
| 244 | 244 | * constructor |
| 245 | 245 | * @param EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table. |
| 246 | 246 | */ |
| 247 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
| 247 | + public function __construct(EE_Admin_Page $admin_page) { |
|
| 248 | 248 | $this->_admin_page = $admin_page; |
| 249 | 249 | $this->_req_data = $this->_admin_page->get_request_data(); |
| 250 | 250 | $this->_view = $this->_admin_page->get_view(); |
| 251 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
| 251 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
| 252 | 252 | $this->_current_page = $this->get_pagenum(); |
| 253 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
| 254 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
| 253 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
| 254 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
| 255 | 255 | |
| 256 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
| 256 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
| 257 | 257 | |
| 258 | 258 | $this->_setup_data(); |
| 259 | 259 | $this->_add_view_counts(); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $this->_set_properties(); |
| 264 | 264 | |
| 265 | 265 | //set primary column |
| 266 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
| 266 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
| 267 | 267 | |
| 268 | 268 | //set parent defaults |
| 269 | 269 | parent::__construct($this->_wp_list_args); |
@@ -339,17 +339,17 @@ discard block |
||
| 339 | 339 | * @return string |
| 340 | 340 | */ |
| 341 | 341 | protected function _get_hidden_fields() { |
| 342 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
| 343 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
| 342 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
| 343 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
| 344 | 344 | //if action is STILL empty, then we set it to default |
| 345 | - $action = empty( $action ) ? 'default' : $action; |
|
| 346 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
| 347 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
| 348 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
| 345 | + $action = empty($action) ? 'default' : $action; |
|
| 346 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
| 347 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
| 348 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
| 349 | 349 | |
| 350 | 350 | $bulk_actions = $this->_get_bulk_actions(); |
| 351 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
| 352 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
| 351 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
| 352 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | return $field; |
@@ -379,15 +379,15 @@ discard block |
||
| 379 | 379 | * |
| 380 | 380 | * @var array |
| 381 | 381 | */ |
| 382 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
| 382 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
| 383 | 383 | |
| 384 | 384 | $sortable = array(); |
| 385 | - foreach ( $_sortable as $id => $data ) { |
|
| 386 | - if ( empty( $data ) ) |
|
| 385 | + foreach ($_sortable as $id => $data) { |
|
| 386 | + if (empty($data)) |
|
| 387 | 387 | continue; |
| 388 | 388 | |
| 389 | 389 | //fix for offset errors with WP_List_Table default get_columninfo() |
| 390 | - if ( is_array($data) ) { |
|
| 390 | + if (is_array($data)) { |
|
| 391 | 391 | $_data[0] = key($data); |
| 392 | 392 | $_data[1] = isset($data[1]) ? $data[1] : false; |
| 393 | 393 | } else { |
@@ -396,14 +396,14 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | $data = (array) $data; |
| 398 | 398 | |
| 399 | - if ( !isset( $data[1] ) ) |
|
| 399 | + if ( ! isset($data[1])) |
|
| 400 | 400 | $_data[1] = false; |
| 401 | 401 | |
| 402 | 402 | |
| 403 | 403 | $sortable[$id] = $_data; |
| 404 | 404 | } |
| 405 | 405 | $primary = $this->get_primary_column_name(); |
| 406 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
| 406 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | * @return string |
| 413 | 413 | */ |
| 414 | 414 | protected function get_primary_column_name() { |
| 415 | - foreach( class_parents( $this ) as $parent ) { |
|
| 416 | - if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) { |
|
| 415 | + foreach (class_parents($this) as $parent) { |
|
| 416 | + if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') { |
|
| 417 | 417 | return parent::get_primary_column_name(); |
| 418 | 418 | } |
| 419 | 419 | } |
@@ -430,10 +430,10 @@ discard block |
||
| 430 | 430 | * @param string $primary |
| 431 | 431 | * @return string |
| 432 | 432 | */ |
| 433 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
| 434 | - foreach( class_parents( $this ) as $parent ) { |
|
| 435 | - if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) { |
|
| 436 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
| 433 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
| 434 | + foreach (class_parents($this) as $parent) { |
|
| 435 | + if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') { |
|
| 436 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | return ''; |
@@ -451,11 +451,11 @@ discard block |
||
| 451 | 451 | protected function _get_bulk_actions() { |
| 452 | 452 | $actions = array(); |
| 453 | 453 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
| 454 | - foreach ( $this->_views as $view => $args) { |
|
| 455 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
| 454 | + foreach ($this->_views as $view => $args) { |
|
| 455 | + if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view) |
|
| 456 | 456 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
| 457 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
| 458 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
| 457 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
| 458 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
| 459 | 459 | $actions[$route] = $label; |
| 460 | 460 | } |
| 461 | 461 | } |
@@ -473,18 +473,18 @@ discard block |
||
| 473 | 473 | */ |
| 474 | 474 | private function _filters() { |
| 475 | 475 | $classname = get_class($this); |
| 476 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
| 476 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
| 477 | 477 | |
| 478 | - if ( empty( $filters )) { |
|
| 478 | + if (empty($filters)) { |
|
| 479 | 479 | return; |
| 480 | 480 | } |
| 481 | - foreach ( $filters as $filter ) { |
|
| 481 | + foreach ($filters as $filter) { |
|
| 482 | 482 | echo $filter; |
| 483 | 483 | } |
| 484 | 484 | //add filter button at end |
| 485 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
| 485 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
| 486 | 486 | //add reset filters button at end |
| 487 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
| 487 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | |
@@ -498,8 +498,8 @@ discard block |
||
| 498 | 498 | * @param string $column_name |
| 499 | 499 | * @return string |
| 500 | 500 | */ |
| 501 | - public function set_primary_column( $column_name ) { |
|
| 502 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
| 501 | + public function set_primary_column($column_name) { |
|
| 502 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | array( |
| 519 | 519 | 'total_items' => $total_items, |
| 520 | 520 | 'per_page' => $this->_per_page, |
| 521 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
| 521 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
| 522 | 522 | ) |
| 523 | 523 | ); |
| 524 | 524 | } |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | * |
| 535 | 535 | * @return string html content for the column |
| 536 | 536 | */ |
| 537 | - public function column_default( $item, $column_name ) { |
|
| 537 | + public function column_default($item, $column_name) { |
|
| 538 | 538 | /** |
| 539 | 539 | * Dynamic hook allowing for adding additional column content in this list table. |
| 540 | 540 | * Note that $this->screen->id is in the format |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | * hook prefix ("event-espresso") will be different. |
| 545 | 545 | * |
| 546 | 546 | */ |
| 547 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
| 547 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | * |
| 561 | 561 | * @var array |
| 562 | 562 | */ |
| 563 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
| 563 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
| 564 | 564 | return $columns; |
| 565 | 565 | } |
| 566 | 566 | |
@@ -572,18 +572,18 @@ discard block |
||
| 572 | 572 | $views = $this->get_views(); |
| 573 | 573 | $assembled_views = ''; |
| 574 | 574 | |
| 575 | - if ( empty( $views )) { |
|
| 575 | + if (empty($views)) { |
|
| 576 | 576 | return; |
| 577 | 577 | } |
| 578 | 578 | echo "<ul class='subsubsub'>\n"; |
| 579 | - foreach ( $views as $view ) { |
|
| 580 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
| 581 | - if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) { |
|
| 582 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
| 579 | + foreach ($views as $view) { |
|
| 580 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
| 581 | + if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) { |
|
| 582 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
| 583 | 583 | } |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
| 586 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
| 587 | 587 | echo "</ul>"; |
| 588 | 588 | } |
| 589 | 589 | |
@@ -596,10 +596,10 @@ discard block |
||
| 596 | 596 | * |
| 597 | 597 | * @param object $item The current item |
| 598 | 598 | */ |
| 599 | - public function single_row( $item ) { |
|
| 600 | - $row_class = $this->_get_row_class( $item ); |
|
| 601 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
| 602 | - $this->single_row_columns( $item ); |
|
| 599 | + public function single_row($item) { |
|
| 600 | + $row_class = $this->_get_row_class($item); |
|
| 601 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
| 602 | + $this->single_row_columns($item); |
|
| 603 | 603 | echo '</tr>'; |
| 604 | 604 | } |
| 605 | 605 | |
@@ -610,13 +610,13 @@ discard block |
||
| 610 | 610 | * @param object $item the current item |
| 611 | 611 | * @return string |
| 612 | 612 | */ |
| 613 | - protected function _get_row_class( $item ) { |
|
| 613 | + protected function _get_row_class($item) { |
|
| 614 | 614 | static $row_class = ''; |
| 615 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
| 615 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
| 616 | 616 | |
| 617 | 617 | $new_row_class = $row_class; |
| 618 | 618 | |
| 619 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
| 619 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
| 620 | 620 | $new_row_class .= ' rowsortable'; |
| 621 | 621 | } |
| 622 | 622 | |
@@ -635,13 +635,13 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | public function get_hidden_columns() { |
| 637 | 637 | $user_id = get_current_user_id(); |
| 638 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
| 639 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
| 640 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
| 641 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
| 638 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
| 639 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
| 640 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
| 641 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
| 642 | 642 | } |
| 643 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
| 644 | - $saved_columns = (array) get_user_option( $ref, $user_id ); |
|
| 643 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
| 644 | + $saved_columns = (array) get_user_option($ref, $user_id); |
|
| 645 | 645 | return $saved_columns; |
| 646 | 646 | } |
| 647 | 647 | |
@@ -656,47 +656,47 @@ discard block |
||
| 656 | 656 | * |
| 657 | 657 | * @param object $item The current item |
| 658 | 658 | */ |
| 659 | - public function single_row_columns( $item ) { |
|
| 660 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
| 659 | + public function single_row_columns($item) { |
|
| 660 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
| 661 | 661 | |
| 662 | 662 | global $wp_version; |
| 663 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
| 663 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
| 664 | 664 | |
| 665 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
| 665 | + foreach ($columns as $column_name => $column_display_name) { |
|
| 666 | 666 | |
| 667 | 667 | /** |
| 668 | 668 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
| 669 | 669 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
| 670 | 670 | */ |
| 671 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
| 672 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
| 671 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
| 672 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
| 673 | 673 | |
| 674 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
| 675 | - if ( $primary == $column_name ) { |
|
| 674 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
| 675 | + if ($primary == $column_name) { |
|
| 676 | 676 | $classes .= ' has-row-actions column-primary'; |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
| 679 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
| 680 | 680 | |
| 681 | 681 | $class = "class='$classes'"; |
| 682 | 682 | |
| 683 | 683 | $attributes = "$class$style$data"; |
| 684 | 684 | |
| 685 | - if ( 'cb' === $column_name ) { |
|
| 685 | + if ('cb' === $column_name) { |
|
| 686 | 686 | echo '<th scope="row" class="check-column">'; |
| 687 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
| 687 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
| 688 | 688 | echo '</th>'; |
| 689 | 689 | } |
| 690 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
| 690 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
| 691 | 691 | echo "<td $attributes>"; |
| 692 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
| 693 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
| 692 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
| 693 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
| 694 | 694 | echo "</td>"; |
| 695 | 695 | } |
| 696 | 696 | else { |
| 697 | 697 | echo "<td $attributes>"; |
| 698 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
| 699 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
| 698 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
| 699 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
| 700 | 700 | echo "</td>"; |
| 701 | 701 | } |
| 702 | 702 | } |
@@ -704,19 +704,19 @@ discard block |
||
| 704 | 704 | |
| 705 | 705 | |
| 706 | 706 | |
| 707 | - public function extra_tablenav( $which ) { |
|
| 708 | - if ( $which == 'top' ) { |
|
| 707 | + public function extra_tablenav($which) { |
|
| 708 | + if ($which == 'top') { |
|
| 709 | 709 | $this->_filters(); |
| 710 | 710 | echo $this->_get_hidden_fields(); |
| 711 | 711 | echo '<br class="clear">'; |
| 712 | - }else{ |
|
| 712 | + } else { |
|
| 713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
| 714 | - foreach($this->_bottom_buttons as $type => $action){ |
|
| 715 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
| 716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
| 714 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
| 715 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
| 716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
| 717 | 717 | echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request); |
| 718 | 718 | } |
| 719 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
| 719 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
| 720 | 720 | echo '</div>'; |
| 721 | 721 | } |
| 722 | 722 | //echo $this->_entries_per_page_dropdown; |
@@ -766,11 +766,11 @@ discard block |
||
| 766 | 766 | * |
| 767 | 767 | * @return string The assembled action elements container. |
| 768 | 768 | */ |
| 769 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
| 769 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
| 770 | 770 | $content = ''; |
| 771 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
| 772 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
| 773 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
| 771 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
| 772 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
| 773 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
| 774 | 774 | try { |
| 775 | 775 | $content .= apply_filters( |
| 776 | 776 | 'FHEE__EE_Admin_List_Table___action_string__action_items', |
@@ -780,11 +780,11 @@ discard block |
||
| 780 | 780 | ); |
| 781 | 781 | } catch (\Exception $e) { |
| 782 | 782 | if (WP_DEBUG) { |
| 783 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 783 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
| 784 | 784 | } |
| 785 | 785 | $content .= $action_items; |
| 786 | 786 | } |
| 787 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
|
| 787 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
| 788 | 788 | return $content; |
| 789 | 789 | } |
| 790 | 790 | } |
@@ -113,7 +113,6 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * This sets the meta caps property. |
| 116 | - |
|
| 117 | 116 | * @since 4.5.0 |
| 118 | 117 | * |
| 119 | 118 | * @return void |
@@ -227,7 +226,7 @@ discard block |
||
| 227 | 226 | * capability mapping which will be used for accessing payment methods owned by |
| 228 | 227 | * other users. This is not fully implemented yet in the payment method ui. |
| 229 | 228 | * Currently only the "plural" caps are in active use. (Specific payment method caps are in use as well). |
| 230 | - **/ |
|
| 229 | + **/ |
|
| 231 | 230 | 'ee_manage_gateways', |
| 232 | 231 | 'ee_read_payment_method', |
| 233 | 232 | 'ee_read_payment_methods', |
@@ -739,15 +738,15 @@ discard block |
||
| 739 | 738 | } |
| 740 | 739 | } |
| 741 | 740 | } else { |
| 742 | - //not a cpt object so handled differently |
|
| 743 | - $has_cap = false; |
|
| 744 | - try { |
|
| 745 | - $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user(); |
|
| 746 | - } catch (Exception $e) { |
|
| 747 | - if (WP_DEBUG) { |
|
| 748 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
| 749 | - } |
|
| 750 | - } |
|
| 741 | + //not a cpt object so handled differently |
|
| 742 | + $has_cap = false; |
|
| 743 | + try { |
|
| 744 | + $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user(); |
|
| 745 | + } catch (Exception $e) { |
|
| 746 | + if (WP_DEBUG) { |
|
| 747 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
| 748 | + } |
|
| 749 | + } |
|
| 751 | 750 | if ($has_cap) { |
| 752 | 751 | $caps[] = $cap; |
| 753 | 752 | } else { |
@@ -854,15 +853,15 @@ discard block |
||
| 854 | 853 | $caps[] = $cap; |
| 855 | 854 | } |
| 856 | 855 | } else { |
| 857 | - //not a cpt object so handled differently |
|
| 858 | - $has_cap = false; |
|
| 859 | - try { |
|
| 860 | - $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user(); |
|
| 861 | - } catch (Exception $e) { |
|
| 862 | - if (WP_DEBUG) { |
|
| 863 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
| 864 | - } |
|
| 865 | - } |
|
| 856 | + //not a cpt object so handled differently |
|
| 857 | + $has_cap = false; |
|
| 858 | + try { |
|
| 859 | + $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user(); |
|
| 860 | + } catch (Exception $e) { |
|
| 861 | + if (WP_DEBUG) { |
|
| 862 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
| 863 | + } |
|
| 864 | + } |
|
| 866 | 865 | if ($has_cap) { |
| 867 | 866 | $caps[] = $cap; |
| 868 | 867 | } elseif ( ! empty( $this->private_cap ) ) { |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | * @package Event Espresso |
| 8 | 8 | * @subpackage core, capabilities |
| 9 | 9 | */ |
| 10 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 11 | - exit( 'No direct script access allowed' ); |
|
| 10 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 11 | + exit('No direct script access allowed'); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public static function instance() { |
| 73 | 73 | //check if instantiated, and if not do so. |
| 74 | - if ( ! self::$_instance instanceof EE_Capabilities ) { |
|
| 74 | + if ( ! self::$_instance instanceof EE_Capabilities) { |
|
| 75 | 75 | self::$_instance = new self(); |
| 76 | 76 | } |
| 77 | 77 | return self::$_instance; |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | * @since 4.5.0 |
| 101 | 101 | * @return void |
| 102 | 102 | */ |
| 103 | - public function init_caps( $reset = false ) { |
|
| 104 | - if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
| 103 | + public function init_caps($reset = false) { |
|
| 104 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
| 105 | 105 | $this->_caps_map = $this->_init_caps_map(); |
| 106 | - $this->init_role_caps( $reset ); |
|
| 106 | + $this->init_role_caps($reset); |
|
| 107 | 107 | $this->_set_meta_caps(); |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | //make sure we're only ever initializing the default _meta_caps array once if it's empty. |
| 123 | 123 | $this->_meta_caps = $this->_get_default_meta_caps_array(); |
| 124 | 124 | |
| 125 | - $this->_meta_caps = apply_filters( 'FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps ); |
|
| 125 | + $this->_meta_caps = apply_filters('FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps); |
|
| 126 | 126 | |
| 127 | 127 | //add filter for map_meta_caps but only if models can query. |
| 128 | - if ( EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ) ) ) { |
|
| 129 | - add_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10, 4 ); |
|
| 128 | + if (EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter('map_meta_cap', array($this, 'map_meta_caps'))) { |
|
| 129 | + add_filter('map_meta_cap', array($this, 'map_meta_caps'), 10, 4); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
@@ -139,37 +139,37 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | private function _get_default_meta_caps_array() { |
| 141 | 141 | static $default_meta_caps = array(); |
| 142 | - if ( empty( $default_meta_caps ) ) { |
|
| 142 | + if (empty($default_meta_caps)) { |
|
| 143 | 143 | $default_meta_caps = array( |
| 144 | 144 | //edits |
| 145 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_event', array( 'Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events' ) ), |
|
| 146 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_venue', array( 'Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues' ) ), |
|
| 147 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_registration', array( 'Registration', '', 'ee_edit_others_registrations', '' ) ), |
|
| 148 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_checkin', array( 'Registration', '', 'ee_edit_others_checkins', '' ) ), |
|
| 149 | - new EE_Meta_Capability_Map_Messages_Cap( 'ee_edit_message', array( 'Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages' ) ), |
|
| 150 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_default_ticket', array( 'Ticket', '', 'ee_edit_others_default_tickets', '' ) ), |
|
| 151 | - new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question', array( 'Question', '', '', 'ee_edit_system_questions' ) ), |
|
| 152 | - new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question_group', array( 'Question_Group', '', '', 'ee_edit_system_question_groups' ) ), |
|
| 153 | - new EE_Meta_Capability_Map_Edit( 'ee_edit_payment_method', array( 'Payment_Method', '', 'ee_edit_others_payment_methods', '' ) ), |
|
| 145 | + new EE_Meta_Capability_Map_Edit('ee_edit_event', array('Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events')), |
|
| 146 | + new EE_Meta_Capability_Map_Edit('ee_edit_venue', array('Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues')), |
|
| 147 | + new EE_Meta_Capability_Map_Edit('ee_edit_registration', array('Registration', '', 'ee_edit_others_registrations', '')), |
|
| 148 | + new EE_Meta_Capability_Map_Edit('ee_edit_checkin', array('Registration', '', 'ee_edit_others_checkins', '')), |
|
| 149 | + new EE_Meta_Capability_Map_Messages_Cap('ee_edit_message', array('Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages')), |
|
| 150 | + new EE_Meta_Capability_Map_Edit('ee_edit_default_ticket', array('Ticket', '', 'ee_edit_others_default_tickets', '')), |
|
| 151 | + new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question', array('Question', '', '', 'ee_edit_system_questions')), |
|
| 152 | + new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question_group', array('Question_Group', '', '', 'ee_edit_system_question_groups')), |
|
| 153 | + new EE_Meta_Capability_Map_Edit('ee_edit_payment_method', array('Payment_Method', '', 'ee_edit_others_payment_methods', '')), |
|
| 154 | 154 | //reads |
| 155 | - new EE_Meta_Capability_Map_Read( 'ee_read_event', array( 'Event', '', 'ee_read_others_events', 'ee_read_private_events' ) ), |
|
| 156 | - new EE_Meta_Capability_Map_Read( 'ee_read_venue', array( 'Venue', '', 'ee_read_others_venues', 'ee_read_private_venues' ) ), |
|
| 157 | - new EE_Meta_Capability_Map_Read( 'ee_read_registration', array( 'Registration', '', '', 'ee_edit_others_registrations' ) ), |
|
| 158 | - new EE_Meta_Capability_Map_Read( 'ee_read_checkin', array( 'Registration', '', '', 'ee_read_others_checkins' ) ), |
|
| 159 | - new EE_Meta_Capability_Map_Messages_Cap( 'ee_read_message', array( 'Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages' ) ), |
|
| 160 | - new EE_Meta_Capability_Map_Read( 'ee_read_default_ticket', array( 'Ticket', '', '', 'ee_read_others_default_tickets' ) ), |
|
| 161 | - new EE_Meta_Capability_Map_Read( 'ee_read_payment_method', array( 'Payment_Method', '', '', 'ee_read_others_payment_methods' ) ), |
|
| 155 | + new EE_Meta_Capability_Map_Read('ee_read_event', array('Event', '', 'ee_read_others_events', 'ee_read_private_events')), |
|
| 156 | + new EE_Meta_Capability_Map_Read('ee_read_venue', array('Venue', '', 'ee_read_others_venues', 'ee_read_private_venues')), |
|
| 157 | + new EE_Meta_Capability_Map_Read('ee_read_registration', array('Registration', '', '', 'ee_edit_others_registrations')), |
|
| 158 | + new EE_Meta_Capability_Map_Read('ee_read_checkin', array('Registration', '', '', 'ee_read_others_checkins')), |
|
| 159 | + new EE_Meta_Capability_Map_Messages_Cap('ee_read_message', array('Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages')), |
|
| 160 | + new EE_Meta_Capability_Map_Read('ee_read_default_ticket', array('Ticket', '', '', 'ee_read_others_default_tickets')), |
|
| 161 | + new EE_Meta_Capability_Map_Read('ee_read_payment_method', array('Payment_Method', '', '', 'ee_read_others_payment_methods')), |
|
| 162 | 162 | |
| 163 | 163 | //deletes |
| 164 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_event', array( 'Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events' ) ), |
|
| 165 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_venue', array( 'Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues' ) ), |
|
| 166 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_registration', array( 'Registration', '', 'ee_delete_others_registrations', '' ) ), |
|
| 167 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_checkin', array( 'Registration', '', 'ee_delete_others_checkins', '' ) ), |
|
| 168 | - new EE_Meta_Capability_Map_Messages_Cap( 'ee_delete_message', array( 'Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages' ) ), |
|
| 169 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_default_ticket', array( 'Ticket', '', 'ee_delete_others_default_tickets', '' ) ), |
|
| 170 | - new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question', array( 'Question', '', '', 'delete_system_questions' ) ), |
|
| 171 | - new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question_group', array( 'Question_Group', '', '', 'delete_system_question_groups' ) ), |
|
| 172 | - new EE_Meta_Capability_Map_Delete( 'ee_delete_payment_method', array( 'Payment_Method', '', 'ee_delete_others_payment_methods', '' ) ), |
|
| 164 | + new EE_Meta_Capability_Map_Delete('ee_delete_event', array('Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events')), |
|
| 165 | + new EE_Meta_Capability_Map_Delete('ee_delete_venue', array('Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues')), |
|
| 166 | + new EE_Meta_Capability_Map_Delete('ee_delete_registration', array('Registration', '', 'ee_delete_others_registrations', '')), |
|
| 167 | + new EE_Meta_Capability_Map_Delete('ee_delete_checkin', array('Registration', '', 'ee_delete_others_checkins', '')), |
|
| 168 | + new EE_Meta_Capability_Map_Messages_Cap('ee_delete_message', array('Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages')), |
|
| 169 | + new EE_Meta_Capability_Map_Delete('ee_delete_default_ticket', array('Ticket', '', 'ee_delete_others_default_tickets', '')), |
|
| 170 | + new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question', array('Question', '', '', 'delete_system_questions')), |
|
| 171 | + new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question_group', array('Question_Group', '', '', 'delete_system_question_groups')), |
|
| 172 | + new EE_Meta_Capability_Map_Delete('ee_delete_payment_method', array('Payment_Method', '', 'ee_delete_others_payment_methods', '')), |
|
| 173 | 173 | ); |
| 174 | 174 | } |
| 175 | 175 | return $default_meta_caps; |
@@ -193,15 +193,15 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @return array actual users capabilities |
| 195 | 195 | */ |
| 196 | - public function map_meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 196 | + public function map_meta_caps($caps, $cap, $user_id, $args) { |
|
| 197 | 197 | //loop through our _meta_caps array |
| 198 | - foreach ( $this->_meta_caps as $meta_map ) { |
|
| 199 | - if ( ! $meta_map instanceof EE_Meta_Capability_Map ) { |
|
| 198 | + foreach ($this->_meta_caps as $meta_map) { |
|
| 199 | + if ( ! $meta_map instanceof EE_Meta_Capability_Map) { |
|
| 200 | 200 | continue; |
| 201 | 201 | } |
| 202 | 202 | $meta_map->ensure_is_model(); |
| 203 | 203 | |
| 204 | - $caps = $meta_map->map_meta_caps( $caps, $cap, $user_id, $args ); |
|
| 204 | + $caps = $meta_map->map_meta_caps($caps, $cap, $user_id, $args); |
|
| 205 | 205 | } |
| 206 | 206 | return $caps; |
| 207 | 207 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | ) |
| 367 | 367 | ); |
| 368 | 368 | |
| 369 | - $caps = apply_filters( 'FHEE__EE_Capabilities__init_caps_map__caps', $caps ); |
|
| 369 | + $caps = apply_filters('FHEE__EE_Capabilities__init_caps_map__caps', $caps); |
|
| 370 | 370 | return $caps; |
| 371 | 371 | } |
| 372 | 372 | |
@@ -383,26 +383,26 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | - public function init_role_caps( $reset = false, $custom_map = array() ) { |
|
| 386 | + public function init_role_caps($reset = false, $custom_map = array()) { |
|
| 387 | 387 | |
| 388 | - $caps_map = empty( $custom_map ) ? $this->_caps_map : $custom_map; |
|
| 388 | + $caps_map = empty($custom_map) ? $this->_caps_map : $custom_map; |
|
| 389 | 389 | |
| 390 | 390 | //first let's determine if these caps have already been set. |
| 391 | - $caps_set_before = get_option( self::option_name, array() ); |
|
| 391 | + $caps_set_before = get_option(self::option_name, array()); |
|
| 392 | 392 | //if not reset, see what caps are new for each role. if they're new, add them. |
| 393 | - foreach ( $caps_map as $role => $caps_for_role ) { |
|
| 394 | - foreach ( $caps_for_role as $cap ) { |
|
| 393 | + foreach ($caps_map as $role => $caps_for_role) { |
|
| 394 | + foreach ($caps_for_role as $cap) { |
|
| 395 | 395 | //first check we haven't already added this cap before, or it's a reset |
| 396 | - if ( $reset || ! isset( $caps_set_before[ $role ] ) || ! in_array( $cap, $caps_set_before[ $role ] ) ) { |
|
| 397 | - $this->add_cap_to_role( $role, $cap ); |
|
| 398 | - $caps_set_before[ $role ][] = $cap; |
|
| 396 | + if ($reset || ! isset($caps_set_before[$role]) || ! in_array($cap, $caps_set_before[$role])) { |
|
| 397 | + $this->add_cap_to_role($role, $cap); |
|
| 398 | + $caps_set_before[$role][] = $cap; |
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | //now let's just save the cap that has been set. |
| 404 | - update_option( self::option_name, $caps_set_before ); |
|
| 405 | - do_action( 'AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before ); |
|
| 404 | + update_option(self::option_name, $caps_set_before); |
|
| 405 | + do_action('AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | |
@@ -421,10 +421,10 @@ discard block |
||
| 421 | 421 | * @param bool $grant Whether to grant access to this cap on this role. |
| 422 | 422 | * @return void |
| 423 | 423 | */ |
| 424 | - public function add_cap_to_role( $role, $cap, $grant = true ) { |
|
| 425 | - $role = get_role( $role ); |
|
| 426 | - if ( $role instanceof WP_Role ) { |
|
| 427 | - $role->add_cap( $cap, $grant ); |
|
| 424 | + public function add_cap_to_role($role, $cap, $grant = true) { |
|
| 425 | + $role = get_role($role); |
|
| 426 | + if ($role instanceof WP_Role) { |
|
| 427 | + $role->add_cap($cap, $grant); |
|
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
@@ -444,10 +444,10 @@ discard block |
||
| 444 | 444 | * |
| 445 | 445 | * @return void |
| 446 | 446 | */ |
| 447 | - public function remove_cap_from_role( $role, $cap ) { |
|
| 448 | - $role = get_role( $role ); |
|
| 449 | - if ( $role instanceof WP_Role ) { |
|
| 450 | - $role->remove_cap( $cap ); |
|
| 447 | + public function remove_cap_from_role($role, $cap) { |
|
| 448 | + $role = get_role($role); |
|
| 449 | + if ($role instanceof WP_Role) { |
|
| 450 | + $role->remove_cap($cap); |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
@@ -468,11 +468,11 @@ discard block |
||
| 468 | 468 | * |
| 469 | 469 | * @return bool Whether user can or not. |
| 470 | 470 | */ |
| 471 | - public function current_user_can( $cap, $context, $id = 0 ) { |
|
| 471 | + public function current_user_can($cap, $context, $id = 0) { |
|
| 472 | 472 | //apply filters (both a global on just the cap, and context specific. Global overrides context specific) |
| 473 | - $filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap__' . $context, $cap, $id ); |
|
| 474 | - $filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id ); |
|
| 475 | - return ! empty( $id ) ? current_user_can( $filtered_cap, $id ) : current_user_can( $filtered_cap ); |
|
| 473 | + $filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap__'.$context, $cap, $id); |
|
| 474 | + $filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id); |
|
| 475 | + return ! empty($id) ? current_user_can($filtered_cap, $id) : current_user_can($filtered_cap); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | |
@@ -489,11 +489,11 @@ discard block |
||
| 489 | 489 | * |
| 490 | 490 | * @return bool Whether user can or not. |
| 491 | 491 | */ |
| 492 | - public function user_can( $user, $cap, $context, $id = 0 ) { |
|
| 492 | + public function user_can($user, $cap, $context, $id = 0) { |
|
| 493 | 493 | //apply filters (both a global on just the cap, and context specific. Global overrides context specific) |
| 494 | - $filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap__' . $context, $cap, $user, $id ); |
|
| 495 | - $filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id ); |
|
| 496 | - return ! empty( $id ) ? user_can( $user, $filtered_cap, $id ) : user_can( $user, $filtered_cap ); |
|
| 494 | + $filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap__'.$context, $cap, $user, $id); |
|
| 495 | + $filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id); |
|
| 496 | + return ! empty($id) ? user_can($user, $filtered_cap, $id) : user_can($user, $filtered_cap); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | |
@@ -513,12 +513,12 @@ discard block |
||
| 513 | 513 | * |
| 514 | 514 | * @return bool Whether user can or not. |
| 515 | 515 | */ |
| 516 | - public function current_user_can_for_blog( $blog_id, $cap, $context, $id = 0 ) { |
|
| 517 | - $user_can = ! empty( $id ) ? current_user_can_for_blog( $blog_id, $cap, $id ) : current_user_can( $blog_id, $cap ); |
|
| 516 | + public function current_user_can_for_blog($blog_id, $cap, $context, $id = 0) { |
|
| 517 | + $user_can = ! empty($id) ? current_user_can_for_blog($blog_id, $cap, $id) : current_user_can($blog_id, $cap); |
|
| 518 | 518 | |
| 519 | 519 | //apply filters (both a global on just the cap, and context specific. Global overrides context specific) |
| 520 | - $user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can__' . $context, $user_can, $blog_id, $cap, $id ); |
|
| 521 | - $user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id ); |
|
| 520 | + $user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can__'.$context, $user_can, $blog_id, $cap, $id); |
|
| 521 | + $user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id); |
|
| 522 | 522 | return $user_can; |
| 523 | 523 | } |
| 524 | 524 | |
@@ -534,12 +534,12 @@ discard block |
||
| 534 | 534 | * |
| 535 | 535 | * @return array |
| 536 | 536 | */ |
| 537 | - public function get_ee_capabilities( $role = 'administrator' ) { |
|
| 537 | + public function get_ee_capabilities($role = 'administrator') { |
|
| 538 | 538 | $capabilities = $this->_init_caps_map(); |
| 539 | - if ( empty( $role ) ) { |
|
| 539 | + if (empty($role)) { |
|
| 540 | 540 | return $capabilities; |
| 541 | 541 | } |
| 542 | - return isset( $capabilities[ $role ] ) ? $capabilities[ $role ] : array(); |
|
| 542 | + return isset($capabilities[$role]) ? $capabilities[$role] : array(); |
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | |
@@ -587,11 +587,11 @@ discard block |
||
| 587 | 587 | * } |
| 588 | 588 | * @throws EE_Error |
| 589 | 589 | */ |
| 590 | - public function __construct( $meta_cap, $map_values ) { |
|
| 590 | + public function __construct($meta_cap, $map_values) { |
|
| 591 | 591 | $this->meta_cap = $meta_cap; |
| 592 | 592 | //verify there are four args in the $map_values array; |
| 593 | - if ( count( $map_values ) !== 4 ) { |
|
| 594 | - throw new EE_Error( sprintf( __( 'Incoming $map_values array should have a count of four values in it. This is what was given: %s', 'event_espresso' ), '<br>' . print_r( $map_values, true ) ) ); |
|
| 593 | + if (count($map_values) !== 4) { |
|
| 594 | + throw new EE_Error(sprintf(__('Incoming $map_values array should have a count of four values in it. This is what was given: %s', 'event_espresso'), '<br>'.print_r($map_values, true))); |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | //set properties |
@@ -605,8 +605,8 @@ discard block |
||
| 605 | 605 | /** |
| 606 | 606 | * Makes it so this object stops filtering caps |
| 607 | 607 | */ |
| 608 | - public function remove_filters(){ |
|
| 609 | - remove_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10 ); |
|
| 608 | + public function remove_filters() { |
|
| 609 | + remove_filter('map_meta_cap', array($this, 'map_meta_caps'), 10); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | |
@@ -621,19 +621,19 @@ discard block |
||
| 621 | 621 | */ |
| 622 | 622 | public function ensure_is_model() { |
| 623 | 623 | //is it already instantiated? |
| 624 | - if ( $this->_model instanceof EEM_Base ) { |
|
| 624 | + if ($this->_model instanceof EEM_Base) { |
|
| 625 | 625 | return; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | //ensure model name is string |
| 629 | 629 | $this->_model_name = (string) $this->_model_name; |
| 630 | 630 | //error proof if the name has EEM in it |
| 631 | - $this->_model_name = str_replace( 'EEM', '', $this->_model_name ); |
|
| 631 | + $this->_model_name = str_replace('EEM', '', $this->_model_name); |
|
| 632 | 632 | |
| 633 | - $this->_model = EE_Registry::instance()->load_model( $this->_model_name ); |
|
| 633 | + $this->_model = EE_Registry::instance()->load_model($this->_model_name); |
|
| 634 | 634 | |
| 635 | - if ( ! $this->_model instanceof EEM_Base ) { |
|
| 636 | - throw new EE_Error( sprintf( __( 'This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class. Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso' ), get_class( $this ), $this->_model ) ); |
|
| 635 | + if ( ! $this->_model instanceof EEM_Base) { |
|
| 636 | + throw new EE_Error(sprintf(__('This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class. Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso'), get_class($this), $this->_model)); |
|
| 637 | 637 | } |
| 638 | 638 | } |
| 639 | 639 | |
@@ -649,8 +649,8 @@ discard block |
||
| 649 | 649 | * |
| 650 | 650 | * @return array |
| 651 | 651 | */ |
| 652 | - public function map_meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 653 | - return $this->_map_meta_caps( $caps, $cap, $user_id, $args ); |
|
| 652 | + public function map_meta_caps($caps, $cap, $user_id, $args) { |
|
| 653 | + return $this->_map_meta_caps($caps, $cap, $user_id, $args); |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | * |
| 669 | 669 | * @return array actual users capabilities |
| 670 | 670 | */ |
| 671 | - abstract protected function _map_meta_caps( $caps, $cap, $user_id, $args ); |
|
| 671 | + abstract protected function _map_meta_caps($caps, $cap, $user_id, $args); |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | |
@@ -700,28 +700,28 @@ discard block |
||
| 700 | 700 | * |
| 701 | 701 | * @return array actual users capabilities |
| 702 | 702 | */ |
| 703 | - protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 703 | + protected function _map_meta_caps($caps, $cap, $user_id, $args) { |
|
| 704 | 704 | //only process if we're checking our mapped_cap |
| 705 | - if ( $cap !== $this->meta_cap ) { |
|
| 705 | + if ($cap !== $this->meta_cap) { |
|
| 706 | 706 | return $caps; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - $obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null; |
|
| 709 | + $obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null; |
|
| 710 | 710 | |
| 711 | 711 | //if no obj then let's just do cap |
| 712 | - if ( ! $obj instanceof EE_Base_Class ) { |
|
| 712 | + if ( ! $obj instanceof EE_Base_Class) { |
|
| 713 | 713 | $caps[] = $cap; |
| 714 | 714 | return $caps; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | - if ( $obj instanceof EE_CPT_Base ) { |
|
| 717 | + if ($obj instanceof EE_CPT_Base) { |
|
| 718 | 718 | //if the item author is set and the user is the author... |
| 719 | - if ( $obj->wp_user() && $user_id == $obj->wp_user() ) { |
|
| 720 | - if ( empty( $this->published_cap ) ) { |
|
| 719 | + if ($obj->wp_user() && $user_id == $obj->wp_user()) { |
|
| 720 | + if (empty($this->published_cap)) { |
|
| 721 | 721 | $caps[] = $cap; |
| 722 | 722 | } else { |
| 723 | 723 | //if obj is published... |
| 724 | - if ( $obj->status() == 'publish' ) { |
|
| 724 | + if ($obj->status() == 'publish') { |
|
| 725 | 725 | $caps[] = $this->published_cap; |
| 726 | 726 | } else { |
| 727 | 727 | $caps[] = $cap; |
@@ -729,12 +729,12 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | } else { |
| 731 | 731 | //the user is trying to edit someone else's obj |
| 732 | - if ( ! empty( $this->others_cap ) ) { |
|
| 732 | + if ( ! empty($this->others_cap)) { |
|
| 733 | 733 | $caps[] = $this->others_cap; |
| 734 | 734 | } |
| 735 | - if ( ! empty( $this->published_cap ) && $obj->status() == 'publish' ) { |
|
| 735 | + if ( ! empty($this->published_cap) && $obj->status() == 'publish') { |
|
| 736 | 736 | $caps[] = $this->published_cap; |
| 737 | - } elseif ( ! empty( $this->private_cap ) && $obj->status() == 'private' ) { |
|
| 737 | + } elseif ( ! empty($this->private_cap) && $obj->status() == 'private') { |
|
| 738 | 738 | $caps[] = $this->private_cap; |
| 739 | 739 | } |
| 740 | 740 | } |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | if ($has_cap) { |
| 752 | 752 | $caps[] = $cap; |
| 753 | 753 | } else { |
| 754 | - if ( ! empty( $this->others_cap ) ) { |
|
| 754 | + if ( ! empty($this->others_cap)) { |
|
| 755 | 755 | $caps[] = $this->others_cap; |
| 756 | 756 | } |
| 757 | 757 | } |
@@ -788,8 +788,8 @@ discard block |
||
| 788 | 788 | * |
| 789 | 789 | * @return array actual users capabilities |
| 790 | 790 | */ |
| 791 | - protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 792 | - return parent::_map_meta_caps( $caps, $cap, $user_id, $args ); |
|
| 791 | + protected function _map_meta_caps($caps, $cap, $user_id, $args) { |
|
| 792 | + return parent::_map_meta_caps($caps, $cap, $user_id, $args); |
|
| 793 | 793 | } |
| 794 | 794 | } |
| 795 | 795 | |
@@ -821,34 +821,34 @@ discard block |
||
| 821 | 821 | * |
| 822 | 822 | * @return array actual users capabilities |
| 823 | 823 | */ |
| 824 | - protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 824 | + protected function _map_meta_caps($caps, $cap, $user_id, $args) { |
|
| 825 | 825 | //only process if we're checking our mapped cap; |
| 826 | - if ( $cap !== $this->meta_cap ) { |
|
| 826 | + if ($cap !== $this->meta_cap) { |
|
| 827 | 827 | return $caps; |
| 828 | 828 | } |
| 829 | 829 | |
| 830 | - $obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null; |
|
| 830 | + $obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null; |
|
| 831 | 831 | |
| 832 | 832 | //if no obj then let's just do cap |
| 833 | - if ( ! $obj instanceof EE_Base_Class ) { |
|
| 833 | + if ( ! $obj instanceof EE_Base_Class) { |
|
| 834 | 834 | $caps[] = $cap; |
| 835 | 835 | return $caps; |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - if ( $obj instanceof EE_CPT_Base ) { |
|
| 839 | - $status_obj = get_post_status_object( $obj->status() ); |
|
| 840 | - if ( $status_obj->public ) { |
|
| 838 | + if ($obj instanceof EE_CPT_Base) { |
|
| 839 | + $status_obj = get_post_status_object($obj->status()); |
|
| 840 | + if ($status_obj->public) { |
|
| 841 | 841 | $caps[] = $cap; |
| 842 | 842 | return $caps; |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | //if the item author is set and the user is the author... |
| 846 | - if ( $obj->wp_user() && $user_id == $obj->wp_user() ) { |
|
| 846 | + if ($obj->wp_user() && $user_id == $obj->wp_user()) { |
|
| 847 | 847 | $caps[] = $cap; |
| 848 | - } elseif ( $status_obj->private && ! empty( $this->private_cap ) ) { |
|
| 848 | + } elseif ($status_obj->private && ! empty($this->private_cap)) { |
|
| 849 | 849 | //the user is trying to view someone else's obj |
| 850 | 850 | $caps[] = $this->private_cap; |
| 851 | - } elseif ( ! empty( $this->others_cap ) ) { |
|
| 851 | + } elseif ( ! empty($this->others_cap)) { |
|
| 852 | 852 | $caps[] = $this->others_cap; |
| 853 | 853 | } else { |
| 854 | 854 | $caps[] = $cap; |
@@ -865,9 +865,9 @@ discard block |
||
| 865 | 865 | } |
| 866 | 866 | if ($has_cap) { |
| 867 | 867 | $caps[] = $cap; |
| 868 | - } elseif ( ! empty( $this->private_cap ) ) { |
|
| 868 | + } elseif ( ! empty($this->private_cap)) { |
|
| 869 | 869 | $caps[] = $this->private_cap; |
| 870 | - } elseif ( ! empty( $this->others_cap ) ) { |
|
| 870 | + } elseif ( ! empty($this->others_cap)) { |
|
| 871 | 871 | $caps[] = $this->others_cap; |
| 872 | 872 | } else { |
| 873 | 873 | $caps[] = $cap; |
@@ -904,30 +904,30 @@ discard block |
||
| 904 | 904 | * |
| 905 | 905 | * @return array actual users capabilities |
| 906 | 906 | */ |
| 907 | - protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 907 | + protected function _map_meta_caps($caps, $cap, $user_id, $args) { |
|
| 908 | 908 | //only process if we're checking our mapped_cap |
| 909 | - if ( $cap !== $this->meta_cap ) { |
|
| 909 | + if ($cap !== $this->meta_cap) { |
|
| 910 | 910 | return $caps; |
| 911 | 911 | } |
| 912 | 912 | |
| 913 | - $obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null; |
|
| 913 | + $obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null; |
|
| 914 | 914 | |
| 915 | 915 | //if no obj then let's just do cap |
| 916 | - if ( ! $obj instanceof EE_Message_Template_Group ) { |
|
| 916 | + if ( ! $obj instanceof EE_Message_Template_Group) { |
|
| 917 | 917 | $caps[] = $cap; |
| 918 | 918 | return $caps; |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | $is_global = $obj->is_global(); |
| 922 | 922 | |
| 923 | - if ( $obj->wp_user() && $user_id == $obj->wp_user() ) { |
|
| 924 | - if ( $is_global ) { |
|
| 925 | - $caps[] = $this->private_cap; |
|
| 923 | + if ($obj->wp_user() && $user_id == $obj->wp_user()) { |
|
| 924 | + if ($is_global) { |
|
| 925 | + $caps[] = $this->private_cap; |
|
| 926 | 926 | } else { |
| 927 | 927 | $caps[] = $cap; |
| 928 | 928 | } |
| 929 | 929 | } else { |
| 930 | - if ( $is_global ) { |
|
| 930 | + if ($is_global) { |
|
| 931 | 931 | $caps[] = $this->private_cap; |
| 932 | 932 | } else { |
| 933 | 933 | $caps[] = $this->others_cap; |
@@ -965,16 +965,16 @@ discard block |
||
| 965 | 965 | * |
| 966 | 966 | * @return array actual users capabilities |
| 967 | 967 | */ |
| 968 | - protected function _map_meta_caps( $caps, $cap, $user_id, $args ) { |
|
| 968 | + protected function _map_meta_caps($caps, $cap, $user_id, $args) { |
|
| 969 | 969 | //only process if we're checking our mapped_cap |
| 970 | - if ( $cap !== $this->meta_cap ) { |
|
| 970 | + if ($cap !== $this->meta_cap) { |
|
| 971 | 971 | return $caps; |
| 972 | 972 | } |
| 973 | 973 | |
| 974 | - $obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null; |
|
| 974 | + $obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null; |
|
| 975 | 975 | |
| 976 | 976 | //if no obj then let's just do cap |
| 977 | - if ( ! $obj instanceof EE_Base_Class ) { |
|
| 977 | + if ( ! $obj instanceof EE_Base_Class) { |
|
| 978 | 978 | $caps[] = $cap; |
| 979 | 979 | return $caps; |
| 980 | 980 | } |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | $is_system = $obj instanceof EE_Question_Group ? $obj->system_group() : false; |
| 983 | 983 | $is_system = $obj instanceof EE_Question ? $obj->is_system_question() : $is_system; |
| 984 | 984 | |
| 985 | - if ( $is_system ) { |
|
| 985 | + if ($is_system) { |
|
| 986 | 986 | $caps[] = $this->private_cap; |
| 987 | 987 | } else { |
| 988 | 988 | $caps[] = $cap; |
@@ -374,18 +374,18 @@ discard block |
||
| 374 | 374 | * @return string |
| 375 | 375 | * @throws \EE_Error |
| 376 | 376 | */ |
| 377 | - public function column_cb($item){ |
|
| 378 | - /** checkbox/lock **/ |
|
| 379 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
| 380 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
| 381 | - return $payment_count > 0 |
|
| 382 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
| 383 | - . '<span class="ee-lock-icon"></span>' |
|
| 384 | - : sprintf( |
|
| 385 | - '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
| 386 | - $item->ID() |
|
| 387 | - ); |
|
| 388 | - } |
|
| 377 | + public function column_cb($item){ |
|
| 378 | + /** checkbox/lock **/ |
|
| 379 | + $transaction = $item->get_first_related( 'Transaction' ); |
|
| 380 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
| 381 | + return $payment_count > 0 |
|
| 382 | + ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
| 383 | + . '<span class="ee-lock-icon"></span>' |
|
| 384 | + : sprintf( |
|
| 385 | + '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
| 386 | + $item->ID() |
|
| 387 | + ); |
|
| 388 | + } |
|
| 389 | 389 | |
| 390 | 390 | |
| 391 | 391 | |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | * @throws \EE_Error |
| 399 | 399 | */ |
| 400 | 400 | public function column__REG_ID(EE_Registration $item){ |
| 401 | - $attendee = $item->attendee(); |
|
| 401 | + $attendee = $item->attendee(); |
|
| 402 | 402 | $content = $item->ID(); |
| 403 | 403 | $content .= '<div class="show-on-mobile-view-only">'; |
| 404 | 404 | $content .= '<br>'; |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function column__REG_date(EE_Registration $item){ |
| 423 | 423 | $this->_set_related_details($item); |
| 424 | - //Build row actions |
|
| 424 | + //Build row actions |
|
| 425 | 425 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
| 426 | 426 | $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
| 427 | 427 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
@@ -441,27 +441,27 @@ discard block |
||
| 441 | 441 | public function column_event_name(EE_Registration $item){ |
| 442 | 442 | $this->_set_related_details( $item ); |
| 443 | 443 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
| 444 | - $EVT_ID = $item->event_ID(); |
|
| 445 | - $event_name = $item->event_name(); |
|
| 446 | - $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
|
| 447 | - $event_name = wp_trim_words($event_name, 30, '...'); |
|
| 448 | - if ($EVT_ID) { |
|
| 449 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID), |
|
| 450 | - EVENTS_ADMIN_URL); |
|
| 451 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
|
| 452 | - ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>' |
|
| 453 | - : $event_name; |
|
| 454 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
|
| 455 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
| 456 | - $actions['event_filter'] .= sprintf( |
|
| 457 | - esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
| 458 | - $event_name |
|
| 459 | - ); |
|
| 460 | - $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
| 461 | - } else { |
|
| 462 | - $edit_event = $event_name; |
|
| 463 | - $actions['event_filter'] = ''; |
|
| 464 | - } |
|
| 444 | + $EVT_ID = $item->event_ID(); |
|
| 445 | + $event_name = $item->event_name(); |
|
| 446 | + $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
|
| 447 | + $event_name = wp_trim_words($event_name, 30, '...'); |
|
| 448 | + if ($EVT_ID) { |
|
| 449 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID), |
|
| 450 | + EVENTS_ADMIN_URL); |
|
| 451 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
|
| 452 | + ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>' |
|
| 453 | + : $event_name; |
|
| 454 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
|
| 455 | + $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
| 456 | + $actions['event_filter'] .= sprintf( |
|
| 457 | + esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
| 458 | + $event_name |
|
| 459 | + ); |
|
| 460 | + $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
| 461 | + } else { |
|
| 462 | + $edit_event = $event_name; |
|
| 463 | + $actions['event_filter'] = ''; |
|
| 464 | + } |
|
| 465 | 465 | |
| 466 | 466 | return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
| 467 | 467 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | } else { |
| 490 | 490 | return __( 'There is no ticket on this registration', 'event_espresso' ); |
| 491 | 491 | } |
| 492 | - } |
|
| 492 | + } |
|
| 493 | 493 | |
| 494 | 494 | |
| 495 | 495 | |
@@ -502,32 +502,32 @@ discard block |
||
| 502 | 502 | * @throws \EE_Error |
| 503 | 503 | */ |
| 504 | 504 | public function column_ATT_fname(EE_Registration $item){ |
| 505 | - $attendee = $item->attendee(); |
|
| 505 | + $attendee = $item->attendee(); |
|
| 506 | 506 | |
| 507 | 507 | $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
| 508 | 508 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
| 509 | 509 | $link = EE_Registry::instance()->CAP->current_user_can( |
| 510 | - 'ee_read_registration', |
|
| 511 | - 'espresso_registrations_view_registration', |
|
| 512 | - $item->ID() |
|
| 513 | - ) |
|
| 514 | - ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' |
|
| 515 | - : $attendee_name; |
|
| 510 | + 'ee_read_registration', |
|
| 511 | + 'espresso_registrations_view_registration', |
|
| 512 | + $item->ID() |
|
| 513 | + ) |
|
| 514 | + ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' |
|
| 515 | + : $attendee_name; |
|
| 516 | 516 | $link .= $item->count() === 1 |
| 517 | - ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' |
|
| 518 | - : ''; |
|
| 517 | + ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' |
|
| 518 | + : ''; |
|
| 519 | 519 | |
| 520 | 520 | $t = $item->get_first_related('Transaction'); |
| 521 | 521 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
| 522 | 522 | |
| 523 | - //append group count to name |
|
| 524 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 523 | + //append group count to name |
|
| 524 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 525 | 525 | |
| 526 | - //append reg_code |
|
| 527 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
| 526 | + //append reg_code |
|
| 527 | + $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
| 528 | 528 | |
| 529 | - //reg status text for accessibility |
|
| 530 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
| 529 | + //reg status text for accessibility |
|
| 530 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
| 531 | 531 | |
| 532 | 532 | //trash/restore/delete actions |
| 533 | 533 | $actions = array(); |
@@ -755,14 +755,14 @@ discard block |
||
| 755 | 755 | //message list table link (filtered by REG_ID |
| 756 | 756 | if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
| 757 | 757 | $actions['filtered_messages_link'] = '<li>' |
| 758 | - . EEH_MSG_Template::get_message_action_link( |
|
| 758 | + . EEH_MSG_Template::get_message_action_link( |
|
| 759 | 759 | 'see_notifications_for', |
| 760 | 760 | null, |
| 761 | 761 | array( |
| 762 | 762 | '_REG_ID' => $item->ID() |
| 763 | 763 | ) |
| 764 | 764 | ) |
| 765 | - . '</li>'; |
|
| 765 | + . '</li>'; |
|
| 766 | 766 | } |
| 767 | 767 | $actions = apply_filters( 'FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this ); |
| 768 | 768 | return $this->_action_string( |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * @param \Registrations_Admin_Page $admin_page |
| 56 | 56 | */ |
| 57 | - public function __construct( Registrations_Admin_Page $admin_page ){ |
|
| 58 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
| 57 | + public function __construct(Registrations_Admin_Page $admin_page) { |
|
| 58 | + if ( ! empty($_GET['event_id'])) { |
|
| 59 | 59 | $extra_query_args = array(); |
| 60 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
| 61 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
| 60 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
| 61 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
| 62 | 62 | } |
| 63 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
| 63 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
| 64 | 64 | } |
| 65 | 65 | parent::__construct($admin_page); |
| 66 | 66 | $this->_status = $this->_admin_page->get_registration_status_array(); |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | * @return void |
| 76 | 76 | */ |
| 77 | 77 | protected function _setup_data() { |
| 78 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
| 79 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
| 78 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
| 79 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -93,30 +93,30 @@ discard block |
||
| 93 | 93 | 'ajax' => TRUE, |
| 94 | 94 | 'screen' => $this->_admin_page->get_current_screen()->id |
| 95 | 95 | ); |
| 96 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
| 96 | + $ID_column_name = __('ID', 'event_espresso'); |
|
| 97 | 97 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
| 98 | - $ID_column_name .= __( 'Registrant Name', 'event_espresso' ); |
|
| 98 | + $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
| 99 | 99 | $ID_column_name .= '</span> '; |
| 100 | - if ( isset( $_GET['event_id'] )) { |
|
| 100 | + if (isset($_GET['event_id'])) { |
|
| 101 | 101 | $this->_columns = array( |
| 102 | 102 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
| 103 | 103 | '_REG_ID' => $ID_column_name, |
| 104 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
| 104 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
| 105 | 105 | 'ATT_email' => __('Email', 'event_espresso'), |
| 106 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
| 107 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
| 108 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
| 109 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
| 106 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
| 107 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
| 108 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
| 109 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
| 110 | 110 | 'TXN_paid' => __('Paid', 'event_espresso'), |
| 111 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
| 111 | + 'actions' => __('Actions', 'event_espresso') |
|
| 112 | 112 | ); |
| 113 | 113 | $this->_bottom_buttons = array( |
| 114 | 114 | 'report'=> array( |
| 115 | 115 | 'route' => 'registrations_report', |
| 116 | 116 | 'extra_request' => |
| 117 | 117 | array( |
| 118 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
| 119 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) |
|
| 118 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
| 119 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") |
|
| 120 | 120 | ) |
| 121 | 121 | ), |
| 122 | 122 | ); |
@@ -124,19 +124,19 @@ discard block |
||
| 124 | 124 | $this->_columns = array( |
| 125 | 125 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
| 126 | 126 | '_REG_ID' => $ID_column_name, |
| 127 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
| 128 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
| 129 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
| 130 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
| 131 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
| 132 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
| 133 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
| 127 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
| 128 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
| 129 | + 'event_name' => __('Event', 'event_espresso'), |
|
| 130 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
| 131 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
| 132 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
| 133 | + 'actions' => __('Actions', 'event_espresso') |
|
| 134 | 134 | ); |
| 135 | 135 | $this->_bottom_buttons = array( |
| 136 | 136 | 'report_all'=> array( |
| 137 | 137 | 'route' => 'registrations_report', |
| 138 | 138 | 'extra_request' => array( |
| 139 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
| 139 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
| 140 | 140 | ), |
| 141 | 141 | ); |
| 142 | 142 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | $this->_primary_column = '_REG_ID'; |
| 145 | 145 | |
| 146 | 146 | $this->_sortable_columns = array( |
| 147 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
| 148 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
| 149 | - 'event_name' => array( 'event_name' => FALSE ), |
|
| 150 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
| 151 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
| 147 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
| 148 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
| 149 | + 'event_name' => array('event_name' => FALSE), |
|
| 150 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
| 151 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
| 152 | 152 | ); |
| 153 | 153 | |
| 154 | 154 | $this->_hidden_columns = array(); |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | * @param EE_Registration $item the current item |
| 163 | 163 | * @return string |
| 164 | 164 | */ |
| 165 | - protected function _get_row_class( $item ) { |
|
| 166 | - $class = parent::_get_row_class( $item ); |
|
| 165 | + protected function _get_row_class($item) { |
|
| 166 | + $class = parent::_get_row_class($item); |
|
| 167 | 167 | //add status class |
| 168 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
| 169 | - if ( $this->_has_checkbox_column ) { |
|
| 168 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
| 169 | + if ($this->_has_checkbox_column) { |
|
| 170 | 170 | $class .= ' has-checkbox-column'; |
| 171 | 171 | } |
| 172 | 172 | return $class; |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | * @param EE_Registration $registration |
| 181 | 181 | * @throws \EE_Error |
| 182 | 182 | */ |
| 183 | - protected function _set_related_details( EE_Registration $registration ) { |
|
| 183 | + protected function _set_related_details(EE_Registration $registration) { |
|
| 184 | 184 | |
| 185 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
| 185 | + $transaction = $registration->get_first_related('Transaction'); |
|
| 186 | 186 | $status = $transaction instanceof EE_Transaction |
| 187 | 187 | ? $transaction->status_ID() |
| 188 | 188 | : EEM_Transaction::failed_status_code; |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | 'status' => $status, |
| 192 | 192 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
| 193 | 193 | 'title_attr' => sprintf( |
| 194 | - __( 'View Transaction Details (%s)', 'event_espresso' ), |
|
| 195 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
| 194 | + __('View Transaction Details (%s)', 'event_espresso'), |
|
| 195 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
| 196 | 196 | ) |
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | 199 | try { |
| 200 | 200 | $event = $registration->event(); |
| 201 | - } catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) { |
|
| 201 | + } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
|
| 202 | 202 | $event = null; |
| 203 | 203 | } |
| 204 | 204 | $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive; |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | 'status' => $status, |
| 208 | 208 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
| 209 | 209 | 'title_attr' => sprintf( |
| 210 | - __( 'Edit Event (%s)', 'event_espresso' ), |
|
| 211 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
| 210 | + __('Edit Event (%s)', 'event_espresso'), |
|
| 211 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
| 212 | 212 | ) |
| 213 | 213 | ); |
| 214 | 214 | } |
@@ -225,30 +225,30 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
| 227 | 227 | |
| 228 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
| 229 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
| 230 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
| 228 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
| 229 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
| 230 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
| 231 | 231 | |
| 232 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
| 233 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
| 232 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
| 233 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
| 234 | 234 | |
| 235 | 235 | $status = array(); |
| 236 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
| 237 | - foreach ( $this->_status as $key => $value ) { |
|
| 238 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
| 236 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
| 237 | + foreach ($this->_status as $key => $value) { |
|
| 238 | + $status[] = array('id' => $key, 'text' => $value); |
|
| 239 | 239 | } |
| 240 | - if ( $this->_view !== 'incomplete' ) { |
|
| 240 | + if ($this->_view !== 'incomplete') { |
|
| 241 | 241 | $filters[] = EEH_Form_Fields::select_input( |
| 242 | 242 | '_reg_status', |
| 243 | 243 | $status, |
| 244 | - isset( $this->_req_data['_reg_status'] ) |
|
| 245 | - ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) |
|
| 244 | + isset($this->_req_data['_reg_status']) |
|
| 245 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
| 246 | 246 | : '' |
| 247 | 247 | ); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
| 251 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
| 250 | + if (isset($this->_req_data['event_id'])) { |
|
| 251 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | return $filters; |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | $this->_views['all']['count'] = $this->_total_registrations(); |
| 268 | 268 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
| 269 | 269 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
| 270 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
| 271 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
| 272 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
| 270 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
| 271 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
| 272 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | |
@@ -283,23 +283,23 @@ discard block |
||
| 283 | 283 | * @return int |
| 284 | 284 | * @throws \EE_Error |
| 285 | 285 | */ |
| 286 | - protected function _total_registrations( $view = '' ){ |
|
| 286 | + protected function _total_registrations($view = '') { |
|
| 287 | 287 | $_where = array(); |
| 288 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
| 289 | - if( $EVT_ID ) { |
|
| 288 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
| 289 | + if ($EVT_ID) { |
|
| 290 | 290 | $_where['EVT_ID'] = $EVT_ID; |
| 291 | 291 | } |
| 292 | - switch ( $view ) { |
|
| 292 | + switch ($view) { |
|
| 293 | 293 | case 'trash' : |
| 294 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
| 294 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
| 295 | 295 | break; |
| 296 | 296 | case 'incomplete' : |
| 297 | 297 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
| 298 | 298 | break; |
| 299 | 299 | default : |
| 300 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
| 300 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 301 | 301 | } |
| 302 | - return EEM_Registration::instance()->count( array( $_where )); |
|
| 302 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
@@ -311,32 +311,32 @@ discard block |
||
| 311 | 311 | * @return int |
| 312 | 312 | * @throws \EE_Error |
| 313 | 313 | */ |
| 314 | - protected function _total_registrations_this_month(){ |
|
| 315 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
| 316 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
| 314 | + protected function _total_registrations_this_month() { |
|
| 315 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
| 316 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
| 317 | 317 | $this_year_r = date('Y', current_time('timestamp')); |
| 318 | 318 | $time_start = ' 00:00:00'; |
| 319 | 319 | $time_end = ' 23:59:59'; |
| 320 | 320 | $this_month_r = date('m', current_time('timestamp')); |
| 321 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
| 321 | + $days_this_month = date('t', current_time('timestamp')); |
|
| 322 | 322 | //setup date query. |
| 323 | 323 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
| 324 | 324 | 'REG_date', |
| 325 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
| 325 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
| 326 | 326 | 'Y-m-d H:i:s' |
| 327 | 327 | ); |
| 328 | 328 | $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
| 329 | 329 | 'REG_date', |
| 330 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
| 330 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
| 331 | 331 | 'Y-m-d H:i:s' |
| 332 | 332 | ); |
| 333 | - $_where['REG_date']= array('BETWEEN', |
|
| 333 | + $_where['REG_date'] = array('BETWEEN', |
|
| 334 | 334 | array( |
| 335 | 335 | $beginning_string, |
| 336 | 336 | $end_string |
| 337 | 337 | )); |
| 338 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
| 339 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
| 338 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 339 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | |
@@ -348,20 +348,20 @@ discard block |
||
| 348 | 348 | * @return int |
| 349 | 349 | * @throws \EE_Error |
| 350 | 350 | */ |
| 351 | - protected function _total_registrations_today(){ |
|
| 351 | + protected function _total_registrations_today() { |
|
| 352 | 352 | |
| 353 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
| 354 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
| 353 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
| 354 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
| 355 | 355 | $current_date = date('Y-m-d', current_time('timestamp')); |
| 356 | 356 | $time_start = ' 00:00:00'; |
| 357 | 357 | $time_end = ' 23:59:59'; |
| 358 | - $_where['REG_date']= array('BETWEEN', |
|
| 358 | + $_where['REG_date'] = array('BETWEEN', |
|
| 359 | 359 | array( |
| 360 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
| 361 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
| 360 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
| 361 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
| 362 | 362 | )); |
| 363 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
| 364 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
| 363 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 364 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
@@ -374,12 +374,12 @@ discard block |
||
| 374 | 374 | * @return string |
| 375 | 375 | * @throws \EE_Error |
| 376 | 376 | */ |
| 377 | - public function column_cb($item){ |
|
| 377 | + public function column_cb($item) { |
|
| 378 | 378 | /** checkbox/lock **/ |
| 379 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
| 380 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
| 379 | + $transaction = $item->get_first_related('Transaction'); |
|
| 380 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
| 381 | 381 | return $payment_count > 0 |
| 382 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
| 382 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()) |
|
| 383 | 383 | . '<span class="ee-lock-icon"></span>' |
| 384 | 384 | : sprintf( |
| 385 | 385 | '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
@@ -397,14 +397,14 @@ discard block |
||
| 397 | 397 | * @return string |
| 398 | 398 | * @throws \EE_Error |
| 399 | 399 | */ |
| 400 | - public function column__REG_ID(EE_Registration $item){ |
|
| 400 | + public function column__REG_ID(EE_Registration $item) { |
|
| 401 | 401 | $attendee = $item->attendee(); |
| 402 | 402 | $content = $item->ID(); |
| 403 | 403 | $content .= '<div class="show-on-mobile-view-only">'; |
| 404 | 404 | $content .= '<br>'; |
| 405 | 405 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
| 406 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 407 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
| 406 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 407 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 408 | 408 | $content .= '</div>'; |
| 409 | 409 | return $content; |
| 410 | 410 | } |
@@ -419,12 +419,12 @@ discard block |
||
| 419 | 419 | * @return string |
| 420 | 420 | * @throws \EE_Error |
| 421 | 421 | */ |
| 422 | - public function column__REG_date(EE_Registration $item){ |
|
| 422 | + public function column__REG_date(EE_Registration $item) { |
|
| 423 | 423 | $this->_set_related_details($item); |
| 424 | 424 | //Build row actions |
| 425 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
| 426 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
| 427 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
| 425 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
| 426 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
| 427 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
| 428 | 428 | return $view_link; |
| 429 | 429 | } |
| 430 | 430 | |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | * @return string |
| 439 | 439 | * @throws \EE_Error |
| 440 | 440 | */ |
| 441 | - public function column_event_name(EE_Registration $item){ |
|
| 442 | - $this->_set_related_details( $item ); |
|
| 441 | + public function column_event_name(EE_Registration $item) { |
|
| 442 | + $this->_set_related_details($item); |
|
| 443 | 443 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
| 444 | 444 | $EVT_ID = $item->event_ID(); |
| 445 | 445 | $event_name = $item->event_name(); |
@@ -449,21 +449,21 @@ discard block |
||
| 449 | 449 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID), |
| 450 | 450 | EVENTS_ADMIN_URL); |
| 451 | 451 | $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
| 452 | - ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>' |
|
| 452 | + ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.$event_name.'</a>' |
|
| 453 | 453 | : $event_name; |
| 454 | 454 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
| 455 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
| 455 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'; |
|
| 456 | 456 | $actions['event_filter'] .= sprintf( |
| 457 | 457 | esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
| 458 | 458 | $event_name |
| 459 | 459 | ); |
| 460 | - $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
| 460 | + $actions['event_filter'] .= '">'.__('View Registrations', 'event_espresso').'</a>'; |
|
| 461 | 461 | } else { |
| 462 | 462 | $edit_event = $event_name; |
| 463 | 463 | $actions['event_filter'] = ''; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
| 466 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | |
@@ -476,18 +476,18 @@ discard block |
||
| 476 | 476 | * @return string |
| 477 | 477 | * @throws \EE_Error |
| 478 | 478 | */ |
| 479 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
| 479 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
| 480 | 480 | $datetime_strings = array(); |
| 481 | - $ticket = $item->ticket( TRUE ); |
|
| 482 | - if ( $ticket instanceof EE_Ticket ) { |
|
| 481 | + $ticket = $item->ticket(TRUE); |
|
| 482 | + if ($ticket instanceof EE_Ticket) { |
|
| 483 | 483 | $remove_defaults = array('default_where_conditions' => 'none'); |
| 484 | 484 | $datetimes = $ticket->datetimes($remove_defaults); |
| 485 | - foreach($datetimes as $datetime){ |
|
| 486 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
| 485 | + foreach ($datetimes as $datetime) { |
|
| 486 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
| 487 | 487 | } |
| 488 | - return implode("<br />",$datetime_strings); |
|
| 488 | + return implode("<br />", $datetime_strings); |
|
| 489 | 489 | } else { |
| 490 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
| 490 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
@@ -501,17 +501,17 @@ discard block |
||
| 501 | 501 | * @return string |
| 502 | 502 | * @throws \EE_Error |
| 503 | 503 | */ |
| 504 | - public function column_ATT_fname(EE_Registration $item){ |
|
| 504 | + public function column_ATT_fname(EE_Registration $item) { |
|
| 505 | 505 | $attendee = $item->attendee(); |
| 506 | 506 | |
| 507 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 507 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 508 | 508 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
| 509 | 509 | $link = EE_Registry::instance()->CAP->current_user_can( |
| 510 | 510 | 'ee_read_registration', |
| 511 | 511 | 'espresso_registrations_view_registration', |
| 512 | 512 | $item->ID() |
| 513 | 513 | ) |
| 514 | - ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' |
|
| 514 | + ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' |
|
| 515 | 515 | : $attendee_name; |
| 516 | 516 | $link .= $item->count() === 1 |
| 517 | 517 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' |
@@ -521,33 +521,33 @@ discard block |
||
| 521 | 521 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
| 522 | 522 | |
| 523 | 523 | //append group count to name |
| 524 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 524 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 525 | 525 | |
| 526 | 526 | //append reg_code |
| 527 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
| 527 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 528 | 528 | |
| 529 | 529 | //reg status text for accessibility |
| 530 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
| 530 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
| 531 | 531 | |
| 532 | 532 | //trash/restore/delete actions |
| 533 | 533 | $actions = array(); |
| 534 | - if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
| 535 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 536 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
| 537 | - } elseif ( $this->_view === 'trash' ) { |
|
| 534 | + if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
| 535 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 536 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
| 537 | + } elseif ($this->_view === 'trash') { |
|
| 538 | 538 | // restore registration link |
| 539 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
| 540 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 541 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
| 539 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
| 540 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 541 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
| 542 | 542 | } |
| 543 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
| 544 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 543 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
| 544 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 545 | 545 | |
| 546 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
| 546 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
| 547 | 547 | } |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
| 550 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | * @return string |
| 561 | 561 | * @throws \EE_Error |
| 562 | 562 | */ |
| 563 | - public function column_ATT_email( EE_Registration $item ) { |
|
| 563 | + public function column_ATT_email(EE_Registration $item) { |
|
| 564 | 564 | $attendee = $item->get_first_related('Attendee'); |
| 565 | 565 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
| 566 | 566 | } |
@@ -574,8 +574,8 @@ discard block |
||
| 574 | 574 | * @param \EE_Registration $item |
| 575 | 575 | * @return string |
| 576 | 576 | */ |
| 577 | - public function column__REG_count(EE_Registration $item){ |
|
| 578 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
| 577 | + public function column__REG_count(EE_Registration $item) { |
|
| 578 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | |
@@ -587,16 +587,16 @@ discard block |
||
| 587 | 587 | * @param \EE_Registration $item |
| 588 | 588 | * @return string |
| 589 | 589 | */ |
| 590 | - public function column_PRC_amount(EE_Registration $item){ |
|
| 590 | + public function column_PRC_amount(EE_Registration $item) { |
|
| 591 | 591 | $ticket = $item->ticket(); |
| 592 | 592 | |
| 593 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
| 593 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
| 594 | 594 | |
| 595 | - if ( $item->final_price() > 0 ) { |
|
| 596 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 595 | + if ($item->final_price() > 0) { |
|
| 596 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
| 597 | 597 | } else { |
| 598 | 598 | // free event |
| 599 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
| 599 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | return $content; |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | * @param \EE_Registration $item |
| 613 | 613 | * @return string |
| 614 | 614 | */ |
| 615 | - public function column__REG_final_price(EE_Registration $item){ |
|
| 615 | + public function column__REG_final_price(EE_Registration $item) { |
|
| 616 | 616 | $ticket = $item->ticket(); |
| 617 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
| 617 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
| 618 | 618 | |
| 619 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 619 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
| 620 | 620 | return $content; |
| 621 | 621 | |
| 622 | 622 | } |
@@ -630,13 +630,13 @@ discard block |
||
| 630 | 630 | * @param \EE_Registration $item |
| 631 | 631 | * @return string |
| 632 | 632 | */ |
| 633 | - public function column__REG_paid(EE_Registration $item){ |
|
| 633 | + public function column__REG_paid(EE_Registration $item) { |
|
| 634 | 634 | $payment_method = $item->payment_method(); |
| 635 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
| 635 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
| 636 | 636 | |
| 637 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
| 638 | - if ( $item->paid() > 0 ) { |
|
| 639 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
| 637 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
| 638 | + if ($item->paid() > 0) { |
|
| 639 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
| 640 | 640 | } |
| 641 | 641 | return $content; |
| 642 | 642 | } |
@@ -651,11 +651,11 @@ discard block |
||
| 651 | 651 | * @return string |
| 652 | 652 | * @throws \EE_Error |
| 653 | 653 | */ |
| 654 | - public function column_TXN_total(EE_Registration $item){ |
|
| 655 | - if($item->transaction()){ |
|
| 656 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
| 657 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
| 658 | - }else{ |
|
| 654 | + public function column_TXN_total(EE_Registration $item) { |
|
| 655 | + if ($item->transaction()) { |
|
| 656 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
| 657 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
| 658 | + } else { |
|
| 659 | 659 | return __("None", "event_espresso"); |
| 660 | 660 | } |
| 661 | 661 | } |
@@ -670,15 +670,15 @@ discard block |
||
| 670 | 670 | * @return string |
| 671 | 671 | * @throws \EE_Error |
| 672 | 672 | */ |
| 673 | - public function column_TXN_paid(EE_Registration $item){ |
|
| 673 | + public function column_TXN_paid(EE_Registration $item) { |
|
| 674 | 674 | |
| 675 | - if ( $item->count() === 1 ) { |
|
| 675 | + if ($item->count() === 1) { |
|
| 676 | 676 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
| 677 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
| 677 | + if ($transaction->paid() >= $transaction->total()) { |
|
| 678 | 678 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
| 679 | 679 | } else { |
| 680 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
| 681 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
| 680 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
| 681 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
| 682 | 682 | } |
| 683 | 683 | } |
| 684 | 684 | |
@@ -699,42 +699,42 @@ discard block |
||
| 699 | 699 | public function column_actions(EE_Registration $item) { |
| 700 | 700 | $actions = array(); |
| 701 | 701 | $attendee = $item->attendee(); |
| 702 | - $this->_set_related_details( $item ); |
|
| 702 | + $this->_set_related_details($item); |
|
| 703 | 703 | |
| 704 | 704 | //Build row actions |
| 705 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
| 706 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
| 705 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
| 706 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
| 707 | 707 | |
| 708 | 708 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
| 709 | 709 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
| 710 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
| 710 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
| 711 | 711 | |
| 712 | 712 | |
| 713 | 713 | //Build row actions |
| 714 | - $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
| 714 | + $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
| 715 | 715 | <li> |
| 716 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
| 716 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
| 717 | 717 | <div class="dashicons dashicons-clipboard"></div> |
| 718 | 718 | </a> |
| 719 | 719 | </li>' : ''; |
| 720 | - $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
| 720 | + $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
| 721 | 721 | <li> |
| 722 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
| 722 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
| 723 | 723 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
| 724 | 724 | </a> |
| 725 | 725 | </li>' : ''; |
| 726 | - $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
| 726 | + $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
| 727 | 727 | <li> |
| 728 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
| 728 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
| 729 | 729 | <div class="dashicons dashicons-email-alt"></div> |
| 730 | 730 | </a> |
| 731 | 731 | </li>' : ''; |
| 732 | 732 | |
| 733 | 733 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
| 734 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
| 735 | - $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
| 734 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
| 735 | + $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
| 736 | 736 | <li> |
| 737 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '"> |
|
| 737 | + <a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'"> |
|
| 738 | 738 | <div class="dashicons dashicons-cart"></div> |
| 739 | 739 | </a> |
| 740 | 740 | </li>' : ''; |
@@ -743,17 +743,17 @@ discard block |
||
| 743 | 743 | $actions['dl_invoice_lnk'] = ''; |
| 744 | 744 | $dl_invoice_lnk_url = $item->invoice_url(); |
| 745 | 745 | //only show invoice link if message type is active. |
| 746 | - if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
| 746 | + if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) { |
|
| 747 | 747 | $actions['dl_invoice_lnk'] = ' |
| 748 | 748 | <li> |
| 749 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
| 749 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
| 750 | 750 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
| 751 | 751 | </a> |
| 752 | 752 | </li>'; |
| 753 | 753 | } |
| 754 | 754 | $actions['filtered_messages_link'] = ''; |
| 755 | 755 | //message list table link (filtered by REG_ID |
| 756 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
| 756 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
| 757 | 757 | $actions['filtered_messages_link'] = '<li>' |
| 758 | 758 | . EEH_MSG_Template::get_message_action_link( |
| 759 | 759 | 'see_notifications_for', |
@@ -764,9 +764,9 @@ discard block |
||
| 764 | 764 | ) |
| 765 | 765 | . '</li>'; |
| 766 | 766 | } |
| 767 | - $actions = apply_filters( 'FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this ); |
|
| 767 | + $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
|
| 768 | 768 | return $this->_action_string( |
| 769 | - implode( '', $actions ), |
|
| 769 | + implode('', $actions), |
|
| 770 | 770 | $item, |
| 771 | 771 | 'ul', |
| 772 | 772 | 'reg-overview-actions-ul' |