@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | /** |
204 | 204 | * column_REG_att_checked_in |
205 | - */ |
|
205 | + */ |
|
206 | 206 | function column__REG_att_checked_in(EE_Registration $item){ |
207 | 207 | $attendee = $item->attendee(); |
208 | 208 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | /** |
290 | 290 | * column_REG_final_price |
291 | - */ |
|
291 | + */ |
|
292 | 292 | function column__REG_final_price(EE_Registration $item){ |
293 | 293 | return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
294 | 294 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | /** |
301 | 301 | * column_TXN_paid |
302 | - */ |
|
302 | + */ |
|
303 | 303 | function column_TXN_paid(EE_Registration $item){ |
304 | 304 | |
305 | 305 | if ( $item->count() == 1 ) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | /** |
328 | 328 | * column_TXN_total |
329 | - */ |
|
329 | + */ |
|
330 | 330 | function column_TXN_total(EE_Registration $item){ |
331 | 331 | $txn = $item->transaction(); |
332 | 332 | $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | |
4 | 6 | class EE_Event_Registrations_List_Table extends EE_Admin_List_Table { |
@@ -126,8 +128,9 @@ discard block |
||
126 | 128 | $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
127 | 129 | foreach ( $events as $evt ) { |
128 | 130 | //any registrations for this event? |
129 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
130 | - continue; |
|
131 | + if ( ! $evt->get_count_of_all_registrations() ) { |
|
132 | + continue; |
|
133 | + } |
|
131 | 134 | $evts[] = array( 'id' => $evt->ID(), 'text' => $evt->get('EVT_name') ); |
132 | 135 | } |
133 | 136 | $filters[] = EEH_Form_Fields::select_input( 'event_id', $evts ); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - public function __construct( $admin_page ) { |
|
19 | + public function __construct($admin_page) { |
|
20 | 20 | parent::__construct($admin_page); |
21 | 21 | $this->_status = $this->_admin_page->get_registration_status_array(); |
22 | 22 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | protected function _setup_data() { |
28 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE ); |
|
29 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees( $this->_per_page, TRUE, TRUE); |
|
28 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE); |
|
29 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function _set_properties() { |
36 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
36 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
37 | 37 | |
38 | 38 | $this->_wp_list_args = array( |
39 | 39 | 'singular' => __('registrant', 'event_espresso'), |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $columns = array(); |
46 | 46 | //$columns['_Reg_Status'] = ''; |
47 | - if ( !empty( $evt_id ) ) { |
|
47 | + if ( ! empty($evt_id)) { |
|
48 | 48 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
49 | 49 | $this->_has_checkbox_column = true; |
50 | 50 | } |
@@ -60,26 +60,26 @@ discard block |
||
60 | 60 | 'TXN_total' => __('Total', 'event_espresso') |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_columns = array_merge( $columns, $this->_columns); |
|
63 | + $this->_columns = array_merge($columns, $this->_columns); |
|
64 | 64 | |
65 | 65 | $this->_primary_column = '_REG_att_checked_in'; |
66 | 66 | |
67 | - if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id ) ) { |
|
67 | + if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) { |
|
68 | 68 | $this->_bottom_buttons = array( |
69 | 69 | 'report'=> array( |
70 | 70 | 'route' => 'registrations_report', |
71 | 71 | 'extra_request' => |
72 | 72 | array( |
73 | 73 | 'EVT_ID'=> $evt_id, |
74 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
74 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
75 | 75 | ) |
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->_sortable_columns = array( |
80 | 80 | //true means its already sorted |
81 | - 'ATT_name' => array( 'ATT_name' => TRUE ), |
|
82 | - 'Event' => array( 'Event.EVT.Name' => FALSE ) |
|
81 | + 'ATT_name' => array('ATT_name' => TRUE), |
|
82 | + 'Event' => array('Event.EVT.Name' => FALSE) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | $this->_hidden_columns = array(); |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | - protected function _get_row_class( $item ) { |
|
95 | - $class = parent::_get_row_class( $item ); |
|
94 | + protected function _get_row_class($item) { |
|
95 | + $class = parent::_get_row_class($item); |
|
96 | 96 | //add status class |
97 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
98 | - if ( $this->_has_checkbox_column ) { |
|
97 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
98 | + if ($this->_has_checkbox_column) { |
|
99 | 99 | $class .= ' has-checkbox-column'; |
100 | 100 | } |
101 | 101 | return $class; |
@@ -107,42 +107,42 @@ discard block |
||
107 | 107 | $filters = $where = array(); |
108 | 108 | |
109 | 109 | |
110 | - if ( empty( $this->_dtts_for_event ) ) { |
|
110 | + if (empty($this->_dtts_for_event)) { |
|
111 | 111 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
112 | 112 | //note possible capability restrictions |
113 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) { |
|
114 | - $where['status**'] = array( '!=', 'private' ); |
|
113 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
114 | + $where['status**'] = array('!=', 'private'); |
|
115 | 115 | } |
116 | 116 | |
117 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
118 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
117 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
118 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
119 | 119 | } |
120 | 120 | |
121 | - $events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) ); |
|
122 | - $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
|
123 | - foreach ( $events as $evt ) { |
|
121 | + $events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'))); |
|
122 | + $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); |
|
123 | + foreach ($events as $evt) { |
|
124 | 124 | //any registrations for this event? |
125 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
125 | + if ( ! $evt->get_count_of_all_registrations()) |
|
126 | 126 | continue; |
127 | 127 | $evts[] = array( |
128 | 128 | 'id' => $evt->ID(), |
129 | - 'text' => $evt->get( 'EVT_name' ), |
|
129 | + 'text' => $evt->get('EVT_name'), |
|
130 | 130 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '' |
131 | 131 | ); |
132 | 132 | } |
133 | 133 | $event_filter = '<div class="ee-event-filter">'; |
134 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts ); |
|
135 | - $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>'; |
|
134 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts); |
|
135 | + $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>'; |
|
136 | 136 | $event_filter .= '</div>'; |
137 | 137 | $filters[] = $event_filter; |
138 | 138 | |
139 | 139 | } else { |
140 | 140 | //DTT datetimes filter |
141 | - $cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
141 | + $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
142 | 142 | $dtts = array(); |
143 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
144 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time(); |
|
145 | - $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string ); |
|
143 | + foreach ($this->_dtts_for_event as $dtt) { |
|
144 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time(); |
|
145 | + $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); |
|
146 | 146 | } |
147 | 147 | $filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); |
148 | 148 | } |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | |
164 | 164 | |
165 | 165 | protected function _get_total_event_attendees() { |
166 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
167 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
166 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
167 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
168 | 168 | $query_params = array(); |
169 | - if ($EVT_ID){ |
|
170 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
169 | + if ($EVT_ID) { |
|
170 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
171 | 171 | } |
172 | 172 | //if DTT is included we do multiple datetimes. Otherwise we just do primary datetime |
173 | - if ( $DTT_ID ) { |
|
173 | + if ($DTT_ID) { |
|
174 | 174 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
175 | 175 | } |
176 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
176 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
177 | 177 | |
178 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
178 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
179 | 179 | |
180 | 180 | return EEM_Registration::instance()->count($query_params); |
181 | 181 | } |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | |
187 | 187 | |
188 | 188 | |
189 | - function column__Reg_Status( EE_Registration $item ) { |
|
190 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
189 | + function column__Reg_Status(EE_Registration $item) { |
|
190 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | |
197 | 197 | function column_cb($item) { |
198 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
198 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | /** |
209 | 209 | * column_REG_att_checked_in |
210 | 210 | */ |
211 | - function column__REG_att_checked_in(EE_Registration $item){ |
|
211 | + function column__REG_att_checked_in(EE_Registration $item) { |
|
212 | 212 | $attendee = $item->attendee(); |
213 | 213 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
214 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
214 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
215 | 215 | $checkinstatus = $item->check_in_status_for_datetime($DTT_ID); |
216 | 216 | $nonce = wp_create_nonce('checkin_nonce'); |
217 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
218 | - $toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : ''; |
|
217 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
218 | + $toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : ''; |
|
219 | 219 | |
220 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
220 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
221 | 221 | |
222 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content; |
|
222 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -228,45 +228,45 @@ discard block |
||
228 | 228 | |
229 | 229 | function column_ATT_name(EE_Registration $item) { |
230 | 230 | $attendee = $item->attendee(); |
231 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
231 | + if ( ! $attendee instanceof EE_Attendee) { |
|
232 | 232 | return __('No contact record for this registration.', 'event_espresso'); |
233 | 233 | } |
234 | 234 | |
235 | 235 | // edit attendee link |
236 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
237 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name(); |
|
236 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
237 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name(); |
|
238 | 238 | $name_link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' : ''; |
239 | 239 | |
240 | 240 | //add group details |
241 | - $name_link .= ' ' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size()); |
|
241 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
242 | 242 | |
243 | 243 | //add regcode |
244 | - $link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL ); |
|
244 | + $link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); |
|
245 | 245 | $name_link .= '<br>'; |
246 | - $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() ) |
|
247 | - ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>' |
|
246 | + $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID()) |
|
247 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>' |
|
248 | 248 | : $item->reg_code(); |
249 | 249 | |
250 | 250 | //status |
251 | - $name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
251 | + $name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
252 | 252 | |
253 | 253 | $actions = array(); |
254 | - $DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
255 | - $DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID; |
|
254 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
255 | + $DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID; |
|
256 | 256 | |
257 | - if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) { |
|
258 | - $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
259 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>'; |
|
257 | + if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) { |
|
258 | + $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
259 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
263 | 263 | |
264 | - return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link; |
|
264 | + return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
268 | 268 | |
269 | - function column_ATT_email( EE_Registration $item ) { |
|
269 | + function column_ATT_email(EE_Registration $item) { |
|
270 | 270 | $attendee = $item->attendee(); |
271 | 271 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
272 | 272 | return $item->get_first_related('Attendee')->email(); |
@@ -279,10 +279,10 @@ discard block |
||
279 | 279 | function column_Event(EE_Registration $item) { |
280 | 280 | try { |
281 | 281 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
282 | - $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL ); |
|
283 | - $event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ? '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name(); |
|
284 | - } catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) { |
|
285 | - $event_label = esc_html__( 'Unknown', 'event_espresso' ); |
|
282 | + $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL); |
|
283 | + $event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name(); |
|
284 | + } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
|
285 | + $event_label = esc_html__('Unknown', 'event_espresso'); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return $event_label; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | |
293 | 293 | |
294 | 294 | |
295 | - function column_PRC_name(EE_Registration $item){ |
|
295 | + function column_PRC_name(EE_Registration $item) { |
|
296 | 296 | return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
297 | 297 | } |
298 | 298 | |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * column_REG_final_price |
306 | 306 | */ |
307 | - function column__REG_final_price(EE_Registration $item){ |
|
308 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
307 | + function column__REG_final_price(EE_Registration $item) { |
|
308 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | |
@@ -315,20 +315,20 @@ discard block |
||
315 | 315 | /** |
316 | 316 | * column_TXN_paid |
317 | 317 | */ |
318 | - function column_TXN_paid(EE_Registration $item){ |
|
318 | + function column_TXN_paid(EE_Registration $item) { |
|
319 | 319 | |
320 | - if ( $item->count() == 1 ) { |
|
320 | + if ($item->count() == 1) { |
|
321 | 321 | |
322 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
322 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
323 | 323 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
324 | 324 | } else { |
325 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
326 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
325 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
326 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
327 | 327 | <span class="reg-pad-rght"> |
328 | - <a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '"> |
|
329 | - ' . $item->transaction()->pretty_paid(). ' |
|
328 | + <a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"> |
|
329 | + ' . $item->transaction()->pretty_paid().' |
|
330 | 330 | </a> |
331 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
331 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
332 | 332 | } |
333 | 333 | } else { |
334 | 334 | return '<span class="reg-pad-rght"></span>'; |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | /** |
343 | 343 | * column_TXN_total |
344 | 344 | */ |
345 | - function column_TXN_total(EE_Registration $item){ |
|
345 | + function column_TXN_total(EE_Registration $item) { |
|
346 | 346 | $txn = $item->transaction(); |
347 | - $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
348 | - if ( $item->get('REG_count') == 1 ) { |
|
347 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
348 | + if ($item->get('REG_count') == 1) { |
|
349 | 349 | $line_total_obj = $txn->total_line_item(); |
350 | 350 | $txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso'); |
351 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
351 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
352 | 352 | } else { |
353 | 353 | return '<span class="reg-pad-rght"></span>'; |
354 | 354 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
3 | 5 | /** |
4 | 6 | * Event Espresso |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/** |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); /** |
|
3 | 3 | * |
4 | 4 | * Event Espresso |
5 | 5 | * |
@@ -67,24 +67,24 @@ discard block |
||
67 | 67 | * @param EE_Session $session |
68 | 68 | * @return \EE_Cart |
69 | 69 | */ |
70 | - public static function instance( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
71 | - if ( ! empty( $grand_total ) ){ |
|
72 | - self::$_instance = new self( $grand_total, $session ); |
|
70 | + public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
71 | + if ( ! empty($grand_total)) { |
|
72 | + self::$_instance = new self($grand_total, $session); |
|
73 | 73 | } |
74 | 74 | // or maybe retrieve an existing one ? |
75 | - if ( ! self::$_instance instanceof EE_Cart ) { |
|
75 | + if ( ! self::$_instance instanceof EE_Cart) { |
|
76 | 76 | // try getting the cart out of the session |
77 | 77 | $saved_cart = $session instanceof EE_Session ? $session->cart() : null; |
78 | - self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self( $grand_total, $session ); |
|
79 | - unset( $saved_cart ); |
|
78 | + self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session); |
|
79 | + unset($saved_cart); |
|
80 | 80 | } |
81 | 81 | // verify that cart is ok and grand total line item exists |
82 | - if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item ) { |
|
83 | - self::$_instance = new self( $grand_total, $session ); |
|
82 | + if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) { |
|
83 | + self::$_instance = new self($grand_total, $session); |
|
84 | 84 | } |
85 | 85 | self::$_instance->get_grand_total(); |
86 | 86 | // once everything is all said and done, save the cart to the EE_Session |
87 | - add_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 ); |
|
87 | + add_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
88 | 88 | return self::$_instance; |
89 | 89 | } |
90 | 90 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @param EE_Session $session |
99 | 99 | * @return \EE_Cart |
100 | 100 | */ |
101 | - private function __construct( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
102 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
103 | - $this->set_session( $session ); |
|
104 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
105 | - $this->set_grand_total_line_item( $grand_total ); |
|
101 | + private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
102 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
103 | + $this->set_session($session); |
|
104 | + if ($grand_total instanceof EE_Line_Item) { |
|
105 | + $this->set_grand_total_line_item($grand_total); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | * @param EE_Session $session |
115 | 115 | * @return EE_Cart |
116 | 116 | */ |
117 | - public static function reset( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
118 | - remove_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 ); |
|
119 | - if ( $session instanceof EE_Session ) { |
|
117 | + public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
118 | + remove_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
119 | + if ($session instanceof EE_Session) { |
|
120 | 120 | $session->reset_cart(); |
121 | 121 | } |
122 | 122 | self::$_instance = null; |
123 | - return self::instance( $grand_total, $session ); |
|
123 | + return self::instance($grand_total, $session); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @param EE_Session $session |
130 | 130 | */ |
131 | - public function set_session( EE_Session $session = null ) { |
|
132 | - $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core( 'Session' ); |
|
131 | + public function set_session(EE_Session $session = null) { |
|
132 | + $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * know the grand total line item on it |
140 | 140 | * @param EE_Line_Item $line_item |
141 | 141 | */ |
142 | - public function set_grand_total_line_item( EE_Line_Item $line_item ) { |
|
142 | + public function set_grand_total_line_item(EE_Line_Item $line_item) { |
|
143 | 143 | $this->_grand_total = $line_item; |
144 | 144 | } |
145 | 145 | |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | * @param EE_Session $session |
153 | 153 | * @return \EE_Cart |
154 | 154 | */ |
155 | - public static function get_cart_from_txn( EE_Transaction $transaction, EE_Session $session = null ) { |
|
155 | + public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null) { |
|
156 | 156 | $grand_total = $transaction->total_line_item(); |
157 | 157 | $grand_total->get_items(); |
158 | 158 | $grand_total->tax_descendants(); |
159 | - return EE_Cart::instance( $grand_total, $session ); |
|
159 | + return EE_Cart::instance($grand_total, $session); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items |
166 | 166 | * @return EE_Line_Item |
167 | 167 | */ |
168 | - private function _create_grand_total(){ |
|
168 | + private function _create_grand_total() { |
|
169 | 169 | $this->_grand_total = EEH_Line_Item::create_total_line_item(); |
170 | 170 | return $this->_grand_total; |
171 | 171 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @return \EE_Line_Item[] |
179 | 179 | */ |
180 | 180 | public function get_tickets() { |
181 | - return EEH_Line_Item::get_ticket_line_items( $this->_grand_total ); |
|
181 | + return EEH_Line_Item::get_ticket_line_items($this->_grand_total); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function all_ticket_quantity_count() { |
193 | 193 | $tickets = $this->get_tickets(); |
194 | - if ( empty( $tickets )) { |
|
194 | + if (empty($tickets)) { |
|
195 | 195 | return 0; |
196 | 196 | } |
197 | 197 | $count = 0; |
198 | - foreach ( $tickets as $ticket ) { |
|
198 | + foreach ($tickets as $ticket) { |
|
199 | 199 | $count = $count + $ticket->get('LIN_quantity'); |
200 | 200 | } |
201 | 201 | return $count; |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * Gets all the tax line items |
208 | 208 | * @return \EE_Line_Item[] |
209 | 209 | */ |
210 | - public function get_taxes(){ |
|
211 | - return EEH_Line_Item::get_taxes_subtotal( $this->_grand_total )->children(); |
|
210 | + public function get_taxes() { |
|
211 | + return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children(); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * Gets the total line item (which is a parent of all other line items) on this cart |
218 | 218 | * @return EE_Line_Item |
219 | 219 | */ |
220 | - public function get_grand_total(){ |
|
220 | + public function get_grand_total() { |
|
221 | 221 | return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total(); |
222 | 222 | } |
223 | 223 | |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | * @param int $qty |
231 | 231 | * @return TRUE on success, FALSE on fail |
232 | 232 | */ |
233 | - public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) { |
|
234 | - EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty ); |
|
233 | + public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1) { |
|
234 | + EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty); |
|
235 | 235 | return $this->save_cart() ? TRUE : FALSE; |
236 | 236 | } |
237 | 237 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @return float |
255 | 255 | */ |
256 | 256 | public function get_applied_taxes() { |
257 | - return EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
257 | + return EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @return float |
266 | 266 | */ |
267 | 267 | public function get_cart_grand_total() { |
268 | - EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
268 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
269 | 269 | return $this->get_grand_total()->total(); |
270 | 270 | } |
271 | 271 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function recalculate_all_cart_totals() { |
280 | 280 | $pre_tax_total = $this->get_cart_total_before_tax(); |
281 | - $taxes_total = EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
282 | - $this->_grand_total->set_total( $pre_tax_total + $taxes_total ); |
|
281 | + $taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
282 | + $this->_grand_total->set_total($pre_tax_total + $taxes_total); |
|
283 | 283 | $this->_grand_total->save_this_and_descendants_to_txn(); |
284 | 284 | return $this->get_grand_total()->total(); |
285 | 285 | } |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | * @param array|bool|string $line_item_codes |
293 | 293 | * @return int on success, FALSE on fail |
294 | 294 | */ |
295 | - public function delete_items( $line_item_codes = FALSE ) { |
|
296 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
297 | - return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes ); |
|
295 | + public function delete_items($line_item_codes = FALSE) { |
|
296 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
297 | + return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | * @return bool |
306 | 306 | */ |
307 | 307 | public function empty_cart() { |
308 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
308 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
309 | 309 | $this->_grand_total = $this->_create_grand_total(); |
310 | - return $this->save_cart( TRUE ); |
|
310 | + return $this->save_cart(TRUE); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * @return bool |
319 | 319 | */ |
320 | 320 | public function delete_cart() { |
321 | - $deleted = EEH_Line_Item::delete_all_child_items( $this->_grand_total ); |
|
322 | - if ( $deleted ) { |
|
321 | + $deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total); |
|
322 | + if ($deleted) { |
|
323 | 323 | $deleted += $this->_grand_total->delete(); |
324 | 324 | $this->_grand_total = null; |
325 | 325 | } |
@@ -334,17 +334,17 @@ discard block |
||
334 | 334 | * @param bool $apply_taxes |
335 | 335 | * @return TRUE on success, FALSE on fail |
336 | 336 | */ |
337 | - public function save_cart( $apply_taxes = TRUE ) { |
|
338 | - if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) { |
|
339 | - EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
337 | + public function save_cart($apply_taxes = TRUE) { |
|
338 | + if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) { |
|
339 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
340 | 340 | //make sure we don't cache the transaction because it can get stale |
341 | - if( $this->_grand_total->get_one_from_cache( 'Transaction' ) instanceof EE_Transaction && |
|
342 | - $this->_grand_total->get_one_from_cache( 'Transaction' )->ID()) { |
|
343 | - $this->_grand_total->clear_cache( 'Transaction', null, true ); |
|
341 | + if ($this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction && |
|
342 | + $this->_grand_total->get_one_from_cache('Transaction')->ID()) { |
|
343 | + $this->_grand_total->clear_cache('Transaction', null, true); |
|
344 | 344 | } |
345 | 345 | } |
346 | - if ( $this->_session instanceof EE_Session ) { |
|
347 | - return $this->_session->set_cart( $this ); |
|
346 | + if ($this->_session instanceof EE_Session) { |
|
347 | + return $this->_session->set_cart($this); |
|
348 | 348 | } else { |
349 | 349 | return false; |
350 | 350 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @access public |
229 | 229 | * @param EE_Ticket $ticket |
230 | 230 | * @param int $qty |
231 | - * @return TRUE on success, FALSE on fail |
|
231 | + * @return boolean on success, FALSE on fail |
|
232 | 232 | */ |
233 | 233 | public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) { |
234 | 234 | EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty ); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @save cart to session |
333 | 333 | * @access public |
334 | 334 | * @param bool $apply_taxes |
335 | - * @return TRUE on success, FALSE on fail |
|
335 | + * @return boolean on success, FALSE on fail |
|
336 | 336 | */ |
337 | 337 | public function save_cart( $apply_taxes = TRUE ) { |
338 | 338 | if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) { |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | |
6 | 7 | /** |
@@ -362,8 +363,9 @@ discard block |
||
362 | 363 | |
363 | 364 | $sortable = array(); |
364 | 365 | foreach ( $_sortable as $id => $data ) { |
365 | - if ( empty( $data ) ) |
|
366 | - continue; |
|
366 | + if ( empty( $data ) ) { |
|
367 | + continue; |
|
368 | + } |
|
367 | 369 | |
368 | 370 | //fix for offset errors with WP_List_Table default get_columninfo() |
369 | 371 | if ( is_array($data) ) { |
@@ -375,8 +377,9 @@ discard block |
||
375 | 377 | |
376 | 378 | $data = (array) $data; |
377 | 379 | |
378 | - if ( !isset( $data[1] ) ) |
|
379 | - $_data[1] = false; |
|
380 | + if ( !isset( $data[1] ) ) { |
|
381 | + $_data[1] = false; |
|
382 | + } |
|
380 | 383 | |
381 | 384 | |
382 | 385 | $sortable[$id] = $_data; |
@@ -399,11 +402,12 @@ discard block |
||
399 | 402 | $actions = array(); |
400 | 403 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
401 | 404 | foreach ( $this->_views as $view => $args) { |
402 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
403 | - //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
|
405 | + if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) { |
|
406 | + //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
|
404 | 407 | foreach ( $args['bulk_action'] as $route =>$label ) { |
405 | 408 | if ( $this->_admin_page->check_user_access( $route, true ) ) { |
406 | 409 | $actions[$route] = $label; |
410 | + } |
|
407 | 411 | } |
408 | 412 | } |
409 | 413 | } |
@@ -633,14 +637,12 @@ discard block |
||
633 | 637 | echo '<th scope="row" class="check-column">'; |
634 | 638 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
635 | 639 | echo '</th>'; |
636 | - } |
|
637 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
640 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
638 | 641 | echo "<td $attributes>"; |
639 | 642 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
640 | 643 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
641 | 644 | echo "</td>"; |
642 | - } |
|
643 | - else { |
|
645 | + } else { |
|
644 | 646 | echo "<td $attributes>"; |
645 | 647 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
646 | 648 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
@@ -656,7 +658,7 @@ discard block |
||
656 | 658 | $this->_filters(); |
657 | 659 | echo $this->_get_hidden_fields(); |
658 | 660 | echo '<br class="clear">'; |
659 | - }else{ |
|
661 | + } else{ |
|
660 | 662 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
661 | 663 | foreach($this->_bottom_buttons as $type => $action){ |
662 | 664 | $route = isset( $action['route'] ) ? $action['route'] : ''; |
@@ -594,7 +594,7 @@ |
||
594 | 594 | * @since 4.1 |
595 | 595 | * @access public |
596 | 596 | * |
597 | - * @param object $item The current item |
|
597 | + * @param EE_Message_Template_Group $item The current item |
|
598 | 598 | */ |
599 | 599 | public function single_row( $item ) { |
600 | 600 | $row_class = $this->_get_row_class( $item ); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | |
34 | 34 | if ( ! class_exists( 'WP_List_Table' )) { |
35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
35 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -771,19 +771,19 @@ discard block |
||
771 | 771 | $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
772 | 772 | $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
773 | 773 | $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
774 | - try { |
|
775 | - $content .= apply_filters( |
|
776 | - 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
777 | - $action_items, |
|
778 | - $item, |
|
779 | - $this |
|
780 | - ); |
|
781 | - } catch (\Exception $e) { |
|
782 | - if (WP_DEBUG) { |
|
783 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
784 | - } |
|
785 | - $content .= $action_items; |
|
786 | - } |
|
774 | + try { |
|
775 | + $content .= apply_filters( |
|
776 | + 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
777 | + $action_items, |
|
778 | + $item, |
|
779 | + $this |
|
780 | + ); |
|
781 | + } catch (\Exception $e) { |
|
782 | + if (WP_DEBUG) { |
|
783 | + \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
784 | + } |
|
785 | + $content .= $action_items; |
|
786 | + } |
|
787 | 787 | $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
788 | 788 | return $content; |
789 | 789 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * ------------------------------------------------------------------------ |
32 | 32 | */ |
33 | 33 | |
34 | -if ( ! class_exists( 'WP_List_Table' )) { |
|
35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
34 | +if ( ! class_exists('WP_List_Table')) { |
|
35 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -244,16 +244,16 @@ discard block |
||
244 | 244 | * constructor |
245 | 245 | * @param EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table. |
246 | 246 | */ |
247 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
247 | + public function __construct(EE_Admin_Page $admin_page) { |
|
248 | 248 | $this->_admin_page = $admin_page; |
249 | 249 | $this->_req_data = $this->_admin_page->get_request_data(); |
250 | 250 | $this->_view = $this->_admin_page->get_view(); |
251 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
251 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
252 | 252 | $this->_current_page = $this->get_pagenum(); |
253 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
254 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
253 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
254 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
255 | 255 | |
256 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
256 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
257 | 257 | |
258 | 258 | $this->_setup_data(); |
259 | 259 | $this->_add_view_counts(); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $this->_set_properties(); |
264 | 264 | |
265 | 265 | //set primary column |
266 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
266 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
267 | 267 | |
268 | 268 | //set parent defaults |
269 | 269 | parent::__construct($this->_wp_list_args); |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | * @return string |
340 | 340 | */ |
341 | 341 | protected function _get_hidden_fields() { |
342 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
343 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
342 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
343 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
344 | 344 | //if action is STILL empty, then we set it to default |
345 | - $action = empty( $action ) ? 'default' : $action; |
|
346 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
347 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
348 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
345 | + $action = empty($action) ? 'default' : $action; |
|
346 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
347 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
348 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
349 | 349 | |
350 | 350 | $bulk_actions = $this->_get_bulk_actions(); |
351 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
352 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
351 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
352 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | return $field; |
@@ -379,15 +379,15 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @var array |
381 | 381 | */ |
382 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
382 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
383 | 383 | |
384 | 384 | $sortable = array(); |
385 | - foreach ( $_sortable as $id => $data ) { |
|
386 | - if ( empty( $data ) ) |
|
385 | + foreach ($_sortable as $id => $data) { |
|
386 | + if (empty($data)) |
|
387 | 387 | continue; |
388 | 388 | |
389 | 389 | //fix for offset errors with WP_List_Table default get_columninfo() |
390 | - if ( is_array($data) ) { |
|
390 | + if (is_array($data)) { |
|
391 | 391 | $_data[0] = key($data); |
392 | 392 | $_data[1] = isset($data[1]) ? $data[1] : false; |
393 | 393 | } else { |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | |
397 | 397 | $data = (array) $data; |
398 | 398 | |
399 | - if ( !isset( $data[1] ) ) |
|
399 | + if ( ! isset($data[1])) |
|
400 | 400 | $_data[1] = false; |
401 | 401 | |
402 | 402 | |
403 | 403 | $sortable[$id] = $_data; |
404 | 404 | } |
405 | 405 | $primary = $this->get_primary_column_name(); |
406 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
406 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | * @return string |
413 | 413 | */ |
414 | 414 | protected function get_primary_column_name() { |
415 | - foreach( class_parents( $this ) as $parent ) { |
|
416 | - if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) { |
|
415 | + foreach (class_parents($this) as $parent) { |
|
416 | + if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') { |
|
417 | 417 | return parent::get_primary_column_name(); |
418 | 418 | } |
419 | 419 | } |
@@ -430,10 +430,10 @@ discard block |
||
430 | 430 | * @param string $primary |
431 | 431 | * @return string |
432 | 432 | */ |
433 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
434 | - foreach( class_parents( $this ) as $parent ) { |
|
435 | - if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) { |
|
436 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
433 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
434 | + foreach (class_parents($this) as $parent) { |
|
435 | + if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') { |
|
436 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | return ''; |
@@ -451,11 +451,11 @@ discard block |
||
451 | 451 | protected function _get_bulk_actions() { |
452 | 452 | $actions = array(); |
453 | 453 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
454 | - foreach ( $this->_views as $view => $args) { |
|
455 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
454 | + foreach ($this->_views as $view => $args) { |
|
455 | + if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view) |
|
456 | 456 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
457 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
458 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
457 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
458 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
459 | 459 | $actions[$route] = $label; |
460 | 460 | } |
461 | 461 | } |
@@ -473,18 +473,18 @@ discard block |
||
473 | 473 | */ |
474 | 474 | private function _filters() { |
475 | 475 | $classname = get_class($this); |
476 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
476 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
477 | 477 | |
478 | - if ( empty( $filters )) { |
|
478 | + if (empty($filters)) { |
|
479 | 479 | return; |
480 | 480 | } |
481 | - foreach ( $filters as $filter ) { |
|
481 | + foreach ($filters as $filter) { |
|
482 | 482 | echo $filter; |
483 | 483 | } |
484 | 484 | //add filter button at end |
485 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
485 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
486 | 486 | //add reset filters button at end |
487 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
487 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | * @param string $column_name |
499 | 499 | * @return string |
500 | 500 | */ |
501 | - public function set_primary_column( $column_name ) { |
|
502 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
501 | + public function set_primary_column($column_name) { |
|
502 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | array( |
519 | 519 | 'total_items' => $total_items, |
520 | 520 | 'per_page' => $this->_per_page, |
521 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
521 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
522 | 522 | ) |
523 | 523 | ); |
524 | 524 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @return string html content for the column |
536 | 536 | */ |
537 | - public function column_default( $item, $column_name ) { |
|
537 | + public function column_default($item, $column_name) { |
|
538 | 538 | /** |
539 | 539 | * Dynamic hook allowing for adding additional column content in this list table. |
540 | 540 | * Note that $this->screen->id is in the format |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * hook prefix ("event-espresso") will be different. |
545 | 545 | * |
546 | 546 | */ |
547 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
547 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @var array |
562 | 562 | */ |
563 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
563 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
564 | 564 | return $columns; |
565 | 565 | } |
566 | 566 | |
@@ -572,18 +572,18 @@ discard block |
||
572 | 572 | $views = $this->get_views(); |
573 | 573 | $assembled_views = ''; |
574 | 574 | |
575 | - if ( empty( $views )) { |
|
575 | + if (empty($views)) { |
|
576 | 576 | return; |
577 | 577 | } |
578 | 578 | echo "<ul class='subsubsub'>\n"; |
579 | - foreach ( $views as $view ) { |
|
580 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
581 | - if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) { |
|
582 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
579 | + foreach ($views as $view) { |
|
580 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
581 | + if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) { |
|
582 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
586 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
586 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
587 | 587 | echo "</ul>"; |
588 | 588 | } |
589 | 589 | |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @param object $item The current item |
598 | 598 | */ |
599 | - public function single_row( $item ) { |
|
600 | - $row_class = $this->_get_row_class( $item ); |
|
601 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
602 | - $this->single_row_columns( $item ); |
|
599 | + public function single_row($item) { |
|
600 | + $row_class = $this->_get_row_class($item); |
|
601 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
602 | + $this->single_row_columns($item); |
|
603 | 603 | echo '</tr>'; |
604 | 604 | } |
605 | 605 | |
@@ -610,13 +610,13 @@ discard block |
||
610 | 610 | * @param object $item the current item |
611 | 611 | * @return string |
612 | 612 | */ |
613 | - protected function _get_row_class( $item ) { |
|
613 | + protected function _get_row_class($item) { |
|
614 | 614 | static $row_class = ''; |
615 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
615 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
616 | 616 | |
617 | 617 | $new_row_class = $row_class; |
618 | 618 | |
619 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
619 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
620 | 620 | $new_row_class .= ' rowsortable'; |
621 | 621 | } |
622 | 622 | |
@@ -635,13 +635,13 @@ discard block |
||
635 | 635 | |
636 | 636 | public function get_hidden_columns() { |
637 | 637 | $user_id = get_current_user_id(); |
638 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
639 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
640 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
641 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
638 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
639 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
640 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
641 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
642 | 642 | } |
643 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
644 | - $saved_columns = (array) get_user_option( $ref, $user_id ); |
|
643 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
644 | + $saved_columns = (array) get_user_option($ref, $user_id); |
|
645 | 645 | return $saved_columns; |
646 | 646 | } |
647 | 647 | |
@@ -656,47 +656,47 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @param object $item The current item |
658 | 658 | */ |
659 | - public function single_row_columns( $item ) { |
|
660 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
659 | + public function single_row_columns($item) { |
|
660 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
661 | 661 | |
662 | 662 | global $wp_version; |
663 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
663 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
664 | 664 | |
665 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
665 | + foreach ($columns as $column_name => $column_display_name) { |
|
666 | 666 | |
667 | 667 | /** |
668 | 668 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
669 | 669 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
670 | 670 | */ |
671 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
672 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
671 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
672 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
673 | 673 | |
674 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
675 | - if ( $primary == $column_name ) { |
|
674 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
675 | + if ($primary == $column_name) { |
|
676 | 676 | $classes .= ' has-row-actions column-primary'; |
677 | 677 | } |
678 | 678 | |
679 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
679 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
680 | 680 | |
681 | 681 | $class = "class='$classes'"; |
682 | 682 | |
683 | 683 | $attributes = "$class$style$data"; |
684 | 684 | |
685 | - if ( 'cb' === $column_name ) { |
|
685 | + if ('cb' === $column_name) { |
|
686 | 686 | echo '<th scope="row" class="check-column">'; |
687 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
687 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
688 | 688 | echo '</th>'; |
689 | 689 | } |
690 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
690 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
691 | 691 | echo "<td $attributes>"; |
692 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
693 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
692 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
693 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
694 | 694 | echo "</td>"; |
695 | 695 | } |
696 | 696 | else { |
697 | 697 | echo "<td $attributes>"; |
698 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
699 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
698 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
699 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
700 | 700 | echo "</td>"; |
701 | 701 | } |
702 | 702 | } |
@@ -704,19 +704,19 @@ discard block |
||
704 | 704 | |
705 | 705 | |
706 | 706 | |
707 | - public function extra_tablenav( $which ) { |
|
708 | - if ( $which == 'top' ) { |
|
707 | + public function extra_tablenav($which) { |
|
708 | + if ($which == 'top') { |
|
709 | 709 | $this->_filters(); |
710 | 710 | echo $this->_get_hidden_fields(); |
711 | 711 | echo '<br class="clear">'; |
712 | - }else{ |
|
712 | + } else { |
|
713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | - foreach($this->_bottom_buttons as $type => $action){ |
|
715 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
714 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
715 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
717 | 717 | echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request); |
718 | 718 | } |
719 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
719 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
720 | 720 | echo '</div>'; |
721 | 721 | } |
722 | 722 | //echo $this->_entries_per_page_dropdown; |
@@ -766,11 +766,11 @@ discard block |
||
766 | 766 | * |
767 | 767 | * @return string The assembled action elements container. |
768 | 768 | */ |
769 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
769 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
770 | 770 | $content = ''; |
771 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
772 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
773 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
771 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
772 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
773 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
774 | 774 | try { |
775 | 775 | $content .= apply_filters( |
776 | 776 | 'FHEE__EE_Admin_List_Table___action_string__action_items', |
@@ -780,11 +780,11 @@ discard block |
||
780 | 780 | ); |
781 | 781 | } catch (\Exception $e) { |
782 | 782 | if (WP_DEBUG) { |
783 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
783 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
784 | 784 | } |
785 | 785 | $content .= $action_items; |
786 | 786 | } |
787 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
|
787 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
788 | 788 | return $content; |
789 | 789 | } |
790 | 790 | } |
@@ -2,25 +2,25 @@ |
||
2 | 2 | //this displays any legends with an array of $items that are indexed by id for each item and each item itself is an array of 'icon' and 'desc'. |
3 | 3 | |
4 | 4 | //figure out the columns based on the count of items (we want a max of 6 items per column). |
5 | -$per_col = isset( $per_column ) ? $per_column : 5; |
|
5 | +$per_col = isset($per_column) ? $per_column : 5; |
|
6 | 6 | $count = 1; |
7 | 7 | ?> |
8 | 8 | <div class="ee-list-table-legend-container"> |
9 | 9 | <h4><?php _e('Legend', 'event_espresso'); ?></h4> |
10 | 10 | <dl class="alignleft ee-list-table-legend"> |
11 | - <?php foreach ( $items as $item => $details ) : ?> |
|
12 | - <?php if ( $per_col < $count ) : ?> |
|
11 | + <?php foreach ($items as $item => $details) : ?> |
|
12 | + <?php if ($per_col < $count) : ?> |
|
13 | 13 | </dl> |
14 | 14 | <dl class="alignleft ee-list-table-legend"> |
15 | 15 | <?php $count = 1; endif; ?> |
16 | 16 | <dt id="ee-legend-item-<?php echo $item; ?>"> |
17 | - <?php $class = ! empty( $details['class'] ) ? $details['class'] : 'ee-legend-img-container'; ?> |
|
18 | - <?php if ( strpos( $details[ 'class' ], '<span' ) !== false ) { |
|
17 | + <?php $class = ! empty($details['class']) ? $details['class'] : 'ee-legend-img-container'; ?> |
|
18 | + <?php if (strpos($details['class'], '<span') !== false) { |
|
19 | 19 | echo $class; |
20 | 20 | } else { ?> |
21 | 21 | <span class="<?php echo $class; ?>"> |
22 | - <?php if ( ! empty( $details[ 'icon' ] ) ) : ?> |
|
23 | - <img src="<?php echo $details[ 'icon' ]; ?>" class="ee-legend-icon" alt="<?php echo esc_attr( $details[ 'desc' ] ); ?>"/> |
|
22 | + <?php if ( ! empty($details['icon'])) : ?> |
|
23 | + <img src="<?php echo $details['icon']; ?>" class="ee-legend-icon" alt="<?php echo esc_attr($details['desc']); ?>"/> |
|
24 | 24 | <?php endif; ?> |
25 | 25 | </span> |
26 | 26 | <?php } ?> |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | 'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false) |
56 | 56 | ) |
57 | 57 | */ |
58 | -class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage{ |
|
58 | +class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage { |
|
59 | 59 | private $_old_table; |
60 | 60 | private $_new_table; |
61 | 61 | private $_option_table; |
62 | - function _migration_step($num_items=50){ |
|
62 | + function _migration_step($num_items = 50) { |
|
63 | 63 | global $wpdb; |
64 | 64 | $start_at_record = $this->count_records_migrated(); |
65 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d",$start_at_record,$num_items),ARRAY_A); |
|
65 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
66 | 66 | $items_actually_migrated = 0; |
67 | - foreach($rows as $question_row){ |
|
67 | + foreach ($rows as $question_row) { |
|
68 | 68 | $new_id = $this->_insert_new_question($question_row); |
69 | 69 | $this->get_migration_script()->set_mapping($this->_old_table, $question_row['id'], $this->_new_table, $new_id); |
70 | 70 | $items_actually_migrated++; |
71 | 71 | } |
72 | - if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){ |
|
72 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
73 | 73 | $this->set_completed(); |
74 | 74 | } |
75 | 75 | return $items_actually_migrated; |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | $this->_option_table = $wpdb->prefix."esp_question_option"; |
88 | 88 | parent::__construct(); |
89 | 89 | } |
90 | - private function _insert_new_question($old_question){ |
|
90 | + private function _insert_new_question($old_question) { |
|
91 | 91 | global $wpdb; |
92 | 92 | //if this pretends to be a 'system' question, check if we already have a |
93 | 93 | //system question for that string. If so, pretend THAT new question |
94 | 94 | //is what we just isnerted |
95 | - if($old_question['system_name']){ |
|
96 | - $id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s",$old_question['system_name']))); |
|
97 | - if($id_of_new_system_question){ |
|
95 | + if ($old_question['system_name']) { |
|
96 | + $id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s", $old_question['system_name']))); |
|
97 | + if ($id_of_new_system_question) { |
|
98 | 98 | return $id_of_new_system_question; |
99 | 99 | } |
100 | 100 | //ok so this must be the first one. Carry on. |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | 'QST_deleted'=>false |
114 | 114 | ); |
115 | 115 | $datatypes = array( |
116 | - '%s',//QST_display_text |
|
117 | - '%s',//QST-admin_label |
|
118 | - '%s',//QST_system |
|
119 | - '%s',//QST_type |
|
120 | - '%d',//QST_required |
|
121 | - '%s',//QST_required_text |
|
122 | - '%d',//QST_order |
|
123 | - '%d',//QST_admin_only |
|
124 | - '%d',//QST_wp_user |
|
125 | - '%d',//QST_deleted |
|
116 | + '%s', //QST_display_text |
|
117 | + '%s', //QST-admin_label |
|
118 | + '%s', //QST_system |
|
119 | + '%s', //QST_type |
|
120 | + '%d', //QST_required |
|
121 | + '%s', //QST_required_text |
|
122 | + '%d', //QST_order |
|
123 | + '%d', //QST_admin_only |
|
124 | + '%d', //QST_wp_user |
|
125 | + '%d', //QST_deleted |
|
126 | 126 | ); |
127 | - $success = $wpdb->insert($this->_new_table,$cols_n_values,$datatypes); |
|
128 | - if ( ! $success){ |
|
127 | + $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
128 | + if ( ! $success) { |
|
129 | 129 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question, $this->_new_table, $cols_n_values, $datatypes)); |
130 | 130 | return 0; |
131 | 131 | } |
132 | 132 | $new_id = $wpdb->insert_id; |
133 | 133 | //now take care of posisbly adding question options |
134 | - if(in_array($old_question['question_type'],array('DROPDOWN','SINGLE','MULTIPLE'))){ |
|
135 | - $options = explode(",",$old_question['response']); |
|
136 | - foreach($options as $option){ |
|
134 | + if (in_array($old_question['question_type'], array('DROPDOWN', 'SINGLE', 'MULTIPLE'))) { |
|
135 | + $options = explode(",", $old_question['response']); |
|
136 | + foreach ($options as $option) { |
|
137 | 137 | $this->_insert_question_option($option, $new_id); |
138 | 138 | } |
139 | 139 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param int $question_id |
147 | 147 | * @return int |
148 | 148 | */ |
149 | - private function _insert_question_option($option,$question_id){ |
|
149 | + private function _insert_question_option($option, $question_id) { |
|
150 | 150 | $option = trim($option); |
151 | 151 | global $wpdb; |
152 | 152 | $cols_n_values = array( |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | 'QSO_value'=>$option, |
155 | 155 | 'QSO_deleted'=>false |
156 | 156 | ); |
157 | - $datatypes= array( |
|
158 | - '%d',//QST_ID |
|
159 | - '%s',//QSO_value |
|
160 | - '%d',//QSO_deleted |
|
157 | + $datatypes = array( |
|
158 | + '%d', //QST_ID |
|
159 | + '%s', //QSO_value |
|
160 | + '%d', //QSO_deleted |
|
161 | 161 | ); |
162 | - $success = $wpdb->insert($this->_option_table,$cols_n_values,$datatypes); |
|
163 | - if ( ! $success ){ |
|
164 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option,'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
162 | + $success = $wpdb->insert($this->_option_table, $cols_n_values, $datatypes); |
|
163 | + if ( ! $success) { |
|
164 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option, 'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
165 | 165 | return 0; |
166 | 166 | } |
167 | 167 | return $wpdb->insert_id; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -12,68 +12,68 @@ discard block |
||
12 | 12 | * @author Mike Nelson |
13 | 13 | * |
14 | 14 | */ |
15 | -class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table{ |
|
16 | - function __construct(){ |
|
15 | +class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table { |
|
16 | + function __construct() { |
|
17 | 17 | global $wpdb; |
18 | - $this->_old_table = $wpdb->prefix . 'esp_line_item'; |
|
18 | + $this->_old_table = $wpdb->prefix.'esp_line_item'; |
|
19 | 19 | $this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"'; |
20 | 20 | $this->_pretty_name = __('Event Sub-total line items', 'event_espresso'); |
21 | 21 | parent::__construct(); |
22 | 22 | } |
23 | - protected function _migrate_old_row( $line_item_row ) { |
|
23 | + protected function _migrate_old_row($line_item_row) { |
|
24 | 24 | global $wpdb; |
25 | 25 | //what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID |
26 | - $event_id = $wpdb->get_var( $wpdb->prepare( 'SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row[ 'TXN_ID' ] ) ); |
|
26 | + $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM '.$wpdb->prefix.'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID'])); |
|
27 | 27 | $new_line_item_data = array( |
28 | - 'LIN_code' => 'event-' . $event_id, |
|
29 | - 'TXN_ID' => $line_item_row[ 'TXN_ID' ], |
|
30 | - 'LIN_name' => __( 'Event', 'event_espresso' ), |
|
31 | - 'LIN_desc' => $line_item_row[ 'LIN_desc' ], |
|
32 | - 'LIN_unit_price' => $line_item_row[ 'LIN_unit_price' ], |
|
33 | - 'LIN_percent' => $line_item_row[ 'LIN_percent' ], |
|
34 | - 'LIN_is_taxable' => $line_item_row[ 'LIN_is_taxable' ], |
|
35 | - 'LIN_order' => $line_item_row[ 'LIN_order' ], |
|
36 | - 'LIN_total' => $line_item_row[ 'LIN_total' ], |
|
37 | - 'LIN_quantity' => $line_item_row[ 'LIN_quantity' ], |
|
38 | - 'LIN_parent' => $line_item_row[ 'LIN_ID'], |
|
28 | + 'LIN_code' => 'event-'.$event_id, |
|
29 | + 'TXN_ID' => $line_item_row['TXN_ID'], |
|
30 | + 'LIN_name' => __('Event', 'event_espresso'), |
|
31 | + 'LIN_desc' => $line_item_row['LIN_desc'], |
|
32 | + 'LIN_unit_price' => $line_item_row['LIN_unit_price'], |
|
33 | + 'LIN_percent' => $line_item_row['LIN_percent'], |
|
34 | + 'LIN_is_taxable' => $line_item_row['LIN_is_taxable'], |
|
35 | + 'LIN_order' => $line_item_row['LIN_order'], |
|
36 | + 'LIN_total' => $line_item_row['LIN_total'], |
|
37 | + 'LIN_quantity' => $line_item_row['LIN_quantity'], |
|
38 | + 'LIN_parent' => $line_item_row['LIN_ID'], |
|
39 | 39 | 'LIN_type' => 'sub-total', |
40 | 40 | 'OBJ_type' => 'Event', |
41 | 41 | 'OBJ_ID' => $event_id, |
42 | 42 | ); |
43 | 43 | $new_line_item_datatypes = array( |
44 | - '%s',//LIN_code |
|
45 | - '%d',//TXN_ID |
|
46 | - '%s',//LIN_name |
|
47 | - '%s',//LIN_desc |
|
48 | - '%f',//LIN_unit_price |
|
49 | - '%f',//LIN_percent |
|
50 | - '%d',//LIN_is_taxable |
|
51 | - '%d',//LIN_order |
|
52 | - '%f',//LIN_total |
|
53 | - '%d',//LIN_quantity |
|
54 | - '%d',//LIN_parent |
|
55 | - '%s',//LIN_type |
|
56 | - '%s',//OBJ_type |
|
57 | - '%d',//OBJ_ID |
|
44 | + '%s', //LIN_code |
|
45 | + '%d', //TXN_ID |
|
46 | + '%s', //LIN_name |
|
47 | + '%s', //LIN_desc |
|
48 | + '%f', //LIN_unit_price |
|
49 | + '%f', //LIN_percent |
|
50 | + '%d', //LIN_is_taxable |
|
51 | + '%d', //LIN_order |
|
52 | + '%f', //LIN_total |
|
53 | + '%d', //LIN_quantity |
|
54 | + '%d', //LIN_parent |
|
55 | + '%s', //LIN_type |
|
56 | + '%s', //OBJ_type |
|
57 | + '%d', //OBJ_ID |
|
58 | 58 | ); |
59 | 59 | //insert the new event subtotal line item, pointing to this line item |
60 | - $success = $wpdb->insert( $this->_old_table, $new_line_item_data, $new_line_item_datatypes ); |
|
61 | - if( ! $success ) { |
|
62 | - $this->add_error( $this->_create_error_message_for_db_insertion( $this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes ) ); |
|
60 | + $success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes); |
|
61 | + if ( ! $success) { |
|
62 | + $this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes)); |
|
63 | 63 | } |
64 | 64 | $new_line_item_id = $wpdb->insert_id; |
65 | - $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row[ 'LIN_ID' ], $this->_old_table, $new_line_item_id ); |
|
65 | + $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row['LIN_ID'], $this->_old_table, $new_line_item_id); |
|
66 | 66 | $query = $wpdb->prepare( |
67 | 67 | "UPDATE {$this->_old_table} SET LIN_parent=%d WHERE LIN_parent = %d AND LIN_ID != %d LIMIT 100", |
68 | 68 | $new_line_item_id, |
69 | - $line_item_row[ 'LIN_ID' ], |
|
69 | + $line_item_row['LIN_ID'], |
|
70 | 70 | $new_line_item_id ); |
71 | - $success = $wpdb->query( $query ); |
|
72 | - if( $success === false ) { |
|
71 | + $success = $wpdb->query($query); |
|
72 | + if ($success === false) { |
|
73 | 73 | $this->add_error( |
74 | - sprintf( __( 'Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso' ), |
|
74 | + sprintf(__('Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso'), |
|
75 | 75 | $new_line_item_id, |
76 | - $line_item_row[ 'LIN_ID' ], |
|
76 | + $line_item_row['LIN_ID'], |
|
77 | 77 | $wpdb->last_error, |
78 | 78 | $query, |
79 | 79 | $success) ); |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | //(all other times it gets resurrected from a wordpress option) |
9 | 9 | $stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*'); |
10 | 10 | $class_to_filepath = array(); |
11 | -foreach($stages as $filepath){ |
|
11 | +foreach ($stages as $filepath) { |
|
12 | 12 | $matches = array(); |
13 | - preg_match('~4_9_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
13 | + preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
14 | 14 | $class_to_filepath[$matches[1]] = $filepath; |
15 | 15 | } |
16 | 16 | //give addons a chance to autoload their stages too |
17 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages',$class_to_filepath); |
|
17 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath); |
|
18 | 18 | EEH_Autoloader::register_autoloader($class_to_filepath); |
19 | 19 | |
20 | 20 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @since 4.6.0 |
31 | 31 | * |
32 | 32 | */ |
33 | -class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base{ |
|
33 | +class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base { |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * return EE_DMS_Core_4_9_0 |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function can_migrate_from_version($version_array) { |
56 | 56 | $version_string = $version_array['Core']; |
57 | - if( $version_string <= '4.9.0' && $version_string >= '4.8.0' ){ |
|
57 | + if ($version_string <= '4.9.0' && $version_string >= '4.8.0') { |
|
58 | 58 | // echo "$version_string can be migrated from"; |
59 | 59 | return true; |
60 | - } elseif( ! $version_string ){ |
|
60 | + } elseif ( ! $version_string) { |
|
61 | 61 | // echo "no version string provided: $version_string"; |
62 | 62 | //no version string provided... this must be pre 4.3 |
63 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | - }else{ |
|
63 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | + } else { |
|
65 | 65 | // echo "$version_string doesnt apply"; |
66 | 66 | return false; |
67 | 67 | } |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | * @return bool |
83 | 83 | */ |
84 | 84 | public function schema_changes_before_migration() { |
85 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
86 | - $now_in_mysql = current_time( 'mysql', true ); |
|
85 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
86 | + $now_in_mysql = current_time('mysql', true); |
|
87 | 87 | |
88 | - $table_name='esp_answer'; |
|
89 | - $sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
88 | + $table_name = 'esp_answer'; |
|
89 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
90 | 90 | REG_ID int(10) unsigned NOT NULL, |
91 | 91 | QST_ID int(10) unsigned NOT NULL, |
92 | 92 | ANS_value text NOT NULL, |
93 | 93 | PRIMARY KEY (ANS_ID), |
94 | 94 | KEY REG_ID (REG_ID), |
95 | 95 | KEY QST_ID (QST_ID)"; |
96 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
96 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
97 | 97 | |
98 | 98 | $table_name = 'esp_attendee_meta'; |
99 | 99 | $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | KEY ATT_fname (ATT_fname)"; |
116 | 116 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
117 | 117 | |
118 | - $table_name='esp_checkin'; |
|
118 | + $table_name = 'esp_checkin'; |
|
119 | 119 | $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
120 | 120 | REG_ID int(10) unsigned NOT NULL, |
121 | 121 | DTT_ID int(10) unsigned NOT NULL, |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | CNT_is_EU tinyint(1) DEFAULT '0', |
144 | 144 | CNT_active tinyint(1) DEFAULT '0', |
145 | 145 | PRIMARY KEY (CNT_ISO)"; |
146 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
146 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
147 | 147 | |
148 | 148 | $table_name = 'esp_currency'; |
149 | 149 | $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
154 | 154 | CUR_active tinyint(1) DEFAULT '0', |
155 | 155 | PRIMARY KEY (CUR_code)"; |
156 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
156 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
157 | 157 | |
158 | 158 | |
159 | 159 | $table_name = 'esp_currency_payment_method'; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | KEY DTT_EVT_start (DTT_EVT_start), |
182 | 182 | KEY EVT_ID (EVT_ID), |
183 | 183 | KEY DTT_is_primary (DTT_is_primary)"; |
184 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
184 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
185 | 185 | |
186 | 186 | $table_name = "esp_datetime_ticket"; |
187 | 187 | $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | PRIMARY KEY (EMT_ID), |
200 | 200 | KEY EVT_ID (EVT_ID), |
201 | 201 | KEY GRP_ID (GRP_ID)"; |
202 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | 203 | |
204 | 204 | $table_name = 'esp_event_meta'; |
205 | 205 | $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | EVT_donations tinyint(1) NULL, |
218 | 218 | PRIMARY KEY (EVTM_ID), |
219 | 219 | KEY EVT_ID (EVT_ID)"; |
220 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
220 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
221 | 221 | |
222 | - $table_name='esp_event_question_group'; |
|
222 | + $table_name = 'esp_event_question_group'; |
|
223 | 223 | $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
224 | 224 | EVT_ID bigint(20) unsigned NOT NULL, |
225 | 225 | QSG_ID int(10) unsigned NOT NULL, |
@@ -227,17 +227,17 @@ discard block |
||
227 | 227 | PRIMARY KEY (EQG_ID), |
228 | 228 | KEY EVT_ID (EVT_ID), |
229 | 229 | KEY QSG_ID (QSG_ID)"; |
230 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
230 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
231 | 231 | |
232 | - $table_name='esp_event_venue'; |
|
232 | + $table_name = 'esp_event_venue'; |
|
233 | 233 | $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
234 | 234 | EVT_ID bigint(20) unsigned NOT NULL, |
235 | 235 | VNU_ID bigint(20) unsigned NOT NULL, |
236 | 236 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
237 | 237 | PRIMARY KEY (EVV_ID)"; |
238 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
238 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
239 | 239 | |
240 | - $table_name='esp_extra_meta'; |
|
240 | + $table_name = 'esp_extra_meta'; |
|
241 | 241 | $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
242 | 242 | OBJ_ID int(11) DEFAULT NULL, |
243 | 243 | EXM_type varchar(45) DEFAULT NULL, |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | EXM_value text, |
246 | 246 | PRIMARY KEY (EXM_ID), |
247 | 247 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
248 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
248 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
249 | 249 | |
250 | 250 | $table_name = 'esp_extra_join'; |
251 | 251 | $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
259 | 259 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
260 | 260 | |
261 | - $table_name='esp_line_item'; |
|
261 | + $table_name = 'esp_line_item'; |
|
262 | 262 | $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
263 | 263 | LIN_code varchar(245) NOT NULL DEFAULT '', |
264 | 264 | TXN_ID int(11) DEFAULT NULL, |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | PRIMARY KEY (LIN_ID), |
279 | 279 | KEY LIN_code (LIN_code(191)), |
280 | 280 | KEY TXN_ID (TXN_ID)"; |
281 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' ); |
|
281 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
282 | 282 | |
283 | 283 | $table_name = 'esp_log'; |
284 | 284 | $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | KEY STS_ID (STS_ID), |
328 | 328 | KEY MSG_created (MSG_created), |
329 | 329 | KEY MSG_modified (MSG_modified)"; |
330 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
330 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
331 | 331 | |
332 | 332 | $table_name = 'esp_message_template'; |
333 | 333 | $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
353 | 353 | PRIMARY KEY (GRP_ID), |
354 | 354 | KEY MTP_user_id (MTP_user_id)"; |
355 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
355 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
356 | 356 | |
357 | 357 | $table_name = 'esp_payment'; |
358 | 358 | $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | PRIMARY KEY (TTM_ID)"; |
411 | 411 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
412 | 412 | |
413 | - $table_name='esp_question'; |
|
413 | + $table_name = 'esp_question'; |
|
414 | 414 | $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
415 | 415 | QST_display_text text NOT NULL, |
416 | 416 | QST_admin_label varchar(255) NOT NULL, |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
426 | 426 | PRIMARY KEY (QST_ID), |
427 | 427 | KEY QST_order (QST_order)'; |
428 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
428 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
429 | 429 | |
430 | - $table_name='esp_question_group_question'; |
|
430 | + $table_name = 'esp_question_group_question'; |
|
431 | 431 | $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
432 | 432 | QSG_ID int(10) unsigned NOT NULL, |
433 | 433 | QST_ID int(10) unsigned NOT NULL, |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | PRIMARY KEY (QGQ_ID), |
436 | 436 | KEY QST_ID (QST_ID), |
437 | 437 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
438 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
438 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
439 | 439 | |
440 | - $table_name='esp_question_option'; |
|
440 | + $table_name = 'esp_question_option'; |
|
441 | 441 | $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
442 | 442 | QSO_value varchar(255) NOT NULL, |
443 | 443 | QSO_desc text NOT NULL, |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | PRIMARY KEY (QSO_ID), |
449 | 449 | KEY QST_ID (QST_ID), |
450 | 450 | KEY QSO_order (QSO_order)"; |
451 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
451 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
452 | 452 | |
453 | 453 | $table_name = 'esp_registration'; |
454 | 454 | $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | PRC_parent int(10) unsigned DEFAULT 0, |
562 | 562 | PRIMARY KEY (PRC_ID), |
563 | 563 | KEY PRT_ID (PRT_ID)"; |
564 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
564 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
565 | 565 | |
566 | 566 | $table_name = "esp_price_type"; |
567 | 567 | $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
599 | 599 | PRIMARY KEY (TKT_ID), |
600 | 600 | KEY TKT_start_date (TKT_start_date)"; |
601 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
601 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
602 | 602 | |
603 | 603 | $table_name = 'esp_question_group'; |
604 | 604 | $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | PRIMARY KEY (QSG_ID), |
615 | 615 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
616 | 616 | KEY QSG_order (QSG_order)'; |
617 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
617 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
618 | 618 | |
619 | 619 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
620 | 620 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -648,5 +648,5 @@ discard block |
||
648 | 648 | return true; |
649 | 649 | } |
650 | 650 | |
651 | - public function migration_page_hooks(){} |
|
651 | + public function migration_page_hooks() {} |
|
652 | 652 | } |
653 | 653 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_WP_User class |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param array $props_n_values |
23 | 23 | * @return EE_WP_User|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array() ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
25 | + public static function new_instance($props_n_values = array()) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
27 | + return $has_object ? $has_object : new self($props_n_values); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param array $props_n_values |
34 | 34 | * @return EE_WP_User |
35 | 35 | */ |
36 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
37 | - return new self( $props_n_values, TRUE ); |
|
36 | + public static function new_instance_from_db($props_n_values = array()) { |
|
37 | + return new self($props_n_values, TRUE); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @return WP_User |
43 | 43 | */ |
44 | 44 | public function wp_user_obj() { |
45 | - if( ! $this->_wp_user_obj ) { |
|
46 | - $this->_wp_user_obj = get_user_by('ID', $this->ID() ); |
|
45 | + if ( ! $this->_wp_user_obj) { |
|
46 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
47 | 47 | } |
48 | 48 | return $this->_wp_user_obj; |
49 | 49 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $_SERVER['REQUEST_URI'] |
70 | 70 | ) |
71 | 71 | ), |
72 | - get_edit_user_link( $this->ID() ) |
|
72 | + get_edit_user_link($this->ID()) |
|
73 | 73 | ) |
74 | 74 | ); |
75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return string |
88 | 88 | */ |
89 | 89 | public function get_admin_overview_link() { |
90 | - return admin_url( 'users.php' ); |
|
90 | + return admin_url('users.php'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -105,42 +105,42 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return EEM_Message |
107 | 107 | */ |
108 | - protected function __construct( $timezone = null ) { |
|
109 | - $this->singular_item = __('Message','event_espresso'); |
|
110 | - $this->plural_item = __('Messages','event_espresso'); |
|
108 | + protected function __construct($timezone = null) { |
|
109 | + $this->singular_item = __('Message', 'event_espresso'); |
|
110 | + $this->plural_item = __('Messages', 'event_espresso'); |
|
111 | 111 | |
112 | 112 | //used for token generator |
113 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
113 | + EE_Registry::instance()->load_helper('URL'); |
|
114 | 114 | |
115 | 115 | $this->_tables = array( |
116 | - 'Message'=>new EE_Primary_Table('esp_message','MSG_ID') |
|
116 | + 'Message'=>new EE_Primary_Table('esp_message', 'MSG_ID') |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | $allowed_priority = array( |
120 | - self::priority_high => __( 'high', 'event_espresso' ), |
|
121 | - self::priority_medium => __( 'medium', 'event_espresso' ), |
|
122 | - self::priority_low => __( 'low', 'event_espresso' ) |
|
120 | + self::priority_high => __('high', 'event_espresso'), |
|
121 | + self::priority_medium => __('medium', 'event_espresso'), |
|
122 | + self::priority_low => __('low', 'event_espresso') |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | $this->_fields = array( |
126 | 126 | 'Message'=>array( |
127 | - 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID','event_espresso')), |
|
128 | - 'MSG_token' => new EE_Plain_Text_Field( 'MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso' ), false, EEH_URL::generate_unique_token() ), |
|
129 | - 'GRP_ID'=>new EE_Foreign_Key_Int_Field( 'GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso' ), true, 0, 'Message_Template_Group' ), |
|
130 | - 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( 'Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso' ), true, 0, 'Transaction' ), |
|
131 | - 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __( 'Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso' ), false, 'email' ), |
|
132 | - 'MSG_message_type' => new EE_Plain_Text_Field( 'MSG_message_type', __( 'Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso' ), false, 'receipt' ), |
|
133 | - 'MSG_context' => new EE_Plain_Text_Field( 'MSG_context', __( 'Context', 'event_espresso' ), false ), |
|
134 | - 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field( 'MSG_recipient_ID', __( 'Recipient ID', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
135 | - 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field( 'MSG_recipient_type', __( 'Recipient Type', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
136 | - 'MSG_content' => new EE_Maybe_Serialized_Text_Field( 'MSG_content', __( 'Content', 'event_espresso' ), true, '' ), |
|
137 | - 'MSG_to' => new EE_Maybe_Serialized_Text_Field( 'MSG_to', __( 'Address To', 'event_espresso' ), true ), |
|
138 | - 'MSG_from' => new EE_Maybe_Serialized_Text_Field( 'MSG_from', __( 'Address From', 'event_espresso' ), true ), |
|
139 | - 'MSG_subject' => new EE_Maybe_Serialized_Text_Field( 'MSG_subject', __( 'Subject', 'event_espresso' ), true, '' ), |
|
140 | - 'MSG_priority' => new EE_Enum_Integer_Field( 'MSG_priority', __( 'Priority', 'event_espresso' ), false, self::priority_low, $allowed_priority ), |
|
141 | - 'STS_ID' => new EE_Foreign_Key_String_Field( 'STS_ID', __( 'Status', 'event_espresso' ), false, self::status_incomplete, 'Status' ), |
|
142 | - 'MSG_created' => new EE_Datetime_Field( 'MSG_created', __( 'Created', 'event_espresso' ), false, time() ), |
|
143 | - 'MSG_modified' => new EE_Datetime_Field( 'MSG_modified', __( 'Modified', 'event_espresso' ), true, time() ) |
|
127 | + 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID', 'event_espresso')), |
|
128 | + 'MSG_token' => new EE_Plain_Text_Field('MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso'), false, EEH_URL::generate_unique_token()), |
|
129 | + 'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso'), true, 0, 'Message_Template_Group'), |
|
130 | + 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __('Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso'), true, 0, 'Transaction'), |
|
131 | + 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __('Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso'), false, 'email'), |
|
132 | + 'MSG_message_type' => new EE_Plain_Text_Field('MSG_message_type', __('Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso'), false, 'receipt'), |
|
133 | + 'MSG_context' => new EE_Plain_Text_Field('MSG_context', __('Context', 'event_espresso'), false), |
|
134 | + 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field('MSG_recipient_ID', __('Recipient ID', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
135 | + 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field('MSG_recipient_type', __('Recipient Type', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
136 | + 'MSG_content' => new EE_Maybe_Serialized_Text_Field('MSG_content', __('Content', 'event_espresso'), true, ''), |
|
137 | + 'MSG_to' => new EE_Maybe_Serialized_Text_Field('MSG_to', __('Address To', 'event_espresso'), true), |
|
138 | + 'MSG_from' => new EE_Maybe_Serialized_Text_Field('MSG_from', __('Address From', 'event_espresso'), true), |
|
139 | + 'MSG_subject' => new EE_Maybe_Serialized_Text_Field('MSG_subject', __('Subject', 'event_espresso'), true, ''), |
|
140 | + 'MSG_priority' => new EE_Enum_Integer_Field('MSG_priority', __('Priority', 'event_espresso'), false, self::priority_low, $allowed_priority), |
|
141 | + 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status', 'event_espresso'), false, self::status_incomplete, 'Status'), |
|
142 | + 'MSG_created' => new EE_Datetime_Field('MSG_created', __('Created', 'event_espresso'), false, time()), |
|
143 | + 'MSG_modified' => new EE_Datetime_Field('MSG_modified', __('Modified', 'event_espresso'), true, time()) |
|
144 | 144 | ) |
145 | 145 | ); |
146 | 146 | $this->_model_relations = array( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'Message_Template_Group' => new EE_Belongs_To_Relation(), |
151 | 151 | 'Transaction' => new EE_Belongs_To_Relation() |
152 | 152 | ); |
153 | - parent::__construct( $timezone ); |
|
153 | + parent::__construct($timezone); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | public function create_default_object() { |
162 | 162 | /** @type EE_Message $message */ |
163 | 163 | $message = parent::create_default_object(); |
164 | - if ( $message instanceof EE_Message ) { |
|
165 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
164 | + if ($message instanceof EE_Message) { |
|
165 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
166 | 166 | } |
167 | 167 | return null; |
168 | 168 | } |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @param mixed $cols_n_values |
174 | 174 | * @return \EE_Message |
175 | 175 | */ |
176 | - public function instantiate_class_from_array_or_object( $cols_n_values ) { |
|
176 | + public function instantiate_class_from_array_or_object($cols_n_values) { |
|
177 | 177 | /** @type EE_Message $message */ |
178 | - $message = parent::instantiate_class_from_array_or_object( $cols_n_values ); |
|
179 | - if ( $message instanceof EE_Message ) { |
|
180 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
178 | + $message = parent::instantiate_class_from_array_or_object($cols_n_values); |
|
179 | + if ($message instanceof EE_Message) { |
|
180 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
181 | 181 | } |
182 | 182 | return null; |
183 | 183 | } |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @param string $message_type the message type slug |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function message_sent_for_attendee( $attendee, $message_type ) { |
|
194 | - $attendee_ID = EEM_Attendee::instance()->ensure_is_ID( $attendee ); |
|
195 | - return $this->exists( array( array( |
|
193 | + public function message_sent_for_attendee($attendee, $message_type) { |
|
194 | + $attendee_ID = EEM_Attendee::instance()->ensure_is_ID($attendee); |
|
195 | + return $this->exists(array(array( |
|
196 | 196 | 'Attendee.ATT_ID' => $attendee_ID, |
197 | 197 | 'MSG_message_type' => $message_type, |
198 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
199 | - ) ) ); |
|
198 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
199 | + ))); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | * @param string $message_type the message type slug |
209 | 209 | * @return boolean |
210 | 210 | */ |
211 | - public function message_sent_for_registration( $registration, $message_type ) { |
|
212 | - $registrationID = EEM_Registration::instance()->ensure_is_ID( $registration ); |
|
213 | - return $this->exists( array( array( |
|
211 | + public function message_sent_for_registration($registration, $message_type) { |
|
212 | + $registrationID = EEM_Registration::instance()->ensure_is_ID($registration); |
|
213 | + return $this->exists(array(array( |
|
214 | 214 | 'Registration.REG_ID' => $registrationID, |
215 | 215 | 'MSG_message_type' => $message_type, |
216 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
217 | - ) ) ); |
|
216 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
217 | + ))); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | * @param string $token |
226 | 226 | * @return EE_Message |
227 | 227 | */ |
228 | - public function get_one_by_token( $token ) { |
|
229 | - return $this->get_one( array( array( |
|
228 | + public function get_one_by_token($token) { |
|
229 | + return $this->get_one(array(array( |
|
230 | 230 | 'MSG_token' => $token |
231 | - ) ) ); |
|
231 | + ))); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * Returns stati that indicate the message HAS been sent |
237 | 237 | * @return array of strings for possible stati |
238 | 238 | */ |
239 | - public function stati_indicating_sent(){ |
|
240 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_sent', array( self::status_sent ) ); |
|
239 | + public function stati_indicating_sent() { |
|
240 | + return apply_filters('FHEE__EEM_Message__stati_indicating_sent', array(self::status_sent)); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @return array of strings for possible stati. |
249 | 249 | */ |
250 | 250 | public function stati_indicating_to_send() { |
251 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_to_send', array( self::status_idle, self::status_resend ) ); |
|
251 | + return apply_filters('FHEE__EEM_Message__stati_indicating_to_send', array(self::status_idle, self::status_resend)); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | self::status_retry, |
263 | 263 | ); |
264 | 264 | //if WP_DEBUG is set, then let's include debug_only fails |
265 | - if ( WP_DEBUG ) { |
|
265 | + if (WP_DEBUG) { |
|
266 | 266 | $failed_stati[] = self::status_debug_only; |
267 | 267 | } |
268 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_failed_sending', $failed_stati ); |
|
268 | + return apply_filters('FHEE__EEM_Message__stati_indicating_failed_sending', $failed_stati); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -300,11 +300,11 @@ discard block |
||
300 | 300 | // the value, matches the corresponding EEM_Base child reference. |
301 | 301 | $expected_vars = $this->_expected_vars_for_query_inject(); |
302 | 302 | $query_params[0] = array(); |
303 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
304 | - $request_value = EE_Registry::instance()->REQ->get( $request_key ); |
|
305 | - if ( $request_value ) { |
|
303 | + foreach ($expected_vars as $request_key => $model_name) { |
|
304 | + $request_value = EE_Registry::instance()->REQ->get($request_key); |
|
305 | + if ($request_value) { |
|
306 | 306 | //special case |
307 | - switch ( $request_key ) { |
|
307 | + switch ($request_key) { |
|
308 | 308 | case '_REG_ID' : |
309 | 309 | $query_params[0]['AND**filter_by']['OR**filter_by_REG_ID'] = array( |
310 | 310 | 'Transaction.Registration.REG_ID' => $request_value, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | ); |
317 | 317 | break; |
318 | 318 | default : |
319 | - $query_params[0]['AND**filter_by'][ 'OR**filter_by_' . $request_key ][ $model_name . '.' . $request_key ] = $request_value; |
|
319 | + $query_params[0]['AND**filter_by']['OR**filter_by_'.$request_key][$model_name.'.'.$request_key] = $request_value; |
|
320 | 320 | break; |
321 | 321 | } |
322 | 322 | } |
@@ -333,53 +333,53 @@ discard block |
||
333 | 333 | $expected_vars = $this->_expected_vars_for_query_inject(); |
334 | 334 | $pretty_label = ''; |
335 | 335 | $label_parts = array(); |
336 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
337 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
338 | - if ( $model_field_value = EE_Registry::instance()->REQ->get( $request_key ) ) { |
|
339 | - switch ( $request_key ) { |
|
336 | + foreach ($expected_vars as $request_key => $model_name) { |
|
337 | + $model = EE_Registry::instance()->load_model($model_name); |
|
338 | + if ($model_field_value = EE_Registry::instance()->REQ->get($request_key)) { |
|
339 | + switch ($request_key) { |
|
340 | 340 | case '_REG_ID' : |
341 | 341 | $label_parts[] = sprintf( |
342 | - esc_html__( 'Registration with the ID: %s', 'event_espresso' ), |
|
342 | + esc_html__('Registration with the ID: %s', 'event_espresso'), |
|
343 | 343 | $model_field_value |
344 | 344 | ); |
345 | 345 | break; |
346 | 346 | case 'ATT_ID' : |
347 | 347 | /** @var EE_Attendee $attendee */ |
348 | - $attendee = $model->get_one_by_ID( $model_field_value ); |
|
348 | + $attendee = $model->get_one_by_ID($model_field_value); |
|
349 | 349 | $label_parts[] = $attendee instanceof EE_Attendee |
350 | - ? sprintf( esc_html__( 'Attendee %s', 'event_espresso' ), $attendee->full_name() ) |
|
351 | - : sprintf( esc_html__( 'Attendee ID: %s', 'event_espresso' ), $model_field_value ); |
|
350 | + ? sprintf(esc_html__('Attendee %s', 'event_espresso'), $attendee->full_name()) |
|
351 | + : sprintf(esc_html__('Attendee ID: %s', 'event_espresso'), $model_field_value); |
|
352 | 352 | break; |
353 | 353 | case 'ID' : |
354 | 354 | /** @var EE_WP_User $wpUser */ |
355 | - $wpUser = $model->get_one_by_ID( $model_field_value ); |
|
355 | + $wpUser = $model->get_one_by_ID($model_field_value); |
|
356 | 356 | $label_parts[] = $wpUser instanceof EE_WP_User |
357 | - ? sprintf( esc_html__( 'WP User: %s', 'event_espresso' ), $wpUser->name() ) |
|
358 | - : sprintf( esc_html__( 'WP User ID: %s', 'event_espresso' ), $model_field_value ); |
|
357 | + ? sprintf(esc_html__('WP User: %s', 'event_espresso'), $wpUser->name()) |
|
358 | + : sprintf(esc_html__('WP User ID: %s', 'event_espresso'), $model_field_value); |
|
359 | 359 | break; |
360 | 360 | case 'TXN_ID' : |
361 | 361 | $label_parts[] = sprintf( |
362 | - esc_html__( 'Transaction with the ID: %s', 'event_espresso' ), |
|
362 | + esc_html__('Transaction with the ID: %s', 'event_espresso'), |
|
363 | 363 | $model_field_value |
364 | 364 | ); |
365 | 365 | break; |
366 | 366 | case 'EVT_ID' : |
367 | 367 | /** @var EE_Event $Event */ |
368 | - $Event = $model->get_one_by_ID( $model_field_value ); |
|
368 | + $Event = $model->get_one_by_ID($model_field_value); |
|
369 | 369 | $label_parts[] = $Event instanceof EE_Event |
370 | - ? sprintf( esc_html__( 'for the Event: %s', 'event_espresso' ), $Event->name() ) |
|
371 | - : sprintf( esc_html__( 'for the Event with ID: %s', 'event_espresso' ), $model_field_value ); |
|
370 | + ? sprintf(esc_html__('for the Event: %s', 'event_espresso'), $Event->name()) |
|
371 | + : sprintf(esc_html__('for the Event with ID: %s', 'event_espresso'), $model_field_value); |
|
372 | 372 | break; |
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | - if ( $label_parts ) { |
|
377 | + if ($label_parts) { |
|
378 | 378 | |
379 | 379 | //prepend to the last element of $label_parts an "and". |
380 | - if ( count( $label_parts ) > 1 ) { |
|
381 | - $label_parts_index_to_prepend = count( $label_parts ) - 1; |
|
382 | - $label_parts[ $label_parts_index_to_prepend ] = 'and' . $label_parts[ $label_parts_index_to_prepend ]; |
|
380 | + if (count($label_parts) > 1) { |
|
381 | + $label_parts_index_to_prepend = count($label_parts) - 1; |
|
382 | + $label_parts[$label_parts_index_to_prepend] = 'and'.$label_parts[$label_parts_index_to_prepend]; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | $pretty_label .= sprintf( |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'A label for the messages returned in a query that are filtered by items in the query. This could be Transaction, Event, Attendee, Registration, or WP_User.', |
389 | 389 | 'event_espresso' |
390 | 390 | ), |
391 | - implode( ', ', $label_parts ) |
|
391 | + implode(', ', $label_parts) |
|
392 | 392 | ); |
393 | 393 | } |
394 | 394 | return $pretty_label; |
@@ -438,20 +438,20 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @return bool true means Messages is in debug mode. false means messages system is not in debug mode. |
440 | 440 | */ |
441 | - public static function debug( $set_debug = null ) { |
|
441 | + public static function debug($set_debug = null) { |
|
442 | 442 | static $is_debugging = null; |
443 | 443 | |
444 | 444 | //initialize (use constant if set). |
445 | - if ( is_null( $set_debug ) && is_null( $is_debugging ) ) { |
|
446 | - $is_debugging = defined( 'EE_DEBUG_MESSAGES' ) && EE_DEBUG_MESSAGES; |
|
445 | + if (is_null($set_debug) && is_null($is_debugging)) { |
|
446 | + $is_debugging = defined('EE_DEBUG_MESSAGES') && EE_DEBUG_MESSAGES; |
|
447 | 447 | } |
448 | 448 | |
449 | - if ( ! is_null( $set_debug ) ) { |
|
450 | - $is_debugging = filter_var( $set_debug, FILTER_VALIDATE_BOOLEAN ); |
|
449 | + if ( ! is_null($set_debug)) { |
|
450 | + $is_debugging = filter_var($set_debug, FILTER_VALIDATE_BOOLEAN); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | //return filtered value |
454 | - return apply_filters( 'FHEE__EEM_Message__debug', $is_debugging ); |
|
454 | + return apply_filters('FHEE__EEM_Message__debug', $is_debugging); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 |