@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @throws \EE_Error |
152 | 152 | */ |
153 | 153 | public function column_TXN_ID( EE_Transaction $item ){ |
154 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
154 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
155 | 155 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
156 | 156 | |
157 | 157 | //txn timestamp |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | 323 | public function column_event_name( EE_Transaction $item ){ |
324 | - $actions = array(); |
|
324 | + $actions = array(); |
|
325 | 325 | $event = $item->primary_registration()->get_first_related('Event'); |
326 | 326 | if ( !empty( $event ) ) { |
327 | 327 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function column_actions( EE_Transaction $item ){ |
352 | 352 | |
353 | - $registration = $item->primary_registration(); |
|
354 | - $attendee = $registration->attendee(); |
|
353 | + $registration = $item->primary_registration(); |
|
354 | + $attendee = $registration->attendee(); |
|
355 | 355 | |
356 | - //Build row actions |
|
356 | + //Build row actions |
|
357 | 357 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
358 | 358 | $dl_invoice_lnk_url = $registration->invoice_url(); |
359 | 359 | $dl_receipt_lnk_url = $registration->receipt_url(); |
360 | 360 | $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
361 | 361 | $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
362 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
363 | - 'TXN_ID' => $item->ID() |
|
364 | - )); |
|
362 | + $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
363 | + 'TXN_ID' => $item->ID() |
|
364 | + )); |
|
365 | 365 | |
366 | 366 | //Build row actions |
367 | 367 | $view_lnk = ' |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | |
436 | 436 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
437 | - } |
|
437 | + } |
|
438 | 438 | |
439 | 439 | |
440 | 440 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @param \Transactions_Admin_Page $admin_page |
33 | 33 | */ |
34 | - public function __construct( \Transactions_Admin_Page $admin_page ){ |
|
35 | - parent::__construct( $admin_page ); |
|
34 | + public function __construct(\Transactions_Admin_Page $admin_page) { |
|
35 | + parent::__construct($admin_page); |
|
36 | 36 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
37 | 37 | } |
38 | 38 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | *_setup_data |
43 | 43 | */ |
44 | 44 | protected function _setup_data() { |
45 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
46 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
47 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
45 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
46 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
47 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -59,25 +59,25 @@ discard block |
||
59 | 59 | 'ajax' => TRUE, |
60 | 60 | 'screen' => $this->_admin_page->get_current_screen()->id |
61 | 61 | ); |
62 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
62 | + $ID_column_name = __('ID', 'event_espresso'); |
|
63 | 63 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
64 | - $ID_column_name .= __( 'Transaction Date', 'event_espresso' ); |
|
64 | + $ID_column_name .= __('Transaction Date', 'event_espresso'); |
|
65 | 65 | $ID_column_name .= '</span> '; |
66 | 66 | $this->_columns = array( |
67 | 67 | 'TXN_ID' => $ID_column_name, |
68 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
69 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
70 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
71 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
72 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
73 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
69 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
70 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
71 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
72 | + 'event_name' => __('Event', 'event_espresso'), |
|
73 | + 'actions' => __('Actions', 'event_espresso') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $this->_sortable_columns = array( |
77 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
78 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
79 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
80 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
77 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
78 | + 'event_name' => array('event_name'=> FALSE), |
|
79 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
80 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | $this->_primary_column = 'TXN_ID'; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return string |
96 | 96 | * @throws \EE_Error |
97 | 97 | */ |
98 | - protected function _get_row_class( $item ) { |
|
99 | - $class = parent::_get_row_class( $item ); |
|
98 | + protected function _get_row_class($item) { |
|
99 | + $class = parent::_get_row_class($item); |
|
100 | 100 | //add status class |
101 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
102 | - if ( $this->_has_checkbox_column ) { |
|
101 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
102 | + if ($this->_has_checkbox_column) { |
|
103 | 103 | $class .= ' has-checkbox-column'; |
104 | 104 | } |
105 | 105 | return $class; |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function _get_table_filters() { |
118 | 118 | $filters = array(); |
119 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
120 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
119 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
120 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
121 | 121 | ob_start(); |
122 | 122 | ?> |
123 | 123 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | *_add_view_counts |
137 | 137 | */ |
138 | 138 | protected function _add_view_counts() { |
139 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
140 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
141 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
139 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
140 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
141 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @return string |
151 | 151 | * @throws \EE_Error |
152 | 152 | */ |
153 | - public function column_TXN_ID( EE_Transaction $item ){ |
|
154 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
155 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
153 | + public function column_TXN_ID(EE_Transaction $item) { |
|
154 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
155 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
156 | 156 | |
157 | 157 | //txn timestamp |
158 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
158 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
159 | 159 | return $content; |
160 | 160 | } |
161 | 161 | |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | * @return mixed|string|void |
167 | 167 | * @throws \EE_Error |
168 | 168 | */ |
169 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
169 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
170 | 170 | //txn timestamp |
171 | 171 | // is TXN less than 2 hours old ? |
172 | 172 | if ( |
173 | - ( $item->failed() || $item->is_abandoned() ) |
|
173 | + ($item->failed() || $item->is_abandoned()) |
|
174 | 174 | && ( |
175 | - ( time() - EE_Registry::instance()->SSN->lifespan() ) < $item->datetime( false, true ) |
|
175 | + (time() - EE_Registry::instance()->SSN->lifespan()) < $item->datetime(false, true) |
|
176 | 176 | ) |
177 | 177 | ) { |
178 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
178 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
179 | 179 | } else { |
180 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
180 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
181 | 181 | } |
182 | 182 | return $timestamp; |
183 | 183 | } |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | * @return string |
192 | 192 | * @throws \EE_Error |
193 | 193 | */ |
194 | - public function column_cb($item ){ |
|
195 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
194 | + public function column_cb($item) { |
|
195 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * @return string |
205 | 205 | * @throws \EE_Error |
206 | 206 | */ |
207 | - public function column_TXN_timestamp( EE_Transaction $item ){ |
|
208 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
209 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
207 | + public function column_TXN_timestamp(EE_Transaction $item) { |
|
208 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
209 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
210 | 210 | //status |
211 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
211 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
212 | 212 | return $txn_date; |
213 | 213 | } |
214 | 214 | |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | * @throws \EE_Error |
223 | 223 | */ |
224 | - public function column_TXN_total( EE_Transaction $item ){ |
|
225 | - if ( $item->get('TXN_total') > 0 ) { |
|
226 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
224 | + public function column_TXN_total(EE_Transaction $item) { |
|
225 | + if ($item->get('TXN_total') > 0) { |
|
226 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
227 | 227 | } else { |
228 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
228 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @return mixed|string |
239 | 239 | * @throws \EE_Error |
240 | 240 | */ |
241 | - public function column_TXN_paid( EE_Transaction $item ){ |
|
241 | + public function column_TXN_paid(EE_Transaction $item) { |
|
242 | 242 | $transaction_total = $item->get('TXN_total'); |
243 | 243 | $transaction_paid = $item->get('TXN_paid'); |
244 | 244 | |
245 | - if ( \EEH_Money::compare_floats( $transaction_total, 0,'>' ) ) { |
|
245 | + if (\EEH_Money::compare_floats($transaction_total, 0, '>')) { |
|
246 | 246 | // monies owing |
247 | 247 | $span_class = 'txn-overview-part-payment-spn'; |
248 | - if ( \EEH_Money::compare_floats( $transaction_paid, $transaction_total, '>=' ) ) { |
|
248 | + if (\EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) { |
|
249 | 249 | // paid in full |
250 | 250 | $span_class = 'txn-overview-full-payment-spn'; |
251 | - } elseif ( \EEH_Money::compare_floats( $transaction_paid, 0, '==' ) ) { |
|
251 | + } elseif (\EEH_Money::compare_floats($transaction_paid, 0, '==')) { |
|
252 | 252 | // no payments made |
253 | 253 | $span_class = 'txn-overview-no-payment-spn'; |
254 | 254 | } |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | $payment_method = $item->payment_method(); |
261 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
261 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
262 | 262 | |
263 | - $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
264 | - if ( $transaction_paid > 0 ) { |
|
265 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
263 | + $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
264 | + if ($transaction_paid > 0) { |
|
265 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
266 | 266 | } |
267 | 267 | return $content; |
268 | 268 | } |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | * @return string|void |
277 | 277 | * @throws \EE_Error |
278 | 278 | */ |
279 | - public function column_ATT_fname( EE_Transaction $item ){ |
|
279 | + public function column_ATT_fname(EE_Transaction $item) { |
|
280 | 280 | $primary_reg = $item->primary_registration(); |
281 | 281 | $attendee = $primary_reg->get_first_related('Attendee'); |
282 | - if ( $attendee instanceof EE_Attendee ) { |
|
283 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
284 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
285 | - $content .= '<br>' . $attendee->email(); |
|
282 | + if ($attendee instanceof EE_Attendee) { |
|
283 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
284 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
285 | + $content .= '<br>'.$attendee->email(); |
|
286 | 286 | return $content; |
287 | 287 | } |
288 | 288 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | * @return string|void |
298 | 298 | * @throws \EE_Error |
299 | 299 | */ |
300 | - public function column_ATT_email( EE_Transaction $item ){ |
|
300 | + public function column_ATT_email(EE_Transaction $item) { |
|
301 | 301 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
302 | - if ( ! empty( $attendee ) ) { |
|
303 | - return '<a href="mailto:' . $attendee->get( 'ATT_email' ) . '">' . $attendee->get( 'ATT_email' ) . '</a>'; |
|
302 | + if ( ! empty($attendee)) { |
|
303 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
304 | 304 | } else { |
305 | 305 | return $item->failed() || $item->is_abandoned() |
306 | - ? __( 'no contact record.', 'event_espresso' ) |
|
306 | + ? __('no contact record.', 'event_espresso') |
|
307 | 307 | : __( |
308 | 308 | 'No contact record, because the transaction was abandoned or the registration process failed.', |
309 | 309 | 'event_espresso' |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @return string|void |
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | - public function column_event_name( EE_Transaction $item ){ |
|
323 | + public function column_event_name(EE_Transaction $item) { |
|
324 | 324 | $actions = array(); |
325 | 325 | $event = $item->primary_registration()->get_first_related('Event'); |
326 | - if ( !empty( $event ) ) { |
|
327 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
326 | + if ( ! empty($event)) { |
|
327 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
328 | 328 | $event_name = $event->get('EVT_name'); |
329 | 329 | |
330 | 330 | //filter this view by transactions for this event |
331 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
332 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
333 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
331 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
332 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
333 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
334 | 334 | } |
335 | 335 | |
336 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
336 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
337 | 337 | } else { |
338 | 338 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
339 | 339 | } |
@@ -348,35 +348,35 @@ discard block |
||
348 | 348 | * @return string |
349 | 349 | * @throws \EE_Error |
350 | 350 | */ |
351 | - public function column_actions( EE_Transaction $item ){ |
|
351 | + public function column_actions(EE_Transaction $item) { |
|
352 | 352 | |
353 | 353 | $registration = $item->primary_registration(); |
354 | 354 | $attendee = $registration->attendee(); |
355 | 355 | |
356 | 356 | //Build row actions |
357 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
357 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
358 | 358 | $dl_invoice_lnk_url = $registration->invoice_url(); |
359 | 359 | $dl_receipt_lnk_url = $registration->receipt_url(); |
360 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
361 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
362 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
360 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
361 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
362 | + $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array( |
|
363 | 363 | 'TXN_ID' => $item->ID() |
364 | 364 | )); |
365 | 365 | |
366 | 366 | //Build row actions |
367 | 367 | $view_lnk = ' |
368 | 368 | <li> |
369 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
369 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
370 | 370 | <span class="dashicons dashicons-cart"></span> |
371 | 371 | </a> |
372 | 372 | </li>'; |
373 | 373 | |
374 | 374 | $dl_invoice_lnk = ''; |
375 | 375 | //only show invoice link if message type is active. |
376 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
376 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
377 | 377 | $dl_invoice_lnk = ' |
378 | 378 | <li> |
379 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
379 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
380 | 380 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
381 | 381 | </a> |
382 | 382 | </li>'; |
@@ -384,17 +384,17 @@ discard block |
||
384 | 384 | |
385 | 385 | $dl_receipt_lnk = ''; |
386 | 386 | //only show receipt link if message type is active. |
387 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
387 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
388 | 388 | $dl_receipt_lnk = ' |
389 | 389 | <li> |
390 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
390 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
391 | 391 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
392 | 392 | </a> |
393 | 393 | </li>'; |
394 | 394 | } |
395 | 395 | |
396 | 396 | //only show payment reminder link if the message type is active. |
397 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
397 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
398 | 398 | $send_pay_lnk = $attendee instanceof EE_Attendee |
399 | 399 | && EE_Registry::instance()->CAP->current_user_can( |
400 | 400 | 'ee_send_message', |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ) |
403 | 403 | ? ' |
404 | 404 | <li> |
405 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
405 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
406 | 406 | <span class="dashicons dashicons-email-alt"></span> |
407 | 407 | </a> |
408 | 408 | </li>' |
@@ -422,18 +422,18 @@ discard block |
||
422 | 422 | ) |
423 | 423 | ? ' |
424 | 424 | <li> |
425 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
425 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
426 | 426 | <span class="dashicons dashicons-clipboard"></span> |
427 | 427 | </a> |
428 | 428 | </li>' |
429 | 429 | : ''; |
430 | 430 | |
431 | 431 | $view_related_messages_lnk = ''; |
432 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
433 | - $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>'; |
|
432 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
433 | + $view_related_messages_lnk = '<li>'.$related_messages_link.'</li>'; |
|
434 | 434 | } |
435 | 435 | |
436 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
436 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item){ |
|
374 | 374 | /** checkbox/lock **/ |
375 | 375 | $transaction = $item->get_first_related( 'Transaction' ); |
376 | 376 | $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
377 | - return $payment_count > 0 |
|
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
379 | - . '<span class="ee-lock-icon"></span>' |
|
380 | - : sprintf( |
|
381 | - '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
382 | - $item->ID() |
|
383 | - ); |
|
384 | - } |
|
377 | + return $payment_count > 0 |
|
378 | + ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
379 | + . '<span class="ee-lock-icon"></span>' |
|
380 | + : sprintf( |
|
381 | + '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
382 | + $item->ID() |
|
383 | + ); |
|
384 | + } |
|
385 | 385 | |
386 | 386 | |
387 | 387 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function column__REG_date(EE_Registration $item){ |
419 | 419 | $this->_set_related_details($item); |
420 | - //Build row actions |
|
420 | + //Build row actions |
|
421 | 421 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
422 | 422 | $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
423 | 423 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } else { |
472 | 472 | return __( 'There is no ticket on this registration', 'event_espresso' ); |
473 | 473 | } |
474 | - } |
|
474 | + } |
|
475 | 475 | |
476 | 476 | |
477 | 477 | |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | - //append group count to name |
|
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
497 | + //append group count to name |
|
498 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | - //append reg_code |
|
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
500 | + //append reg_code |
|
501 | + $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
502 | 502 | |
503 | - //reg status text for accessibility |
|
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
503 | + //reg status text for accessibility |
|
504 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
@@ -731,14 +731,14 @@ discard block |
||
731 | 731 | //message list table link (filtered by REG_ID |
732 | 732 | if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
733 | 733 | $filtered_messages_link = '<li>' |
734 | - . EEH_MSG_Template::get_message_action_link( |
|
734 | + . EEH_MSG_Template::get_message_action_link( |
|
735 | 735 | 'see_notifications_for', |
736 | 736 | null, |
737 | 737 | array( |
738 | 738 | '_REG_ID' => $item->ID() |
739 | 739 | ) |
740 | 740 | ) |
741 | - . '</li>'; |
|
741 | + . '</li>'; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' ); |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * @param \Registrations_Admin_Page $admin_page |
56 | 56 | */ |
57 | - public function __construct( Registrations_Admin_Page $admin_page ){ |
|
58 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
57 | + public function __construct(Registrations_Admin_Page $admin_page) { |
|
58 | + if ( ! empty($_GET['event_id'])) { |
|
59 | 59 | $extra_query_args = array(); |
60 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
61 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
60 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
61 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
62 | 62 | } |
63 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
63 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
64 | 64 | } |
65 | 65 | parent::__construct($admin_page); |
66 | 66 | $this->_status = $this->_admin_page->get_registration_status_array(); |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @return void |
76 | 76 | */ |
77 | 77 | protected function _setup_data() { |
78 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
79 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
78 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
79 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,30 +93,30 @@ discard block |
||
93 | 93 | 'ajax' => TRUE, |
94 | 94 | 'screen' => $this->_admin_page->get_current_screen()->id |
95 | 95 | ); |
96 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
96 | + $ID_column_name = __('ID', 'event_espresso'); |
|
97 | 97 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
98 | - $ID_column_name .= __( 'Registrant Name', 'event_espresso' ); |
|
98 | + $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
99 | 99 | $ID_column_name .= '</span> '; |
100 | - if ( isset( $_GET['event_id'] )) { |
|
100 | + if (isset($_GET['event_id'])) { |
|
101 | 101 | $this->_columns = array( |
102 | 102 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
103 | 103 | '_REG_ID' => $ID_column_name, |
104 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
104 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
105 | 105 | 'ATT_email' => __('Email', 'event_espresso'), |
106 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
107 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
108 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
109 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
106 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
107 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
108 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
109 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
110 | 110 | 'TXN_paid' => __('Paid', 'event_espresso'), |
111 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
111 | + 'actions' => __('Actions', 'event_espresso') |
|
112 | 112 | ); |
113 | 113 | $this->_bottom_buttons = array( |
114 | 114 | 'report'=> array( |
115 | 115 | 'route' => 'registrations_report', |
116 | 116 | 'extra_request' => |
117 | 117 | array( |
118 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
119 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) |
|
118 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
119 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") |
|
120 | 120 | ) |
121 | 121 | ), |
122 | 122 | ); |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | $this->_columns = array( |
125 | 125 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
126 | 126 | '_REG_ID' => $ID_column_name, |
127 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
128 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
129 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
130 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
131 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
132 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
133 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
127 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
128 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
129 | + 'event_name' => __('Event', 'event_espresso'), |
|
130 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
131 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
132 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
133 | + 'actions' => __('Actions', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | $this->_bottom_buttons = array( |
136 | 136 | 'report_all'=> array( |
137 | 137 | 'route' => 'registrations_report', |
138 | 138 | 'extra_request' => array( |
139 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
139 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
140 | 140 | ), |
141 | 141 | ); |
142 | 142 | } |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $this->_primary_column = '_REG_ID'; |
145 | 145 | |
146 | 146 | $this->_sortable_columns = array( |
147 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
148 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
149 | - 'event_name' => array( 'event_name' => FALSE ), |
|
150 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
151 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
147 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
148 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
149 | + 'event_name' => array('event_name' => FALSE), |
|
150 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
151 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
152 | 152 | ); |
153 | 153 | |
154 | 154 | $this->_hidden_columns = array(); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | * @param EE_Registration $item the current item |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - protected function _get_row_class( $item ) { |
|
166 | - $class = parent::_get_row_class( $item ); |
|
165 | + protected function _get_row_class($item) { |
|
166 | + $class = parent::_get_row_class($item); |
|
167 | 167 | //add status class |
168 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
169 | - if ( $this->_has_checkbox_column ) { |
|
168 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
169 | + if ($this->_has_checkbox_column) { |
|
170 | 170 | $class .= ' has-checkbox-column'; |
171 | 171 | } |
172 | 172 | return $class; |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param EE_Registration $registration |
181 | 181 | * @throws \EE_Error |
182 | 182 | */ |
183 | - protected function _set_related_details( EE_Registration $registration ) { |
|
183 | + protected function _set_related_details(EE_Registration $registration) { |
|
184 | 184 | |
185 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
185 | + $transaction = $registration->get_first_related('Transaction'); |
|
186 | 186 | $status = $transaction instanceof EE_Transaction |
187 | 187 | ? $transaction->status_ID() |
188 | 188 | : EEM_Transaction::failed_status_code; |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | 'status' => $status, |
192 | 192 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
193 | 193 | 'title_attr' => sprintf( |
194 | - __( 'View Transaction Details (%s)', 'event_espresso' ), |
|
195 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
194 | + __('View Transaction Details (%s)', 'event_espresso'), |
|
195 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
196 | 196 | ) |
197 | 197 | ); |
198 | 198 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | 'status' => $status, |
204 | 204 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
205 | 205 | 'title_attr' => sprintf( |
206 | - __( 'Edit Event (%s)', 'event_espresso' ), |
|
207 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
206 | + __('Edit Event (%s)', 'event_espresso'), |
|
207 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | } |
@@ -221,30 +221,30 @@ discard block |
||
221 | 221 | |
222 | 222 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
223 | 223 | |
224 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
225 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
224 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
225 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
227 | 227 | |
228 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
229 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
228 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
229 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
230 | 230 | |
231 | 231 | $status = array(); |
232 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
233 | - foreach ( $this->_status as $key => $value ) { |
|
234 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
232 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
233 | + foreach ($this->_status as $key => $value) { |
|
234 | + $status[] = array('id' => $key, 'text' => $value); |
|
235 | 235 | } |
236 | - if ( $this->_view !== 'incomplete' ) { |
|
236 | + if ($this->_view !== 'incomplete') { |
|
237 | 237 | $filters[] = EEH_Form_Fields::select_input( |
238 | 238 | '_reg_status', |
239 | 239 | $status, |
240 | - isset( $this->_req_data['_reg_status'] ) |
|
241 | - ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) |
|
240 | + isset($this->_req_data['_reg_status']) |
|
241 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
242 | 242 | : '' |
243 | 243 | ); |
244 | 244 | } |
245 | 245 | |
246 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
247 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
246 | + if (isset($this->_req_data['event_id'])) { |
|
247 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $filters; |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $this->_views['all']['count'] = $this->_total_registrations(); |
264 | 264 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
265 | 265 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
266 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
267 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
268 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
266 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
267 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
268 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
@@ -279,23 +279,23 @@ discard block |
||
279 | 279 | * @return int |
280 | 280 | * @throws \EE_Error |
281 | 281 | */ |
282 | - protected function _total_registrations( $view = '' ){ |
|
282 | + protected function _total_registrations($view = '') { |
|
283 | 283 | $_where = array(); |
284 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
285 | - if( $EVT_ID ) { |
|
284 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
285 | + if ($EVT_ID) { |
|
286 | 286 | $_where['EVT_ID'] = $EVT_ID; |
287 | 287 | } |
288 | - switch ( $view ) { |
|
288 | + switch ($view) { |
|
289 | 289 | case 'trash' : |
290 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
290 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
291 | 291 | break; |
292 | 292 | case 'incomplete' : |
293 | 293 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
294 | 294 | break; |
295 | 295 | default : |
296 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
296 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
297 | 297 | } |
298 | - return EEM_Registration::instance()->count( array( $_where )); |
|
298 | + return EEM_Registration::instance()->count(array($_where)); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -307,32 +307,32 @@ discard block |
||
307 | 307 | * @return int |
308 | 308 | * @throws \EE_Error |
309 | 309 | */ |
310 | - protected function _total_registrations_this_month(){ |
|
311 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
312 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
310 | + protected function _total_registrations_this_month() { |
|
311 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
312 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
313 | 313 | $this_year_r = date('Y', current_time('timestamp')); |
314 | 314 | $time_start = ' 00:00:00'; |
315 | 315 | $time_end = ' 23:59:59'; |
316 | 316 | $this_month_r = date('m', current_time('timestamp')); |
317 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
317 | + $days_this_month = date('t', current_time('timestamp')); |
|
318 | 318 | //setup date query. |
319 | 319 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
320 | 320 | 'REG_date', |
321 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
321 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
322 | 322 | 'Y-m-d H:i:s' |
323 | 323 | ); |
324 | 324 | $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
325 | 325 | 'REG_date', |
326 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
326 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
327 | 327 | 'Y-m-d H:i:s' |
328 | 328 | ); |
329 | - $_where['REG_date']= array('BETWEEN', |
|
329 | + $_where['REG_date'] = array('BETWEEN', |
|
330 | 330 | array( |
331 | 331 | $beginning_string, |
332 | 332 | $end_string |
333 | 333 | )); |
334 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
335 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
334 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
335 | + return EEM_Registration::instance()->count(array($_where)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -344,20 +344,20 @@ discard block |
||
344 | 344 | * @return int |
345 | 345 | * @throws \EE_Error |
346 | 346 | */ |
347 | - protected function _total_registrations_today(){ |
|
347 | + protected function _total_registrations_today() { |
|
348 | 348 | |
349 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
350 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
349 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
350 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
351 | 351 | $current_date = date('Y-m-d', current_time('timestamp')); |
352 | 352 | $time_start = ' 00:00:00'; |
353 | 353 | $time_end = ' 23:59:59'; |
354 | - $_where['REG_date']= array('BETWEEN', |
|
354 | + $_where['REG_date'] = array('BETWEEN', |
|
355 | 355 | array( |
356 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
357 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
356 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
357 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
358 | 358 | )); |
359 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
360 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
359 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
360 | + return EEM_Registration::instance()->count(array($_where)); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item) { |
|
374 | 374 | /** checkbox/lock **/ |
375 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
376 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
375 | + $transaction = $item->get_first_related('Transaction'); |
|
376 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
377 | 377 | return $payment_count > 0 |
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
378 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()) |
|
379 | 379 | . '<span class="ee-lock-icon"></span>' |
380 | 380 | : sprintf( |
381 | 381 | '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | * @return string |
394 | 394 | * @throws \EE_Error |
395 | 395 | */ |
396 | - public function column__REG_ID(EE_Registration $item){ |
|
396 | + public function column__REG_ID(EE_Registration $item) { |
|
397 | 397 | $attendee = $item->attendee(); |
398 | 398 | $content = $item->ID(); |
399 | 399 | $content .= '<div class="show-on-mobile-view-only">'; |
400 | 400 | $content .= '<br>'; |
401 | 401 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
402 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
403 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
402 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
403 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
404 | 404 | $content .= '</div>'; |
405 | 405 | return $content; |
406 | 406 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | * @return string |
416 | 416 | * @throws \EE_Error |
417 | 417 | */ |
418 | - public function column__REG_date(EE_Registration $item){ |
|
418 | + public function column__REG_date(EE_Registration $item) { |
|
419 | 419 | $this->_set_related_details($item); |
420 | 420 | //Build row actions |
421 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
422 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
423 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
421 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
422 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
423 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
424 | 424 | return $view_link; |
425 | 425 | } |
426 | 426 | |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | * @return string |
435 | 435 | * @throws \EE_Error |
436 | 436 | */ |
437 | - public function column_event_name(EE_Registration $item){ |
|
438 | - $this->_set_related_details( $item ); |
|
437 | + public function column_event_name(EE_Registration $item) { |
|
438 | + $this->_set_related_details($item); |
|
439 | 439 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
440 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
440 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
441 | 441 | $event_name = $item->event_name(); |
442 | 442 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
443 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
443 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
444 | 444 | |
445 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
446 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
445 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
446 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
447 | 447 | |
448 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
448 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -458,18 +458,18 @@ discard block |
||
458 | 458 | * @return string |
459 | 459 | * @throws \EE_Error |
460 | 460 | */ |
461 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
461 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
462 | 462 | $datetime_strings = array(); |
463 | - $ticket = $item->ticket( TRUE ); |
|
464 | - if ( $ticket instanceof EE_Ticket ) { |
|
463 | + $ticket = $item->ticket(TRUE); |
|
464 | + if ($ticket instanceof EE_Ticket) { |
|
465 | 465 | $remove_defaults = array('default_where_conditions' => 'none'); |
466 | 466 | $datetimes = $ticket->datetimes($remove_defaults); |
467 | - foreach($datetimes as $datetime){ |
|
468 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
467 | + foreach ($datetimes as $datetime) { |
|
468 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
469 | 469 | } |
470 | - return implode("<br />",$datetime_strings); |
|
470 | + return implode("<br />", $datetime_strings); |
|
471 | 471 | } else { |
472 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
472 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
@@ -483,45 +483,45 @@ discard block |
||
483 | 483 | * @return string |
484 | 484 | * @throws \EE_Error |
485 | 485 | */ |
486 | - public function column_ATT_fname(EE_Registration $item){ |
|
486 | + public function column_ATT_fname(EE_Registration $item) { |
|
487 | 487 | $attendee = $item->attendee(); |
488 | 488 | |
489 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
489 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
490 | 490 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
491 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
491 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
492 | 492 | $link .= $item->count() === 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
493 | 493 | |
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | 497 | //append group count to name |
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
498 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | 500 | //append reg_code |
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
501 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
502 | 502 | |
503 | 503 | //reg status text for accessibility |
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
504 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
508 | - if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
509 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
510 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
511 | - } elseif ( $this->_view === 'trash' ) { |
|
508 | + if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
509 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
510 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
511 | + } elseif ($this->_view === 'trash') { |
|
512 | 512 | // restore registration link |
513 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
514 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
515 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
513 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
514 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
515 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
516 | 516 | } |
517 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
518 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
517 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
518 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
519 | 519 | |
520 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
520 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
524 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @return string |
535 | 535 | * @throws \EE_Error |
536 | 536 | */ |
537 | - public function column_ATT_email( EE_Registration $item ) { |
|
537 | + public function column_ATT_email(EE_Registration $item) { |
|
538 | 538 | $attendee = $item->get_first_related('Attendee'); |
539 | 539 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
540 | 540 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @param \EE_Registration $item |
549 | 549 | * @return string |
550 | 550 | */ |
551 | - public function column__REG_count(EE_Registration $item){ |
|
552 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
551 | + public function column__REG_count(EE_Registration $item) { |
|
552 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | * @param \EE_Registration $item |
562 | 562 | * @return string |
563 | 563 | */ |
564 | - public function column_PRC_amount(EE_Registration $item){ |
|
564 | + public function column_PRC_amount(EE_Registration $item) { |
|
565 | 565 | $ticket = $item->ticket(); |
566 | 566 | |
567 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
567 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
568 | 568 | |
569 | - if ( $item->final_price() > 0 ) { |
|
570 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
569 | + if ($item->final_price() > 0) { |
|
570 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
571 | 571 | } else { |
572 | 572 | // free event |
573 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
573 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | return $content; |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | * @param \EE_Registration $item |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - public function column__REG_final_price(EE_Registration $item){ |
|
589 | + public function column__REG_final_price(EE_Registration $item) { |
|
590 | 590 | $ticket = $item->ticket(); |
591 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
591 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
592 | 592 | |
593 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
593 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
594 | 594 | return $content; |
595 | 595 | |
596 | 596 | } |
@@ -604,13 +604,13 @@ discard block |
||
604 | 604 | * @param \EE_Registration $item |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - public function column__REG_paid(EE_Registration $item){ |
|
607 | + public function column__REG_paid(EE_Registration $item) { |
|
608 | 608 | $payment_method = $item->payment_method(); |
609 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
609 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
610 | 610 | |
611 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
612 | - if ( $item->paid() > 0 ) { |
|
613 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
611 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
612 | + if ($item->paid() > 0) { |
|
613 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
614 | 614 | } |
615 | 615 | return $content; |
616 | 616 | } |
@@ -625,11 +625,11 @@ discard block |
||
625 | 625 | * @return string |
626 | 626 | * @throws \EE_Error |
627 | 627 | */ |
628 | - public function column_TXN_total(EE_Registration $item){ |
|
629 | - if($item->transaction()){ |
|
630 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
631 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
632 | - }else{ |
|
628 | + public function column_TXN_total(EE_Registration $item) { |
|
629 | + if ($item->transaction()) { |
|
630 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
631 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
632 | + } else { |
|
633 | 633 | return __("None", "event_espresso"); |
634 | 634 | } |
635 | 635 | } |
@@ -644,15 +644,15 @@ discard block |
||
644 | 644 | * @return string |
645 | 645 | * @throws \EE_Error |
646 | 646 | */ |
647 | - public function column_TXN_paid(EE_Registration $item){ |
|
647 | + public function column_TXN_paid(EE_Registration $item) { |
|
648 | 648 | |
649 | - if ( $item->count() === 1 ) { |
|
649 | + if ($item->count() === 1) { |
|
650 | 650 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
651 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
651 | + if ($transaction->paid() >= $transaction->total()) { |
|
652 | 652 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
653 | 653 | } else { |
654 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
655 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
654 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
655 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | |
@@ -672,44 +672,44 @@ discard block |
||
672 | 672 | */ |
673 | 673 | public function column_actions(EE_Registration $item) { |
674 | 674 | $attendee = $item->attendee(); |
675 | - $this->_set_related_details( $item ); |
|
675 | + $this->_set_related_details($item); |
|
676 | 676 | |
677 | 677 | //Build row actions |
678 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
679 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
678 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
679 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
680 | 680 | |
681 | 681 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
682 | 682 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
683 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
683 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
684 | 684 | |
685 | 685 | |
686 | 686 | //Build row actions |
687 | - $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
687 | + $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
688 | 688 | <li> |
689 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
689 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
690 | 690 | <div class="dashicons dashicons-clipboard"></div> |
691 | 691 | </a> |
692 | 692 | </li>' : ''; |
693 | 693 | |
694 | - $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
694 | + $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
695 | 695 | <li> |
696 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
696 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
697 | 697 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
698 | 698 | </a> |
699 | 699 | </li>' : ''; |
700 | 700 | |
701 | - $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
701 | + $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
702 | 702 | <li> |
703 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
703 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
704 | 704 | <div class="dashicons dashicons-email-alt"></div> |
705 | 705 | </a> |
706 | 706 | </li>' : ''; |
707 | 707 | |
708 | 708 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
709 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
710 | - $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
709 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
710 | + $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
711 | 711 | <li> |
712 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '"> |
|
712 | + <a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'"> |
|
713 | 713 | <div class="dashicons dashicons-cart"></div> |
714 | 714 | </a> |
715 | 715 | </li>' : ''; |
@@ -718,10 +718,10 @@ discard block |
||
718 | 718 | $dl_invoice_lnk = ''; |
719 | 719 | $dl_invoice_lnk_url = $item->invoice_url(); |
720 | 720 | //only show invoice link if message type is active. |
721 | - if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
721 | + if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) { |
|
722 | 722 | $dl_invoice_lnk = ' |
723 | 723 | <li> |
724 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
724 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
725 | 725 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
726 | 726 | </a> |
727 | 727 | </li>'; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | $filtered_messages_link = ''; |
731 | 731 | //message list table link (filtered by REG_ID |
732 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
732 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
733 | 733 | $filtered_messages_link = '<li>' |
734 | 734 | . EEH_MSG_Template::get_message_action_link( |
735 | 735 | 'see_notifications_for', |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | . '</li>'; |
742 | 742 | } |
743 | 743 | |
744 | - return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' ); |
|
744 | + return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk.$filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul'); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | } |
@@ -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 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | protected function _setup_data() { |
29 | - $this->_data = $this->_get_messages( $this->_per_page, $this->_view ); |
|
30 | - $this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true ); |
|
29 | + $this->_data = $this->_get_messages($this->_per_page, $this->_view); |
|
30 | + $this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,32 +35,32 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function _set_properties() { |
37 | 37 | $this->_wp_list_args = array( |
38 | - 'singular' => __( 'Message', 'event_espresso' ), |
|
39 | - 'plural' => __( 'Messages', 'event_espresso' ), |
|
38 | + 'singular' => __('Message', 'event_espresso'), |
|
39 | + 'plural' => __('Messages', 'event_espresso'), |
|
40 | 40 | 'ajax' => true, |
41 | 41 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
42 | 42 | ); |
43 | 43 | |
44 | 44 | $this->_columns = array( |
45 | 45 | 'cb' => '<input type="checkbox" />', |
46 | - 'to' => __( 'To', 'event_espresso' ), |
|
47 | - 'from' => __( 'From', 'event_espresso' ), |
|
48 | - 'messenger' => __( 'Messenger', 'event_espresso' ), |
|
49 | - 'message_type' => __( 'Message Type', 'event_espresso' ), |
|
50 | - 'context' => __( 'Context', 'event_espresso' ), |
|
51 | - 'modified' => __( 'Modified', 'event_espresso' ), |
|
52 | - 'action' => __( 'Actions', 'event_espresso' ), |
|
53 | - 'msg_id' => __( 'ID', 'event_espresso' ), |
|
46 | + 'to' => __('To', 'event_espresso'), |
|
47 | + 'from' => __('From', 'event_espresso'), |
|
48 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
49 | + 'message_type' => __('Message Type', 'event_espresso'), |
|
50 | + 'context' => __('Context', 'event_espresso'), |
|
51 | + 'modified' => __('Modified', 'event_espresso'), |
|
52 | + 'action' => __('Actions', 'event_espresso'), |
|
53 | + 'msg_id' => __('ID', 'event_espresso'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | $this->_sortable_columns = array( |
57 | - 'modified' => array( 'MSG_modified' => true ), |
|
58 | - 'message_type' => array( 'MSG_message_type' => false ), |
|
59 | - 'messenger' => array( 'MSG_messenger' => false ), |
|
60 | - 'to' => array( 'MSG_to' => false ), |
|
61 | - 'from' => array( 'MSG_from' => false ), |
|
62 | - 'context' => array( 'MSG_context' => false ), |
|
63 | - 'msg_id' => array( 'MSG_ID', false ), |
|
57 | + 'modified' => array('MSG_modified' => true), |
|
58 | + 'message_type' => array('MSG_message_type' => false), |
|
59 | + 'messenger' => array('MSG_messenger' => false), |
|
60 | + 'to' => array('MSG_to' => false), |
|
61 | + 'from' => array('MSG_from' => false), |
|
62 | + 'context' => array('MSG_context' => false), |
|
63 | + 'msg_id' => array('MSG_ID', false), |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->_primary_column = 'to'; |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @param object $item the current item |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - protected function _get_row_class( $item ) { |
|
82 | - $class = parent::_get_row_class( $item ); |
|
81 | + protected function _get_row_class($item) { |
|
82 | + $class = parent::_get_row_class($item); |
|
83 | 83 | //add status class |
84 | - $class .= ' ee-status-strip msg-status-' . $item->STS_ID(); |
|
85 | - if ( $this->_has_checkbox_column ) { |
|
84 | + $class .= ' ee-status-strip msg-status-'.$item->STS_ID(); |
|
85 | + if ($this->_has_checkbox_column) { |
|
86 | 86 | $class .= ' has-checkbox-column'; |
87 | 87 | } |
88 | 88 | return $class; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function _get_table_filters() { |
103 | 103 | $filters = array(); |
104 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
104 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
105 | 105 | //setup messengers for selects |
106 | 106 | $m_values = $this->get_admin_page()->get_messengers_for_list_table(); |
107 | 107 | //lets do the same for message types |
@@ -110,88 +110,88 @@ discard block |
||
110 | 110 | $contexts = $this->get_admin_page()->get_contexts_for_message_types_for_list_table(); |
111 | 111 | $i = 1; |
112 | 112 | $labels = $c_values = array(); |
113 | - foreach ( $contexts as $context => $label ) { |
|
113 | + foreach ($contexts as $context => $label) { |
|
114 | 114 | //some message types may have the same label for a different context, so we're grouping these together so the end user |
115 | 115 | //doesn't get confused. |
116 | - if ( isset( $labels[ $label ] ) ) { |
|
117 | - $c_values[ $labels[ $label ] ]['id'] .= ',' . $context; |
|
116 | + if (isset($labels[$label])) { |
|
117 | + $c_values[$labels[$label]]['id'] .= ','.$context; |
|
118 | 118 | continue; |
119 | 119 | } |
120 | - $c_values[ $i ]['id'] = $context; |
|
121 | - $c_values[ $i ]['text'] = $label; |
|
122 | - $labels[ $label ] = $i; |
|
120 | + $c_values[$i]['id'] = $context; |
|
121 | + $c_values[$i]['text'] = $label; |
|
122 | + $labels[$label] = $i; |
|
123 | 123 | $i++; |
124 | 124 | } |
125 | 125 | |
126 | 126 | $msgr_default[0] = array( |
127 | 127 | 'id' => 'none_selected', |
128 | - 'text' => __( 'All Messengers', 'event_espresso' ) |
|
128 | + 'text' => __('All Messengers', 'event_espresso') |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $mt_default[0] = array( |
132 | 132 | 'id' => 'none_selected', |
133 | - 'text' => __( 'All Message Types', 'event_espresso' ) |
|
133 | + 'text' => __('All Message Types', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | $c_default[0] = array( |
137 | 137 | 'id' => 'none_selected', |
138 | - 'text' => __( 'All Contexts', 'event_espresso ' ) |
|
138 | + 'text' => __('All Contexts', 'event_espresso ') |
|
139 | 139 | ); |
140 | 140 | |
141 | - $msgr_filters = count( $m_values ) > 1 |
|
142 | - ? array_merge( $msgr_default, $m_values ) |
|
141 | + $msgr_filters = count($m_values) > 1 |
|
142 | + ? array_merge($msgr_default, $m_values) |
|
143 | 143 | : $m_values; |
144 | - $mt_filters = ! empty( $mt_values ) && count( $mt_values ) > 1 |
|
145 | - ? array_merge( $mt_default, $mt_values ) |
|
144 | + $mt_filters = ! empty($mt_values) && count($mt_values) > 1 |
|
145 | + ? array_merge($mt_default, $mt_values) |
|
146 | 146 | : (array) $mt_values; |
147 | - $c_filters = ! empty( $c_values ) && count( $c_values ) > 1 |
|
148 | - ? array_merge( $c_default, $c_values ) |
|
147 | + $c_filters = ! empty($c_values) && count($c_values) > 1 |
|
148 | + ? array_merge($c_default, $c_values) |
|
149 | 149 | : (array) $c_values; |
150 | 150 | |
151 | - if ( empty( $msgr_filters ) ) { |
|
151 | + if (empty($msgr_filters)) { |
|
152 | 152 | $msgr_filters[0] = array( |
153 | 153 | 'id' => 'none_selected', |
154 | - 'text' => __( 'No Messengers active', 'event_espresso' ) |
|
154 | + 'text' => __('No Messengers active', 'event_espresso') |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | - if ( empty( $mt_filters ) ) { |
|
158 | + if (empty($mt_filters)) { |
|
159 | 159 | $mt_filters[0] = array( |
160 | 160 | 'id' => 'none_selected', |
161 | - 'text' => __( 'No Message Types active', 'event_espresso' ) |
|
161 | + 'text' => __('No Message Types active', 'event_espresso') |
|
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - if ( empty( $c_filters ) ) { |
|
165 | + if (empty($c_filters)) { |
|
166 | 166 | $c_filters[0] = array( |
167 | 167 | 'id' => 'none_selected', |
168 | - 'text' => __( 'No Contexts (because no message types active)', 'event_espresso' ) |
|
168 | + 'text' => __('No Contexts (because no message types active)', 'event_espresso') |
|
169 | 169 | ); |
170 | 170 | } |
171 | 171 | |
172 | - if ( count ( $msgr_filters ) > 1 ) { |
|
172 | + if (count($msgr_filters) > 1) { |
|
173 | 173 | $filters[] = EEH_Form_Fields::select_input( |
174 | 174 | 'ee_messenger_filter_by', |
175 | - array_values( $msgr_filters ), |
|
176 | - isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
177 | - ? sanitize_title( $this->_req_data['ee_messenger_filter_by'] ) |
|
175 | + array_values($msgr_filters), |
|
176 | + isset($this->_req_data['ee_messenger_filter_by']) |
|
177 | + ? sanitize_title($this->_req_data['ee_messenger_filter_by']) |
|
178 | 178 | : '' |
179 | 179 | ); |
180 | 180 | } |
181 | - if ( count( $mt_filters ) > 1 ) { |
|
181 | + if (count($mt_filters) > 1) { |
|
182 | 182 | $filters[] = EEH_Form_Fields::select_input( |
183 | 183 | 'ee_message_type_filter_by', |
184 | - array_values( $mt_filters ), |
|
185 | - isset( $this->_req_data['ee_message_type_filter_by'] ) ? sanitize_title( |
|
184 | + array_values($mt_filters), |
|
185 | + isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_title( |
|
186 | 186 | $this->_req_data['ee_message_type_filter_by'] |
187 | 187 | ) : '' |
188 | 188 | ); |
189 | 189 | } |
190 | - if ( count( $c_filters ) > 1 ) { |
|
190 | + if (count($c_filters) > 1) { |
|
191 | 191 | $filters[] = EEH_Form_Fields::select_input( |
192 | 192 | 'ee_context_filter_by', |
193 | - array_values( $c_filters ), |
|
194 | - isset( $this->_req_data['ee_context_filter_by'] ) ? sanitize_text_field( |
|
193 | + array_values($c_filters), |
|
194 | + isset($this->_req_data['ee_context_filter_by']) ? sanitize_text_field( |
|
195 | 195 | $this->_req_data['ee_context_filter_by'] |
196 | 196 | ) : '' |
197 | 197 | ); |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | |
204 | 204 | protected function _add_view_counts() { |
205 | - foreach ( $this->_views as $view => $args ) { |
|
206 | - $this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true ); |
|
205 | + foreach ($this->_views as $view => $args) { |
|
206 | + $this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @return string checkbox |
215 | 215 | * @throws \EE_Error |
216 | 216 | */ |
217 | - public function column_cb( $message ) { |
|
218 | - return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() ); |
|
217 | + public function column_cb($message) { |
|
218 | + return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @return string |
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | - public function column_msg_id( EE_Message $message ) { |
|
228 | + public function column_msg_id(EE_Message $message) { |
|
229 | 229 | return $message->ID(); |
230 | 230 | } |
231 | 231 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @return string The recipient of the message |
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | - public function column_to( EE_Message $message ) { |
|
240 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
239 | + public function column_to(EE_Message $message) { |
|
240 | + EE_Registry::instance()->load_helper('URL'); |
|
241 | 241 | $actions = array(); |
242 | 242 | $actions['delete'] = '<a href="' |
243 | 243 | . EEH_URL::add_query_args_and_nonce( |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | 'action' => 'delete_ee_message', |
247 | 247 | 'MSG_ID' => $message->ID() |
248 | 248 | ), |
249 | - admin_url( 'admin.php' ) |
|
249 | + admin_url('admin.php') |
|
250 | 250 | ) |
251 | - . '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
252 | - return $message->to() . $this->row_actions( $actions ); |
|
251 | + . '">'.__('Delete', 'event_espresso').'</a>'; |
|
252 | + return $message->to().$this->row_actions($actions); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param EE_Message $message |
258 | 258 | * @return string The sender of the message |
259 | 259 | */ |
260 | - public function column_from( EE_Message $message ) { |
|
260 | + public function column_from(EE_Message $message) { |
|
261 | 261 | return $message->from(); |
262 | 262 | } |
263 | 263 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @param EE_Message $message |
268 | 268 | * @return string The messenger used to send the message. |
269 | 269 | */ |
270 | - public function column_messenger( EE_Message $message ) { |
|
271 | - return ucwords( $message->messenger_label() ); |
|
270 | + public function column_messenger(EE_Message $message) { |
|
271 | + return ucwords($message->messenger_label()); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | * @param EE_Message $message |
277 | 277 | * @return string The message type used to generate the message. |
278 | 278 | */ |
279 | - public function column_message_type( EE_Message $message ) { |
|
280 | - return ucwords( $message->message_type_label() ); |
|
279 | + public function column_message_type(EE_Message $message) { |
|
280 | + return ucwords($message->message_type_label()); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param EE_Message $message |
286 | 286 | * @return string The context the message was generated for. |
287 | 287 | */ |
288 | - public function column_context( EE_Message $message ) { |
|
288 | + public function column_context(EE_Message $message) { |
|
289 | 289 | return $message->context_label(); |
290 | 290 | } |
291 | 291 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param EE_Message $message |
295 | 295 | * @return string The timestamp when this message was last modified. |
296 | 296 | */ |
297 | - public function column_modified( EE_Message $message ) { |
|
297 | + public function column_modified(EE_Message $message) { |
|
298 | 298 | return $message->modified(); |
299 | 299 | } |
300 | 300 | |
@@ -303,36 +303,36 @@ discard block |
||
303 | 303 | * @param EE_Message $message |
304 | 304 | * @return string Actions that can be done on the current message. |
305 | 305 | */ |
306 | - public function column_action( EE_Message $message ) { |
|
307 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
306 | + public function column_action(EE_Message $message) { |
|
307 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
308 | 308 | $action_links = array( |
309 | - 'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ), |
|
310 | - 'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ), |
|
311 | - 'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ), |
|
312 | - 'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ), |
|
313 | - 'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ), |
|
314 | - 'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ), |
|
309 | + 'view' => EEH_MSG_Template::get_message_action_link('view', $message), |
|
310 | + 'error' => EEH_MSG_Template::get_message_action_link('error', $message), |
|
311 | + 'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message), |
|
312 | + 'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message), |
|
313 | + 'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message), |
|
314 | + 'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message), |
|
315 | 315 | ); |
316 | 316 | $content = ''; |
317 | - switch ( $message->STS_ID() ) { |
|
317 | + switch ($message->STS_ID()) { |
|
318 | 318 | case EEM_Message::status_sent : |
319 | - $content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction']; |
|
319 | + $content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction']; |
|
320 | 320 | break; |
321 | 321 | case EEM_Message::status_resend : |
322 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
322 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
323 | 323 | break; |
324 | 324 | case EEM_Message::status_retry : |
325 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction']; |
|
325 | + $content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction']; |
|
326 | 326 | break; |
327 | 327 | case EEM_Message::status_failed : |
328 | 328 | case EEM_Message::status_debug_only : |
329 | - $content = $action_links['error'] . $action_links['view_transaction']; |
|
329 | + $content = $action_links['error'].$action_links['view_transaction']; |
|
330 | 330 | break; |
331 | 331 | case EEM_Message::status_idle : |
332 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
332 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
333 | 333 | break; |
334 | 334 | case EEM_Message::status_incomplete; |
335 | - $content = $action_links['generate_now'] . $action_links['view_transaction']; |
|
335 | + $content = $action_links['generate_now'].$action_links['view_transaction']; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | return $content; |
@@ -350,69 +350,69 @@ discard block |
||
350 | 350 | * @return int | EE_Message[] |
351 | 351 | * @throws \EE_Error |
352 | 352 | */ |
353 | - protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) { |
|
353 | + protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) { |
|
354 | 354 | |
355 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
355 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
356 | 356 | ? $this->_req_data['paged'] |
357 | 357 | : 1; |
358 | 358 | |
359 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
359 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
360 | 360 | ? $this->_req_data['perpage'] |
361 | 361 | : $perpage; |
362 | 362 | |
363 | - $offset = ( $current_page - 1 ) * $per_page; |
|
364 | - $limit = $all || $count ? null : array( $offset, $per_page ); |
|
363 | + $offset = ($current_page - 1) * $per_page; |
|
364 | + $limit = $all || $count ? null : array($offset, $per_page); |
|
365 | 365 | $query_params = array( |
366 | - 'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ], |
|
367 | - 'order' => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ], |
|
366 | + 'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'], |
|
367 | + 'order' => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'], |
|
368 | 368 | 'limit' => $limit, |
369 | 369 | ); |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Any filters coming in from other routes? |
373 | 373 | */ |
374 | - if ( isset( $this->_req_data['filterby'] ) ) { |
|
375 | - $query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() ); |
|
376 | - if ( ! $count ) { |
|
374 | + if (isset($this->_req_data['filterby'])) { |
|
375 | + $query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params()); |
|
376 | + if ( ! $count) { |
|
377 | 377 | $query_params['group_by'] = 'MSG_ID'; |
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | 381 | //view conditionals |
382 | - if ( $view !== 'all' && $count && $all ) { |
|
382 | + if ($view !== 'all' && $count && $all) { |
|
383 | 383 | $query_params[0]['AND*view_conditional'] = array( |
384 | - 'STS_ID' => strtoupper( $view ), |
|
384 | + 'STS_ID' => strtoupper($view), |
|
385 | 385 | ); |
386 | 386 | } |
387 | 387 | |
388 | - if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) { |
|
388 | + if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') { |
|
389 | 389 | $query_params[0]['AND*view_conditional'] = array( |
390 | - 'STS_ID' => strtoupper( $this->_req_data['status'] ), |
|
390 | + 'STS_ID' => strtoupper($this->_req_data['status']), |
|
391 | 391 | ); |
392 | 392 | } |
393 | 393 | |
394 | - if ( ! $all && ! empty( $this->_req_data['s'] ) ) { |
|
395 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
394 | + if ( ! $all && ! empty($this->_req_data['s'])) { |
|
395 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
396 | 396 | $query_params[0]['OR'] = array( |
397 | - 'MSG_to' => array( 'LIKE', $search_string ), |
|
398 | - 'MSG_from' => array( 'LIKE', $search_string ), |
|
399 | - 'MSG_subject' => array( 'LIKE', $search_string ), |
|
400 | - 'MSG_content' => array( 'LIKE', $search_string ), |
|
397 | + 'MSG_to' => array('LIKE', $search_string), |
|
398 | + 'MSG_from' => array('LIKE', $search_string), |
|
399 | + 'MSG_subject' => array('LIKE', $search_string), |
|
400 | + 'MSG_content' => array('LIKE', $search_string), |
|
401 | 401 | ); |
402 | 402 | } |
403 | 403 | |
404 | 404 | //account for debug only status. We don't show Messages with the EEM_Message::status_debug_only to clients when |
405 | 405 | //`WP_DEBUG` is false. |
406 | - if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { |
|
406 | + if ( ! defined('WP_DEBUG') || ! WP_DEBUG) { |
|
407 | 407 | $query_params[0]['AND*debug_only_conditional'] = array( |
408 | - 'STS_ID' => array( '!=', EEM_Message::status_debug_only ) |
|
408 | + 'STS_ID' => array('!=', EEM_Message::status_debug_only) |
|
409 | 409 | ); |
410 | 410 | } |
411 | 411 | |
412 | 412 | //account for filters |
413 | 413 | if ( |
414 | 414 | ! $all |
415 | - && isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
415 | + && isset($this->_req_data['ee_messenger_filter_by']) |
|
416 | 416 | && $this->_req_data['ee_messenger_filter_by'] !== 'none_selected' |
417 | 417 | ) { |
418 | 418 | $query_params[0]['AND*messenger_filter'] = array( |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | if ( |
423 | 423 | ! $all |
424 | - && ! empty( $this->_req_data['ee_message_type_filter_by'] ) |
|
424 | + && ! empty($this->_req_data['ee_message_type_filter_by']) |
|
425 | 425 | && $this->_req_data['ee_message_type_filter_by'] !== 'none_selected' |
426 | 426 | ) { |
427 | 427 | $query_params[0]['AND*message_type_filter'] = array( |
@@ -431,17 +431,17 @@ discard block |
||
431 | 431 | |
432 | 432 | if ( |
433 | 433 | ! $all |
434 | - && ! empty( $this->_req_data['ee_context_filter_by'] ) |
|
434 | + && ! empty($this->_req_data['ee_context_filter_by']) |
|
435 | 435 | && $this->_req_data['ee_context_filter_by'] !== 'none_selected' |
436 | 436 | ) { |
437 | 437 | $query_params[0]['AND*context_filter'] = array( |
438 | - 'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) ) |
|
438 | + 'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])) |
|
439 | 439 | ); |
440 | 440 | } |
441 | 441 | |
442 | 442 | return $count |
443 | - ? EEM_Message::instance()->count( $query_params, null, true ) |
|
444 | - : EEM_Message::instance()->get_all( $query_params ); |
|
443 | + ? EEM_Message::instance()->count($query_params, null, true) |
|
444 | + : EEM_Message::instance()->get_all($query_params); |
|
445 | 445 | |
446 | 446 | } |
447 | 447 | } //end EE_Message_List_Table class |
448 | 448 | \ No newline at end of file |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * @param int | \EE_Event $event |
28 | 28 | * @return bool |
29 | 29 | */ |
30 | -function is_espresso_event( $event = NULL ) { |
|
31 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
30 | +function is_espresso_event($event = NULL) { |
|
31 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
32 | 32 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
33 | - $event = EEH_Event_View::get_event( $event ); |
|
33 | + $event = EEH_Event_View::get_event($event); |
|
34 | 34 | // do we have a valid event ? |
35 | - return $event instanceof EE_Event ? TRUE : FALSE; |
|
35 | + return $event instanceof EE_Event ? TRUE : FALSE; |
|
36 | 36 | } |
37 | 37 | return FALSE; |
38 | 38 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return bool |
45 | 45 | */ |
46 | 46 | function is_espresso_event_single() { |
47 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
47 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
48 | 48 | global $wp_query; |
49 | 49 | // return conditionals set by CPTs |
50 | 50 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return bool |
60 | 60 | */ |
61 | 61 | function is_espresso_event_archive() { |
62 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
62 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
63 | 63 | global $wp_query; |
64 | 64 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE; |
65 | 65 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return bool |
74 | 74 | */ |
75 | 75 | function is_espresso_event_taxonomy() { |
76 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
76 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
77 | 77 | global $wp_query; |
78 | 78 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE; |
79 | 79 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param int | \EE_Venue $venue |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | -function is_espresso_venue( $venue = NULL ) { |
|
91 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
90 | +function is_espresso_venue($venue = NULL) { |
|
91 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
92 | 92 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
93 | - $venue = EEH_Venue_View::get_venue( $venue, FALSE ); |
|
93 | + $venue = EEH_Venue_View::get_venue($venue, FALSE); |
|
94 | 94 | // do we have a valid event ? |
95 | 95 | return $venue instanceof EE_Venue ? TRUE : FALSE; |
96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return bool |
105 | 105 | */ |
106 | 106 | function is_espresso_venue_single() { |
107 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
107 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
108 | 108 | global $wp_query; |
109 | 109 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE; |
110 | 110 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return bool |
119 | 119 | */ |
120 | 120 | function is_espresso_venue_archive() { |
121 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
121 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
122 | 122 | global $wp_query; |
123 | 123 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE; |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return bool |
133 | 133 | */ |
134 | 134 | function is_espresso_venue_taxonomy() { |
135 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
135 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
136 | 136 | global $wp_query; |
137 | 137 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE; |
138 | 138 | } |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * @param $conditional_tag |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | -function can_use_espresso_conditionals( $conditional_tag ) { |
|
150 | - if ( ! did_action( 'AHEE__EE_System__initialize' )) { |
|
149 | +function can_use_espresso_conditionals($conditional_tag) { |
|
150 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
151 | 151 | EE_Error::doing_it_wrong( |
152 | 152 | __FUNCTION__, |
153 | 153 | sprintf( |
154 | - __( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'), |
|
154 | + __('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'), |
|
155 | 155 | $conditional_tag |
156 | 156 | ), |
157 | 157 | '4.4.0' |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | |
167 | 167 | /*************************** Event Queries ***************************/ |
168 | 168 | |
169 | -if ( ! function_exists( 'espresso_get_events' )) { |
|
169 | +if ( ! function_exists('espresso_get_events')) { |
|
170 | 170 | /** |
171 | 171 | * espresso_get_events |
172 | 172 | * @param array $params |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - function espresso_get_events( $params = array() ) { |
|
175 | + function espresso_get_events($params = array()) { |
|
176 | 176 | //set default params |
177 | 177 | $default_espresso_events_params = array( |
178 | 178 | 'limit' => 10, |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | 'sort' => 'ASC' |
184 | 184 | ); |
185 | 185 | // allow the defaults to be filtered |
186 | - $default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params ); |
|
186 | + $default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params); |
|
187 | 187 | // grab params and merge with defaults, then extract |
188 | - $params = array_merge( $default_espresso_events_params, $params ); |
|
188 | + $params = array_merge($default_espresso_events_params, $params); |
|
189 | 189 | // run the query |
190 | - $events_query = new EE_Event_List_Query( $params ); |
|
190 | + $events_query = new EE_Event_List_Query($params); |
|
191 | 191 | // assign results to a variable so we can return it |
192 | 192 | $events = $events_query->have_posts() ? $events_query->posts : array(); |
193 | 193 | // but first reset the query and postdata |
194 | 194 | wp_reset_query(); |
195 | 195 | wp_reset_postdata(); |
196 | 196 | EED_Events_Archive::remove_all_events_archive_filters(); |
197 | - unset( $events_query ); |
|
197 | + unset($events_query); |
|
198 | 198 | return $events; |
199 | 199 | } |
200 | 200 | } |
@@ -208,32 +208,32 @@ discard block |
||
208 | 208 | * espresso_load_ticket_selector |
209 | 209 | */ |
210 | 210 | function espresso_load_ticket_selector() { |
211 | - EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' ); |
|
211 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
212 | 212 | } |
213 | 213 | |
214 | -if ( ! function_exists( 'espresso_ticket_selector' )) { |
|
214 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
215 | 215 | /** |
216 | 216 | * espresso_ticket_selector |
217 | 217 | * @param null $event |
218 | 218 | */ |
219 | - function espresso_ticket_selector( $event = NULL ) { |
|
220 | - if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
|
219 | + function espresso_ticket_selector($event = NULL) { |
|
220 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) { |
|
221 | 221 | espresso_load_ticket_selector(); |
222 | - echo EED_Ticket_Selector::display_ticket_selector( $event ); |
|
222 | + echo EED_Ticket_Selector::display_ticket_selector($event); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | - if ( ! function_exists( 'espresso_view_details_btn' )) { |
|
228 | + if ( ! function_exists('espresso_view_details_btn')) { |
|
229 | 229 | /** |
230 | 230 | * espresso_view_details_btn |
231 | 231 | * @param null $event |
232 | 232 | */ |
233 | - function espresso_view_details_btn( $event = NULL ) { |
|
234 | - if ( ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) { |
|
233 | + function espresso_view_details_btn($event = NULL) { |
|
234 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) { |
|
235 | 235 | espresso_load_ticket_selector(); |
236 | - echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE ); |
|
236 | + echo EED_Ticket_Selector::display_ticket_selector($event, TRUE); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | /*************************** EEH_Event_View ***************************/ |
245 | 245 | |
246 | -if ( ! function_exists( 'espresso_load_event_list_assets' )) { |
|
246 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
247 | 247 | /** |
248 | 248 | * espresso_load_event_list_assets |
249 | 249 | * ensures that event list styles and scripts are loaded |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function espresso_load_event_list_assets() { |
254 | 254 | $event_list = EED_Events_Archive::instance(); |
255 | - add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 ); |
|
256 | - add_filter( 'FHEE_enable_default_espresso_css', '__return_true' ); |
|
255 | + add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); |
|
256 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | -if ( ! function_exists( 'espresso_event_reg_button' )) { |
|
261 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
262 | 262 | /** |
263 | 263 | * espresso_event_reg_button |
264 | 264 | * returns the "Register Now" button if event is active, |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * @param bool $EVT_ID |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) { |
|
274 | - $event_status = EEH_Event_View::event_active_status( $EVT_ID ); |
|
275 | - switch ( $event_status ) { |
|
273 | + function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) { |
|
274 | + $event_status = EEH_Event_View::event_active_status($EVT_ID); |
|
275 | + switch ($event_status) { |
|
276 | 276 | case EE_Datetime::sold_out : |
277 | 277 | $btn_text = __('Sold Out', 'event_espresso'); |
278 | 278 | $class = 'ee-pink'; |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | case EE_Datetime::upcoming : |
289 | 289 | case EE_Datetime::active : |
290 | 290 | default : |
291 | - $btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' ); |
|
291 | + $btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso'); |
|
292 | 292 | $class = 'ee-green'; |
293 | 293 | } |
294 | - if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) { |
|
294 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
295 | 295 | $btn_text = $btn_text_if_inactive; |
296 | 296 | $class = 'ee-grey'; |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | |
307 | 307 | |
308 | -if ( ! function_exists( 'espresso_display_ticket_selector' )) { |
|
308 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
309 | 309 | /** |
310 | 310 | * espresso_display_ticket_selector |
311 | 311 | * whether or not to display the Ticket Selector for an event |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | * @param bool $EVT_ID |
314 | 314 | * @return boolean |
315 | 315 | */ |
316 | - function espresso_display_ticket_selector( $EVT_ID = FALSE ) { |
|
317 | - return EEH_Event_View::display_ticket_selector( $EVT_ID ); |
|
316 | + function espresso_display_ticket_selector($EVT_ID = FALSE) { |
|
317 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | -if ( ! function_exists( 'espresso_event_status_banner' )) { |
|
323 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
324 | 324 | /** |
325 | 325 | * espresso_event_status |
326 | 326 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | * @param bool $EVT_ID |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - function espresso_event_status_banner( $EVT_ID = FALSE ) { |
|
332 | - return EEH_Event_View::event_status( $EVT_ID ); |
|
331 | + function espresso_event_status_banner($EVT_ID = FALSE) { |
|
332 | + return EEH_Event_View::event_status($EVT_ID); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | 336 | |
337 | -if ( ! function_exists( 'espresso_event_status' )) { |
|
337 | +if ( ! function_exists('espresso_event_status')) { |
|
338 | 338 | /** |
339 | 339 | * espresso_event_status |
340 | 340 | * returns the event status if it is sold out, expired, or inactive |
@@ -343,17 +343,17 @@ discard block |
||
343 | 343 | * @param bool $echo |
344 | 344 | * @return string |
345 | 345 | */ |
346 | - function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) { |
|
347 | - if ( $echo ) { |
|
348 | - echo EEH_Event_View::event_active_status( $EVT_ID ); |
|
346 | + function espresso_event_status($EVT_ID = 0, $echo = TRUE) { |
|
347 | + if ($echo) { |
|
348 | + echo EEH_Event_View::event_active_status($EVT_ID); |
|
349 | 349 | return ''; |
350 | 350 | } |
351 | - return EEH_Event_View::event_active_status( $EVT_ID ); |
|
351 | + return EEH_Event_View::event_active_status($EVT_ID); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | -if ( ! function_exists( 'espresso_event_categories' )) { |
|
356 | +if ( ! function_exists('espresso_event_categories')) { |
|
357 | 357 | /** |
358 | 358 | * espresso_event_categories |
359 | 359 | * returns the terms associated with an event |
@@ -363,17 +363,17 @@ discard block |
||
363 | 363 | * @param bool $echo |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
367 | - if ( $echo ) { |
|
368 | - echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
366 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
367 | + if ($echo) { |
|
368 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
369 | 369 | return ''; |
370 | 370 | } |
371 | - return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
371 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
375 | 375 | |
376 | -if ( ! function_exists( 'espresso_event_tickets_available' )) { |
|
376 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
377 | 377 | /** |
378 | 378 | * espresso_event_tickets_available |
379 | 379 | * returns the ticket types available for purchase for an event |
@@ -383,26 +383,26 @@ discard block |
||
383 | 383 | * @param bool $format |
384 | 384 | * @return string |
385 | 385 | */ |
386 | - function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) { |
|
387 | - $tickets = EEH_Event_View::event_tickets_available( $EVT_ID ); |
|
388 | - if ( is_array( $tickets ) && ! empty( $tickets )) { |
|
386 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { |
|
387 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
388 | + if (is_array($tickets) && ! empty($tickets)) { |
|
389 | 389 | // if formatting then $html will be a string, else it will be an array of ticket objects |
390 | - $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); |
|
391 | - foreach ( $tickets as $ticket ) { |
|
392 | - if ( $ticket instanceof EE_Ticket ) { |
|
393 | - if ( $format ) { |
|
394 | - $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; |
|
395 | - $html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() ); |
|
390 | + $html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array(); |
|
391 | + foreach ($tickets as $ticket) { |
|
392 | + if ($ticket instanceof EE_Ticket) { |
|
393 | + if ($format) { |
|
394 | + $html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">'; |
|
395 | + $html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); |
|
396 | 396 | $html .= '</li>'; |
397 | 397 | } else { |
398 | 398 | $html[] = $ticket; |
399 | 399 | } |
400 | 400 | } |
401 | 401 | } |
402 | - if ( $format ) { |
|
402 | + if ($format) { |
|
403 | 403 | $html .= '</ul>'; |
404 | 404 | } |
405 | - if ( $echo && ! $format ) { |
|
405 | + if ($echo && ! $format) { |
|
406 | 406 | echo $html; |
407 | 407 | return ''; |
408 | 408 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | -if ( ! function_exists( 'espresso_event_date_obj' )) { |
|
415 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
416 | 416 | /** |
417 | 417 | * espresso_event_date_obj |
418 | 418 | * returns the primary date object for an event |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | * @param bool $EVT_ID |
421 | 421 | * @return object |
422 | 422 | */ |
423 | - function espresso_event_date_obj( $EVT_ID = FALSE ) { |
|
424 | - return EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
423 | + function espresso_event_date_obj($EVT_ID = FALSE) { |
|
424 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | 428 | |
429 | -if ( ! function_exists( 'espresso_event_date' )) { |
|
429 | +if ( ! function_exists('espresso_event_date')) { |
|
430 | 430 | /** |
431 | 431 | * espresso_event_date |
432 | 432 | * returns the primary date for an event |
@@ -437,22 +437,22 @@ discard block |
||
437 | 437 | * @param bool $echo |
438 | 438 | * @return string |
439 | 439 | */ |
440 | - function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
441 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
442 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
443 | - $date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format ); |
|
444 | - $time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format ); |
|
445 | - if($echo){ |
|
446 | - echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
440 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
441 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
442 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
443 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
444 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
445 | + if ($echo) { |
|
446 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
447 | 447 | return ''; |
448 | 448 | } |
449 | - return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
449 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
450 | 450 | |
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | 454 | |
455 | -if ( ! function_exists( 'espresso_list_of_event_dates' )) { |
|
455 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
456 | 456 | /** |
457 | 457 | * espresso_list_of_event_dates |
458 | 458 | * returns a unordered list of dates for an event |
@@ -467,40 +467,40 @@ discard block |
||
467 | 467 | * @param null $limit |
468 | 468 | * @return string |
469 | 469 | */ |
470 | - function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) { |
|
471 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
472 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
473 | - $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format ); |
|
474 | - $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format ); |
|
475 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit ); |
|
476 | - if ( ! $format ) { |
|
477 | - return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes ); |
|
470 | + function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) { |
|
471 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
472 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
473 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
474 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
475 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit); |
|
476 | + if ( ! $format) { |
|
477 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
478 | 478 | } |
479 | 479 | //d( $datetimes ); |
480 | - if ( is_array( $datetimes ) && ! empty( $datetimes )) { |
|
480 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
481 | 481 | global $post; |
482 | - $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
483 | - foreach ( $datetimes as $datetime ) { |
|
484 | - if ( $datetime instanceof EE_Datetime ) { |
|
485 | - $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID(); |
|
486 | - $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">'; |
|
482 | + $html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
483 | + foreach ($datetimes as $datetime) { |
|
484 | + if ($datetime instanceof EE_Datetime) { |
|
485 | + $html .= '<li id="ee-event-datetimes-li-'.$datetime->ID(); |
|
486 | + $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">'; |
|
487 | 487 | $datetime_name = $datetime->name(); |
488 | - $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : ''; |
|
489 | - $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : ''; |
|
490 | - $html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>'; |
|
491 | - $html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format ); |
|
488 | + $html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : ''; |
|
489 | + $html .= ! empty($datetime_name) && $add_breaks ? '<br />' : ''; |
|
490 | + $html .= '<span class="dashicons dashicons-calendar"></span>'.$datetime->date_range($date_format).'<br/>'; |
|
491 | + $html .= '<span class="dashicons dashicons-clock"></span>'.$datetime->time_range($time_format); |
|
492 | 492 | $datetime_description = $datetime->description(); |
493 | - $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : ''; |
|
494 | - $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : ''; |
|
495 | - $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime ); |
|
493 | + $html .= ! empty($datetime_description) && $add_breaks ? '<br />' : ''; |
|
494 | + $html .= ! empty($datetime_description) ? ' - '.$datetime_description : ''; |
|
495 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime); |
|
496 | 496 | $html .= '</li>'; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | $html .= $format ? '</ul>' : ''; |
500 | 500 | } else { |
501 | - $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : ''; |
|
501 | + $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : ''; |
|
502 | 502 | } |
503 | - if ( $echo ) { |
|
503 | + if ($echo) { |
|
504 | 504 | echo $html; |
505 | 505 | return ''; |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | |
512 | -if ( ! function_exists( 'espresso_event_end_date' )) { |
|
512 | +if ( ! function_exists('espresso_event_end_date')) { |
|
513 | 513 | /** |
514 | 514 | * espresso_event_end_date |
515 | 515 | * returns the last date for an event |
@@ -520,20 +520,20 @@ discard block |
||
520 | 520 | * @param bool $echo |
521 | 521 | * @return string |
522 | 522 | */ |
523 | - function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
524 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
525 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
526 | - $date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format ); |
|
527 | - $time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format ); |
|
528 | - if($echo){ |
|
529 | - echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
523 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
524 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
525 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
526 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
527 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
528 | + if ($echo) { |
|
529 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
530 | 530 | return ''; |
531 | 531 | } |
532 | - return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
532 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -if ( ! function_exists( 'espresso_event_date_range' )) { |
|
536 | +if ( ! function_exists('espresso_event_date_range')) { |
|
537 | 537 | /** |
538 | 538 | * espresso_event_date_range |
539 | 539 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -546,31 +546,31 @@ discard block |
||
546 | 546 | * @param bool $echo |
547 | 547 | * @return string |
548 | 548 | */ |
549 | - function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
549 | + function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
550 | 550 | // set and filter date and time formats when a range is returned |
551 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
552 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format ); |
|
551 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
552 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
553 | 553 | // get the start and end date with NO time portion |
554 | - $the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID ); |
|
555 | - $the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID ); |
|
554 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
555 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
556 | 556 | // now we can determine if date range spans more than one day |
557 | - if ( $the_event_date != $the_event_end_date ) { |
|
558 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
559 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format ); |
|
557 | + if ($the_event_date != $the_event_end_date) { |
|
558 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
559 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
560 | 560 | $html = sprintf( |
561 | - __( '%1$s - %2$s', 'event_espresso' ), |
|
562 | - EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ), |
|
563 | - EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID ) |
|
561 | + __('%1$s - %2$s', 'event_espresso'), |
|
562 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
563 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
564 | 564 | ); |
565 | 565 | } else { |
566 | 566 | // set and filter date and time formats when only a single datetime is returned |
567 | - $single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' ); |
|
568 | - $single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' ); |
|
569 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format ); |
|
570 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format ); |
|
571 | - $html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID ); |
|
567 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
568 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
569 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
570 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
571 | + $html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
572 | 572 | } |
573 | - if ( $echo ) { |
|
573 | + if ($echo) { |
|
574 | 574 | echo $html; |
575 | 575 | return ''; |
576 | 576 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | } |
580 | 580 | |
581 | 581 | |
582 | -if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) { |
|
582 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
583 | 583 | /** |
584 | 584 | * espresso_event_date_as_calendar_page |
585 | 585 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -587,15 +587,15 @@ discard block |
||
587 | 587 | * @param bool $EVT_ID |
588 | 588 | * @return string |
589 | 589 | */ |
590 | - function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) { |
|
591 | - EEH_Event_View::event_date_as_calendar_page( $EVT_ID ); |
|
590 | + function espresso_event_date_as_calendar_page($EVT_ID = FALSE) { |
|
591 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | 597 | |
598 | -if ( ! function_exists( 'espresso_event_link_url' )) { |
|
598 | +if ( ! function_exists('espresso_event_link_url')) { |
|
599 | 599 | /** |
600 | 600 | * espresso_event_link_url |
601 | 601 | * |
@@ -603,18 +603,18 @@ discard block |
||
603 | 603 | * @param bool $echo |
604 | 604 | * @return string |
605 | 605 | */ |
606 | - function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) { |
|
607 | - if ( $echo ) { |
|
608 | - echo EEH_Event_View::event_link_url( $EVT_ID ); |
|
606 | + function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) { |
|
607 | + if ($echo) { |
|
608 | + echo EEH_Event_View::event_link_url($EVT_ID); |
|
609 | 609 | return ''; |
610 | 610 | } |
611 | - return EEH_Event_View::event_link_url( $EVT_ID ); |
|
611 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | 615 | |
616 | 616 | |
617 | -if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) { |
|
617 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
618 | 618 | /** |
619 | 619 | * espresso_event_has_content_or_excerpt |
620 | 620 | * |
@@ -622,15 +622,15 @@ discard block |
||
622 | 622 | * @param bool $EVT_ID |
623 | 623 | * @return boolean |
624 | 624 | */ |
625 | - function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) { |
|
626 | - return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID ); |
|
625 | + function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) { |
|
626 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
630 | 630 | |
631 | 631 | |
632 | 632 | |
633 | -if ( ! function_exists( 'espresso_event_content_or_excerpt' )) { |
|
633 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
634 | 634 | /** |
635 | 635 | * espresso_event_content_or_excerpt |
636 | 636 | * |
@@ -639,18 +639,18 @@ discard block |
||
639 | 639 | * @param bool $echo |
640 | 640 | * @return string |
641 | 641 | */ |
642 | - function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) { |
|
643 | - if ( $echo ) { |
|
644 | - echo EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
642 | + function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) { |
|
643 | + if ($echo) { |
|
644 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
645 | 645 | return ''; |
646 | 646 | } |
647 | - return EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
647 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | |
651 | 651 | |
652 | 652 | |
653 | -if ( ! function_exists( 'espresso_event_phone' )) { |
|
653 | +if ( ! function_exists('espresso_event_phone')) { |
|
654 | 654 | /** |
655 | 655 | * espresso_event_phone |
656 | 656 | * |
@@ -658,18 +658,18 @@ discard block |
||
658 | 658 | * @param bool $echo |
659 | 659 | * @return string |
660 | 660 | */ |
661 | - function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) { |
|
662 | - if ( $echo ) { |
|
663 | - echo EEH_Event_View::event_phone( $EVT_ID ); |
|
661 | + function espresso_event_phone($EVT_ID = 0, $echo = TRUE) { |
|
662 | + if ($echo) { |
|
663 | + echo EEH_Event_View::event_phone($EVT_ID); |
|
664 | 664 | return ''; |
665 | 665 | } |
666 | - return EEH_Event_View::event_phone( $EVT_ID ); |
|
666 | + return EEH_Event_View::event_phone($EVT_ID); |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
670 | 670 | |
671 | 671 | |
672 | -if ( ! function_exists( 'espresso_edit_event_link' )) { |
|
672 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
673 | 673 | /** |
674 | 674 | * espresso_edit_event_link |
675 | 675 | * returns a link to edit an event |
@@ -678,39 +678,39 @@ discard block |
||
678 | 678 | * @param bool $echo |
679 | 679 | * @return string |
680 | 680 | */ |
681 | - function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) { |
|
682 | - if ( $echo ) { |
|
683 | - echo EEH_Event_View::edit_event_link( $EVT_ID ); |
|
681 | + function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { |
|
682 | + if ($echo) { |
|
683 | + echo EEH_Event_View::edit_event_link($EVT_ID); |
|
684 | 684 | return ''; |
685 | 685 | } |
686 | - return EEH_Event_View::edit_event_link( $EVT_ID ); |
|
686 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
687 | 687 | } |
688 | 688 | } |
689 | 689 | |
690 | 690 | |
691 | -if ( ! function_exists( 'espresso_organization_name' )) { |
|
691 | +if ( ! function_exists('espresso_organization_name')) { |
|
692 | 692 | /** |
693 | 693 | * espresso_organization_name |
694 | 694 | * @param bool $echo |
695 | 695 | * @return string |
696 | 696 | */ |
697 | 697 | function espresso_organization_name($echo = TRUE) { |
698 | - if($echo){ |
|
699 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
698 | + if ($echo) { |
|
699 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
700 | 700 | return ''; |
701 | 701 | } |
702 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
702 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
703 | 703 | } |
704 | 704 | } |
705 | 705 | |
706 | -if ( ! function_exists( 'espresso_organization_address' )) { |
|
706 | +if ( ! function_exists('espresso_organization_address')) { |
|
707 | 707 | /** |
708 | 708 | * espresso_organization_address |
709 | 709 | * @param string $type |
710 | 710 | * @return string |
711 | 711 | */ |
712 | - function espresso_organization_address( $type = 'inline' ) { |
|
713 | - if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) { |
|
712 | + function espresso_organization_address($type = 'inline') { |
|
713 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
714 | 714 | $address = new EventEspresso\core\entities\GenericAddress( |
715 | 715 | EE_Registry::instance()->CFG->organization->address_1, |
716 | 716 | EE_Registry::instance()->CFG->organization->address_2, |
@@ -719,129 +719,129 @@ discard block |
||
719 | 719 | EE_Registry::instance()->CFG->organization->zip, |
720 | 720 | EE_Registry::instance()->CFG->organization->CNT_ISO |
721 | 721 | ); |
722 | - return EEH_Address::format( $address, $type ); |
|
722 | + return EEH_Address::format($address, $type); |
|
723 | 723 | } |
724 | 724 | return ''; |
725 | 725 | } |
726 | 726 | } |
727 | 727 | |
728 | -if ( ! function_exists( 'espresso_organization_email' )) { |
|
728 | +if ( ! function_exists('espresso_organization_email')) { |
|
729 | 729 | /** |
730 | 730 | * espresso_organization_email |
731 | 731 | * @param bool $echo |
732 | 732 | * @return string |
733 | 733 | */ |
734 | - function espresso_organization_email( $echo = TRUE ) { |
|
735 | - if($echo){ |
|
736 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
734 | + function espresso_organization_email($echo = TRUE) { |
|
735 | + if ($echo) { |
|
736 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
737 | 737 | return ''; |
738 | 738 | } |
739 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
739 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
740 | 740 | } |
741 | 741 | } |
742 | 742 | |
743 | -if ( ! function_exists( 'espresso_organization_logo_url' )) { |
|
743 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
744 | 744 | /** |
745 | 745 | * espresso_organization_logo_url |
746 | 746 | * @param bool $echo |
747 | 747 | * @return string |
748 | 748 | */ |
749 | - function espresso_organization_logo_url( $echo = TRUE ) { |
|
750 | - if($echo){ |
|
751 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
749 | + function espresso_organization_logo_url($echo = TRUE) { |
|
750 | + if ($echo) { |
|
751 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
752 | 752 | return ''; |
753 | 753 | } |
754 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
754 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
755 | 755 | } |
756 | 756 | } |
757 | 757 | |
758 | -if ( ! function_exists( 'espresso_organization_facebook' )) { |
|
758 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
759 | 759 | /** |
760 | 760 | * espresso_organization_facebook |
761 | 761 | * @param bool $echo |
762 | 762 | * @return string |
763 | 763 | */ |
764 | - function espresso_organization_facebook( $echo = TRUE ) { |
|
765 | - if($echo){ |
|
766 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
764 | + function espresso_organization_facebook($echo = TRUE) { |
|
765 | + if ($echo) { |
|
766 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
767 | 767 | return ''; |
768 | 768 | } |
769 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
769 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
770 | 770 | } |
771 | 771 | } |
772 | 772 | |
773 | -if ( ! function_exists( 'espresso_organization_twitter' )) { |
|
773 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
774 | 774 | /** |
775 | 775 | * espresso_organization_twitter |
776 | 776 | * @param bool $echo |
777 | 777 | * @return string |
778 | 778 | */ |
779 | - function espresso_organization_twitter( $echo = TRUE ) { |
|
780 | - if($echo){ |
|
781 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
779 | + function espresso_organization_twitter($echo = TRUE) { |
|
780 | + if ($echo) { |
|
781 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
782 | 782 | return ''; |
783 | 783 | } |
784 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
784 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
788 | -if ( ! function_exists( 'espresso_organization_linkedin' )) { |
|
788 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
789 | 789 | /** |
790 | 790 | * espresso_organization_linkedin |
791 | 791 | * @param bool $echo |
792 | 792 | * @return string |
793 | 793 | */ |
794 | - function espresso_organization_linkedin( $echo = TRUE ) { |
|
795 | - if($echo){ |
|
796 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
794 | + function espresso_organization_linkedin($echo = TRUE) { |
|
795 | + if ($echo) { |
|
796 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
797 | 797 | return ''; |
798 | 798 | } |
799 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
799 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
800 | 800 | } |
801 | 801 | } |
802 | 802 | |
803 | -if ( ! function_exists( 'espresso_organization_pinterest' )) { |
|
803 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
804 | 804 | /** |
805 | 805 | * espresso_organization_pinterest |
806 | 806 | * @param bool $echo |
807 | 807 | * @return string |
808 | 808 | */ |
809 | - function espresso_organization_pinterest( $echo = TRUE ) { |
|
810 | - if($echo){ |
|
811 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
809 | + function espresso_organization_pinterest($echo = TRUE) { |
|
810 | + if ($echo) { |
|
811 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
812 | 812 | return ''; |
813 | 813 | } |
814 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
814 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
815 | 815 | } |
816 | 816 | } |
817 | 817 | |
818 | -if ( ! function_exists( 'espresso_organization_google' )) { |
|
818 | +if ( ! function_exists('espresso_organization_google')) { |
|
819 | 819 | /** |
820 | 820 | * espresso_organization_google |
821 | 821 | * @param bool $echo |
822 | 822 | * @return string |
823 | 823 | */ |
824 | - function espresso_organization_google( $echo = TRUE ) { |
|
825 | - if($echo){ |
|
826 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
824 | + function espresso_organization_google($echo = TRUE) { |
|
825 | + if ($echo) { |
|
826 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
827 | 827 | return ''; |
828 | 828 | } |
829 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
829 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
830 | 830 | } |
831 | 831 | } |
832 | 832 | |
833 | -if ( ! function_exists( 'espresso_organization_instagram' )) { |
|
833 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
834 | 834 | /** |
835 | 835 | * espresso_organization_instagram |
836 | 836 | * @param bool $echo |
837 | 837 | * @return string |
838 | 838 | */ |
839 | - function espresso_organization_instagram( $echo = TRUE ) { |
|
840 | - if($echo){ |
|
841 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
839 | + function espresso_organization_instagram($echo = TRUE) { |
|
840 | + if ($echo) { |
|
841 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
842 | 842 | return ''; |
843 | 843 | } |
844 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
844 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
845 | 845 | } |
846 | 846 | } |
847 | 847 | |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | |
852 | 852 | |
853 | 853 | |
854 | -if ( ! function_exists( 'espresso_event_venues' )) { |
|
854 | +if ( ! function_exists('espresso_event_venues')) { |
|
855 | 855 | /** |
856 | 856 | * espresso_event_venues |
857 | 857 | * |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | |
866 | 866 | |
867 | 867 | |
868 | -if ( ! function_exists( 'espresso_venue_id' )) { |
|
868 | +if ( ! function_exists('espresso_venue_id')) { |
|
869 | 869 | /** |
870 | 870 | * espresso_venue_name |
871 | 871 | * |
@@ -873,15 +873,15 @@ discard block |
||
873 | 873 | * @param int $EVT_ID |
874 | 874 | * @return string |
875 | 875 | */ |
876 | - function espresso_venue_id( $EVT_ID = 0 ) { |
|
877 | - $venue = EEH_Venue_View::get_venue( $EVT_ID ); |
|
876 | + function espresso_venue_id($EVT_ID = 0) { |
|
877 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
878 | 878 | return $venue instanceof EE_Venue ? $venue->ID() : 0; |
879 | 879 | } |
880 | 880 | } |
881 | 881 | |
882 | 882 | |
883 | 883 | |
884 | -if ( ! function_exists( 'espresso_is_venue_private' ) ) { |
|
884 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
885 | 885 | /** |
886 | 886 | * Return whether a venue is private or not. |
887 | 887 | * @see EEH_Venue_View::get_venue() for more info on expected return results. |
@@ -890,45 +890,45 @@ discard block |
||
890 | 890 | * |
891 | 891 | * @return bool | null |
892 | 892 | */ |
893 | - function espresso_is_venue_private( $VNU_ID = 0 ) { |
|
894 | - return EEH_Venue_View::is_venue_private( $VNU_ID ); |
|
893 | + function espresso_is_venue_private($VNU_ID = 0) { |
|
894 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
895 | 895 | } |
896 | 896 | } |
897 | 897 | |
898 | 898 | |
899 | 899 | |
900 | -if ( ! function_exists( 'espresso_venue_is_password_protected' ) ) { |
|
900 | +if ( ! function_exists('espresso_venue_is_password_protected')) { |
|
901 | 901 | /** |
902 | 902 | * returns true or false if a venue is password protected or not |
903 | 903 | * |
904 | 904 | * @param int $VNU_ID optional, the venue id to check. |
905 | 905 | * @return string |
906 | 906 | */ |
907 | - function espresso_venue_is_password_protected( $VNU_ID = 0 ) { |
|
908 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
909 | - return EEH_Venue_View::is_venue_password_protected( $VNU_ID ); |
|
907 | + function espresso_venue_is_password_protected($VNU_ID = 0) { |
|
908 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
909 | + return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
910 | 910 | } |
911 | 911 | } |
912 | 912 | |
913 | 913 | |
914 | 914 | |
915 | -if ( ! function_exists( 'espresso_password_protected_venue_form' ) ) { |
|
915 | +if ( ! function_exists('espresso_password_protected_venue_form')) { |
|
916 | 916 | /** |
917 | 917 | * Returns a password form if venue is password protected. |
918 | 918 | * |
919 | 919 | * @param int $VNU_ID optional, the venue id to check. |
920 | 920 | * @return string |
921 | 921 | */ |
922 | - function espresso_password_protected_venue_form( $VNU_ID = 0 ) { |
|
923 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
924 | - return EEH_Venue_View::password_protected_venue_form( $VNU_ID ); |
|
922 | + function espresso_password_protected_venue_form($VNU_ID = 0) { |
|
923 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
924 | + return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
925 | 925 | } |
926 | 926 | } |
927 | 927 | |
928 | 928 | |
929 | 929 | |
930 | 930 | |
931 | -if ( ! function_exists( 'espresso_venue_name' )) { |
|
931 | +if ( ! function_exists('espresso_venue_name')) { |
|
932 | 932 | /** |
933 | 933 | * espresso_venue_name |
934 | 934 | * |
@@ -938,19 +938,19 @@ discard block |
||
938 | 938 | * @param bool $echo |
939 | 939 | * @return string |
940 | 940 | */ |
941 | - function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) { |
|
942 | - if($echo){ |
|
943 | - echo EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
941 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) { |
|
942 | + if ($echo) { |
|
943 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
944 | 944 | return ''; |
945 | 945 | } |
946 | - return EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
946 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
947 | 947 | } |
948 | 948 | } |
949 | 949 | |
950 | 950 | |
951 | 951 | |
952 | 952 | |
953 | -if ( ! function_exists( 'espresso_venue_link' )) { |
|
953 | +if ( ! function_exists('espresso_venue_link')) { |
|
954 | 954 | /** |
955 | 955 | * espresso_venue_link |
956 | 956 | * |
@@ -959,14 +959,14 @@ discard block |
||
959 | 959 | * @param string $text |
960 | 960 | * @return string |
961 | 961 | */ |
962 | - function espresso_venue_link( $VNU_ID = 0, $text = '' ) { |
|
963 | - return EEH_Venue_View::venue_details_link( $VNU_ID, $text ); |
|
962 | + function espresso_venue_link($VNU_ID = 0, $text = '') { |
|
963 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
964 | 964 | } |
965 | 965 | } |
966 | 966 | |
967 | 967 | |
968 | 968 | |
969 | -if ( ! function_exists( 'espresso_venue_description' )) { |
|
969 | +if ( ! function_exists('espresso_venue_description')) { |
|
970 | 970 | /** |
971 | 971 | * espresso_venue_description |
972 | 972 | * |
@@ -975,17 +975,17 @@ discard block |
||
975 | 975 | * @param bool $echo |
976 | 976 | * @return string |
977 | 977 | */ |
978 | - function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) { |
|
979 | - if($echo){ |
|
980 | - echo EEH_Venue_View::venue_description( $VNU_ID ); |
|
978 | + function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) { |
|
979 | + if ($echo) { |
|
980 | + echo EEH_Venue_View::venue_description($VNU_ID); |
|
981 | 981 | return ''; |
982 | 982 | } |
983 | - return EEH_Venue_View::venue_description( $VNU_ID ); |
|
983 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
984 | 984 | } |
985 | 985 | } |
986 | 986 | |
987 | 987 | |
988 | -if ( ! function_exists( 'espresso_venue_excerpt' )) { |
|
988 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
989 | 989 | /** |
990 | 990 | * espresso_venue_excerpt |
991 | 991 | * |
@@ -994,18 +994,18 @@ discard block |
||
994 | 994 | * @param bool $echo |
995 | 995 | * @return string |
996 | 996 | */ |
997 | - function espresso_venue_excerpt( $VNU_ID = 0, $echo = TRUE ) { |
|
998 | - if ( $echo ) { |
|
999 | - echo EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
997 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) { |
|
998 | + if ($echo) { |
|
999 | + echo EEH_Venue_View::venue_excerpt($VNU_ID); |
|
1000 | 1000 | return ''; |
1001 | 1001 | } |
1002 | - return EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
1002 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | |
1007 | 1007 | |
1008 | -if ( ! function_exists( 'espresso_venue_categories' )) { |
|
1008 | +if ( ! function_exists('espresso_venue_categories')) { |
|
1009 | 1009 | /** |
1010 | 1010 | * espresso_venue_categories |
1011 | 1011 | * returns the terms associated with a venue |
@@ -1015,17 +1015,17 @@ discard block |
||
1015 | 1015 | * @param bool $echo |
1016 | 1016 | * @return string |
1017 | 1017 | */ |
1018 | - function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
1019 | - if ( $echo ) { |
|
1020 | - echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1018 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
1019 | + if ($echo) { |
|
1020 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1021 | 1021 | return ''; |
1022 | 1022 | } |
1023 | - return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1023 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
1028 | -if ( ! function_exists( 'espresso_venue_address' )) { |
|
1028 | +if ( ! function_exists('espresso_venue_address')) { |
|
1029 | 1029 | /** |
1030 | 1030 | * espresso_venue_address |
1031 | 1031 | * returns a formatted block of html for displaying a venue's address |
@@ -1035,17 +1035,17 @@ discard block |
||
1035 | 1035 | * @param bool $echo |
1036 | 1036 | * @return string |
1037 | 1037 | */ |
1038 | - function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1039 | - if ( $echo ) { |
|
1040 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1038 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1039 | + if ($echo) { |
|
1040 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1041 | 1041 | return ''; |
1042 | 1042 | } |
1043 | - return EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1043 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | |
1048 | -if ( ! function_exists( 'espresso_venue_raw_address' )) { |
|
1048 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
1049 | 1049 | /** |
1050 | 1050 | * espresso_venue_address |
1051 | 1051 | * returns an UN-formatted string containing a venue's address |
@@ -1055,17 +1055,17 @@ discard block |
||
1055 | 1055 | * @param bool $echo |
1056 | 1056 | * @return string |
1057 | 1057 | */ |
1058 | - function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1059 | - if ( $echo ) { |
|
1060 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1058 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1059 | + if ($echo) { |
|
1060 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1061 | 1061 | return ''; |
1062 | 1062 | } |
1063 | - return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1063 | + return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | |
1068 | -if ( ! function_exists( 'espresso_venue_has_address' )) { |
|
1068 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
1069 | 1069 | /** |
1070 | 1070 | * espresso_venue_has_address |
1071 | 1071 | * returns TRUE or FALSE if a Venue has address information |
@@ -1073,13 +1073,13 @@ discard block |
||
1073 | 1073 | * @param int $VNU_ID |
1074 | 1074 | * @return bool |
1075 | 1075 | */ |
1076 | - function espresso_venue_has_address( $VNU_ID = 0 ) { |
|
1077 | - return EEH_Venue_View::venue_has_address( $VNU_ID ); |
|
1076 | + function espresso_venue_has_address($VNU_ID = 0) { |
|
1077 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | |
1082 | -if ( ! function_exists( 'espresso_venue_gmap' )) { |
|
1082 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
1083 | 1083 | /** |
1084 | 1084 | * espresso_venue_gmap |
1085 | 1085 | * returns a google map for the venue address |
@@ -1090,17 +1090,17 @@ discard block |
||
1090 | 1090 | * @param bool $echo |
1091 | 1091 | * @return string |
1092 | 1092 | */ |
1093 | - function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE ) { |
|
1094 | - if ( $echo ) { |
|
1095 | - echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1093 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) { |
|
1094 | + if ($echo) { |
|
1095 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1096 | 1096 | return ''; |
1097 | 1097 | } |
1098 | - return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1098 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1099 | 1099 | } |
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | |
1103 | -if ( ! function_exists( 'espresso_venue_phone' )) { |
|
1103 | +if ( ! function_exists('espresso_venue_phone')) { |
|
1104 | 1104 | /** |
1105 | 1105 | * espresso_venue_phone |
1106 | 1106 | * |
@@ -1108,18 +1108,18 @@ discard block |
||
1108 | 1108 | * @param bool $echo |
1109 | 1109 | * @return string |
1110 | 1110 | */ |
1111 | - function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) { |
|
1112 | - if ( $echo ) { |
|
1113 | - echo EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1111 | + function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) { |
|
1112 | + if ($echo) { |
|
1113 | + echo EEH_Venue_View::venue_phone($VNU_ID); |
|
1114 | 1114 | return ''; |
1115 | 1115 | } |
1116 | - return EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1116 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | |
1121 | 1121 | |
1122 | -if ( ! function_exists( 'espresso_venue_website' )) { |
|
1122 | +if ( ! function_exists('espresso_venue_website')) { |
|
1123 | 1123 | /** |
1124 | 1124 | * espresso_venue_website |
1125 | 1125 | * |
@@ -1127,18 +1127,18 @@ discard block |
||
1127 | 1127 | * @param bool $echo |
1128 | 1128 | * @return string |
1129 | 1129 | */ |
1130 | - function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) { |
|
1131 | - if ( $echo ) { |
|
1132 | - echo EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1130 | + function espresso_venue_website($VNU_ID = 0, $echo = TRUE) { |
|
1131 | + if ($echo) { |
|
1132 | + echo EEH_Venue_View::venue_website_link($VNU_ID); |
|
1133 | 1133 | return ''; |
1134 | 1134 | } |
1135 | - return EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1135 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1136 | 1136 | } |
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | |
1140 | 1140 | |
1141 | -if ( ! function_exists( 'espresso_edit_venue_link' )) { |
|
1141 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
1142 | 1142 | /** |
1143 | 1143 | * espresso_edit_venue_link |
1144 | 1144 | * |
@@ -1146,12 +1146,12 @@ discard block |
||
1146 | 1146 | * @param bool $echo |
1147 | 1147 | * @return string |
1148 | 1148 | */ |
1149 | - function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) { |
|
1150 | - if($echo){ |
|
1151 | - echo EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1149 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) { |
|
1150 | + if ($echo) { |
|
1151 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1152 | 1152 | return ''; |
1153 | 1153 | } |
1154 | - return EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1154 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1155 | 1155 | } |
1156 | 1156 | } |
1157 | 1157 |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | * @param bool $password_check |
46 | 46 | * @return \EE_Venue|null |
47 | 47 | */ |
48 | - public static function get_venue( $VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true, $password_check = true ) { |
|
49 | - $VNU_ID = absint( $VNU_ID ); |
|
48 | + public static function get_venue($VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true, $password_check = true) { |
|
49 | + $VNU_ID = absint($VNU_ID); |
|
50 | 50 | // do we already have the Venue you are looking for? |
51 | - if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID ) { |
|
52 | - return EEH_Venue_View::_get_venue( $privacy_check ); |
|
51 | + if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID) { |
|
52 | + return EEH_Venue_View::_get_venue($privacy_check); |
|
53 | 53 | } |
54 | 54 | // international newspaper? |
55 | 55 | global $post; |
56 | - if ( $post instanceof WP_Post ) { |
|
57 | - switch ( $post->post_type ) { |
|
56 | + if ($post instanceof WP_Post) { |
|
57 | + switch ($post->post_type) { |
|
58 | 58 | // if this is being called from an EE_Venue post, |
59 | 59 | // and the EE_Venue post corresponds to the EE_Venue that is being asked for, |
60 | 60 | // then we can try to just grab the attached EE_Venue object |
@@ -62,31 +62,31 @@ discard block |
||
62 | 62 | // the post already contains the related EE_Venue object AND one of the following is TRUE: |
63 | 63 | // the requested Venue ID matches the post ID OR... |
64 | 64 | // there was no specific Venue ID requested |
65 | - if ( isset( $post->EE_Venue ) && ( $VNU_ID == $post->ID || ! $VNU_ID )) { |
|
65 | + if (isset($post->EE_Venue) && ($VNU_ID == $post->ID || ! $VNU_ID)) { |
|
66 | 66 | // use existing related EE_Venue object |
67 | - EEH_Venue_View::$_venue = $post->EE_Venue; |
|
68 | - } else if ( $VNU_ID ) { |
|
67 | + EEH_Venue_View::$_venue = $post->EE_Venue; |
|
68 | + } else if ($VNU_ID) { |
|
69 | 69 | // there WAS a specific Venue ID requested, but it's NOT the current post object |
70 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
70 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
71 | 71 | } else { |
72 | 72 | // no specific Venue ID requested, so use post ID to generate EE_Venue object |
73 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $post->ID ); |
|
73 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($post->ID); |
|
74 | 74 | } |
75 | 75 | break; |
76 | 76 | |
77 | 77 | case 'espresso_events': |
78 | - if ( $look_in_event ) { |
|
78 | + if ($look_in_event) { |
|
79 | 79 | // grab the events related venues |
80 | 80 | $venues = EEH_Venue_View::get_event_venues(); |
81 | 81 | // make sure the result is an array |
82 | - $venues = is_array( $venues ) ? $venues : array(); |
|
82 | + $venues = is_array($venues) ? $venues : array(); |
|
83 | 83 | // do we have an ID for a specific venue? |
84 | - if ( $VNU_ID ) { |
|
84 | + if ($VNU_ID) { |
|
85 | 85 | // loop thru the related venues |
86 | - foreach( $venues as $venue ) { |
|
87 | - if ( $venue instanceof EE_Venue ) { |
|
86 | + foreach ($venues as $venue) { |
|
87 | + if ($venue instanceof EE_Venue) { |
|
88 | 88 | // until we find the venue we're looking for |
89 | - if ( $venue->ID() == $VNU_ID ) { |
|
89 | + if ($venue->ID() == $VNU_ID) { |
|
90 | 90 | EEH_Venue_View::$_venue = $venue; |
91 | 91 | break; |
92 | 92 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // then the global post is an events post and this function was called with no argument |
99 | 99 | } else { |
100 | 100 | // just grab the first related event venue |
101 | - EEH_Venue_View::$_venue = reset( $venues ); |
|
101 | + EEH_Venue_View::$_venue = reset($venues); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | break; |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | // now if we STILL do NOT have an EE_Venue model object, BUT we have a Venue ID... |
109 | - if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID ) { |
|
109 | + if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID) { |
|
110 | 110 | // sigh... pull it from the db |
111 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
111 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
112 | 112 | } |
113 | - return EEH_Venue_View::_get_venue( $privacy_check, $password_check ); |
|
113 | + return EEH_Venue_View::_get_venue($privacy_check, $password_check); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | * @param bool $password_check |
124 | 124 | * @return EE_Venue |
125 | 125 | */ |
126 | - protected static function _get_venue( $privacy_check = true, $password_check = true ) { |
|
126 | + protected static function _get_venue($privacy_check = true, $password_check = true) { |
|
127 | 127 | // check for private venues. |
128 | 128 | if ( |
129 | 129 | EEH_Venue_View::$_venue instanceof EE_Venue |
130 | 130 | && EEH_Venue_View::$_venue->status() == 'private' |
131 | 131 | && $privacy_check |
132 | - && ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) |
|
132 | + && ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues') |
|
133 | 133 | ) { |
134 | 134 | return null; |
135 | 135 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if ( |
138 | 138 | EEH_Venue_View::$_venue instanceof EE_Venue |
139 | 139 | && $password_check |
140 | - && post_password_required( EEH_Venue_View::$_venue->ID() ) |
|
140 | + && post_password_required(EEH_Venue_View::$_venue->ID()) |
|
141 | 141 | ) { |
142 | 142 | return null; |
143 | 143 | } |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public static function get_event_venues() { |
156 | 156 | global $post; |
157 | - if ( $post->post_type == 'espresso_events' ) { |
|
158 | - if ( isset( $post->EE_Event ) && $post->EE_Event instanceof EE_Event ) { |
|
157 | + if ($post->post_type == 'espresso_events') { |
|
158 | + if (isset($post->EE_Event) && $post->EE_Event instanceof EE_Event) { |
|
159 | 159 | return $post->EE_Event->venues(); |
160 | 160 | } |
161 | 161 | } |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool|null |
177 | 177 | */ |
178 | - public static function is_venue_private( $VNU_ID = false ) { |
|
179 | - $venue = EEH_Venue_View::get_venue( $VNU_ID, true, true ); |
|
180 | - if ( ! $venue instanceof EE_Venue ) { |
|
178 | + public static function is_venue_private($VNU_ID = false) { |
|
179 | + $venue = EEH_Venue_View::get_venue($VNU_ID, true, true); |
|
180 | + if ( ! $venue instanceof EE_Venue) { |
|
181 | 181 | return null; |
182 | 182 | } |
183 | 183 | |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | * @param bool $VNU_ID venue to check (optional). If not included will use internally derived venue object. |
193 | 193 | * @return bool |
194 | 194 | */ |
195 | - public static function is_venue_password_protected( $VNU_ID = false ) { |
|
196 | - $venue = EEH_Venue_View::get_venue( $VNU_ID, true, true, false ); |
|
195 | + public static function is_venue_password_protected($VNU_ID = false) { |
|
196 | + $venue = EEH_Venue_View::get_venue($VNU_ID, true, true, false); |
|
197 | 197 | if ( |
198 | 198 | $venue instanceof EE_Venue |
199 | - && post_password_required( $venue->ID() ) |
|
199 | + && post_password_required($venue->ID()) |
|
200 | 200 | ) { |
201 | 201 | return true; |
202 | 202 | } |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function password_protected_venue_form( $VNU_ID = false ) { |
|
217 | - $venue = EEH_Venue_View::get_venue( $VNU_ID, true, true, false ); |
|
216 | + public static function password_protected_venue_form($VNU_ID = false) { |
|
217 | + $venue = EEH_Venue_View::get_venue($VNU_ID, true, true, false); |
|
218 | 218 | if ( |
219 | 219 | $venue instanceof EE_Venue |
220 | - && post_password_required( $venue->ID() ) |
|
220 | + && post_password_required($venue->ID()) |
|
221 | 221 | ) { |
222 | - return get_the_password_form( $venue->ID() ); |
|
222 | + return get_the_password_form($venue->ID()); |
|
223 | 223 | } |
224 | 224 | return ''; |
225 | 225 | } |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | * @param int $VNU_ID |
234 | 234 | * @return string |
235 | 235 | */ |
236 | - public static function venue_description( $VNU_ID = 0 ) { |
|
237 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
238 | - if ( $venue instanceof EE_Venue ) { |
|
236 | + public static function venue_description($VNU_ID = 0) { |
|
237 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
238 | + if ($venue instanceof EE_Venue) { |
|
239 | 239 | return$venue->description(); |
240 | 240 | } |
241 | 241 | return ''; |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | * @param int $VNU_ID |
251 | 251 | * @return string |
252 | 252 | */ |
253 | - public static function venue_excerpt( $VNU_ID = 0 ) { |
|
254 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
255 | - if ( $venue instanceof EE_Venue ) { |
|
253 | + public static function venue_excerpt($VNU_ID = 0) { |
|
254 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
255 | + if ($venue instanceof EE_Venue) { |
|
256 | 256 | $excerpt = $venue->excerpt() != NULL && $venue->excerpt() ? $venue->excerpt() : $venue->description(); |
257 | - $venue_link = ' ' . EEH_Venue_View::venue_details_link( $venue->ID(), __( 'more', 'event_espresso' ) . '…' ); |
|
258 | - return ! empty( $excerpt ) ? wp_trim_words( $excerpt, 25, '' ) . $venue_link : ''; |
|
257 | + $venue_link = ' '.EEH_Venue_View::venue_details_link($venue->ID(), __('more', 'event_espresso').'…'); |
|
258 | + return ! empty($excerpt) ? wp_trim_words($excerpt, 25, '').$venue_link : ''; |
|
259 | 259 | } |
260 | 260 | return ''; |
261 | 261 | } |
@@ -270,22 +270,22 @@ discard block |
||
270 | 270 | * @param bool $hide_uncategorized |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - public static function venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE ) { |
|
273 | + public static function venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE) { |
|
274 | 274 | $category_links = array(); |
275 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
276 | - if ( $venue instanceof EE_Venue ) { |
|
275 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
276 | + if ($venue instanceof EE_Venue) { |
|
277 | 277 | // get category terms |
278 | - if ( $venue_categories = get_the_terms( $venue->ID(), 'espresso_venue_categories' )) { |
|
278 | + if ($venue_categories = get_the_terms($venue->ID(), 'espresso_venue_categories')) { |
|
279 | 279 | // loop thru terms and create links |
280 | - foreach ( $venue_categories as $term ) { |
|
281 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
282 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
283 | - $category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a> '; |
|
280 | + foreach ($venue_categories as $term) { |
|
281 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
282 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
283 | + $category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a> '; |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | - return implode( ', ', $category_links ); |
|
288 | + return implode(', ', $category_links); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | * @param bool $add_wrapper |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - public static function venue_address( $type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true ) { |
|
304 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
305 | - if ( $venue instanceof EE_Venue ) { |
|
306 | - return EEH_Address::format( $venue, $type, $use_schema, $add_wrapper ); |
|
303 | + public static function venue_address($type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true) { |
|
304 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
305 | + if ($venue instanceof EE_Venue) { |
|
306 | + return EEH_Address::format($venue, $type, $use_schema, $add_wrapper); |
|
307 | 307 | } |
308 | 308 | return ''; |
309 | 309 | } |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | * @param int $VNU_ID |
318 | 318 | * @return bool|string |
319 | 319 | */ |
320 | - public static function venue_has_address( $VNU_ID = 0 ) { |
|
321 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
322 | - if ( $venue instanceof EE_Venue ) { |
|
323 | - return EEH_Address::format( $venue, 'inline', FALSE, FALSE ); |
|
320 | + public static function venue_has_address($VNU_ID = 0) { |
|
321 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
322 | + if ($venue instanceof EE_Venue) { |
|
323 | + return EEH_Address::format($venue, 'inline', FALSE, FALSE); |
|
324 | 324 | } |
325 | 325 | return false; |
326 | 326 | } |
@@ -335,30 +335,30 @@ discard block |
||
335 | 335 | * @param int $VNU_ID |
336 | 336 | * @return string |
337 | 337 | */ |
338 | - public static function venue_name( $link_to = 'details', $VNU_ID = 0 ) { |
|
339 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
340 | - if ( $venue instanceof EE_Venue ) { |
|
338 | + public static function venue_name($link_to = 'details', $VNU_ID = 0) { |
|
339 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
340 | + if ($venue instanceof EE_Venue) { |
|
341 | 341 | $venue_name = apply_filters( |
342 | 342 | 'FHEE__EEH_Venue__venue_name__append_private_venue_name', |
343 | 343 | EEH_Venue_View::is_venue_private() |
344 | - ? EEH_Venue_View::$_venue->name() . " " . __( '(Private)', 'event_espresso' ) |
|
344 | + ? EEH_Venue_View::$_venue->name()." ".__('(Private)', 'event_espresso') |
|
345 | 345 | : EEH_Venue_View::$_venue->name(), |
346 | 346 | EEH_Venue_View::$_venue |
347 | 347 | ); |
348 | - $venue_name = EEH_Schema::name( $venue_name ); |
|
348 | + $venue_name = EEH_Schema::name($venue_name); |
|
349 | 349 | |
350 | 350 | //if venue is trashed then ignore the "link to" setting because the venue is trashed. |
351 | - if ( $venue->get('status') == 'trash' ) { |
|
351 | + if ($venue->get('status') == 'trash') { |
|
352 | 352 | $link_to = ''; |
353 | 353 | } |
354 | - switch( $link_to ) { |
|
354 | + switch ($link_to) { |
|
355 | 355 | |
356 | 356 | case 'details' : |
357 | - return EEH_Venue_View::venue_details_link( $venue->ID(), $venue_name ); |
|
357 | + return EEH_Venue_View::venue_details_link($venue->ID(), $venue_name); |
|
358 | 358 | break; |
359 | 359 | |
360 | 360 | case 'website' : |
361 | - return EEH_Venue_View::venue_website_link( $venue->ID(), $venue_name ); |
|
361 | + return EEH_Venue_View::venue_website_link($venue->ID(), $venue_name); |
|
362 | 362 | break; |
363 | 363 | |
364 | 364 | default : |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | * @param string $text |
379 | 379 | * @return string |
380 | 380 | */ |
381 | - public static function venue_details_link( $VNU_ID = 0, $text = '' ) { |
|
382 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
383 | - if ( $venue instanceof EE_Venue ) { |
|
384 | - return EEH_Schema::url( get_permalink( $venue->ID() ), $text ); |
|
381 | + public static function venue_details_link($VNU_ID = 0, $text = '') { |
|
382 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
383 | + if ($venue instanceof EE_Venue) { |
|
384 | + return EEH_Schema::url(get_permalink($venue->ID()), $text); |
|
385 | 385 | } |
386 | 386 | return ''; |
387 | 387 | } |
@@ -396,12 +396,12 @@ discard block |
||
396 | 396 | * @param string $text |
397 | 397 | * @return string |
398 | 398 | */ |
399 | - public static function venue_website_link( $VNU_ID = 0, $text = '' ) { |
|
400 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
401 | - if ( $venue instanceof EE_Venue ) { |
|
399 | + public static function venue_website_link($VNU_ID = 0, $text = '') { |
|
400 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
401 | + if ($venue instanceof EE_Venue) { |
|
402 | 402 | $url = $venue->venue_url(); |
403 | - $text = ! empty( $text ) ? $text : $url; |
|
404 | - return ! empty( $url ) ? EEH_Schema::url( $url, $text ) : ''; |
|
403 | + $text = ! empty($text) ? $text : $url; |
|
404 | + return ! empty($url) ? EEH_Schema::url($url, $text) : ''; |
|
405 | 405 | } |
406 | 406 | return ''; |
407 | 407 | } |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | * @param int $VNU_ID |
416 | 416 | * @return string |
417 | 417 | */ |
418 | - public static function venue_phone( $VNU_ID = 0) { |
|
419 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
420 | - if ( $venue instanceof EE_Venue ) { |
|
421 | - return EEH_Schema::telephone( $venue->phone() ); |
|
418 | + public static function venue_phone($VNU_ID = 0) { |
|
419 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
420 | + if ($venue instanceof EE_Venue) { |
|
421 | + return EEH_Schema::telephone($venue->phone()); |
|
422 | 422 | } |
423 | 423 | return ''; |
424 | 424 | } |
@@ -434,48 +434,48 @@ discard block |
||
434 | 434 | * @param array $gmap map options |
435 | 435 | * @return string |
436 | 436 | */ |
437 | - public static function venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array() ) { |
|
437 | + public static function venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array()) { |
|
438 | 438 | |
439 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
440 | - if ( $venue instanceof EE_Venue ) { |
|
439 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
440 | + if ($venue instanceof EE_Venue) { |
|
441 | 441 | // check for global espresso_events post and use it's ID if no map_ID is set |
442 | 442 | global $post; |
443 | - $map_ID = empty( $map_ID ) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID; |
|
443 | + $map_ID = empty($map_ID) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID; |
|
444 | 444 | // grab map settings |
445 | 445 | $map_cfg = EE_Registry::instance()->CFG->map_settings; |
446 | 446 | // are maps enabled ? |
447 | - if ( $map_cfg->use_google_maps && $venue->enable_for_gmap() ) { |
|
447 | + if ($map_cfg->use_google_maps && $venue->enable_for_gmap()) { |
|
448 | 448 | |
449 | 449 | $details_page = is_single(); |
450 | 450 | $options = array(); |
451 | - $options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID . '-' . $venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/; |
|
451 | + $options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID.'-'.$venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/; |
|
452 | 452 | |
453 | - $options['location'] = EEH_Address::format( $venue, 'inline', FALSE, FALSE ); |
|
453 | + $options['location'] = EEH_Address::format($venue, 'inline', FALSE, FALSE); |
|
454 | 454 | |
455 | 455 | $options['ee_map_width'] = $details_page ? $map_cfg->event_details_map_width : $map_cfg->event_list_map_width; |
456 | - $options['ee_map_width'] = isset( $gmap['ee_map_width'] ) && ! empty( $gmap['ee_map_width'] ) ? $gmap['ee_map_width'] : $options['ee_map_width']; |
|
456 | + $options['ee_map_width'] = isset($gmap['ee_map_width']) && ! empty($gmap['ee_map_width']) ? $gmap['ee_map_width'] : $options['ee_map_width']; |
|
457 | 457 | |
458 | 458 | $options['ee_map_height'] = $details_page ? $map_cfg->event_details_map_height : $map_cfg->event_list_map_height; |
459 | - $options['ee_map_height'] = isset( $gmap['ee_map_height'] ) && ! empty( $gmap['ee_map_height'] ) ? $gmap['ee_map_height'] : $options['ee_map_height']; |
|
459 | + $options['ee_map_height'] = isset($gmap['ee_map_height']) && ! empty($gmap['ee_map_height']) ? $gmap['ee_map_height'] : $options['ee_map_height']; |
|
460 | 460 | |
461 | 461 | $options['ee_map_zoom'] = $details_page ? $map_cfg->event_details_map_zoom : $map_cfg->event_list_map_zoom; |
462 | - $options['ee_map_zoom'] = isset( $gmap['ee_map_zoom'] ) && ! empty( $gmap['ee_map_zoom'] ) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom']; |
|
462 | + $options['ee_map_zoom'] = isset($gmap['ee_map_zoom']) && ! empty($gmap['ee_map_zoom']) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom']; |
|
463 | 463 | |
464 | 464 | $options['ee_map_nav_display'] = $details_page ? $map_cfg->event_details_display_nav : $map_cfg->event_list_display_nav; |
465 | - $options['ee_map_nav_display'] = isset( $gmap['ee_map_nav_display'] ) && ! empty( $gmap['ee_map_nav_display'] ) ? 'true' : $options['ee_map_nav_display'];; |
|
465 | + $options['ee_map_nav_display'] = isset($gmap['ee_map_nav_display']) && ! empty($gmap['ee_map_nav_display']) ? 'true' : $options['ee_map_nav_display']; ; |
|
466 | 466 | |
467 | 467 | $options['ee_map_nav_size'] = $details_page ? $map_cfg->event_details_nav_size : $map_cfg->event_list_nav_size; |
468 | - $options['ee_map_nav_size'] = isset( $gmap['ee_map_nav_size'] ) && ! empty( $gmap['ee_map_nav_size'] )? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size']; |
|
468 | + $options['ee_map_nav_size'] = isset($gmap['ee_map_nav_size']) && ! empty($gmap['ee_map_nav_size']) ? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size']; |
|
469 | 469 | |
470 | 470 | $options['ee_map_type_control'] = $details_page ? $map_cfg->event_details_control_type : $map_cfg->event_list_control_type; |
471 | - $options['ee_map_type_control'] = isset( $gmap['ee_map_type_control'] ) && ! empty( $gmap['ee_map_type_control'] )? $gmap['ee_map_type_control'] : $options['ee_map_type_control']; |
|
471 | + $options['ee_map_type_control'] = isset($gmap['ee_map_type_control']) && ! empty($gmap['ee_map_type_control']) ? $gmap['ee_map_type_control'] : $options['ee_map_type_control']; |
|
472 | 472 | |
473 | 473 | $options['ee_map_align'] = $details_page ? $map_cfg->event_details_map_align : $map_cfg->event_list_map_align; |
474 | - $options['ee_map_align'] = isset( $gmap['ee_map_align'] ) && ! empty( $gmap['ee_map_align'] )? $gmap['ee_map_align'] : $options['ee_map_align']; |
|
474 | + $options['ee_map_align'] = isset($gmap['ee_map_align']) && ! empty($gmap['ee_map_align']) ? $gmap['ee_map_align'] : $options['ee_map_align']; |
|
475 | 475 | |
476 | - $options['ee_static_url'] = isset( $gmap['ee_static_url'] ) && ! empty( $gmap['ee_static_url'] ) ? (bool)absint( $gmap['ee_static_url'] ) : $venue->google_map_link(); |
|
476 | + $options['ee_static_url'] = isset($gmap['ee_static_url']) && ! empty($gmap['ee_static_url']) ? (bool) absint($gmap['ee_static_url']) : $venue->google_map_link(); |
|
477 | 477 | |
478 | - return EEH_Maps::google_map( $options ); |
|
478 | + return EEH_Maps::google_map($options); |
|
479 | 479 | |
480 | 480 | } |
481 | 481 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @param array $atts like EEH_Maps::google_map_link |
491 | 491 | * @return string |
492 | 492 | */ |
493 | - public static function espresso_google_static_map( EE_Venue $venue, $atts = array() ){ |
|
493 | + public static function espresso_google_static_map(EE_Venue $venue, $atts = array()) { |
|
494 | 494 | $state = $venue->state_obj(); |
495 | 495 | $country = $venue->country_obj(); |
496 | 496 | $atts = shortcode_atts( |
@@ -521,23 +521,23 @@ discard block |
||
521 | 521 | * @param string $after |
522 | 522 | * @return string |
523 | 523 | */ |
524 | - public static function edit_venue_link( $VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>' ) { |
|
525 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
526 | - if ( $venue instanceof EE_Venue ) { |
|
524 | + public static function edit_venue_link($VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>') { |
|
525 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
526 | + if ($venue instanceof EE_Venue) { |
|
527 | 527 | // can the user edit this post ? |
528 | - if ( current_user_can( 'edit_post', $venue->ID() )) { |
|
528 | + if (current_user_can('edit_post', $venue->ID())) { |
|
529 | 529 | // set link text |
530 | - $link = ! empty( $link ) ? $link : __('edit this venue'); |
|
530 | + $link = ! empty($link) ? $link : __('edit this venue'); |
|
531 | 531 | // generate nonce |
532 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
532 | + $nonce = wp_create_nonce('edit_nonce'); |
|
533 | 533 | // generate url to venue editor for this venue |
534 | - $url = add_query_arg( array( 'page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce ), admin_url( 'admin.php' ) ); |
|
534 | + $url = add_query_arg(array('page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce), admin_url('admin.php')); |
|
535 | 535 | // get edit CPT text |
536 | - $post_type_obj = get_post_type_object( 'espresso_venues' ); |
|
536 | + $post_type_obj = get_post_type_object('espresso_venues'); |
|
537 | 537 | // build final link html |
538 | - $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>'; |
|
538 | + $link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>'; |
|
539 | 539 | // put it all together |
540 | - return $before . apply_filters( 'edit_post_link', $link, $venue->ID() ) . $after; |
|
540 | + return $before.apply_filters('edit_post_link', $link, $venue->ID()).$after; |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | return ''; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venue_Single |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - EE_Config::register_route( 'venue', 'Venue_Single', 'run' ); |
|
40 | + EE_Config::register_route('venue', 'Venue_Single', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
82 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
83 | 83 | // don't display entry meta because the existing theme will take car of that |
84 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
84 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
85 | 85 | } |
86 | 86 | return $template; |
87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $title |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function the_title( $title = '' ) { |
|
98 | + public function the_title($title = '') { |
|
99 | 99 | return $title; |
100 | 100 | } |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $content |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function venue_details( $content ) { |
|
110 | + public function venue_details($content) { |
|
111 | 111 | global $post; |
112 | 112 | if ( |
113 | 113 | $post->post_type == 'espresso_venues' |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | // it uses the_content() for displaying the $post->post_content |
118 | 118 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
119 | 119 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
120 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
120 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
121 | 121 | // add filters we want |
122 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
122 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
123 | 123 | // now load our template |
124 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
124 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
125 | 125 | // remove other filters we added so they won't get applied to the next post |
126 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
126 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | 127 | } |
128 | 128 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
129 | - return ! empty( $template ) ? $template : $content; |
|
129 | + return ! empty($template) ? $template : $content; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param string $content |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function venue_location( $content ) { |
|
142 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
141 | + public function venue_location($content) { |
|
142 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function wp_enqueue_scripts() { |
154 | 154 | // get some style |
155 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) { |
|
155 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) { |
|
156 | 156 | // first check theme folder |
157 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
158 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
159 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
160 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
157 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
158 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
159 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
160 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
161 | 161 | } |
162 | - wp_enqueue_style( $this->theme ); |
|
163 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
164 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
162 | + wp_enqueue_style($this->theme); |
|
163 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
164 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venues_Archive |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - EE_Config::register_route( 'venues', 'Venues_Archive', 'run' ); |
|
40 | + EE_Config::register_route('venues', 'Venues_Archive', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | 82 | // don't know if theme uses the_excerpt |
83 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
83 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
84 | 84 | // or the_content |
85 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
85 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
86 | 86 | // don't display entry meta because the existing theme will take care of that |
87 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
87 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
88 | 88 | } |
89 | 89 | return $template; |
90 | 90 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $title |
99 | 99 | * @return string |
100 | 100 | */ |
101 | - public function the_title( $title = '' ) { |
|
101 | + public function the_title($title = '') { |
|
102 | 102 | return $title; |
103 | 103 | } |
104 | 104 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param string $content |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - public function venue_details( $content ) { |
|
113 | + public function venue_details($content) { |
|
114 | 114 | global $post; |
115 | 115 | if ( |
116 | 116 | $post->post_type == 'espresso_venues' |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | // it uses the_content() for displaying the $post->post_content |
121 | 121 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
122 | 122 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
123 | - remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
124 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
123 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
124 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
125 | 125 | // add filters we want |
126 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
127 | - add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
126 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
128 | 128 | // now load our template |
129 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
129 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
130 | 130 | //now add our filter back in, plus some others |
131 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
132 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
131 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
132 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
133 | 133 | // remove other filters we added so they won't get applied to the next post |
134 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
135 | - remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
134 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
135 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
136 | 136 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
137 | 137 | } |
138 | - return ! empty( $template ) ? $template : $content; |
|
138 | + return ! empty($template) ? $template : $content; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $content |
148 | 148 | * @return string |
149 | 149 | */ |
150 | - public function venue_location( $content ) { |
|
151 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
150 | + public function venue_location($content) { |
|
151 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function wp_enqueue_scripts() { |
164 | 164 | // get some style |
165 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
|
165 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) { |
|
166 | 166 | // first check theme folder |
167 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
168 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
169 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
170 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
167 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
168 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
169 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
170 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
171 | 171 | } |
172 | - wp_enqueue_style( $this->theme ); |
|
172 | + wp_enqueue_style($this->theme); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | use EventEspressoBatchRequest\Helpers\JobParameters; |
20 | 20 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
21 | 21 | |
22 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
23 | - exit( 'No direct script access allowed' ); |
|
22 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
23 | + exit('No direct script access allowed'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @throws BatchRequestException |
36 | 36 | * @return JobStepResponse |
37 | 37 | */ |
38 | - public function create_job( JobParameters $job_parameters ) { |
|
39 | - $event_id = intval( $job_parameters->request_datum( 'EVT_ID', '0' ) ); |
|
40 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_registrations', 'generating_report' ) ) { |
|
38 | + public function create_job(JobParameters $job_parameters) { |
|
39 | + $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
40 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
41 | 41 | throw new BatchRequestException( |
42 | - __( 'You do not have permission to view registrations', 'event_espresso') |
|
42 | + __('You do not have permission to view registrations', 'event_espresso') |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | $filepath = $this->create_file_from_job_with_name( |
46 | 46 | $job_parameters->job_id(), |
47 | - $this->get_filename_from_event( $event_id ) |
|
47 | + $this->get_filename_from_event($event_id) |
|
48 | 48 | ); |
49 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
50 | - $question_data_for_columns = $this->_get_questions_for_report( $event_id ); |
|
51 | - $job_parameters->add_extra_data( 'questions_data', $question_data_for_columns ); |
|
52 | - $job_parameters->set_job_size( $this->count_units_to_process( $event_id ) ); |
|
49 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
50 | + $question_data_for_columns = $this->_get_questions_for_report($event_id); |
|
51 | + $job_parameters->add_extra_data('questions_data', $question_data_for_columns); |
|
52 | + $job_parameters->set_job_size($this->count_units_to_process($event_id)); |
|
53 | 53 | //we should also set the header columns |
54 | 54 | $csv_data_for_row = $this->get_csv_data_for( |
55 | 55 | $event_id, |
56 | 56 | 0, |
57 | 57 | 1, |
58 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
59 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
58 | + $job_parameters->extra_datum('questions_data') ); |
|
59 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
60 | 60 | //if we actually processed a row there, record it |
61 | - if( $job_parameters->job_size() ) { |
|
62 | - $job_parameters->mark_processed( 1 ); |
|
61 | + if ($job_parameters->job_size()) { |
|
62 | + $job_parameters->mark_processed(1); |
|
63 | 63 | } |
64 | 64 | return new JobStepResponse( |
65 | 65 | $job_parameters, |
66 | - __( 'Registrations report started successfully...', 'event_espresso' ) |
|
66 | + __('Registrations report started successfully...', 'event_espresso') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | * @param int $event_id |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - protected function get_filename_from_event( $event_id ) { |
|
78 | - if( $event_id ){ |
|
79 | - $event_slug = \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' ); |
|
80 | - if( ! $event_slug ) { |
|
81 | - $event_slug = __( 'unknown', 'event_espresso' ); |
|
77 | + protected function get_filename_from_event($event_id) { |
|
78 | + if ($event_id) { |
|
79 | + $event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug'); |
|
80 | + if ( ! $event_slug) { |
|
81 | + $event_slug = __('unknown', 'event_espresso'); |
|
82 | 82 | } |
83 | - }else{ |
|
84 | - $event_slug = __( 'all', 'event_espresso' ); |
|
83 | + } else { |
|
84 | + $event_slug = __('all', 'event_espresso'); |
|
85 | 85 | } |
86 | - return sprintf( "registrations-for-%s.csv", $event_slug ); |
|
86 | + return sprintf("registrations-for-%s.csv", $event_slug); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | * @param int|null $event_id |
93 | 93 | * @return array of wpdb results for questions which are to be used for this report |
94 | 94 | */ |
95 | - protected function _get_questions_for_report( $event_id ) { |
|
95 | + protected function _get_questions_for_report($event_id) { |
|
96 | 96 | $question_query_params = array( |
97 | 97 | array( |
98 | - 'Answer.ANS_ID' => array( 'IS_NOT_NULL' ), |
|
98 | + 'Answer.ANS_ID' => array('IS_NOT_NULL'), |
|
99 | 99 | ), |
100 | - 'group_by' => array( 'QST_ID' ) |
|
100 | + 'group_by' => array('QST_ID') |
|
101 | 101 | ); |
102 | - if( $event_id ) { |
|
102 | + if ($event_id) { |
|
103 | 103 | $question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id; |
104 | 104 | } |
105 | - return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params ); |
|
105 | + return \EEM_Question::instance()->get_all_wpdb_results($question_query_params); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | * @return JobStepResponse |
116 | 116 | * @throws \EE_Error |
117 | 117 | */ |
118 | - public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) { |
|
118 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
|
119 | 119 | $csv_data = $this->get_csv_data_for( |
120 | - $job_parameters->request_datum( 'EVT_ID', '0'), |
|
120 | + $job_parameters->request_datum('EVT_ID', '0'), |
|
121 | 121 | $job_parameters->units_processed(), |
122 | 122 | $batch_size, |
123 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
124 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
125 | - $units_processed = count( $csv_data ); |
|
126 | - $job_parameters->mark_processed( $units_processed ); |
|
123 | + $job_parameters->extra_datum('questions_data') ); |
|
124 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
125 | + $units_processed = count($csv_data); |
|
126 | + $job_parameters->mark_processed($units_processed); |
|
127 | 127 | $extra_response_data = array( |
128 | 128 | 'file_url' => '' |
129 | 129 | ); |
130 | - if( $units_processed < $batch_size ) { |
|
131 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
132 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
130 | + if ($units_processed < $batch_size) { |
|
131 | + $job_parameters->set_status(JobParameters::status_complete); |
|
132 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
133 | 133 | } |
134 | 134 | return new JobStepResponse( |
135 | 135 | $job_parameters, |
136 | 136 | sprintf( |
137 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
138 | - count( $csv_data ) ), |
|
137 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
138 | + count($csv_data) ), |
|
139 | 139 | $extra_response_data ); |
140 | 140 | } |
141 | 141 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return array top-level keys are numeric, next-level keys are column headers |
149 | 149 | * |
150 | 150 | */ |
151 | - function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) { |
|
151 | + function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) { |
|
152 | 152 | $reg_fields_to_include = array( |
153 | 153 | 'TXN_ID', |
154 | 154 | 'ATT_ID', |
@@ -179,166 +179,166 @@ discard block |
||
179 | 179 | array( |
180 | 180 | 'OR' => array( |
181 | 181 | //don't include registrations from failed or abandoned transactions... |
182 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
182 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
183 | 183 | //unless the registration is approved, in which case include it regardless of transaction status |
184 | 184 | 'STS_ID' => \EEM_Registration::status_id_approved |
185 | 185 | ), |
186 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
186 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
187 | 187 | ), |
188 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
189 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
190 | - 'limit' => array( $offset, $limit ), |
|
188 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
189 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
190 | + 'limit' => array($offset, $limit), |
|
191 | 191 | 'caps' => \EEM_Base::caps_read_admin |
192 | 192 | ), |
193 | 193 | $event_id |
194 | 194 | ); |
195 | - if( $event_id ){ |
|
196 | - $query_params[0]['EVT_ID'] = $event_id; |
|
197 | - }else{ |
|
198 | - $query_params[ 'force_join' ][] = 'Event'; |
|
195 | + if ($event_id) { |
|
196 | + $query_params[0]['EVT_ID'] = $event_id; |
|
197 | + } else { |
|
198 | + $query_params['force_join'][] = 'Event'; |
|
199 | 199 | } |
200 | - $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
|
200 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
201 | 201 | //get all questions which relate to someone in this group |
202 | 202 | $registration_ids = array(); |
203 | - foreach( $registration_rows as $reg_row ) { |
|
204 | - $registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] ); |
|
203 | + foreach ($registration_rows as $reg_row) { |
|
204 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
205 | 205 | } |
206 | 206 | |
207 | - foreach($registration_rows as $reg_row){ |
|
208 | - if ( is_array( $reg_row ) ) { |
|
207 | + foreach ($registration_rows as $reg_row) { |
|
208 | + if (is_array($reg_row)) { |
|
209 | 209 | $reg_csv_array = array(); |
210 | - if( ! $event_id ){ |
|
210 | + if ( ! $event_id) { |
|
211 | 211 | //get the event's name and Id |
212 | - $reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( \EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] ); |
|
212 | + $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
213 | 213 | } |
214 | - $is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false; |
|
214 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
215 | 215 | /*@var $reg_row EE_Registration */ |
216 | - foreach($reg_fields_to_include as $field_name){ |
|
216 | + foreach ($reg_fields_to_include as $field_name) { |
|
217 | 217 | $field = $reg_model->field_settings_for($field_name); |
218 | - if($field_name == 'REG_final_price'){ |
|
219 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
|
220 | - }elseif( $field_name == 'REG_count' ){ |
|
221 | - $value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) ); |
|
222 | - }elseif( $field_name == 'REG_date' ) { |
|
223 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
|
224 | - }else{ |
|
225 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
|
218 | + if ($field_name == 'REG_final_price') { |
|
219 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
220 | + }elseif ($field_name == 'REG_count') { |
|
221 | + $value = sprintf(__('%s of %s', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size'])); |
|
222 | + }elseif ($field_name == 'REG_date') { |
|
223 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html'); |
|
224 | + } else { |
|
225 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]); |
|
226 | 226 | } |
227 | 227 | $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
228 | - if($field_name == 'REG_final_price'){ |
|
228 | + if ($field_name == 'REG_final_price') { |
|
229 | 229 | //add a column named Currency after the final price |
230 | 230 | $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
231 | 231 | } |
232 | 232 | } |
233 | 233 | //get pretty status |
234 | - $stati = \EEM_Status::instance()->localized_status( array( |
|
235 | - $reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ), |
|
236 | - $reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ), |
|
234 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
235 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
236 | + $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ), |
|
237 | 237 | FALSE, |
238 | - 'sentence' ); |
|
239 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ]; |
|
238 | + 'sentence'); |
|
239 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
240 | 240 | //get pretty transaction status |
241 | - $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ]; |
|
242 | - $reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00'; |
|
243 | - $reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00'; |
|
241 | + $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']]; |
|
242 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00'; |
|
243 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00'; |
|
244 | 244 | $payment_methods = array(); |
245 | 245 | $gateway_txn_ids_etc = array(); |
246 | 246 | $payment_times = array(); |
247 | - if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){ |
|
247 | + if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) { |
|
248 | 248 | $payments_info = \EEM_Payment::instance()->get_all_wpdb_results( |
249 | 249 | array( |
250 | 250 | array( |
251 | - 'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ], |
|
251 | + 'TXN_ID' => $reg_row['TransactionTable.TXN_ID'], |
|
252 | 252 | 'STS_ID' => \EEM_Payment::status_id_approved |
253 | 253 | ), |
254 | - 'force_join' => array( 'Payment_Method' ), |
|
254 | + 'force_join' => array('Payment_Method'), |
|
255 | 255 | |
256 | 256 | ), |
257 | 257 | ARRAY_A, |
258 | 258 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
259 | 259 | |
260 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
261 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
262 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
263 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
260 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
261 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
262 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
263 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | } |
267 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
268 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
269 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
267 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
268 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
269 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
270 | 270 | |
271 | 271 | //get whether or not the user has checked in |
272 | - $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' ); |
|
272 | + $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
273 | 273 | //get ticket of registration and its price |
274 | 274 | $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
275 | - if( $reg_row[ 'Ticket.TKT_ID'] ) { |
|
276 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] ); |
|
275 | + if ($reg_row['Ticket.TKT_ID']) { |
|
276 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']); |
|
277 | 277 | $datetimes_strings = array(); |
278 | - foreach( \EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){ |
|
279 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] ); |
|
278 | + foreach (\EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) { |
|
279 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | } else { |
283 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
284 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
283 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
284 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
285 | 285 | } |
286 | 286 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
287 | 287 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
288 | 288 | //get datetime(s) of registration |
289 | 289 | |
290 | 290 | //add attendee columns |
291 | - foreach($att_fields_to_include as $att_field_name){ |
|
291 | + foreach ($att_fields_to_include as $att_field_name) { |
|
292 | 292 | $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
293 | - if( $reg_row[ 'Attendee_CPT.ID' ]){ |
|
294 | - if($att_field_name == 'STA_ID'){ |
|
295 | - $value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
|
296 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
297 | - $value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
|
298 | - }else{ |
|
299 | - $value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
|
293 | + if ($reg_row['Attendee_CPT.ID']) { |
|
294 | + if ($att_field_name == 'STA_ID') { |
|
295 | + $value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name'); |
|
296 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
297 | + $value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name'); |
|
298 | + } else { |
|
299 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
300 | 300 | } |
301 | - }else{ |
|
301 | + } else { |
|
302 | 302 | $value = ''; |
303 | 303 | } |
304 | 304 | |
305 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value; |
|
305 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | //make sure each registration has the same questions in the same order |
309 | - foreach($questions_for_these_regs_rows as $question_row){ |
|
310 | - if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){ |
|
311 | - $reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null; |
|
309 | + foreach ($questions_for_these_regs_rows as $question_row) { |
|
310 | + if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) { |
|
311 | + $reg_csv_array[$question_row['Question.QST_admin_label']] = null; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | $answers = \EEM_Answer::instance()->get_all_wpdb_results( |
315 | 315 | array( |
316 | - array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), |
|
317 | - 'force_join' => array( 'Question' ) |
|
316 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
317 | + 'force_join' => array('Question') |
|
318 | 318 | ) |
319 | 319 | ); |
320 | 320 | //now fill out the questions THEY answered |
321 | - foreach( $answers as $answer_row ){ |
|
322 | - if( $answer_row[ 'Question.QST_ID' ] ){ |
|
321 | + foreach ($answers as $answer_row) { |
|
322 | + if ($answer_row['Question.QST_ID']) { |
|
323 | 323 | $question_label = \EEH_Export::prepare_value_from_db_for_display( |
324 | 324 | \EEM_Question::instance(), |
325 | 325 | 'QST_admin_label', |
326 | - $answer_row[ 'Question.QST_admin_label' ] |
|
326 | + $answer_row['Question.QST_admin_label'] |
|
327 | 327 | ); |
328 | 328 | } else { |
329 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] ); |
|
329 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
330 | 330 | } |
331 | - if ( isset( $answer_row[ 'Question.QST_type' ] ) |
|
332 | - && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state |
|
331 | + if (isset($answer_row['Question.QST_type']) |
|
332 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
333 | 333 | ) { |
334 | - $reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID( |
|
335 | - $answer_row[ 'Answer.ANS_value' ] |
|
334 | + $reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID( |
|
335 | + $answer_row['Answer.ANS_value'] |
|
336 | 336 | ); |
337 | 337 | } else { |
338 | - $reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display( |
|
338 | + $reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display( |
|
339 | 339 | \EEM_Answer::instance(), |
340 | 340 | 'ANS_value', |
341 | - $answer_row[ 'Answer.ANS_value' ] |
|
341 | + $answer_row['Answer.ANS_value'] |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | } |
@@ -349,17 +349,17 @@ discard block |
||
349 | 349 | } |
350 | 350 | } |
351 | 351 | //if we couldn't export anything, we want to at least show the column headers |
352 | - if ( empty( $registrations_csv_ready_array ) ) { |
|
352 | + if (empty($registrations_csv_ready_array)) { |
|
353 | 353 | $reg_csv_array = array(); |
354 | 354 | $model_and_fields_to_include = array( |
355 | 355 | 'Registration' => $reg_fields_to_include, |
356 | 356 | 'Attendee' => $att_fields_to_include |
357 | 357 | ); |
358 | - foreach ( $model_and_fields_to_include as $model_name => $field_list ) { |
|
359 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
360 | - foreach ( $field_list as $field_name ) { |
|
361 | - $field = $model->field_settings_for( $field_name ); |
|
362 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null; |
|
358 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
359 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
360 | + foreach ($field_list as $field_name) { |
|
361 | + $field = $model->field_settings_for($field_name); |
|
362 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | $registrations_csv_ready_array[] = $reg_csv_array; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @param int $event_id |
376 | 376 | * @return int |
377 | 377 | */ |
378 | - public function count_units_to_process( $event_id ) { |
|
378 | + public function count_units_to_process($event_id) { |
|
379 | 379 | //use the legacy filter |
380 | 380 | $query_params = apply_filters( |
381 | 381 | 'FHEE__EE_Export__report_registration_for_event', |
@@ -383,24 +383,24 @@ discard block |
||
383 | 383 | array( |
384 | 384 | 'OR' => array( |
385 | 385 | //don't include registrations from failed or abandoned transactions... |
386 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
386 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
387 | 387 | //unless the registration is approved, in which case include it regardless of transaction status |
388 | 388 | 'STS_ID' => \EEM_Registration::status_id_approved |
389 | 389 | ), |
390 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
390 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
391 | 391 | ), |
392 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
393 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
392 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
393 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
394 | 394 | 'caps' => \EEM_Base::caps_read_admin |
395 | 395 | ), |
396 | 396 | $event_id |
397 | 397 | ); |
398 | - if( $event_id ){ |
|
399 | - $query_params[0]['EVT_ID'] = $event_id; |
|
398 | + if ($event_id) { |
|
399 | + $query_params[0]['EVT_ID'] = $event_id; |
|
400 | 400 | } else { |
401 | - $query_params[ 'force_join' ][] = 'Event'; |
|
401 | + $query_params['force_join'][] = 'Event'; |
|
402 | 402 | } |
403 | - return \EEM_Registration::instance()->count( $query_params ); |
|
403 | + return \EEM_Registration::instance()->count($query_params); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | * @param JobParameters $job_parameters |
412 | 412 | * @return boolean |
413 | 413 | */ |
414 | - public function cleanup_job( JobParameters $job_parameters ){ |
|
414 | + public function cleanup_job(JobParameters $job_parameters) { |
|
415 | 415 | $this->_file_helper->delete( |
416 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
416 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
417 | 417 | true, |
418 | 418 | 'd' |
419 | 419 | ); |
420 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
420 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Transaction Model |
@@ -67,36 +67,36 @@ discard block |
||
67 | 67 | * @return EEM_Transaction |
68 | 68 | * @throws \EE_Error |
69 | 69 | */ |
70 | - protected function __construct( $timezone ) { |
|
71 | - $this->singular_item = __('Transaction','event_espresso'); |
|
72 | - $this->plural_item = __('Transactions','event_espresso'); |
|
70 | + protected function __construct($timezone) { |
|
71 | + $this->singular_item = __('Transaction', 'event_espresso'); |
|
72 | + $this->plural_item = __('Transactions', 'event_espresso'); |
|
73 | 73 | |
74 | 74 | $this->_tables = array( |
75 | - 'TransactionTable'=>new EE_Primary_Table('esp_transaction','TXN_ID') |
|
75 | + 'TransactionTable'=>new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
76 | 76 | ); |
77 | 77 | $this->_fields = array( |
78 | 78 | 'TransactionTable'=>array( |
79 | - 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')), |
|
80 | - 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ), |
|
81 | - 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0), |
|
82 | - 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0), |
|
83 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
84 | - 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''), |
|
85 | - 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''), |
|
79 | + 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
80 | + 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone), |
|
81 | + 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0), |
|
82 | + 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
83 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
84 | + 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''), |
|
85 | + 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
86 | 86 | 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'), |
87 | - 'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ), |
|
87 | + 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()), |
|
88 | 88 | ) |
89 | 89 | ); |
90 | 90 | $this->_model_relations = array( |
91 | 91 | 'Registration'=>new EE_Has_Many_Relation(), |
92 | 92 | 'Payment'=>new EE_Has_Many_Relation(), |
93 | 93 | 'Status'=>new EE_Belongs_To_Relation(), |
94 | - 'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items |
|
94 | + 'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items |
|
95 | 95 | 'Payment_Method'=>new EE_Belongs_To_Relation(), |
96 | 96 | 'Message' => new EE_Has_Many_Relation() |
97 | 97 | ); |
98 | 98 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
99 | - parent::__construct( $timezone ); |
|
99 | + parent::__construct($timezone); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -107,22 +107,22 @@ discard block |
||
107 | 107 | * @param string $period |
108 | 108 | * @return \stdClass[] |
109 | 109 | */ |
110 | - public function get_revenue_per_day_report( $period = '-1 month' ) { |
|
111 | - $sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', strtotime( $period ) ), 'Y-m-d H:i:s', 'UTC' ); |
|
110 | + public function get_revenue_per_day_report($period = '-1 month') { |
|
111 | + $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
112 | 112 | |
113 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'TXN_timestamp' ); |
|
113 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
114 | 114 | return $this->_get_all_wpdb_results( |
115 | 115 | array( |
116 | 116 | array( |
117 | - 'TXN_timestamp' => array( '>=', $sql_date ) |
|
117 | + 'TXN_timestamp' => array('>=', $sql_date) |
|
118 | 118 | ), |
119 | 119 | 'group_by' => 'txnDate', |
120 | - 'order_by' => array( 'TXN_timestamp' => 'ASC' ) |
|
120 | + 'order_by' => array('TXN_timestamp' => 'ASC') |
|
121 | 121 | ), |
122 | 122 | OBJECT, |
123 | 123 | array( |
124 | - 'txnDate' => array( 'DATE(' . $query_interval . ')', '%s' ), |
|
125 | - 'revenue' => array( 'SUM(TransactionTable.TXN_paid)', '%d' ) |
|
124 | + 'txnDate' => array('DATE('.$query_interval.')', '%s'), |
|
125 | + 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
|
126 | 126 | ) |
127 | 127 | ); |
128 | 128 | } |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | * @throws \EE_Error |
138 | 138 | * @return mixed |
139 | 139 | */ |
140 | - public function get_revenue_per_event_report( $period = '-1 month' ) { |
|
140 | + public function get_revenue_per_event_report($period = '-1 month') { |
|
141 | 141 | global $wpdb; |
142 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
143 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
142 | + $transaction_table = $wpdb->prefix.'esp_transaction'; |
|
143 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
144 | 144 | $event_table = $wpdb->posts; |
145 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
146 | - $sql_date = date( 'Y-m-d H:i:s', strtotime( $period ) ); |
|
145 | + $payment_table = $wpdb->prefix.'esp_payment'; |
|
146 | + $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
147 | 147 | $approved_payment_status = EEM_Payment::status_id_approved; |
148 | 148 | $extra_event_on_join = ''; |
149 | 149 | //exclude events not authored by user if permissions in effect |
150 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
151 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
150 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
151 | + $extra_event_on_join = ' AND Event.post_author = '.get_current_user_id(); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | return $wpdb->get_results( |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | * @param string $reg_url_link |
189 | 189 | * @return EE_Transaction |
190 | 190 | */ |
191 | - public function get_transaction_from_reg_url_link( $reg_url_link = '' ){ |
|
192 | - return $this->get_one( array( |
|
191 | + public function get_transaction_from_reg_url_link($reg_url_link = '') { |
|
192 | + return $this->get_one(array( |
|
193 | 193 | array( |
194 | - 'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) |
|
194 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '') |
|
195 | 195 | ) |
196 | 196 | )); |
197 | 197 | } |
@@ -208,16 +208,16 @@ discard block |
||
208 | 208 | * @return boolean |
209 | 209 | * @throws \EE_Error |
210 | 210 | */ |
211 | - public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){ |
|
211 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) { |
|
212 | 212 | EE_Error::doing_it_wrong( |
213 | - __CLASS__ . '::' . __FUNCTION__, |
|
214 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
213 | + __CLASS__.'::'.__FUNCTION__, |
|
214 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
215 | 215 | '4.6.0' |
216 | 216 | ); |
217 | 217 | /** @type EE_Transaction_Processor $transaction_processor */ |
218 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
218 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
219 | 219 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
220 | - $this->ensure_is_obj( $transaction_obj_or_id ) |
|
220 | + $this->ensure_is_obj($transaction_obj_or_id) |
|
221 | 221 | ); |
222 | 222 | } |
223 | 223 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | array( |
250 | 250 | 0 => array( |
251 | 251 | 'STS_ID' => EEM_Transaction::failed_status_code, |
252 | - 'TXN_timestamp' => array( '<', time() - $time_to_leave_alone ) |
|
252 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
253 | 253 | ) |
254 | 254 | ), |
255 | 255 | $time_to_leave_alone |
@@ -262,29 +262,29 @@ discard block |
||
262 | 262 | */ |
263 | 263 | $txn_ids = apply_filters( |
264 | 264 | 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
265 | - EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ), |
|
265 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
266 | 266 | $time_to_leave_alone |
267 | 267 | ); |
268 | 268 | //now that we have the ids to delete |
269 | - if ( ! empty( $txn_ids ) && is_array( $txn_ids ) ) { |
|
269 | + if ( ! empty($txn_ids) && is_array($txn_ids)) { |
|
270 | 270 | // first, make sure these TXN's are removed the "ee_locked_transactions" array |
271 | - EEM_Transaction::unset_locked_transactions( $txn_ids ); |
|
271 | + EEM_Transaction::unset_locked_transactions($txn_ids); |
|
272 | 272 | // let's get deletin'... |
273 | 273 | // Why no wpdb->prepare? Because the data is trusted. |
274 | 274 | // We got the ids from the original query to get them FROM |
275 | 275 | // the db (which is sanitized) so no need to prepare them again. |
276 | - $query = ' |
|
276 | + $query = ' |
|
277 | 277 | DELETE |
278 | - FROM ' . $this->table() . ' |
|
278 | + FROM ' . $this->table().' |
|
279 | 279 | WHERE |
280 | - TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')'; |
|
281 | - $deleted = $wpdb->query( $query ); |
|
280 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
281 | + $deleted = $wpdb->query($query); |
|
282 | 282 | } |
283 | - if ( $deleted ) { |
|
283 | + if ($deleted) { |
|
284 | 284 | /** |
285 | 285 | * Allows code to do something after the transactions have been deleted. |
286 | 286 | */ |
287 | - do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids ); |
|
287 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
288 | 288 | } |
289 | 289 | return $deleted; |
290 | 290 | } |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | * @param array $transaction_IDs |
296 | 296 | * @return bool |
297 | 297 | */ |
298 | - public static function unset_locked_transactions( array $transaction_IDs ) { |
|
299 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
298 | + public static function unset_locked_transactions(array $transaction_IDs) { |
|
299 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
300 | 300 | $update = false; |
301 | - foreach ( $transaction_IDs as $TXN_ID ) { |
|
302 | - if ( isset( $locked_transactions[ $TXN_ID ] ) ) { |
|
303 | - unset( $locked_transactions[ $TXN_ID ] ); |
|
301 | + foreach ($transaction_IDs as $TXN_ID) { |
|
302 | + if (isset($locked_transactions[$TXN_ID])) { |
|
303 | + unset($locked_transactions[$TXN_ID]); |
|
304 | 304 | $update = true; |
305 | 305 | } |
306 | 306 | } |
307 | - if ( $update ) { |
|
308 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
307 | + if ($update) { |
|
308 | + update_option('ee_locked_transactions', $locked_transactions); |
|
309 | 309 | } |
310 | 310 | return $update; |
311 | 311 | } |