@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function __construct(Registrations_Admin_Page $admin_page) |
| 55 | 55 | { |
| 56 | - if (! empty($_GET['event_id'])) { |
|
| 56 | + if ( ! empty($_GET['event_id'])) { |
|
| 57 | 57 | $extra_query_args = array(); |
| 58 | 58 | foreach ($admin_page->get_views() as $key => $view_details) { |
| 59 | - $extra_query_args[ $view_details['slug'] ] = array('event_id' => $_GET['event_id']); |
|
| 59 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
| 60 | 60 | } |
| 61 | 61 | $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
| 62 | 62 | } |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | ) |
| 157 | 157 | ) |
| 158 | 158 | ); |
| 159 | - if (!empty($filters)) { |
|
| 159 | + if ( ! empty($filters)) { |
|
| 160 | 160 | $this->_bottom_buttons['report_filtered']['extra_request']['filters'] = $filters; |
| 161 | 161 | } |
| 162 | 162 | $this->_primary_column = '_REG_ID'; |
| 163 | 163 | $this->_sortable_columns = array( |
| 164 | - '_REG_date' => array('_REG_date' => true), // true means its already sorted |
|
| 164 | + '_REG_date' => array('_REG_date' => true), // true means its already sorted |
|
| 165 | 165 | /** |
| 166 | 166 | * Allows users to change the default sort if they wish. |
| 167 | 167 | * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | $class = parent::_get_row_class($item); |
| 195 | 195 | // add status class |
| 196 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
| 196 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
| 197 | 197 | if ($this->_has_checkbox_column) { |
| 198 | 198 | $class .= ' has-checkbox-column'; |
| 199 | 199 | } |
@@ -358,12 +358,12 @@ discard block |
||
| 358 | 358 | // setup date query. |
| 359 | 359 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
| 360 | 360 | 'REG_date', |
| 361 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
| 361 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
| 362 | 362 | 'Y-m-d H:i:s' |
| 363 | 363 | ); |
| 364 | 364 | $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
| 365 | 365 | 'REG_date', |
| 366 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
| 366 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
| 367 | 367 | 'Y-m-d H:i:s' |
| 368 | 368 | ); |
| 369 | 369 | $_where['REG_date'] = array( |
@@ -400,12 +400,12 @@ discard block |
||
| 400 | 400 | array( |
| 401 | 401 | EEM_Registration::instance()->convert_datetime_for_query( |
| 402 | 402 | 'REG_date', |
| 403 | - $current_date . $time_start, |
|
| 403 | + $current_date.$time_start, |
|
| 404 | 404 | 'Y-m-d H:i:s' |
| 405 | 405 | ), |
| 406 | 406 | EEM_Registration::instance()->convert_datetime_for_query( |
| 407 | 407 | 'REG_date', |
| 408 | - $current_date . $time_end, |
|
| 408 | + $current_date.$time_end, |
|
| 409 | 409 | 'Y-m-d H:i:s' |
| 410 | 410 | ), |
| 411 | 411 | ), |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | $content .= '<div class="show-on-mobile-view-only">'; |
| 466 | 466 | $content .= '<br>'; |
| 467 | 467 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
| 468 | - $content .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 469 | - $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 468 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 469 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 470 | 470 | $content .= '</div>'; |
| 471 | 471 | return $content; |
| 472 | 472 | } |
@@ -551,12 +551,12 @@ discard block |
||
| 551 | 551 | . $event_name |
| 552 | 552 | . '</a>' : $event_name; |
| 553 | 553 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
| 554 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
| 554 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'; |
|
| 555 | 555 | $actions['event_filter'] .= sprintf( |
| 556 | 556 | esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
| 557 | 557 | $event_name |
| 558 | 558 | ); |
| 559 | - $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
| 559 | + $actions['event_filter'] .= '">'.__('View Registrations', 'event_espresso').'</a>'; |
|
| 560 | 560 | } else { |
| 561 | 561 | $edit_event = $event_name; |
| 562 | 562 | $actions['event_filter'] = ''; |
@@ -603,11 +603,11 @@ discard block |
||
| 603 | 603 | { |
| 604 | 604 | $content = '<div class="ee-registration-event-datetimes-container">'; |
| 605 | 605 | $expand_toggle = count($datetime_strings) > 1 |
| 606 | - ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
| 606 | + ? ' <span title="'.esc_attr__('Click to view all dates', 'event_espresso') |
|
| 607 | 607 | . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
| 608 | 608 | : ''; |
| 609 | 609 | // get first item for initial visibility |
| 610 | - $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
| 610 | + $content .= '<div class="left">'.array_shift($datetime_strings).'</div>'; |
|
| 611 | 611 | $content .= $expand_toggle; |
| 612 | 612 | if ($datetime_strings) { |
| 613 | 613 | $content .= '<div style="clear:both"></div>'; |
@@ -660,9 +660,9 @@ discard block |
||
| 660 | 660 | $t = $item->get_first_related('Transaction'); |
| 661 | 661 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
| 662 | 662 | // append group count to name |
| 663 | - $link .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 663 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 664 | 664 | // append reg_code |
| 665 | - $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 665 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 666 | 666 | // reg status text for accessibility |
| 667 | 667 | $link .= '<br><span class="ee-status-text-small">' |
| 668 | 668 | . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | . $trash_lnk_url |
| 688 | 688 | . '" title="' |
| 689 | 689 | . esc_attr__('Trash Registration', 'event_espresso') |
| 690 | - . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
| 690 | + . '">'.__('Trash', 'event_espresso').'</a>'; |
|
| 691 | 691 | } elseif ($this->_view === 'trash') { |
| 692 | 692 | // restore registration link |
| 693 | 693 | if (EE_Registry::instance()->CAP->current_user_can( |
@@ -705,8 +705,8 @@ discard block |
||
| 705 | 705 | $actions['restore'] = '<a href="' |
| 706 | 706 | . $restore_lnk_url |
| 707 | 707 | . '" title="' |
| 708 | - . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
| 709 | - . __('Restore', 'event_espresso') . '</a>'; |
|
| 708 | + . esc_attr__('Restore Registration', 'event_espresso').'">' |
|
| 709 | + . __('Restore', 'event_espresso').'</a>'; |
|
| 710 | 710 | } |
| 711 | 711 | if (EE_Registry::instance()->CAP->current_user_can( |
| 712 | 712 | 'ee_delete_registration', |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | . $ticket->name() |
| 782 | 782 | . '</span><br />' : ''; |
| 783 | 783 | if ($item->final_price() > 0) { |
| 784 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 784 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
| 785 | 785 | } else { |
| 786 | 786 | // free event |
| 787 | 787 | $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | : '<span class="TKT_name">' |
| 809 | 809 | . $ticket->name() |
| 810 | 810 | . '</span><br />'; |
| 811 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 811 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
| 812 | 812 | return $content; |
| 813 | 813 | } |
| 814 | 814 | |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | $payment_method = $item->payment_method(); |
| 827 | 827 | $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() |
| 828 | 828 | : __('Unknown', 'event_espresso'); |
| 829 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
| 829 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
| 830 | 830 | if ($item->paid() > 0) { |
| 831 | 831 | $content .= '<br><span class="ee-status-text-small">' |
| 832 | 832 | . sprintf( |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | . esc_attr__('View Transaction', 'event_espresso') |
| 875 | 875 | . '">' |
| 876 | 876 | . $item->transaction()->pretty_total() |
| 877 | - . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
| 877 | + . '</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
| 878 | 878 | } else { |
| 879 | 879 | return __("None", "event_espresso"); |
| 880 | 880 | } |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | . esc_attr__('View Transaction', 'event_espresso') |
| 921 | 921 | . '">' |
| 922 | 922 | . $item->transaction()->pretty_paid() |
| 923 | - . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
| 923 | + . '</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
| 924 | 924 | } |
| 925 | 925 | } |
| 926 | 926 | return ' '; |
@@ -990,8 +990,8 @@ discard block |
||
| 990 | 990 | && $attendee instanceof EE_Attendee |
| 991 | 991 | ? ' |
| 992 | 992 | <li> |
| 993 | - <a href="' . $edit_lnk_url . '" title="' |
|
| 994 | - . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text"> |
|
| 993 | + <a href="' . $edit_lnk_url.'" title="' |
|
| 994 | + . esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
| 995 | 995 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
| 996 | 996 | </a> |
| 997 | 997 | </li>' : ''; |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | 'see_notifications_for', |
| 1064 | 1064 | null, |
| 1065 | 1065 | array('_REG_ID' => $item->ID()) |
| 1066 | - ) . '</li>'; |
|
| 1066 | + ).'</li>'; |
|
| 1067 | 1067 | } |
| 1068 | 1068 | $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
| 1069 | 1069 | return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul'); |
@@ -24,1048 +24,1048 @@ |
||
| 24 | 24 | { |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var array |
|
| 29 | - */ |
|
| 30 | - private $_status; |
|
| 27 | + /** |
|
| 28 | + * @var array |
|
| 29 | + */ |
|
| 30 | + private $_status; |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * An array of transaction details for the related transaction to the registration being processed. |
|
| 35 | - * This is set via the _set_related_details method. |
|
| 36 | - * |
|
| 37 | - * @var array |
|
| 38 | - */ |
|
| 39 | - protected $_transaction_details = array(); |
|
| 33 | + /** |
|
| 34 | + * An array of transaction details for the related transaction to the registration being processed. |
|
| 35 | + * This is set via the _set_related_details method. |
|
| 36 | + * |
|
| 37 | + * @var array |
|
| 38 | + */ |
|
| 39 | + protected $_transaction_details = array(); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * An array of event details for the related event to the registration being processed. |
|
| 44 | - * This is set via the _set_related_details method. |
|
| 45 | - * |
|
| 46 | - * @var array |
|
| 47 | - */ |
|
| 48 | - protected $_event_details = array(); |
|
| 42 | + /** |
|
| 43 | + * An array of event details for the related event to the registration being processed. |
|
| 44 | + * This is set via the _set_related_details method. |
|
| 45 | + * |
|
| 46 | + * @var array |
|
| 47 | + */ |
|
| 48 | + protected $_event_details = array(); |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param \Registrations_Admin_Page $admin_page |
|
| 53 | - */ |
|
| 54 | - public function __construct(Registrations_Admin_Page $admin_page) |
|
| 55 | - { |
|
| 56 | - if (! empty($_GET['event_id'])) { |
|
| 57 | - $extra_query_args = array(); |
|
| 58 | - foreach ($admin_page->get_views() as $key => $view_details) { |
|
| 59 | - $extra_query_args[ $view_details['slug'] ] = array('event_id' => $_GET['event_id']); |
|
| 60 | - } |
|
| 61 | - $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
| 62 | - } |
|
| 63 | - parent::__construct($admin_page); |
|
| 64 | - $this->_status = $this->_admin_page->get_registration_status_array(); |
|
| 65 | - } |
|
| 51 | + /** |
|
| 52 | + * @param \Registrations_Admin_Page $admin_page |
|
| 53 | + */ |
|
| 54 | + public function __construct(Registrations_Admin_Page $admin_page) |
|
| 55 | + { |
|
| 56 | + if (! empty($_GET['event_id'])) { |
|
| 57 | + $extra_query_args = array(); |
|
| 58 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
| 59 | + $extra_query_args[ $view_details['slug'] ] = array('event_id' => $_GET['event_id']); |
|
| 60 | + } |
|
| 61 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
| 62 | + } |
|
| 63 | + parent::__construct($admin_page); |
|
| 64 | + $this->_status = $this->_admin_page->get_registration_status_array(); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * _setup_data |
|
| 70 | - * |
|
| 71 | - * @access protected |
|
| 72 | - * @return void |
|
| 73 | - */ |
|
| 74 | - protected function _setup_data() |
|
| 75 | - { |
|
| 76 | - $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
| 77 | - $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false); |
|
| 78 | - } |
|
| 68 | + /** |
|
| 69 | + * _setup_data |
|
| 70 | + * |
|
| 71 | + * @access protected |
|
| 72 | + * @return void |
|
| 73 | + */ |
|
| 74 | + protected function _setup_data() |
|
| 75 | + { |
|
| 76 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
| 77 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * _set_properties |
|
| 83 | - * |
|
| 84 | - * @access protected |
|
| 85 | - * @return void |
|
| 86 | - */ |
|
| 87 | - protected function _set_properties() |
|
| 88 | - { |
|
| 89 | - $this->_wp_list_args = array( |
|
| 90 | - 'singular' => __('registration', 'event_espresso'), |
|
| 91 | - 'plural' => __('registrations', 'event_espresso'), |
|
| 92 | - 'ajax' => true, |
|
| 93 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
| 94 | - ); |
|
| 95 | - $ID_column_name = __('ID', 'event_espresso'); |
|
| 96 | - $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
|
| 97 | - $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
| 98 | - $ID_column_name .= '</span> '; |
|
| 99 | - if (isset($_GET['event_id'])) { |
|
| 100 | - $this->_columns = array( |
|
| 101 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
| 102 | - '_REG_ID' => $ID_column_name, |
|
| 103 | - 'ATT_fname' => __('Name', 'event_espresso'), |
|
| 104 | - 'ATT_email' => __('Email', 'event_espresso'), |
|
| 105 | - '_REG_date' => __('Reg Date', 'event_espresso'), |
|
| 106 | - 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
| 107 | - '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
| 108 | - 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
| 109 | - 'TXN_paid' => __('Paid', 'event_espresso'), |
|
| 110 | - 'actions' => __('Actions', 'event_espresso'), |
|
| 111 | - ); |
|
| 112 | - $this->_bottom_buttons = array( |
|
| 113 | - 'report' => array( |
|
| 114 | - 'route' => 'registrations_report', |
|
| 115 | - 'extra_request' => array( |
|
| 116 | - 'EVT_ID' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
| 117 | - 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
| 118 | - ), |
|
| 119 | - ), |
|
| 120 | - ); |
|
| 121 | - } else { |
|
| 122 | - $this->_columns = array( |
|
| 123 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
| 124 | - '_REG_ID' => $ID_column_name, |
|
| 125 | - 'ATT_fname' => __('Name', 'event_espresso'), |
|
| 126 | - '_REG_date' => __('TXN Date', 'event_espresso'), |
|
| 127 | - 'event_name' => __('Event', 'event_espresso'), |
|
| 128 | - 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
| 129 | - '_REG_final_price' => __('Price', 'event_espresso'), |
|
| 130 | - '_REG_paid' => __('Paid', 'event_espresso'), |
|
| 131 | - 'actions' => __('Actions', 'event_espresso'), |
|
| 132 | - ); |
|
| 133 | - $this->_bottom_buttons = array( |
|
| 134 | - 'report_all' => array( |
|
| 135 | - 'route' => 'registrations_report', |
|
| 136 | - 'extra_request' => array( |
|
| 137 | - 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
| 138 | - ), |
|
| 139 | - ), |
|
| 140 | - ); |
|
| 141 | - } |
|
| 142 | - $this->_bottom_buttons['report_filtered'] = array( |
|
| 143 | - 'route' => 'registrations_report', |
|
| 144 | - 'extra_request' => array( |
|
| 145 | - 'use_filters' => true, |
|
| 146 | - 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
| 147 | - ), |
|
| 148 | - ); |
|
| 149 | - $filters = array_diff_key( |
|
| 150 | - $this->_req_data, |
|
| 151 | - array_flip( |
|
| 152 | - array( |
|
| 153 | - 'page', |
|
| 154 | - 'action', |
|
| 155 | - 'default_nonce', |
|
| 156 | - ) |
|
| 157 | - ) |
|
| 158 | - ); |
|
| 159 | - if (!empty($filters)) { |
|
| 160 | - $this->_bottom_buttons['report_filtered']['extra_request']['filters'] = $filters; |
|
| 161 | - } |
|
| 162 | - $this->_primary_column = '_REG_ID'; |
|
| 163 | - $this->_sortable_columns = array( |
|
| 164 | - '_REG_date' => array('_REG_date' => true), // true means its already sorted |
|
| 165 | - /** |
|
| 166 | - * Allows users to change the default sort if they wish. |
|
| 167 | - * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
| 168 | - * name. |
|
| 169 | - */ |
|
| 170 | - 'ATT_fname' => array( |
|
| 171 | - 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
| 172 | - true, |
|
| 173 | - $this, |
|
| 174 | - ) |
|
| 175 | - ? array('ATT_lname' => false) |
|
| 176 | - : array('ATT_fname' => false), |
|
| 177 | - 'event_name' => array('event_name' => false), |
|
| 178 | - 'DTT_EVT_start' => array('DTT_EVT_start' => false), |
|
| 179 | - '_REG_ID' => array('_REG_ID' => false), |
|
| 180 | - ); |
|
| 181 | - $this->_hidden_columns = array(); |
|
| 182 | - } |
|
| 81 | + /** |
|
| 82 | + * _set_properties |
|
| 83 | + * |
|
| 84 | + * @access protected |
|
| 85 | + * @return void |
|
| 86 | + */ |
|
| 87 | + protected function _set_properties() |
|
| 88 | + { |
|
| 89 | + $this->_wp_list_args = array( |
|
| 90 | + 'singular' => __('registration', 'event_espresso'), |
|
| 91 | + 'plural' => __('registrations', 'event_espresso'), |
|
| 92 | + 'ajax' => true, |
|
| 93 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
| 94 | + ); |
|
| 95 | + $ID_column_name = __('ID', 'event_espresso'); |
|
| 96 | + $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
|
| 97 | + $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
| 98 | + $ID_column_name .= '</span> '; |
|
| 99 | + if (isset($_GET['event_id'])) { |
|
| 100 | + $this->_columns = array( |
|
| 101 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
| 102 | + '_REG_ID' => $ID_column_name, |
|
| 103 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
| 104 | + 'ATT_email' => __('Email', 'event_espresso'), |
|
| 105 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
| 106 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
| 107 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
| 108 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
| 109 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
| 110 | + 'actions' => __('Actions', 'event_espresso'), |
|
| 111 | + ); |
|
| 112 | + $this->_bottom_buttons = array( |
|
| 113 | + 'report' => array( |
|
| 114 | + 'route' => 'registrations_report', |
|
| 115 | + 'extra_request' => array( |
|
| 116 | + 'EVT_ID' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
| 117 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
| 118 | + ), |
|
| 119 | + ), |
|
| 120 | + ); |
|
| 121 | + } else { |
|
| 122 | + $this->_columns = array( |
|
| 123 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
| 124 | + '_REG_ID' => $ID_column_name, |
|
| 125 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
| 126 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
| 127 | + 'event_name' => __('Event', 'event_espresso'), |
|
| 128 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
| 129 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
| 130 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
| 131 | + 'actions' => __('Actions', 'event_espresso'), |
|
| 132 | + ); |
|
| 133 | + $this->_bottom_buttons = array( |
|
| 134 | + 'report_all' => array( |
|
| 135 | + 'route' => 'registrations_report', |
|
| 136 | + 'extra_request' => array( |
|
| 137 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
| 138 | + ), |
|
| 139 | + ), |
|
| 140 | + ); |
|
| 141 | + } |
|
| 142 | + $this->_bottom_buttons['report_filtered'] = array( |
|
| 143 | + 'route' => 'registrations_report', |
|
| 144 | + 'extra_request' => array( |
|
| 145 | + 'use_filters' => true, |
|
| 146 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
| 147 | + ), |
|
| 148 | + ); |
|
| 149 | + $filters = array_diff_key( |
|
| 150 | + $this->_req_data, |
|
| 151 | + array_flip( |
|
| 152 | + array( |
|
| 153 | + 'page', |
|
| 154 | + 'action', |
|
| 155 | + 'default_nonce', |
|
| 156 | + ) |
|
| 157 | + ) |
|
| 158 | + ); |
|
| 159 | + if (!empty($filters)) { |
|
| 160 | + $this->_bottom_buttons['report_filtered']['extra_request']['filters'] = $filters; |
|
| 161 | + } |
|
| 162 | + $this->_primary_column = '_REG_ID'; |
|
| 163 | + $this->_sortable_columns = array( |
|
| 164 | + '_REG_date' => array('_REG_date' => true), // true means its already sorted |
|
| 165 | + /** |
|
| 166 | + * Allows users to change the default sort if they wish. |
|
| 167 | + * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
| 168 | + * name. |
|
| 169 | + */ |
|
| 170 | + 'ATT_fname' => array( |
|
| 171 | + 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
| 172 | + true, |
|
| 173 | + $this, |
|
| 174 | + ) |
|
| 175 | + ? array('ATT_lname' => false) |
|
| 176 | + : array('ATT_fname' => false), |
|
| 177 | + 'event_name' => array('event_name' => false), |
|
| 178 | + 'DTT_EVT_start' => array('DTT_EVT_start' => false), |
|
| 179 | + '_REG_ID' => array('_REG_ID' => false), |
|
| 180 | + ); |
|
| 181 | + $this->_hidden_columns = array(); |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | 184 | |
| 185 | - /** |
|
| 186 | - * This simply sets up the row class for the table rows. |
|
| 187 | - * Allows for easier overriding of child methods for setting up sorting. |
|
| 188 | - * |
|
| 189 | - * @param EE_Registration $item the current item |
|
| 190 | - * @return string |
|
| 191 | - */ |
|
| 192 | - protected function _get_row_class($item) |
|
| 193 | - { |
|
| 194 | - $class = parent::_get_row_class($item); |
|
| 195 | - // add status class |
|
| 196 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
| 197 | - if ($this->_has_checkbox_column) { |
|
| 198 | - $class .= ' has-checkbox-column'; |
|
| 199 | - } |
|
| 200 | - return $class; |
|
| 201 | - } |
|
| 185 | + /** |
|
| 186 | + * This simply sets up the row class for the table rows. |
|
| 187 | + * Allows for easier overriding of child methods for setting up sorting. |
|
| 188 | + * |
|
| 189 | + * @param EE_Registration $item the current item |
|
| 190 | + * @return string |
|
| 191 | + */ |
|
| 192 | + protected function _get_row_class($item) |
|
| 193 | + { |
|
| 194 | + $class = parent::_get_row_class($item); |
|
| 195 | + // add status class |
|
| 196 | + $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
| 197 | + if ($this->_has_checkbox_column) { |
|
| 198 | + $class .= ' has-checkbox-column'; |
|
| 199 | + } |
|
| 200 | + return $class; |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Set the $_transaction_details property if not set yet. |
|
| 206 | - * |
|
| 207 | - * @param EE_Registration $registration |
|
| 208 | - * @throws EE_Error |
|
| 209 | - * @throws InvalidArgumentException |
|
| 210 | - * @throws ReflectionException |
|
| 211 | - * @throws InvalidDataTypeException |
|
| 212 | - * @throws InvalidInterfaceException |
|
| 213 | - */ |
|
| 214 | - protected function _set_related_details(EE_Registration $registration) |
|
| 215 | - { |
|
| 216 | - $transaction = $registration->get_first_related('Transaction'); |
|
| 217 | - $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() |
|
| 218 | - : EEM_Transaction::failed_status_code; |
|
| 219 | - $this->_transaction_details = array( |
|
| 220 | - 'transaction' => $transaction, |
|
| 221 | - 'status' => $status, |
|
| 222 | - 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
|
| 223 | - 'title_attr' => sprintf( |
|
| 224 | - __('View Transaction Details (%s)', 'event_espresso'), |
|
| 225 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
| 226 | - ), |
|
| 227 | - ); |
|
| 228 | - try { |
|
| 229 | - $event = $registration->event(); |
|
| 230 | - } catch (EntityNotFoundException $e) { |
|
| 231 | - $event = null; |
|
| 232 | - } |
|
| 233 | - $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive; |
|
| 234 | - $this->_event_details = array( |
|
| 235 | - 'event' => $event, |
|
| 236 | - 'status' => $status, |
|
| 237 | - 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
|
| 238 | - 'title_attr' => sprintf( |
|
| 239 | - __('Edit Event (%s)', 'event_espresso'), |
|
| 240 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
| 241 | - ), |
|
| 242 | - ); |
|
| 243 | - } |
|
| 204 | + /** |
|
| 205 | + * Set the $_transaction_details property if not set yet. |
|
| 206 | + * |
|
| 207 | + * @param EE_Registration $registration |
|
| 208 | + * @throws EE_Error |
|
| 209 | + * @throws InvalidArgumentException |
|
| 210 | + * @throws ReflectionException |
|
| 211 | + * @throws InvalidDataTypeException |
|
| 212 | + * @throws InvalidInterfaceException |
|
| 213 | + */ |
|
| 214 | + protected function _set_related_details(EE_Registration $registration) |
|
| 215 | + { |
|
| 216 | + $transaction = $registration->get_first_related('Transaction'); |
|
| 217 | + $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() |
|
| 218 | + : EEM_Transaction::failed_status_code; |
|
| 219 | + $this->_transaction_details = array( |
|
| 220 | + 'transaction' => $transaction, |
|
| 221 | + 'status' => $status, |
|
| 222 | + 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
|
| 223 | + 'title_attr' => sprintf( |
|
| 224 | + __('View Transaction Details (%s)', 'event_espresso'), |
|
| 225 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
| 226 | + ), |
|
| 227 | + ); |
|
| 228 | + try { |
|
| 229 | + $event = $registration->event(); |
|
| 230 | + } catch (EntityNotFoundException $e) { |
|
| 231 | + $event = null; |
|
| 232 | + } |
|
| 233 | + $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive; |
|
| 234 | + $this->_event_details = array( |
|
| 235 | + 'event' => $event, |
|
| 236 | + 'status' => $status, |
|
| 237 | + 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
|
| 238 | + 'title_attr' => sprintf( |
|
| 239 | + __('Edit Event (%s)', 'event_espresso'), |
|
| 240 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
| 241 | + ), |
|
| 242 | + ); |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | 245 | |
| 246 | - /** |
|
| 247 | - * _get_table_filters |
|
| 248 | - * |
|
| 249 | - * @access protected |
|
| 250 | - * @return array |
|
| 251 | - */ |
|
| 252 | - protected function _get_table_filters() |
|
| 253 | - { |
|
| 254 | - $filters = array(); |
|
| 255 | - // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
| 256 | - // methods. |
|
| 257 | - $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
| 258 | - $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
| 259 | - $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
| 260 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
| 261 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
| 262 | - $status = array(); |
|
| 263 | - $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
| 264 | - foreach ($this->_status as $key => $value) { |
|
| 265 | - $status[] = array('id' => $key, 'text' => $value); |
|
| 266 | - } |
|
| 267 | - if ($this->_view !== 'incomplete') { |
|
| 268 | - $filters[] = EEH_Form_Fields::select_input( |
|
| 269 | - '_reg_status', |
|
| 270 | - $status, |
|
| 271 | - isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
| 272 | - : '' |
|
| 273 | - ); |
|
| 274 | - } |
|
| 275 | - if (isset($this->_req_data['event_id'])) { |
|
| 276 | - $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
| 277 | - } |
|
| 278 | - return $filters; |
|
| 279 | - } |
|
| 246 | + /** |
|
| 247 | + * _get_table_filters |
|
| 248 | + * |
|
| 249 | + * @access protected |
|
| 250 | + * @return array |
|
| 251 | + */ |
|
| 252 | + protected function _get_table_filters() |
|
| 253 | + { |
|
| 254 | + $filters = array(); |
|
| 255 | + // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
| 256 | + // methods. |
|
| 257 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
| 258 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
| 259 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
| 260 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
| 261 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
| 262 | + $status = array(); |
|
| 263 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
| 264 | + foreach ($this->_status as $key => $value) { |
|
| 265 | + $status[] = array('id' => $key, 'text' => $value); |
|
| 266 | + } |
|
| 267 | + if ($this->_view !== 'incomplete') { |
|
| 268 | + $filters[] = EEH_Form_Fields::select_input( |
|
| 269 | + '_reg_status', |
|
| 270 | + $status, |
|
| 271 | + isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
| 272 | + : '' |
|
| 273 | + ); |
|
| 274 | + } |
|
| 275 | + if (isset($this->_req_data['event_id'])) { |
|
| 276 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
| 277 | + } |
|
| 278 | + return $filters; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * _add_view_counts |
|
| 284 | - * |
|
| 285 | - * @access protected |
|
| 286 | - * @return void |
|
| 287 | - * @throws EE_Error |
|
| 288 | - * @throws InvalidArgumentException |
|
| 289 | - * @throws InvalidDataTypeException |
|
| 290 | - * @throws InvalidInterfaceException |
|
| 291 | - */ |
|
| 292 | - protected function _add_view_counts() |
|
| 293 | - { |
|
| 294 | - $this->_views['all']['count'] = $this->_total_registrations(); |
|
| 295 | - $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
| 296 | - $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
| 297 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
| 298 | - 'ee_delete_registrations', |
|
| 299 | - 'espresso_registrations_trash_registrations' |
|
| 300 | - )) { |
|
| 301 | - $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
| 302 | - $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
| 303 | - } |
|
| 304 | - } |
|
| 282 | + /** |
|
| 283 | + * _add_view_counts |
|
| 284 | + * |
|
| 285 | + * @access protected |
|
| 286 | + * @return void |
|
| 287 | + * @throws EE_Error |
|
| 288 | + * @throws InvalidArgumentException |
|
| 289 | + * @throws InvalidDataTypeException |
|
| 290 | + * @throws InvalidInterfaceException |
|
| 291 | + */ |
|
| 292 | + protected function _add_view_counts() |
|
| 293 | + { |
|
| 294 | + $this->_views['all']['count'] = $this->_total_registrations(); |
|
| 295 | + $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
| 296 | + $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
| 297 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
| 298 | + 'ee_delete_registrations', |
|
| 299 | + 'espresso_registrations_trash_registrations' |
|
| 300 | + )) { |
|
| 301 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
| 302 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
| 303 | + } |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | 306 | |
| 307 | - /** |
|
| 308 | - * _total_registrations |
|
| 309 | - * |
|
| 310 | - * @access protected |
|
| 311 | - * @param string $view |
|
| 312 | - * @return int |
|
| 313 | - * @throws EE_Error |
|
| 314 | - * @throws InvalidArgumentException |
|
| 315 | - * @throws InvalidDataTypeException |
|
| 316 | - * @throws InvalidInterfaceException |
|
| 317 | - */ |
|
| 318 | - protected function _total_registrations($view = '') |
|
| 319 | - { |
|
| 320 | - $_where = array(); |
|
| 321 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
| 322 | - if ($EVT_ID) { |
|
| 323 | - $_where['EVT_ID'] = $EVT_ID; |
|
| 324 | - } |
|
| 325 | - switch ($view) { |
|
| 326 | - case 'trash': |
|
| 327 | - return EEM_Registration::instance()->count_deleted(array($_where)); |
|
| 328 | - break; |
|
| 329 | - case 'incomplete': |
|
| 330 | - $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
|
| 331 | - break; |
|
| 332 | - default: |
|
| 333 | - $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 334 | - } |
|
| 335 | - return EEM_Registration::instance()->count(array($_where)); |
|
| 336 | - } |
|
| 307 | + /** |
|
| 308 | + * _total_registrations |
|
| 309 | + * |
|
| 310 | + * @access protected |
|
| 311 | + * @param string $view |
|
| 312 | + * @return int |
|
| 313 | + * @throws EE_Error |
|
| 314 | + * @throws InvalidArgumentException |
|
| 315 | + * @throws InvalidDataTypeException |
|
| 316 | + * @throws InvalidInterfaceException |
|
| 317 | + */ |
|
| 318 | + protected function _total_registrations($view = '') |
|
| 319 | + { |
|
| 320 | + $_where = array(); |
|
| 321 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
| 322 | + if ($EVT_ID) { |
|
| 323 | + $_where['EVT_ID'] = $EVT_ID; |
|
| 324 | + } |
|
| 325 | + switch ($view) { |
|
| 326 | + case 'trash': |
|
| 327 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
| 328 | + break; |
|
| 329 | + case 'incomplete': |
|
| 330 | + $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
|
| 331 | + break; |
|
| 332 | + default: |
|
| 333 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 334 | + } |
|
| 335 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 336 | + } |
|
| 337 | 337 | |
| 338 | 338 | |
| 339 | - /** |
|
| 340 | - * _total_registrations_this_month |
|
| 341 | - * |
|
| 342 | - * @access protected |
|
| 343 | - * @return int |
|
| 344 | - * @throws EE_Error |
|
| 345 | - * @throws InvalidArgumentException |
|
| 346 | - * @throws InvalidDataTypeException |
|
| 347 | - * @throws InvalidInterfaceException |
|
| 348 | - */ |
|
| 349 | - protected function _total_registrations_this_month() |
|
| 350 | - { |
|
| 351 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
| 352 | - $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
| 353 | - $this_year_r = date('Y', current_time('timestamp')); |
|
| 354 | - $time_start = ' 00:00:00'; |
|
| 355 | - $time_end = ' 23:59:59'; |
|
| 356 | - $this_month_r = date('m', current_time('timestamp')); |
|
| 357 | - $days_this_month = date('t', current_time('timestamp')); |
|
| 358 | - // setup date query. |
|
| 359 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
| 360 | - 'REG_date', |
|
| 361 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
| 362 | - 'Y-m-d H:i:s' |
|
| 363 | - ); |
|
| 364 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
| 365 | - 'REG_date', |
|
| 366 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
| 367 | - 'Y-m-d H:i:s' |
|
| 368 | - ); |
|
| 369 | - $_where['REG_date'] = array( |
|
| 370 | - 'BETWEEN', |
|
| 371 | - array( |
|
| 372 | - $beginning_string, |
|
| 373 | - $end_string, |
|
| 374 | - ), |
|
| 375 | - ); |
|
| 376 | - $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 377 | - return EEM_Registration::instance()->count(array($_where)); |
|
| 378 | - } |
|
| 339 | + /** |
|
| 340 | + * _total_registrations_this_month |
|
| 341 | + * |
|
| 342 | + * @access protected |
|
| 343 | + * @return int |
|
| 344 | + * @throws EE_Error |
|
| 345 | + * @throws InvalidArgumentException |
|
| 346 | + * @throws InvalidDataTypeException |
|
| 347 | + * @throws InvalidInterfaceException |
|
| 348 | + */ |
|
| 349 | + protected function _total_registrations_this_month() |
|
| 350 | + { |
|
| 351 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
| 352 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
| 353 | + $this_year_r = date('Y', current_time('timestamp')); |
|
| 354 | + $time_start = ' 00:00:00'; |
|
| 355 | + $time_end = ' 23:59:59'; |
|
| 356 | + $this_month_r = date('m', current_time('timestamp')); |
|
| 357 | + $days_this_month = date('t', current_time('timestamp')); |
|
| 358 | + // setup date query. |
|
| 359 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
| 360 | + 'REG_date', |
|
| 361 | + $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
| 362 | + 'Y-m-d H:i:s' |
|
| 363 | + ); |
|
| 364 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
| 365 | + 'REG_date', |
|
| 366 | + $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
| 367 | + 'Y-m-d H:i:s' |
|
| 368 | + ); |
|
| 369 | + $_where['REG_date'] = array( |
|
| 370 | + 'BETWEEN', |
|
| 371 | + array( |
|
| 372 | + $beginning_string, |
|
| 373 | + $end_string, |
|
| 374 | + ), |
|
| 375 | + ); |
|
| 376 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 377 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | 380 | |
| 381 | - /** |
|
| 382 | - * _total_registrations_today |
|
| 383 | - * |
|
| 384 | - * @access protected |
|
| 385 | - * @return int |
|
| 386 | - * @throws EE_Error |
|
| 387 | - * @throws InvalidArgumentException |
|
| 388 | - * @throws InvalidDataTypeException |
|
| 389 | - * @throws InvalidInterfaceException |
|
| 390 | - */ |
|
| 391 | - protected function _total_registrations_today() |
|
| 392 | - { |
|
| 393 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
| 394 | - $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
| 395 | - $current_date = date('Y-m-d', current_time('timestamp')); |
|
| 396 | - $time_start = ' 00:00:00'; |
|
| 397 | - $time_end = ' 23:59:59'; |
|
| 398 | - $_where['REG_date'] = array( |
|
| 399 | - 'BETWEEN', |
|
| 400 | - array( |
|
| 401 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
| 402 | - 'REG_date', |
|
| 403 | - $current_date . $time_start, |
|
| 404 | - 'Y-m-d H:i:s' |
|
| 405 | - ), |
|
| 406 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
| 407 | - 'REG_date', |
|
| 408 | - $current_date . $time_end, |
|
| 409 | - 'Y-m-d H:i:s' |
|
| 410 | - ), |
|
| 411 | - ), |
|
| 412 | - ); |
|
| 413 | - $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 414 | - return EEM_Registration::instance()->count(array($_where)); |
|
| 415 | - } |
|
| 381 | + /** |
|
| 382 | + * _total_registrations_today |
|
| 383 | + * |
|
| 384 | + * @access protected |
|
| 385 | + * @return int |
|
| 386 | + * @throws EE_Error |
|
| 387 | + * @throws InvalidArgumentException |
|
| 388 | + * @throws InvalidDataTypeException |
|
| 389 | + * @throws InvalidInterfaceException |
|
| 390 | + */ |
|
| 391 | + protected function _total_registrations_today() |
|
| 392 | + { |
|
| 393 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
| 394 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
| 395 | + $current_date = date('Y-m-d', current_time('timestamp')); |
|
| 396 | + $time_start = ' 00:00:00'; |
|
| 397 | + $time_end = ' 23:59:59'; |
|
| 398 | + $_where['REG_date'] = array( |
|
| 399 | + 'BETWEEN', |
|
| 400 | + array( |
|
| 401 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
| 402 | + 'REG_date', |
|
| 403 | + $current_date . $time_start, |
|
| 404 | + 'Y-m-d H:i:s' |
|
| 405 | + ), |
|
| 406 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
| 407 | + 'REG_date', |
|
| 408 | + $current_date . $time_end, |
|
| 409 | + 'Y-m-d H:i:s' |
|
| 410 | + ), |
|
| 411 | + ), |
|
| 412 | + ); |
|
| 413 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
| 414 | + return EEM_Registration::instance()->count(array($_where)); |
|
| 415 | + } |
|
| 416 | 416 | |
| 417 | 417 | |
| 418 | - /** |
|
| 419 | - * column_cb |
|
| 420 | - * |
|
| 421 | - * @access public |
|
| 422 | - * @param \EE_Registration $item |
|
| 423 | - * @return string |
|
| 424 | - * @throws EE_Error |
|
| 425 | - * @throws InvalidArgumentException |
|
| 426 | - * @throws InvalidDataTypeException |
|
| 427 | - * @throws InvalidInterfaceException |
|
| 428 | - * @throws ReflectionException |
|
| 429 | - */ |
|
| 430 | - public function column_cb($item) |
|
| 431 | - { |
|
| 432 | - /** checkbox/lock **/ |
|
| 433 | - $transaction = $item->get_first_related('Transaction'); |
|
| 434 | - $payment_count = $transaction instanceof EE_Transaction |
|
| 435 | - ? $transaction->count_related('Payment') |
|
| 436 | - : 0; |
|
| 437 | - return $payment_count > 0 |
|
| 438 | - || ! EE_Registry::instance()->CAP->current_user_can( |
|
| 439 | - 'ee_edit_registration', |
|
| 440 | - 'registration_list_table_checkbox_input', |
|
| 441 | - $item->ID() |
|
| 442 | - ) |
|
| 443 | - ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()) |
|
| 444 | - . '<span class="ee-lock-icon"></span>' |
|
| 445 | - : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()); |
|
| 446 | - } |
|
| 418 | + /** |
|
| 419 | + * column_cb |
|
| 420 | + * |
|
| 421 | + * @access public |
|
| 422 | + * @param \EE_Registration $item |
|
| 423 | + * @return string |
|
| 424 | + * @throws EE_Error |
|
| 425 | + * @throws InvalidArgumentException |
|
| 426 | + * @throws InvalidDataTypeException |
|
| 427 | + * @throws InvalidInterfaceException |
|
| 428 | + * @throws ReflectionException |
|
| 429 | + */ |
|
| 430 | + public function column_cb($item) |
|
| 431 | + { |
|
| 432 | + /** checkbox/lock **/ |
|
| 433 | + $transaction = $item->get_first_related('Transaction'); |
|
| 434 | + $payment_count = $transaction instanceof EE_Transaction |
|
| 435 | + ? $transaction->count_related('Payment') |
|
| 436 | + : 0; |
|
| 437 | + return $payment_count > 0 |
|
| 438 | + || ! EE_Registry::instance()->CAP->current_user_can( |
|
| 439 | + 'ee_edit_registration', |
|
| 440 | + 'registration_list_table_checkbox_input', |
|
| 441 | + $item->ID() |
|
| 442 | + ) |
|
| 443 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()) |
|
| 444 | + . '<span class="ee-lock-icon"></span>' |
|
| 445 | + : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()); |
|
| 446 | + } |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | - /** |
|
| 450 | - * column__REG_ID |
|
| 451 | - * |
|
| 452 | - * @access public |
|
| 453 | - * @param \EE_Registration $item |
|
| 454 | - * @return string |
|
| 455 | - * @throws EE_Error |
|
| 456 | - * @throws InvalidArgumentException |
|
| 457 | - * @throws InvalidDataTypeException |
|
| 458 | - * @throws InvalidInterfaceException |
|
| 459 | - * @throws ReflectionException |
|
| 460 | - */ |
|
| 461 | - public function column__REG_ID(EE_Registration $item) |
|
| 462 | - { |
|
| 463 | - $attendee = $item->attendee(); |
|
| 464 | - $content = $item->ID(); |
|
| 465 | - $content .= '<div class="show-on-mobile-view-only">'; |
|
| 466 | - $content .= '<br>'; |
|
| 467 | - $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
| 468 | - $content .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 469 | - $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 470 | - $content .= '</div>'; |
|
| 471 | - return $content; |
|
| 472 | - } |
|
| 449 | + /** |
|
| 450 | + * column__REG_ID |
|
| 451 | + * |
|
| 452 | + * @access public |
|
| 453 | + * @param \EE_Registration $item |
|
| 454 | + * @return string |
|
| 455 | + * @throws EE_Error |
|
| 456 | + * @throws InvalidArgumentException |
|
| 457 | + * @throws InvalidDataTypeException |
|
| 458 | + * @throws InvalidInterfaceException |
|
| 459 | + * @throws ReflectionException |
|
| 460 | + */ |
|
| 461 | + public function column__REG_ID(EE_Registration $item) |
|
| 462 | + { |
|
| 463 | + $attendee = $item->attendee(); |
|
| 464 | + $content = $item->ID(); |
|
| 465 | + $content .= '<div class="show-on-mobile-view-only">'; |
|
| 466 | + $content .= '<br>'; |
|
| 467 | + $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
| 468 | + $content .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 469 | + $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 470 | + $content .= '</div>'; |
|
| 471 | + return $content; |
|
| 472 | + } |
|
| 473 | 473 | |
| 474 | 474 | |
| 475 | - /** |
|
| 476 | - * column__REG_date |
|
| 477 | - * |
|
| 478 | - * @access public |
|
| 479 | - * @param \EE_Registration $item |
|
| 480 | - * @return string |
|
| 481 | - * @throws EE_Error |
|
| 482 | - * @throws InvalidArgumentException |
|
| 483 | - * @throws InvalidDataTypeException |
|
| 484 | - * @throws InvalidInterfaceException |
|
| 485 | - * @throws ReflectionException |
|
| 486 | - */ |
|
| 487 | - public function column__REG_date(EE_Registration $item) |
|
| 488 | - { |
|
| 489 | - $this->_set_related_details($item); |
|
| 490 | - // Build row actions |
|
| 491 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 492 | - array( |
|
| 493 | - 'action' => 'view_transaction', |
|
| 494 | - 'TXN_ID' => $this->_transaction_details['id'], |
|
| 495 | - ), |
|
| 496 | - TXN_ADMIN_URL |
|
| 497 | - ); |
|
| 498 | - $view_link = EE_Registry::instance()->CAP->current_user_can( |
|
| 499 | - 'ee_read_transaction', |
|
| 500 | - 'espresso_transactions_view_transaction' |
|
| 501 | - ) |
|
| 502 | - ? '<a class="ee-status-color-' |
|
| 503 | - . $this->_transaction_details['status'] |
|
| 504 | - . '" href="' |
|
| 505 | - . $view_lnk_url |
|
| 506 | - . '" title="' |
|
| 507 | - . esc_attr($this->_transaction_details['title_attr']) |
|
| 508 | - . '">' |
|
| 509 | - . $item->get_i18n_datetime('REG_date') |
|
| 510 | - . '</a>' : $item->get_i18n_datetime('REG_date'); |
|
| 511 | - $view_link .= '<br><span class="ee-status-text-small">' |
|
| 512 | - . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence') |
|
| 513 | - . '</span>'; |
|
| 514 | - return $view_link; |
|
| 515 | - } |
|
| 475 | + /** |
|
| 476 | + * column__REG_date |
|
| 477 | + * |
|
| 478 | + * @access public |
|
| 479 | + * @param \EE_Registration $item |
|
| 480 | + * @return string |
|
| 481 | + * @throws EE_Error |
|
| 482 | + * @throws InvalidArgumentException |
|
| 483 | + * @throws InvalidDataTypeException |
|
| 484 | + * @throws InvalidInterfaceException |
|
| 485 | + * @throws ReflectionException |
|
| 486 | + */ |
|
| 487 | + public function column__REG_date(EE_Registration $item) |
|
| 488 | + { |
|
| 489 | + $this->_set_related_details($item); |
|
| 490 | + // Build row actions |
|
| 491 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 492 | + array( |
|
| 493 | + 'action' => 'view_transaction', |
|
| 494 | + 'TXN_ID' => $this->_transaction_details['id'], |
|
| 495 | + ), |
|
| 496 | + TXN_ADMIN_URL |
|
| 497 | + ); |
|
| 498 | + $view_link = EE_Registry::instance()->CAP->current_user_can( |
|
| 499 | + 'ee_read_transaction', |
|
| 500 | + 'espresso_transactions_view_transaction' |
|
| 501 | + ) |
|
| 502 | + ? '<a class="ee-status-color-' |
|
| 503 | + . $this->_transaction_details['status'] |
|
| 504 | + . '" href="' |
|
| 505 | + . $view_lnk_url |
|
| 506 | + . '" title="' |
|
| 507 | + . esc_attr($this->_transaction_details['title_attr']) |
|
| 508 | + . '">' |
|
| 509 | + . $item->get_i18n_datetime('REG_date') |
|
| 510 | + . '</a>' : $item->get_i18n_datetime('REG_date'); |
|
| 511 | + $view_link .= '<br><span class="ee-status-text-small">' |
|
| 512 | + . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence') |
|
| 513 | + . '</span>'; |
|
| 514 | + return $view_link; |
|
| 515 | + } |
|
| 516 | 516 | |
| 517 | 517 | |
| 518 | - /** |
|
| 519 | - * column_event_name |
|
| 520 | - * |
|
| 521 | - * @access public |
|
| 522 | - * @param \EE_Registration $item |
|
| 523 | - * @return string |
|
| 524 | - * @throws EE_Error |
|
| 525 | - * @throws InvalidArgumentException |
|
| 526 | - * @throws InvalidDataTypeException |
|
| 527 | - * @throws InvalidInterfaceException |
|
| 528 | - * @throws ReflectionException |
|
| 529 | - */ |
|
| 530 | - public function column_event_name(EE_Registration $item) |
|
| 531 | - { |
|
| 532 | - $this->_set_related_details($item); |
|
| 533 | - // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
|
| 534 | - $EVT_ID = $item->event_ID(); |
|
| 535 | - $event_name = $item->event_name(); |
|
| 536 | - $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
|
| 537 | - $event_name = wp_trim_words($event_name, 30, '...'); |
|
| 538 | - if ($EVT_ID) { |
|
| 539 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 540 | - array('action' => 'edit', 'post' => $EVT_ID), |
|
| 541 | - EVENTS_ADMIN_URL |
|
| 542 | - ); |
|
| 543 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
|
| 544 | - ? '<a class="ee-status-color-' |
|
| 545 | - . $this->_event_details['status'] |
|
| 546 | - . '" href="' |
|
| 547 | - . $edit_event_url |
|
| 548 | - . '" title="' |
|
| 549 | - . esc_attr($this->_event_details['title_attr']) |
|
| 550 | - . '">' |
|
| 551 | - . $event_name |
|
| 552 | - . '</a>' : $event_name; |
|
| 553 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
|
| 554 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
| 555 | - $actions['event_filter'] .= sprintf( |
|
| 556 | - esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
| 557 | - $event_name |
|
| 558 | - ); |
|
| 559 | - $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
| 560 | - } else { |
|
| 561 | - $edit_event = $event_name; |
|
| 562 | - $actions['event_filter'] = ''; |
|
| 563 | - } |
|
| 564 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
| 565 | - } |
|
| 518 | + /** |
|
| 519 | + * column_event_name |
|
| 520 | + * |
|
| 521 | + * @access public |
|
| 522 | + * @param \EE_Registration $item |
|
| 523 | + * @return string |
|
| 524 | + * @throws EE_Error |
|
| 525 | + * @throws InvalidArgumentException |
|
| 526 | + * @throws InvalidDataTypeException |
|
| 527 | + * @throws InvalidInterfaceException |
|
| 528 | + * @throws ReflectionException |
|
| 529 | + */ |
|
| 530 | + public function column_event_name(EE_Registration $item) |
|
| 531 | + { |
|
| 532 | + $this->_set_related_details($item); |
|
| 533 | + // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
|
| 534 | + $EVT_ID = $item->event_ID(); |
|
| 535 | + $event_name = $item->event_name(); |
|
| 536 | + $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
|
| 537 | + $event_name = wp_trim_words($event_name, 30, '...'); |
|
| 538 | + if ($EVT_ID) { |
|
| 539 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 540 | + array('action' => 'edit', 'post' => $EVT_ID), |
|
| 541 | + EVENTS_ADMIN_URL |
|
| 542 | + ); |
|
| 543 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
|
| 544 | + ? '<a class="ee-status-color-' |
|
| 545 | + . $this->_event_details['status'] |
|
| 546 | + . '" href="' |
|
| 547 | + . $edit_event_url |
|
| 548 | + . '" title="' |
|
| 549 | + . esc_attr($this->_event_details['title_attr']) |
|
| 550 | + . '">' |
|
| 551 | + . $event_name |
|
| 552 | + . '</a>' : $event_name; |
|
| 553 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
|
| 554 | + $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
| 555 | + $actions['event_filter'] .= sprintf( |
|
| 556 | + esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
| 557 | + $event_name |
|
| 558 | + ); |
|
| 559 | + $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
| 560 | + } else { |
|
| 561 | + $edit_event = $event_name; |
|
| 562 | + $actions['event_filter'] = ''; |
|
| 563 | + } |
|
| 564 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
| 565 | + } |
|
| 566 | 566 | |
| 567 | 567 | |
| 568 | - /** |
|
| 569 | - * column_DTT_EVT_start |
|
| 570 | - * |
|
| 571 | - * @access public |
|
| 572 | - * @param \EE_Registration $item |
|
| 573 | - * @return string |
|
| 574 | - * @throws EE_Error |
|
| 575 | - * @throws InvalidArgumentException |
|
| 576 | - * @throws InvalidDataTypeException |
|
| 577 | - * @throws InvalidInterfaceException |
|
| 578 | - * @throws ReflectionException |
|
| 579 | - */ |
|
| 580 | - public function column_DTT_EVT_start(EE_Registration $item) |
|
| 581 | - { |
|
| 582 | - $datetime_strings = array(); |
|
| 583 | - $ticket = $item->ticket(true); |
|
| 584 | - if ($ticket instanceof EE_Ticket) { |
|
| 585 | - $remove_defaults = array('default_where_conditions' => 'none'); |
|
| 586 | - $datetimes = $ticket->datetimes($remove_defaults); |
|
| 587 | - foreach ($datetimes as $datetime) { |
|
| 588 | - $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
| 589 | - } |
|
| 590 | - return $this->generateDisplayForDatetimes($datetime_strings); |
|
| 591 | - } |
|
| 592 | - return __('There is no ticket on this registration', 'event_espresso'); |
|
| 593 | - } |
|
| 568 | + /** |
|
| 569 | + * column_DTT_EVT_start |
|
| 570 | + * |
|
| 571 | + * @access public |
|
| 572 | + * @param \EE_Registration $item |
|
| 573 | + * @return string |
|
| 574 | + * @throws EE_Error |
|
| 575 | + * @throws InvalidArgumentException |
|
| 576 | + * @throws InvalidDataTypeException |
|
| 577 | + * @throws InvalidInterfaceException |
|
| 578 | + * @throws ReflectionException |
|
| 579 | + */ |
|
| 580 | + public function column_DTT_EVT_start(EE_Registration $item) |
|
| 581 | + { |
|
| 582 | + $datetime_strings = array(); |
|
| 583 | + $ticket = $item->ticket(true); |
|
| 584 | + if ($ticket instanceof EE_Ticket) { |
|
| 585 | + $remove_defaults = array('default_where_conditions' => 'none'); |
|
| 586 | + $datetimes = $ticket->datetimes($remove_defaults); |
|
| 587 | + foreach ($datetimes as $datetime) { |
|
| 588 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
| 589 | + } |
|
| 590 | + return $this->generateDisplayForDatetimes($datetime_strings); |
|
| 591 | + } |
|
| 592 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
| 593 | + } |
|
| 594 | 594 | |
| 595 | 595 | |
| 596 | - /** |
|
| 597 | - * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
| 598 | - * |
|
| 599 | - * @param array $datetime_strings |
|
| 600 | - * @return string |
|
| 601 | - */ |
|
| 602 | - public function generateDisplayForDateTimes(array $datetime_strings) |
|
| 603 | - { |
|
| 604 | - $content = '<div class="ee-registration-event-datetimes-container">'; |
|
| 605 | - $expand_toggle = count($datetime_strings) > 1 |
|
| 606 | - ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
| 607 | - . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
|
| 608 | - : ''; |
|
| 609 | - // get first item for initial visibility |
|
| 610 | - $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
| 611 | - $content .= $expand_toggle; |
|
| 612 | - if ($datetime_strings) { |
|
| 613 | - $content .= '<div style="clear:both"></div>'; |
|
| 614 | - $content .= '<div class="ee-registration-event-datetimes-container more-items hidden">'; |
|
| 615 | - $content .= implode("<br />", $datetime_strings); |
|
| 616 | - $content .= '</div>'; |
|
| 617 | - } |
|
| 618 | - $content .= '</div>'; |
|
| 619 | - return $content; |
|
| 620 | - } |
|
| 596 | + /** |
|
| 597 | + * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
| 598 | + * |
|
| 599 | + * @param array $datetime_strings |
|
| 600 | + * @return string |
|
| 601 | + */ |
|
| 602 | + public function generateDisplayForDateTimes(array $datetime_strings) |
|
| 603 | + { |
|
| 604 | + $content = '<div class="ee-registration-event-datetimes-container">'; |
|
| 605 | + $expand_toggle = count($datetime_strings) > 1 |
|
| 606 | + ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
| 607 | + . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
|
| 608 | + : ''; |
|
| 609 | + // get first item for initial visibility |
|
| 610 | + $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
| 611 | + $content .= $expand_toggle; |
|
| 612 | + if ($datetime_strings) { |
|
| 613 | + $content .= '<div style="clear:both"></div>'; |
|
| 614 | + $content .= '<div class="ee-registration-event-datetimes-container more-items hidden">'; |
|
| 615 | + $content .= implode("<br />", $datetime_strings); |
|
| 616 | + $content .= '</div>'; |
|
| 617 | + } |
|
| 618 | + $content .= '</div>'; |
|
| 619 | + return $content; |
|
| 620 | + } |
|
| 621 | 621 | |
| 622 | 622 | |
| 623 | - /** |
|
| 624 | - * column_ATT_fname |
|
| 625 | - * |
|
| 626 | - * @access public |
|
| 627 | - * @param \EE_Registration $item |
|
| 628 | - * @return string |
|
| 629 | - * @throws EE_Error |
|
| 630 | - * @throws InvalidArgumentException |
|
| 631 | - * @throws InvalidDataTypeException |
|
| 632 | - * @throws InvalidInterfaceException |
|
| 633 | - * @throws ReflectionException |
|
| 634 | - */ |
|
| 635 | - public function column_ATT_fname(EE_Registration $item) |
|
| 636 | - { |
|
| 637 | - $attendee = $item->attendee(); |
|
| 638 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 639 | - array( |
|
| 640 | - 'action' => 'view_registration', |
|
| 641 | - '_REG_ID' => $item->ID(), |
|
| 642 | - ), |
|
| 643 | - REG_ADMIN_URL |
|
| 644 | - ); |
|
| 645 | - $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
| 646 | - $link = EE_Registry::instance()->CAP->current_user_can( |
|
| 647 | - 'ee_read_registration', |
|
| 648 | - 'espresso_registrations_view_registration', |
|
| 649 | - $item->ID() |
|
| 650 | - ) |
|
| 651 | - ? '<a href="' |
|
| 652 | - . $edit_lnk_url |
|
| 653 | - . '" title="' |
|
| 654 | - . esc_attr__('View Registration Details', 'event_espresso') |
|
| 655 | - . '">' |
|
| 656 | - . $attendee_name |
|
| 657 | - . '</a>' : $attendee_name; |
|
| 658 | - $link .= $item->count() === 1 |
|
| 659 | - ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
|
| 660 | - $t = $item->get_first_related('Transaction'); |
|
| 661 | - $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
|
| 662 | - // append group count to name |
|
| 663 | - $link .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 664 | - // append reg_code |
|
| 665 | - $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 666 | - // reg status text for accessibility |
|
| 667 | - $link .= '<br><span class="ee-status-text-small">' |
|
| 668 | - . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
|
| 669 | - . '</span>'; |
|
| 670 | - // trash/restore/delete actions |
|
| 671 | - $actions = array(); |
|
| 672 | - if ($this->_view !== 'trash' |
|
| 673 | - && $payment_count === 0 |
|
| 674 | - && EE_Registry::instance()->CAP->current_user_can( |
|
| 675 | - 'ee_delete_registration', |
|
| 676 | - 'espresso_registrations_trash_registrations', |
|
| 677 | - $item->ID() |
|
| 678 | - )) { |
|
| 679 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 680 | - array( |
|
| 681 | - 'action' => 'trash_registrations', |
|
| 682 | - '_REG_ID' => $item->ID(), |
|
| 683 | - ), |
|
| 684 | - REG_ADMIN_URL |
|
| 685 | - ); |
|
| 686 | - $actions['trash'] = '<a href="' |
|
| 687 | - . $trash_lnk_url |
|
| 688 | - . '" title="' |
|
| 689 | - . esc_attr__('Trash Registration', 'event_espresso') |
|
| 690 | - . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
| 691 | - } elseif ($this->_view === 'trash') { |
|
| 692 | - // restore registration link |
|
| 693 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
| 694 | - 'ee_delete_registration', |
|
| 695 | - 'espresso_registrations_restore_registrations', |
|
| 696 | - $item->ID() |
|
| 697 | - )) { |
|
| 698 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 699 | - array( |
|
| 700 | - 'action' => 'restore_registrations', |
|
| 701 | - '_REG_ID' => $item->ID(), |
|
| 702 | - ), |
|
| 703 | - REG_ADMIN_URL |
|
| 704 | - ); |
|
| 705 | - $actions['restore'] = '<a href="' |
|
| 706 | - . $restore_lnk_url |
|
| 707 | - . '" title="' |
|
| 708 | - . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
| 709 | - . __('Restore', 'event_espresso') . '</a>'; |
|
| 710 | - } |
|
| 711 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
| 712 | - 'ee_delete_registration', |
|
| 713 | - 'espresso_registrations_ee_delete_registrations', |
|
| 714 | - $item->ID() |
|
| 715 | - )) { |
|
| 716 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 717 | - array( |
|
| 718 | - 'action' => 'delete_registrations', |
|
| 719 | - '_REG_ID' => $item->ID(), |
|
| 720 | - ), |
|
| 721 | - REG_ADMIN_URL |
|
| 722 | - ); |
|
| 723 | - $actions['delete'] = '<a href="' |
|
| 724 | - . $delete_lnk_url |
|
| 725 | - . '" title="' |
|
| 726 | - . esc_attr__('Delete Registration Permanently', 'event_espresso') |
|
| 727 | - . '">' |
|
| 728 | - . __('Delete', 'event_espresso') |
|
| 729 | - . '</a>'; |
|
| 730 | - } |
|
| 731 | - } |
|
| 732 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
| 733 | - } |
|
| 623 | + /** |
|
| 624 | + * column_ATT_fname |
|
| 625 | + * |
|
| 626 | + * @access public |
|
| 627 | + * @param \EE_Registration $item |
|
| 628 | + * @return string |
|
| 629 | + * @throws EE_Error |
|
| 630 | + * @throws InvalidArgumentException |
|
| 631 | + * @throws InvalidDataTypeException |
|
| 632 | + * @throws InvalidInterfaceException |
|
| 633 | + * @throws ReflectionException |
|
| 634 | + */ |
|
| 635 | + public function column_ATT_fname(EE_Registration $item) |
|
| 636 | + { |
|
| 637 | + $attendee = $item->attendee(); |
|
| 638 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 639 | + array( |
|
| 640 | + 'action' => 'view_registration', |
|
| 641 | + '_REG_ID' => $item->ID(), |
|
| 642 | + ), |
|
| 643 | + REG_ADMIN_URL |
|
| 644 | + ); |
|
| 645 | + $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
| 646 | + $link = EE_Registry::instance()->CAP->current_user_can( |
|
| 647 | + 'ee_read_registration', |
|
| 648 | + 'espresso_registrations_view_registration', |
|
| 649 | + $item->ID() |
|
| 650 | + ) |
|
| 651 | + ? '<a href="' |
|
| 652 | + . $edit_lnk_url |
|
| 653 | + . '" title="' |
|
| 654 | + . esc_attr__('View Registration Details', 'event_espresso') |
|
| 655 | + . '">' |
|
| 656 | + . $attendee_name |
|
| 657 | + . '</a>' : $attendee_name; |
|
| 658 | + $link .= $item->count() === 1 |
|
| 659 | + ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
|
| 660 | + $t = $item->get_first_related('Transaction'); |
|
| 661 | + $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
|
| 662 | + // append group count to name |
|
| 663 | + $link .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 664 | + // append reg_code |
|
| 665 | + $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
| 666 | + // reg status text for accessibility |
|
| 667 | + $link .= '<br><span class="ee-status-text-small">' |
|
| 668 | + . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
|
| 669 | + . '</span>'; |
|
| 670 | + // trash/restore/delete actions |
|
| 671 | + $actions = array(); |
|
| 672 | + if ($this->_view !== 'trash' |
|
| 673 | + && $payment_count === 0 |
|
| 674 | + && EE_Registry::instance()->CAP->current_user_can( |
|
| 675 | + 'ee_delete_registration', |
|
| 676 | + 'espresso_registrations_trash_registrations', |
|
| 677 | + $item->ID() |
|
| 678 | + )) { |
|
| 679 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 680 | + array( |
|
| 681 | + 'action' => 'trash_registrations', |
|
| 682 | + '_REG_ID' => $item->ID(), |
|
| 683 | + ), |
|
| 684 | + REG_ADMIN_URL |
|
| 685 | + ); |
|
| 686 | + $actions['trash'] = '<a href="' |
|
| 687 | + . $trash_lnk_url |
|
| 688 | + . '" title="' |
|
| 689 | + . esc_attr__('Trash Registration', 'event_espresso') |
|
| 690 | + . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
| 691 | + } elseif ($this->_view === 'trash') { |
|
| 692 | + // restore registration link |
|
| 693 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
| 694 | + 'ee_delete_registration', |
|
| 695 | + 'espresso_registrations_restore_registrations', |
|
| 696 | + $item->ID() |
|
| 697 | + )) { |
|
| 698 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 699 | + array( |
|
| 700 | + 'action' => 'restore_registrations', |
|
| 701 | + '_REG_ID' => $item->ID(), |
|
| 702 | + ), |
|
| 703 | + REG_ADMIN_URL |
|
| 704 | + ); |
|
| 705 | + $actions['restore'] = '<a href="' |
|
| 706 | + . $restore_lnk_url |
|
| 707 | + . '" title="' |
|
| 708 | + . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
| 709 | + . __('Restore', 'event_espresso') . '</a>'; |
|
| 710 | + } |
|
| 711 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
| 712 | + 'ee_delete_registration', |
|
| 713 | + 'espresso_registrations_ee_delete_registrations', |
|
| 714 | + $item->ID() |
|
| 715 | + )) { |
|
| 716 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 717 | + array( |
|
| 718 | + 'action' => 'delete_registrations', |
|
| 719 | + '_REG_ID' => $item->ID(), |
|
| 720 | + ), |
|
| 721 | + REG_ADMIN_URL |
|
| 722 | + ); |
|
| 723 | + $actions['delete'] = '<a href="' |
|
| 724 | + . $delete_lnk_url |
|
| 725 | + . '" title="' |
|
| 726 | + . esc_attr__('Delete Registration Permanently', 'event_espresso') |
|
| 727 | + . '">' |
|
| 728 | + . __('Delete', 'event_espresso') |
|
| 729 | + . '</a>'; |
|
| 730 | + } |
|
| 731 | + } |
|
| 732 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
| 733 | + } |
|
| 734 | 734 | |
| 735 | 735 | |
| 736 | - /** |
|
| 737 | - * column_ATT_email |
|
| 738 | - * |
|
| 739 | - * @access public |
|
| 740 | - * @param \EE_Registration $item |
|
| 741 | - * @return string |
|
| 742 | - * @throws EE_Error |
|
| 743 | - * @throws InvalidArgumentException |
|
| 744 | - * @throws InvalidDataTypeException |
|
| 745 | - * @throws InvalidInterfaceException |
|
| 746 | - * @throws ReflectionException |
|
| 747 | - */ |
|
| 748 | - public function column_ATT_email(EE_Registration $item) |
|
| 749 | - { |
|
| 750 | - $attendee = $item->get_first_related('Attendee'); |
|
| 751 | - return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') |
|
| 752 | - : $attendee->email(); |
|
| 753 | - } |
|
| 736 | + /** |
|
| 737 | + * column_ATT_email |
|
| 738 | + * |
|
| 739 | + * @access public |
|
| 740 | + * @param \EE_Registration $item |
|
| 741 | + * @return string |
|
| 742 | + * @throws EE_Error |
|
| 743 | + * @throws InvalidArgumentException |
|
| 744 | + * @throws InvalidDataTypeException |
|
| 745 | + * @throws InvalidInterfaceException |
|
| 746 | + * @throws ReflectionException |
|
| 747 | + */ |
|
| 748 | + public function column_ATT_email(EE_Registration $item) |
|
| 749 | + { |
|
| 750 | + $attendee = $item->get_first_related('Attendee'); |
|
| 751 | + return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') |
|
| 752 | + : $attendee->email(); |
|
| 753 | + } |
|
| 754 | 754 | |
| 755 | 755 | |
| 756 | - /** |
|
| 757 | - * column__REG_count |
|
| 758 | - * |
|
| 759 | - * @access public |
|
| 760 | - * @param \EE_Registration $item |
|
| 761 | - * @return string |
|
| 762 | - */ |
|
| 763 | - public function column__REG_count(EE_Registration $item) |
|
| 764 | - { |
|
| 765 | - return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 766 | - } |
|
| 756 | + /** |
|
| 757 | + * column__REG_count |
|
| 758 | + * |
|
| 759 | + * @access public |
|
| 760 | + * @param \EE_Registration $item |
|
| 761 | + * @return string |
|
| 762 | + */ |
|
| 763 | + public function column__REG_count(EE_Registration $item) |
|
| 764 | + { |
|
| 765 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
| 766 | + } |
|
| 767 | 767 | |
| 768 | 768 | |
| 769 | - /** |
|
| 770 | - * column_PRC_amount |
|
| 771 | - * |
|
| 772 | - * @access public |
|
| 773 | - * @param \EE_Registration $item |
|
| 774 | - * @return string |
|
| 775 | - * @throws EE_Error |
|
| 776 | - */ |
|
| 777 | - public function column_PRC_amount(EE_Registration $item) |
|
| 778 | - { |
|
| 779 | - $ticket = $item->ticket(); |
|
| 780 | - $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' |
|
| 781 | - . $ticket->name() |
|
| 782 | - . '</span><br />' : ''; |
|
| 783 | - if ($item->final_price() > 0) { |
|
| 784 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 785 | - } else { |
|
| 786 | - // free event |
|
| 787 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
|
| 788 | - . __('free', 'event_espresso') |
|
| 789 | - . '</span>'; |
|
| 790 | - } |
|
| 791 | - return $content; |
|
| 792 | - } |
|
| 769 | + /** |
|
| 770 | + * column_PRC_amount |
|
| 771 | + * |
|
| 772 | + * @access public |
|
| 773 | + * @param \EE_Registration $item |
|
| 774 | + * @return string |
|
| 775 | + * @throws EE_Error |
|
| 776 | + */ |
|
| 777 | + public function column_PRC_amount(EE_Registration $item) |
|
| 778 | + { |
|
| 779 | + $ticket = $item->ticket(); |
|
| 780 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' |
|
| 781 | + . $ticket->name() |
|
| 782 | + . '</span><br />' : ''; |
|
| 783 | + if ($item->final_price() > 0) { |
|
| 784 | + $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 785 | + } else { |
|
| 786 | + // free event |
|
| 787 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
|
| 788 | + . __('free', 'event_espresso') |
|
| 789 | + . '</span>'; |
|
| 790 | + } |
|
| 791 | + return $content; |
|
| 792 | + } |
|
| 793 | 793 | |
| 794 | 794 | |
| 795 | - /** |
|
| 796 | - * column__REG_final_price |
|
| 797 | - * |
|
| 798 | - * @access public |
|
| 799 | - * @param \EE_Registration $item |
|
| 800 | - * @return string |
|
| 801 | - * @throws EE_Error |
|
| 802 | - */ |
|
| 803 | - public function column__REG_final_price(EE_Registration $item) |
|
| 804 | - { |
|
| 805 | - $ticket = $item->ticket(); |
|
| 806 | - $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket |
|
| 807 | - ? '' |
|
| 808 | - : '<span class="TKT_name">' |
|
| 809 | - . $ticket->name() |
|
| 810 | - . '</span><br />'; |
|
| 811 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 812 | - return $content; |
|
| 813 | - } |
|
| 795 | + /** |
|
| 796 | + * column__REG_final_price |
|
| 797 | + * |
|
| 798 | + * @access public |
|
| 799 | + * @param \EE_Registration $item |
|
| 800 | + * @return string |
|
| 801 | + * @throws EE_Error |
|
| 802 | + */ |
|
| 803 | + public function column__REG_final_price(EE_Registration $item) |
|
| 804 | + { |
|
| 805 | + $ticket = $item->ticket(); |
|
| 806 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket |
|
| 807 | + ? '' |
|
| 808 | + : '<span class="TKT_name">' |
|
| 809 | + . $ticket->name() |
|
| 810 | + . '</span><br />'; |
|
| 811 | + $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
| 812 | + return $content; |
|
| 813 | + } |
|
| 814 | 814 | |
| 815 | 815 | |
| 816 | - /** |
|
| 817 | - * column__REG_paid |
|
| 818 | - * |
|
| 819 | - * @access public |
|
| 820 | - * @param \EE_Registration $item |
|
| 821 | - * @return string |
|
| 822 | - * @throws EE_Error |
|
| 823 | - */ |
|
| 824 | - public function column__REG_paid(EE_Registration $item) |
|
| 825 | - { |
|
| 826 | - $payment_method = $item->payment_method(); |
|
| 827 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() |
|
| 828 | - : __('Unknown', 'event_espresso'); |
|
| 829 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
| 830 | - if ($item->paid() > 0) { |
|
| 831 | - $content .= '<br><span class="ee-status-text-small">' |
|
| 832 | - . sprintf( |
|
| 833 | - __('...via %s', 'event_espresso'), |
|
| 834 | - $payment_method_name |
|
| 835 | - ) |
|
| 836 | - . '</span>'; |
|
| 837 | - } |
|
| 838 | - return $content; |
|
| 839 | - } |
|
| 816 | + /** |
|
| 817 | + * column__REG_paid |
|
| 818 | + * |
|
| 819 | + * @access public |
|
| 820 | + * @param \EE_Registration $item |
|
| 821 | + * @return string |
|
| 822 | + * @throws EE_Error |
|
| 823 | + */ |
|
| 824 | + public function column__REG_paid(EE_Registration $item) |
|
| 825 | + { |
|
| 826 | + $payment_method = $item->payment_method(); |
|
| 827 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() |
|
| 828 | + : __('Unknown', 'event_espresso'); |
|
| 829 | + $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
| 830 | + if ($item->paid() > 0) { |
|
| 831 | + $content .= '<br><span class="ee-status-text-small">' |
|
| 832 | + . sprintf( |
|
| 833 | + __('...via %s', 'event_espresso'), |
|
| 834 | + $payment_method_name |
|
| 835 | + ) |
|
| 836 | + . '</span>'; |
|
| 837 | + } |
|
| 838 | + return $content; |
|
| 839 | + } |
|
| 840 | 840 | |
| 841 | 841 | |
| 842 | - /** |
|
| 843 | - * column_TXN_total |
|
| 844 | - * |
|
| 845 | - * @access public |
|
| 846 | - * @param \EE_Registration $item |
|
| 847 | - * @return string |
|
| 848 | - * @throws EE_Error |
|
| 849 | - * @throws EntityNotFoundException |
|
| 850 | - * @throws InvalidArgumentException |
|
| 851 | - * @throws InvalidDataTypeException |
|
| 852 | - * @throws InvalidInterfaceException |
|
| 853 | - */ |
|
| 854 | - public function column_TXN_total(EE_Registration $item) |
|
| 855 | - { |
|
| 856 | - if ($item->transaction()) { |
|
| 857 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 858 | - array( |
|
| 859 | - 'action' => 'view_transaction', |
|
| 860 | - 'TXN_ID' => $item->transaction_ID(), |
|
| 861 | - ), |
|
| 862 | - TXN_ADMIN_URL |
|
| 863 | - ); |
|
| 864 | - return EE_Registry::instance()->CAP->current_user_can( |
|
| 865 | - 'ee_read_transaction', |
|
| 866 | - 'espresso_transactions_view_transaction', |
|
| 867 | - $item->transaction_ID() |
|
| 868 | - ) |
|
| 869 | - ? '<span class="reg-pad-rght"><a class="status-' |
|
| 870 | - . $item->transaction()->status_ID() |
|
| 871 | - . '" href="' |
|
| 872 | - . $view_txn_lnk_url |
|
| 873 | - . '" title="' |
|
| 874 | - . esc_attr__('View Transaction', 'event_espresso') |
|
| 875 | - . '">' |
|
| 876 | - . $item->transaction()->pretty_total() |
|
| 877 | - . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
| 878 | - } else { |
|
| 879 | - return __("None", "event_espresso"); |
|
| 880 | - } |
|
| 881 | - } |
|
| 842 | + /** |
|
| 843 | + * column_TXN_total |
|
| 844 | + * |
|
| 845 | + * @access public |
|
| 846 | + * @param \EE_Registration $item |
|
| 847 | + * @return string |
|
| 848 | + * @throws EE_Error |
|
| 849 | + * @throws EntityNotFoundException |
|
| 850 | + * @throws InvalidArgumentException |
|
| 851 | + * @throws InvalidDataTypeException |
|
| 852 | + * @throws InvalidInterfaceException |
|
| 853 | + */ |
|
| 854 | + public function column_TXN_total(EE_Registration $item) |
|
| 855 | + { |
|
| 856 | + if ($item->transaction()) { |
|
| 857 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 858 | + array( |
|
| 859 | + 'action' => 'view_transaction', |
|
| 860 | + 'TXN_ID' => $item->transaction_ID(), |
|
| 861 | + ), |
|
| 862 | + TXN_ADMIN_URL |
|
| 863 | + ); |
|
| 864 | + return EE_Registry::instance()->CAP->current_user_can( |
|
| 865 | + 'ee_read_transaction', |
|
| 866 | + 'espresso_transactions_view_transaction', |
|
| 867 | + $item->transaction_ID() |
|
| 868 | + ) |
|
| 869 | + ? '<span class="reg-pad-rght"><a class="status-' |
|
| 870 | + . $item->transaction()->status_ID() |
|
| 871 | + . '" href="' |
|
| 872 | + . $view_txn_lnk_url |
|
| 873 | + . '" title="' |
|
| 874 | + . esc_attr__('View Transaction', 'event_espresso') |
|
| 875 | + . '">' |
|
| 876 | + . $item->transaction()->pretty_total() |
|
| 877 | + . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
| 878 | + } else { |
|
| 879 | + return __("None", "event_espresso"); |
|
| 880 | + } |
|
| 881 | + } |
|
| 882 | 882 | |
| 883 | 883 | |
| 884 | - /** |
|
| 885 | - * column_TXN_paid |
|
| 886 | - * |
|
| 887 | - * @access public |
|
| 888 | - * @param \EE_Registration $item |
|
| 889 | - * @return string |
|
| 890 | - * @throws EE_Error |
|
| 891 | - * @throws EntityNotFoundException |
|
| 892 | - * @throws InvalidArgumentException |
|
| 893 | - * @throws InvalidDataTypeException |
|
| 894 | - * @throws InvalidInterfaceException |
|
| 895 | - */ |
|
| 896 | - public function column_TXN_paid(EE_Registration $item) |
|
| 897 | - { |
|
| 898 | - if ($item->count() === 1) { |
|
| 899 | - $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
|
| 900 | - if ($transaction->paid() >= $transaction->total()) { |
|
| 901 | - return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
|
| 902 | - } else { |
|
| 903 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 904 | - array( |
|
| 905 | - 'action' => 'view_transaction', |
|
| 906 | - 'TXN_ID' => $item->transaction_ID(), |
|
| 907 | - ), |
|
| 908 | - TXN_ADMIN_URL |
|
| 909 | - ); |
|
| 910 | - return EE_Registry::instance()->CAP->current_user_can( |
|
| 911 | - 'ee_read_transaction', |
|
| 912 | - 'espresso_transactions_view_transaction', |
|
| 913 | - $item->transaction_ID() |
|
| 914 | - ) |
|
| 915 | - ? '<span class="reg-pad-rght"><a class="status-' |
|
| 916 | - . $transaction->status_ID() |
|
| 917 | - . '" href="' |
|
| 918 | - . $view_txn_lnk_url |
|
| 919 | - . '" title="' |
|
| 920 | - . esc_attr__('View Transaction', 'event_espresso') |
|
| 921 | - . '">' |
|
| 922 | - . $item->transaction()->pretty_paid() |
|
| 923 | - . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
| 924 | - } |
|
| 925 | - } |
|
| 926 | - return ' '; |
|
| 927 | - } |
|
| 884 | + /** |
|
| 885 | + * column_TXN_paid |
|
| 886 | + * |
|
| 887 | + * @access public |
|
| 888 | + * @param \EE_Registration $item |
|
| 889 | + * @return string |
|
| 890 | + * @throws EE_Error |
|
| 891 | + * @throws EntityNotFoundException |
|
| 892 | + * @throws InvalidArgumentException |
|
| 893 | + * @throws InvalidDataTypeException |
|
| 894 | + * @throws InvalidInterfaceException |
|
| 895 | + */ |
|
| 896 | + public function column_TXN_paid(EE_Registration $item) |
|
| 897 | + { |
|
| 898 | + if ($item->count() === 1) { |
|
| 899 | + $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
|
| 900 | + if ($transaction->paid() >= $transaction->total()) { |
|
| 901 | + return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
|
| 902 | + } else { |
|
| 903 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 904 | + array( |
|
| 905 | + 'action' => 'view_transaction', |
|
| 906 | + 'TXN_ID' => $item->transaction_ID(), |
|
| 907 | + ), |
|
| 908 | + TXN_ADMIN_URL |
|
| 909 | + ); |
|
| 910 | + return EE_Registry::instance()->CAP->current_user_can( |
|
| 911 | + 'ee_read_transaction', |
|
| 912 | + 'espresso_transactions_view_transaction', |
|
| 913 | + $item->transaction_ID() |
|
| 914 | + ) |
|
| 915 | + ? '<span class="reg-pad-rght"><a class="status-' |
|
| 916 | + . $transaction->status_ID() |
|
| 917 | + . '" href="' |
|
| 918 | + . $view_txn_lnk_url |
|
| 919 | + . '" title="' |
|
| 920 | + . esc_attr__('View Transaction', 'event_espresso') |
|
| 921 | + . '">' |
|
| 922 | + . $item->transaction()->pretty_paid() |
|
| 923 | + . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
| 924 | + } |
|
| 925 | + } |
|
| 926 | + return ' '; |
|
| 927 | + } |
|
| 928 | 928 | |
| 929 | 929 | |
| 930 | - /** |
|
| 931 | - * column_actions |
|
| 932 | - * |
|
| 933 | - * @access public |
|
| 934 | - * @param \EE_Registration $item |
|
| 935 | - * @return string |
|
| 936 | - * @throws EE_Error |
|
| 937 | - * @throws InvalidArgumentException |
|
| 938 | - * @throws InvalidDataTypeException |
|
| 939 | - * @throws InvalidInterfaceException |
|
| 940 | - * @throws ReflectionException |
|
| 941 | - */ |
|
| 942 | - public function column_actions(EE_Registration $item) |
|
| 943 | - { |
|
| 944 | - $actions = array(); |
|
| 945 | - $attendee = $item->attendee(); |
|
| 946 | - $this->_set_related_details($item); |
|
| 947 | - // Build row actions |
|
| 948 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 949 | - array( |
|
| 950 | - 'action' => 'view_registration', |
|
| 951 | - '_REG_ID' => $item->ID(), |
|
| 952 | - ), |
|
| 953 | - REG_ADMIN_URL |
|
| 954 | - ); |
|
| 955 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 956 | - array( |
|
| 957 | - 'action' => 'edit_attendee', |
|
| 958 | - 'post' => $item->attendee_ID(), |
|
| 959 | - ), |
|
| 960 | - REG_ADMIN_URL |
|
| 961 | - ); |
|
| 962 | - // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
|
| 963 | - // $resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
|
| 964 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 965 | - array( |
|
| 966 | - 'action' => 'resend_registration', |
|
| 967 | - '_REG_ID' => $item->ID(), |
|
| 968 | - ), |
|
| 969 | - REG_ADMIN_URL, |
|
| 970 | - true |
|
| 971 | - ); |
|
| 972 | - // Build row actions |
|
| 973 | - $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
| 974 | - 'ee_read_registration', |
|
| 975 | - 'espresso_registrations_view_registration', |
|
| 976 | - $item->ID() |
|
| 977 | - ) ? '<li><a href="' |
|
| 978 | - . $view_lnk_url |
|
| 979 | - . '" title="' |
|
| 980 | - . esc_attr__('View Registration Details', 'event_espresso') |
|
| 981 | - . '" class="tiny-text"> |
|
| 930 | + /** |
|
| 931 | + * column_actions |
|
| 932 | + * |
|
| 933 | + * @access public |
|
| 934 | + * @param \EE_Registration $item |
|
| 935 | + * @return string |
|
| 936 | + * @throws EE_Error |
|
| 937 | + * @throws InvalidArgumentException |
|
| 938 | + * @throws InvalidDataTypeException |
|
| 939 | + * @throws InvalidInterfaceException |
|
| 940 | + * @throws ReflectionException |
|
| 941 | + */ |
|
| 942 | + public function column_actions(EE_Registration $item) |
|
| 943 | + { |
|
| 944 | + $actions = array(); |
|
| 945 | + $attendee = $item->attendee(); |
|
| 946 | + $this->_set_related_details($item); |
|
| 947 | + // Build row actions |
|
| 948 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 949 | + array( |
|
| 950 | + 'action' => 'view_registration', |
|
| 951 | + '_REG_ID' => $item->ID(), |
|
| 952 | + ), |
|
| 953 | + REG_ADMIN_URL |
|
| 954 | + ); |
|
| 955 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 956 | + array( |
|
| 957 | + 'action' => 'edit_attendee', |
|
| 958 | + 'post' => $item->attendee_ID(), |
|
| 959 | + ), |
|
| 960 | + REG_ADMIN_URL |
|
| 961 | + ); |
|
| 962 | + // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
|
| 963 | + // $resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
|
| 964 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 965 | + array( |
|
| 966 | + 'action' => 'resend_registration', |
|
| 967 | + '_REG_ID' => $item->ID(), |
|
| 968 | + ), |
|
| 969 | + REG_ADMIN_URL, |
|
| 970 | + true |
|
| 971 | + ); |
|
| 972 | + // Build row actions |
|
| 973 | + $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
| 974 | + 'ee_read_registration', |
|
| 975 | + 'espresso_registrations_view_registration', |
|
| 976 | + $item->ID() |
|
| 977 | + ) ? '<li><a href="' |
|
| 978 | + . $view_lnk_url |
|
| 979 | + . '" title="' |
|
| 980 | + . esc_attr__('View Registration Details', 'event_espresso') |
|
| 981 | + . '" class="tiny-text"> |
|
| 982 | 982 | <div class="dashicons dashicons-clipboard"></div> |
| 983 | 983 | </a> |
| 984 | 984 | </li>' |
| 985 | - : ''; |
|
| 986 | - $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
| 987 | - 'ee_edit_contacts', |
|
| 988 | - 'espresso_registrations_edit_attendee' |
|
| 989 | - ) |
|
| 990 | - && $attendee instanceof EE_Attendee |
|
| 991 | - ? ' |
|
| 985 | + : ''; |
|
| 986 | + $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
| 987 | + 'ee_edit_contacts', |
|
| 988 | + 'espresso_registrations_edit_attendee' |
|
| 989 | + ) |
|
| 990 | + && $attendee instanceof EE_Attendee |
|
| 991 | + ? ' |
|
| 992 | 992 | <li> |
| 993 | 993 | <a href="' . $edit_lnk_url . '" title="' |
| 994 | - . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text"> |
|
| 994 | + . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text"> |
|
| 995 | 995 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
| 996 | 996 | </a> |
| 997 | 997 | </li>' : ''; |
| 998 | - $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee |
|
| 999 | - && EE_Registry::instance()->CAP->current_user_can( |
|
| 1000 | - 'ee_send_message', |
|
| 1001 | - 'espresso_registrations_resend_registration', |
|
| 1002 | - $item->ID() |
|
| 1003 | - ) |
|
| 1004 | - ? ' |
|
| 998 | + $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee |
|
| 999 | + && EE_Registry::instance()->CAP->current_user_can( |
|
| 1000 | + 'ee_send_message', |
|
| 1001 | + 'espresso_registrations_resend_registration', |
|
| 1002 | + $item->ID() |
|
| 1003 | + ) |
|
| 1004 | + ? ' |
|
| 1005 | 1005 | <li> |
| 1006 | 1006 | <a href="' |
| 1007 | - . $resend_reg_lnk_url |
|
| 1008 | - . '" title="' |
|
| 1009 | - . esc_attr__('Resend Registration Details', 'event_espresso') |
|
| 1010 | - . '" class="tiny-text"> |
|
| 1007 | + . $resend_reg_lnk_url |
|
| 1008 | + . '" title="' |
|
| 1009 | + . esc_attr__('Resend Registration Details', 'event_espresso') |
|
| 1010 | + . '" class="tiny-text"> |
|
| 1011 | 1011 | <div class="dashicons dashicons-email-alt"></div> |
| 1012 | 1012 | </a> |
| 1013 | 1013 | </li>' : ''; |
| 1014 | - // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
|
| 1015 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 1016 | - array( |
|
| 1017 | - 'action' => 'view_transaction', |
|
| 1018 | - 'TXN_ID' => $this->_transaction_details['id'], |
|
| 1019 | - ), |
|
| 1020 | - TXN_ADMIN_URL |
|
| 1021 | - ); |
|
| 1022 | - $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
| 1023 | - 'ee_read_transaction', |
|
| 1024 | - 'espresso_transactions_view_transaction', |
|
| 1025 | - $this->_transaction_details['id'] |
|
| 1026 | - ) |
|
| 1027 | - ? ' |
|
| 1014 | + // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
|
| 1015 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
| 1016 | + array( |
|
| 1017 | + 'action' => 'view_transaction', |
|
| 1018 | + 'TXN_ID' => $this->_transaction_details['id'], |
|
| 1019 | + ), |
|
| 1020 | + TXN_ADMIN_URL |
|
| 1021 | + ); |
|
| 1022 | + $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
| 1023 | + 'ee_read_transaction', |
|
| 1024 | + 'espresso_transactions_view_transaction', |
|
| 1025 | + $this->_transaction_details['id'] |
|
| 1026 | + ) |
|
| 1027 | + ? ' |
|
| 1028 | 1028 | <li> |
| 1029 | 1029 | <a class="ee-status-color-' |
| 1030 | - . $this->_transaction_details['status'] |
|
| 1031 | - . ' tiny-text" href="' |
|
| 1032 | - . $view_txn_lnk_url |
|
| 1033 | - . '" title="' |
|
| 1034 | - . $this->_transaction_details['title_attr'] |
|
| 1035 | - . '"> |
|
| 1030 | + . $this->_transaction_details['status'] |
|
| 1031 | + . ' tiny-text" href="' |
|
| 1032 | + . $view_txn_lnk_url |
|
| 1033 | + . '" title="' |
|
| 1034 | + . $this->_transaction_details['title_attr'] |
|
| 1035 | + . '"> |
|
| 1036 | 1036 | <div class="dashicons dashicons-cart"></div> |
| 1037 | 1037 | </a> |
| 1038 | 1038 | </li>' : ''; |
| 1039 | - // invoice link |
|
| 1040 | - $actions['dl_invoice_lnk'] = ''; |
|
| 1041 | - $dl_invoice_lnk_url = $item->invoice_url(); |
|
| 1042 | - // only show invoice link if message type is active. |
|
| 1043 | - if ($attendee instanceof EE_Attendee |
|
| 1044 | - && $item->is_primary_registrant() |
|
| 1045 | - && EEH_MSG_Template::is_mt_active('invoice') |
|
| 1046 | - ) { |
|
| 1047 | - $actions['dl_invoice_lnk'] = ' |
|
| 1039 | + // invoice link |
|
| 1040 | + $actions['dl_invoice_lnk'] = ''; |
|
| 1041 | + $dl_invoice_lnk_url = $item->invoice_url(); |
|
| 1042 | + // only show invoice link if message type is active. |
|
| 1043 | + if ($attendee instanceof EE_Attendee |
|
| 1044 | + && $item->is_primary_registrant() |
|
| 1045 | + && EEH_MSG_Template::is_mt_active('invoice') |
|
| 1046 | + ) { |
|
| 1047 | + $actions['dl_invoice_lnk'] = ' |
|
| 1048 | 1048 | <li> |
| 1049 | 1049 | <a title="' |
| 1050 | - . esc_attr__('View Transaction Invoice', 'event_espresso') |
|
| 1051 | - . '" target="_blank" href="' |
|
| 1052 | - . $dl_invoice_lnk_url |
|
| 1053 | - . '" class="tiny-text"> |
|
| 1050 | + . esc_attr__('View Transaction Invoice', 'event_espresso') |
|
| 1051 | + . '" target="_blank" href="' |
|
| 1052 | + . $dl_invoice_lnk_url |
|
| 1053 | + . '" class="tiny-text"> |
|
| 1054 | 1054 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
| 1055 | 1055 | </a> |
| 1056 | 1056 | </li>'; |
| 1057 | - } |
|
| 1058 | - $actions['filtered_messages_link'] = ''; |
|
| 1059 | - // message list table link (filtered by REG_ID |
|
| 1060 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
| 1061 | - $actions['filtered_messages_link'] = '<li>' |
|
| 1062 | - . EEH_MSG_Template::get_message_action_link( |
|
| 1063 | - 'see_notifications_for', |
|
| 1064 | - null, |
|
| 1065 | - array('_REG_ID' => $item->ID()) |
|
| 1066 | - ) . '</li>'; |
|
| 1067 | - } |
|
| 1068 | - $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
|
| 1069 | - return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul'); |
|
| 1070 | - } |
|
| 1057 | + } |
|
| 1058 | + $actions['filtered_messages_link'] = ''; |
|
| 1059 | + // message list table link (filtered by REG_ID |
|
| 1060 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
| 1061 | + $actions['filtered_messages_link'] = '<li>' |
|
| 1062 | + . EEH_MSG_Template::get_message_action_link( |
|
| 1063 | + 'see_notifications_for', |
|
| 1064 | + null, |
|
| 1065 | + array('_REG_ID' => $item->ID()) |
|
| 1066 | + ) . '</li>'; |
|
| 1067 | + } |
|
| 1068 | + $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
|
| 1069 | + return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul'); |
|
| 1070 | + } |
|
| 1071 | 1071 | } |
@@ -38,103 +38,103 @@ |
||
| 38 | 38 | * @since 4.0 |
| 39 | 39 | */ |
| 40 | 40 | if (function_exists('espresso_version')) { |
| 41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
| 42 | - /** |
|
| 43 | - * espresso_duplicate_plugin_error |
|
| 44 | - * displays if more than one version of EE is activated at the same time |
|
| 45 | - */ |
|
| 46 | - function espresso_duplicate_plugin_error() |
|
| 47 | - { |
|
| 48 | - ?> |
|
| 41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
| 42 | + /** |
|
| 43 | + * espresso_duplicate_plugin_error |
|
| 44 | + * displays if more than one version of EE is activated at the same time |
|
| 45 | + */ |
|
| 46 | + function espresso_duplicate_plugin_error() |
|
| 47 | + { |
|
| 48 | + ?> |
|
| 49 | 49 | <div class="error"> |
| 50 | 50 | <p> |
| 51 | 51 | <?php |
| 52 | - echo esc_html__( |
|
| 53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
| 54 | - 'event_espresso' |
|
| 55 | - ); ?> |
|
| 52 | + echo esc_html__( |
|
| 53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
| 54 | + 'event_espresso' |
|
| 55 | + ); ?> |
|
| 56 | 56 | </p> |
| 57 | 57 | </div> |
| 58 | 58 | <?php |
| 59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 63 | 63 | } else { |
| 64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
| 65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 66 | - /** |
|
| 67 | - * espresso_minimum_php_version_error |
|
| 68 | - * |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 71 | - function espresso_minimum_php_version_error() |
|
| 72 | - { |
|
| 73 | - ?> |
|
| 64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
| 65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 66 | + /** |
|
| 67 | + * espresso_minimum_php_version_error |
|
| 68 | + * |
|
| 69 | + * @return void |
|
| 70 | + */ |
|
| 71 | + function espresso_minimum_php_version_error() |
|
| 72 | + { |
|
| 73 | + ?> |
|
| 74 | 74 | <div class="error"> |
| 75 | 75 | <p> |
| 76 | 76 | <?php |
| 77 | - printf( |
|
| 78 | - esc_html__( |
|
| 79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
| 80 | - 'event_espresso' |
|
| 81 | - ), |
|
| 82 | - EE_MIN_PHP_VER_REQUIRED, |
|
| 83 | - PHP_VERSION, |
|
| 84 | - '<br/>', |
|
| 85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
| 86 | - ); |
|
| 87 | - ?> |
|
| 77 | + printf( |
|
| 78 | + esc_html__( |
|
| 79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
| 80 | + 'event_espresso' |
|
| 81 | + ), |
|
| 82 | + EE_MIN_PHP_VER_REQUIRED, |
|
| 83 | + PHP_VERSION, |
|
| 84 | + '<br/>', |
|
| 85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
| 86 | + ); |
|
| 87 | + ?> |
|
| 88 | 88 | </p> |
| 89 | 89 | </div> |
| 90 | 90 | <?php |
| 91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 92 | - } |
|
| 91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
| 95 | - } else { |
|
| 96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 97 | - /** |
|
| 98 | - * espresso_version |
|
| 99 | - * Returns the plugin version |
|
| 100 | - * |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - function espresso_version() |
|
| 104 | - { |
|
| 105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.69.rc.012'); |
|
| 106 | - } |
|
| 94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
| 95 | + } else { |
|
| 96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 97 | + /** |
|
| 98 | + * espresso_version |
|
| 99 | + * Returns the plugin version |
|
| 100 | + * |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + function espresso_version() |
|
| 104 | + { |
|
| 105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.69.rc.012'); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * espresso_plugin_activation |
|
| 110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
| 111 | - */ |
|
| 112 | - function espresso_plugin_activation() |
|
| 113 | - { |
|
| 114 | - update_option('ee_espresso_activation', true); |
|
| 115 | - } |
|
| 108 | + /** |
|
| 109 | + * espresso_plugin_activation |
|
| 110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
| 111 | + */ |
|
| 112 | + function espresso_plugin_activation() |
|
| 113 | + { |
|
| 114 | + update_option('ee_espresso_activation', true); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 118 | 118 | |
| 119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
| 120 | - bootstrap_espresso(); |
|
| 121 | - } |
|
| 119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
| 120 | + bootstrap_espresso(); |
|
| 121 | + } |
|
| 122 | 122 | } |
| 123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
| 124 | - /** |
|
| 125 | - * deactivate_plugin |
|
| 126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
| 127 | - * |
|
| 128 | - * @access public |
|
| 129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
| 130 | - * @return void |
|
| 131 | - */ |
|
| 132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
| 133 | - { |
|
| 134 | - if (! function_exists('deactivate_plugins')) { |
|
| 135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 136 | - } |
|
| 137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
| 138 | - deactivate_plugins($plugin_basename); |
|
| 139 | - } |
|
| 124 | + /** |
|
| 125 | + * deactivate_plugin |
|
| 126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
| 127 | + * |
|
| 128 | + * @access public |
|
| 129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
| 130 | + * @return void |
|
| 131 | + */ |
|
| 132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
| 133 | + { |
|
| 134 | + if (! function_exists('deactivate_plugins')) { |
|
| 135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 136 | + } |
|
| 137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
| 138 | + deactivate_plugins($plugin_basename); |
|
| 139 | + } |
|
| 140 | 140 | } |