Completed
Branch FET-10304-welcome-to-vue (2869cd)
by
unknown
12:52
created
admin_pages/registrations/EE_Registrations_List_Table.class.php 1 patch
Indentation   +830 added lines, -830 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -26,859 +26,859 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
 
29
-    private $_status;
30
-
31
-
32
-
33
-    /**
34
-     * An array of transaction details for the related transaction to the registration being processed.
35
-     * This is set via the _set_related_details method.
36
-     *
37
-     * @var array
38
-     */
39
-    protected $_transaction_details = array();
40
-
41
-
42
-
43
-    /**
44
-     * An array of event details for the related event to the registration being processed.
45
-     * This is set via the _set_related_details method.
46
-     *
47
-     * @var array
48
-     */
49
-    protected $_event_details = array();
50
-
51
-
52
-
53
-    /**
54
-     * @param \Registrations_Admin_Page $admin_page
55
-     */
56
-    public function __construct(Registrations_Admin_Page $admin_page)
57
-    {
58
-        if ( ! empty($_GET['event_id'])) {
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']);
62
-            }
63
-            $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
64
-        }
65
-        parent::__construct($admin_page);
66
-        $this->_status = $this->_admin_page->get_registration_status_array();
67
-    }
68
-
69
-
70
-
71
-    /**
72
-     *    _setup_data
73
-     *
74
-     * @access protected
75
-     * @return void
76
-     */
77
-    protected function _setup_data()
78
-    {
79
-        $this->_data = $this->_admin_page->get_registrations($this->_per_page);
80
-        $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false);
81
-    }
82
-
83
-
84
-
85
-    /**
86
-     *    _set_properties
87
-     *
88
-     * @access protected
89
-     * @return void
90
-     */
91
-    protected function _set_properties()
92
-    {
93
-        $this->_wp_list_args = array(
94
-            'singular' => __('registration', 'event_espresso'),
95
-            'plural'   => __('registrations', 'event_espresso'),
96
-            'ajax'     => true,
97
-            'screen'   => $this->_admin_page->get_current_screen()->id,
98
-        );
99
-        $ID_column_name = __('ID', 'event_espresso');
100
-        $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
101
-        $ID_column_name .= __('Registrant Name', 'event_espresso');
102
-        $ID_column_name .= '</span> ';
103
-        if (isset($_GET['event_id'])) {
104
-            $this->_columns = array(
105
-                'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
106
-                '_REG_ID'          => $ID_column_name,
107
-                'ATT_fname'        => __('Name', 'event_espresso'),
108
-                'ATT_email'        => __('Email', 'event_espresso'),
109
-                '_REG_date'        => __('Reg Date', 'event_espresso'),
110
-                'PRC_amount'       => __('TKT Price', 'event_espresso'),
111
-                '_REG_final_price' => __('Final Price', 'event_espresso'),
112
-                'TXN_total'        => __('Total Txn', 'event_espresso'),
113
-                'TXN_paid'         => __('Paid', 'event_espresso'),
114
-                'actions'          => __('Actions', 'event_espresso'),
115
-            );
116
-            $this->_bottom_buttons = array(
117
-                'report' => array(
118
-                    'route'         => 'registrations_report',
119
-                    'extra_request' => array(
120
-                        'EVT_ID'     => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
121
-                        'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
122
-                    ),
123
-                ),
124
-            );
125
-        } else {
126
-            $this->_columns = array(
127
-                'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
128
-                '_REG_ID'          => $ID_column_name,
129
-                'ATT_fname'        => __('Name', 'event_espresso'),
130
-                '_REG_date'        => __('TXN Date', 'event_espresso'),
131
-                'event_name'       => __('Event', 'event_espresso'),
132
-                'DTT_EVT_start'    => __('Event Date', 'event_espresso'),
133
-                '_REG_final_price' => __('Price', 'event_espresso'),
134
-                '_REG_paid'        => __('Paid', 'event_espresso'),
135
-                'actions'          => __('Actions', 'event_espresso'),
136
-            );
137
-            $this->_bottom_buttons = array(
138
-                'report_all' => array(
139
-                    'route'         => 'registrations_report',
140
-                    'extra_request' => array(
141
-                        'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
142
-                    ),
143
-                ),
144
-            );
145
-        }
146
-        $this->_bottom_buttons['report_filtered'] = array(
147
-            'route'         => 'registrations_report',
148
-            'extra_request' => array(
149
-                'use_filters' => true,
150
-                'filters'     => array_diff_key($this->_req_data, array_flip(array(
151
-                            'page',
152
-                            'action',
153
-                            'default_nonce',
154
-                        ))),
155
-                'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
156
-            ),
157
-        );
158
-        $this->_primary_column = '_REG_ID';
159
-        $this->_sortable_columns = array(
160
-            '_REG_date'     => array('_REG_date' => true),   //true means its already sorted
161
-            'ATT_fname'     => array('ATT_fname' => false),
162
-            'event_name'    => array('event_name' => false),
163
-            'DTT_EVT_start' => array('DTT_EVT_start' => false),
164
-            '_REG_ID'       => array('_REG_ID' => false),
165
-        );
166
-        $this->_hidden_columns = array();
167
-    }
168
-
169
-
170
-
171
-    /**
172
-     * This simply sets up the row class for the table rows.
173
-     * Allows for easier overriding of child methods for setting up sorting.
174
-     *
175
-     * @param  EE_Registration $item the current item
176
-     * @return string
177
-     */
178
-    protected function _get_row_class($item)
179
-    {
180
-        $class = parent::_get_row_class($item);
181
-        //add status class
182
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
183
-        if ($this->_has_checkbox_column) {
184
-            $class .= ' has-checkbox-column';
185
-        }
186
-        return $class;
187
-    }
188
-
189
-
190
-
191
-    /**
192
-     * Set the $_transaction_details property if not set yet.
193
-     *
194
-     * @param EE_Registration $registration
195
-     * @throws \EE_Error
196
-     */
197
-    protected function _set_related_details(EE_Registration $registration)
198
-    {
199
-        $transaction = $registration->get_first_related('Transaction');
200
-        $status = $transaction instanceof EE_Transaction ? $transaction->status_ID()
201
-            : EEM_Transaction::failed_status_code;
202
-        $this->_transaction_details = array(
203
-            'transaction' => $transaction,
204
-            'status'      => $status,
205
-            'id'          => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
206
-            'title_attr'  => sprintf(__('View Transaction Details (%s)', 'event_espresso'),
207
-                EEH_Template::pretty_status($status, false, 'sentence')),
208
-        );
209
-        try {
210
-            $event = $registration->event();
211
-        } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
212
-            $event = null;
213
-        }
214
-        $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive;
215
-        $this->_event_details = array(
216
-            'event'      => $event,
217
-            'status'     => $status,
218
-            'id'         => $event instanceof EE_Event ? $event->ID() : 0,
219
-            'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'),
220
-                EEH_Template::pretty_status($status, false, 'sentence')),
221
-        );
222
-    }
223
-
224
-
225
-
226
-    /**
227
-     *    _get_table_filters
228
-     *
229
-     * @access protected
230
-     * @return array
231
-     */
232
-    protected function _get_table_filters()
233
-    {
234
-        $filters = array();
235
-        //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
236
-        $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
237
-        $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
238
-        $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
239
-        $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
240
-        $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
241
-        $status = array();
242
-        $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
243
-        foreach ($this->_status as $key => $value) {
244
-            $status[] = array('id' => $key, 'text' => $value);
245
-        }
246
-        if ($this->_view !== 'incomplete') {
247
-            $filters[] = EEH_Form_Fields::select_input('_reg_status', $status,
248
-                isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status']))
249
-                    : '');
250
-        }
251
-        if (isset($this->_req_data['event_id'])) {
252
-            $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
253
-        }
254
-        return $filters;
255
-    }
256
-
257
-
258
-
259
-    /**
260
-     *    _add_view_counts
261
-     *
262
-     * @access protected
263
-     * @return void
264
-     * @throws \EE_Error
265
-     */
266
-    protected function _add_view_counts()
267
-    {
268
-        $this->_views['all']['count'] = $this->_total_registrations();
269
-        $this->_views['month']['count'] = $this->_total_registrations_this_month();
270
-        $this->_views['today']['count'] = $this->_total_registrations_today();
271
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations',
272
-            'espresso_registrations_trash_registrations')
273
-        ) {
274
-            $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
275
-            $this->_views['trash']['count'] = $this->_total_registrations('trash');
276
-        }
277
-    }
278
-
279
-
280
-
281
-    /**
282
-     * _total_registrations
283
-     *
284
-     * @access protected
285
-     * @param string $view
286
-     * @return int
287
-     * @throws \EE_Error
288
-     */
289
-    protected function _total_registrations($view = '')
290
-    {
291
-        $_where = array();
292
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
293
-        if ($EVT_ID) {
294
-            $_where['EVT_ID'] = $EVT_ID;
295
-        }
296
-        switch ($view) {
297
-            case 'trash' :
298
-                return EEM_Registration::instance()->count_deleted(array($_where));
299
-                break;
300
-            case 'incomplete' :
301
-                $_where['STS_ID'] = EEM_Registration::status_id_incomplete;
302
-                break;
303
-            default :
304
-                $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
305
-        }
306
-        return EEM_Registration::instance()->count(array($_where));
307
-    }
308
-
309
-
310
-
311
-    /**
312
-     * _total_registrations_this_month
313
-     *
314
-     * @access protected
315
-     * @return int
316
-     * @throws \EE_Error
317
-     */
318
-    protected function _total_registrations_this_month()
319
-    {
320
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
321
-        $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
322
-        $this_year_r = date('Y', current_time('timestamp'));
323
-        $time_start = ' 00:00:00';
324
-        $time_end = ' 23:59:59';
325
-        $this_month_r = date('m', current_time('timestamp'));
326
-        $days_this_month = date('t', current_time('timestamp'));
327
-        //setup date query.
328
-        $beginning_string = EEM_Registration::instance()
329
-                                            ->convert_datetime_for_query('REG_date',
330
-                                                $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
331
-                                                'Y-m-d H:i:s');
332
-        $end_string = EEM_Registration::instance()
333
-                                      ->convert_datetime_for_query('REG_date',
334
-                                          $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
335
-                                          'Y-m-d H:i:s');
336
-        $_where['REG_date'] = array(
337
-            'BETWEEN',
338
-            array(
339
-                $beginning_string,
340
-                $end_string,
341
-            ),
342
-        );
343
-        $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
344
-        return EEM_Registration::instance()->count(array($_where));
345
-    }
346
-
347
-
348
-
349
-    /**
350
-     * _total_registrations_today
351
-     *
352
-     * @access protected
353
-     * @return int
354
-     * @throws \EE_Error
355
-     */
356
-    protected function _total_registrations_today()
357
-    {
358
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
359
-        $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
360
-        $current_date = date('Y-m-d', current_time('timestamp'));
361
-        $time_start = ' 00:00:00';
362
-        $time_end = ' 23:59:59';
363
-        $_where['REG_date'] = array(
364
-            'BETWEEN',
365
-            array(
366
-                EEM_Registration::instance()
367
-                                ->convert_datetime_for_query('REG_date', $current_date . $time_start, 'Y-m-d H:i:s'),
368
-                EEM_Registration::instance()
369
-                                ->convert_datetime_for_query('REG_date', $current_date . $time_end, 'Y-m-d H:i:s'),
370
-            ),
371
-        );
372
-        $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
373
-        return EEM_Registration::instance()->count(array($_where));
374
-    }
375
-
376
-
377
-
378
-    /**
379
-     * column_cb
380
-     *
381
-     * @access public
382
-     * @param \EE_Registration $item
383
-     * @return string
384
-     * @throws \EE_Error
385
-     */
386
-    public function column_cb($item)
387
-    {
388
-        /** checkbox/lock **/
389
-        $transaction = $item->get_first_related('Transaction');
390
-        $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
391
-        return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID())
392
-                                    . '<span class="ee-lock-icon"></span>'
393
-            : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
394
-    }
395
-
396
-
397
-
398
-    /**
399
-     * column__REG_ID
400
-     *
401
-     * @access public
402
-     * @param \EE_Registration $item
403
-     * @return string
404
-     * @throws \EE_Error
405
-     */
406
-    public function column__REG_ID(EE_Registration $item)
407
-    {
408
-        $attendee = $item->attendee();
409
-        $content = $item->ID();
410
-        $content .= '<div class="show-on-mobile-view-only">';
411
-        $content .= '<br>';
412
-        $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
413
-        $content .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
414
-        $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
415
-        $content .= '</div>';
416
-        return $content;
417
-    }
418
-
419
-
420
-
421
-    /**
422
-     * column__REG_date
423
-     *
424
-     * @access public
425
-     * @param \EE_Registration $item
426
-     * @return string
427
-     * @throws \EE_Error
428
-     */
429
-    public function column__REG_date(EE_Registration $item)
430
-    {
431
-        $this->_set_related_details($item);
432
-        //Build row actions
433
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
434
-            'action' => 'view_transaction',
435
-            'TXN_ID' => $this->_transaction_details['id'],
436
-        ), TXN_ADMIN_URL);
437
-        $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
438
-            'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'
439
-                                                        . $this->_transaction_details['status']
440
-                                                        . '" href="'
441
-                                                        . $view_lnk_url
442
-                                                        . '" title="'
443
-                                                        . esc_attr($this->_transaction_details['title_attr'])
444
-                                                        . '">'
445
-                                                        . $item->get_i18n_datetime('REG_date')
446
-                                                        . '</a>' : $item->get_i18n_datetime('REG_date');
447
-        $view_link .= '<br><span class="ee-status-text-small">'
448
-                      . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence')
449
-                      . '</span>';
450
-        return $view_link;
451
-    }
452
-
453
-
454
-
455
-    /**
456
-     * column_event_name
457
-     *
458
-     * @access public
459
-     * @param \EE_Registration $item
460
-     * @return string
461
-     * @throws \EE_Error
462
-     */
463
-    public function column_event_name(EE_Registration $item)
464
-    {
465
-        $this->_set_related_details($item);
466
-        // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
467
-        $EVT_ID = $item->event_ID();
468
-        $event_name = $item->event_name();
469
-        $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
470
-        $event_name = wp_trim_words($event_name, 30, '...');
471
-        if ($EVT_ID) {
472
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID),
473
-                EVENTS_ADMIN_URL);
474
-            $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
475
-                ? '<a class="ee-status-color-'
476
-                  . $this->_event_details['status']
477
-                  . '" href="'
478
-                  . $edit_event_url
479
-                  . '" title="'
480
-                  . esc_attr($this->_event_details['title_attr'])
481
-                  . '">'
482
-                  . $event_name
483
-                  . '</a>' : $event_name;
484
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
485
-            $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
486
-            $actions['event_filter'] .= sprintf(esc_attr__('Filter this list to only show registrations for %s',
487
-                'event_espresso'), $event_name);
488
-            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
489
-        } else {
490
-            $edit_event = $event_name;
491
-            $actions['event_filter'] = '';
492
-        }
493
-        return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
494
-    }
495
-
496
-
497
-
498
-    /**
499
-     * column_DTT_EVT_start
500
-     *
501
-     * @access public
502
-     * @param \EE_Registration $item
503
-     * @return string
504
-     * @throws \EE_Error
505
-     */
506
-    public function column_DTT_EVT_start(EE_Registration $item)
507
-    {
508
-        $datetime_strings = array();
509
-        $ticket = $item->ticket(true);
510
-        if ($ticket instanceof EE_Ticket) {
511
-            $remove_defaults = array('default_where_conditions' => 'none');
512
-            $datetimes = $ticket->datetimes($remove_defaults);
513
-            foreach ($datetimes as $datetime) {
514
-                $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
515
-            }
516
-            return implode("<br />", $datetime_strings);
517
-        } else {
518
-            return __('There is no ticket on this registration', 'event_espresso');
519
-        }
520
-    }
521
-
522
-
523
-
524
-    /**
525
-     * column_ATT_fname
526
-     *
527
-     * @access public
528
-     * @param \EE_Registration $item
529
-     * @return string
530
-     * @throws \EE_Error
531
-     */
532
-    public function column_ATT_fname(EE_Registration $item)
533
-    {
534
-        $attendee = $item->attendee();
535
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
536
-            'action'  => 'view_registration',
537
-            '_REG_ID' => $item->ID(),
538
-        ), REG_ADMIN_URL);
539
-        $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
540
-        $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
541
-            'espresso_registrations_view_registration', $item->ID()) ? '<a href="'
542
-                                                                       . $edit_lnk_url
543
-                                                                       . '" title="'
544
-                                                                       . esc_attr__('View Registration Details',
545
-                'event_espresso')
546
-                                                                       . '">'
547
-                                                                       . $attendee_name
548
-                                                                       . '</a>' : $attendee_name;
549
-        $link .= $item->count() === 1
550
-            ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
551
-        $t = $item->get_first_related('Transaction');
552
-        $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
553
-        //append group count to name
554
-        $link .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
555
-        //append reg_code
556
-        $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
557
-        //reg status text for accessibility
558
-        $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false,
559
-                'sentence') . '</span>';
560
-        //trash/restore/delete actions
561
-        $actions = array();
562
-        if ($this->_view !== 'trash'
563
-            && $payment_count === 0
564
-            && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
565
-                'espresso_registrations_trash_registrations', $item->ID())
566
-        ) {
567
-            $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
568
-                'action'  => 'trash_registrations',
569
-                '_REG_ID' => $item->ID(),
570
-            ), REG_ADMIN_URL);
571
-            $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Trash Registration',
572
-                    'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
573
-        } elseif ($this->_view === 'trash') {
574
-            // restore registration link
575
-            if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
576
-                'espresso_registrations_restore_registrations', $item->ID())
577
-            ) {
578
-                $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
579
-                    'action'  => 'restore_registrations',
580
-                    '_REG_ID' => $item->ID(),
581
-                ), REG_ADMIN_URL);
582
-                $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Registration',
583
-                        'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
584
-            }
585
-            if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
586
-                'espresso_registrations_ee_delete_registrations', $item->ID())
587
-            ) {
588
-                $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
589
-                    'action'  => 'delete_registrations',
590
-                    '_REG_ID' => $item->ID(),
591
-                ), REG_ADMIN_URL);
592
-                $actions['delete'] = '<a href="'
593
-                                     . $delete_lnk_url
594
-                                     . '" title="'
595
-                                     . esc_attr__('Delete Registration Permanently', 'event_espresso')
596
-                                     . '">'
597
-                                     . __('Delete', 'event_espresso')
598
-                                     . '</a>';
599
-            }
600
-        }
601
-        return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
602
-    }
603
-
604
-
605
-
606
-    /**
607
-     * column_ATT_email
608
-     *
609
-     * @access public
610
-     * @param \EE_Registration $item
611
-     * @return string
612
-     * @throws \EE_Error
613
-     */
614
-    public function column_ATT_email(EE_Registration $item)
615
-    {
616
-        $attendee = $item->get_first_related('Attendee');
617
-        return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso')
618
-            : $attendee->email();
619
-    }
620
-
621
-
622
-
623
-    /**
624
-     * column__REG_count
625
-     *
626
-     * @access public
627
-     * @param \EE_Registration $item
628
-     * @return string
629
-     */
630
-    public function column__REG_count(EE_Registration $item)
631
-    {
632
-        return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
633
-    }
634
-
635
-
636
-
637
-    /**
638
-     * column_PRC_amount
639
-     *
640
-     * @access public
641
-     * @param \EE_Registration $item
642
-     * @return string
643
-     */
644
-    public function column_PRC_amount(EE_Registration $item)
645
-    {
646
-        $ticket = $item->ticket();
647
-        $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'
648
-                                                                              . $ticket->name()
649
-                                                                              . '</span><br />' : '';
650
-        if ($item->final_price() > 0) {
651
-            $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
652
-        } else {
653
-            // free event
654
-            $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'
655
-                        . __('free', 'event_espresso')
656
-                        . '</span>';
657
-        }
658
-        return $content;
659
-    }
660
-
661
-
662
-
663
-    /**
664
-     * column__REG_final_price
665
-     *
666
-     * @access public
667
-     * @param \EE_Registration $item
668
-     * @return string
669
-     */
670
-    public function column__REG_final_price(EE_Registration $item)
671
-    {
672
-        $ticket = $item->ticket();
673
-        $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket
674
-            ? ''
675
-            : '<span class="TKT_name">'
676
-              . $ticket->name()
677
-              . '</span><br />';
678
-        $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
679
-        return $content;
680
-    }
681
-
682
-
683
-
684
-    /**
685
-     * column__REG_paid
686
-     *
687
-     * @access public
688
-     * @param \EE_Registration $item
689
-     * @return string
690
-     */
691
-    public function column__REG_paid(EE_Registration $item)
692
-    {
693
-        $payment_method = $item->payment_method();
694
-        $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name()
695
-            : __('Unknown', 'event_espresso');
696
-        $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';
697
-        if ($item->paid() > 0) {
698
-            $content .= '<br><span class="ee-status-text-small">' . sprintf(__('...via %s', 'event_espresso'),
699
-                    $payment_method_name) . '</span>';
700
-        }
701
-        return $content;
702
-    }
703
-
704
-
705
-
706
-    /**
707
-     * column_TXN_total
708
-     *
709
-     * @access public
710
-     * @param \EE_Registration $item
711
-     * @return string
712
-     * @throws \EE_Error
713
-     */
714
-    public function column_TXN_total(EE_Registration $item)
715
-    {
716
-        if ($item->transaction()) {
717
-            $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
718
-                'action' => 'view_transaction',
719
-                'TXN_ID' => $item->transaction_ID(),
720
-            ), TXN_ADMIN_URL);
721
-            return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
722
-                'espresso_transactions_view_transaction', $item->transaction_ID())
723
-                ? '<span class="reg-pad-rght"><a class="status-'
724
-                  . $item->transaction()->status_ID()
725
-                  . '" href="'
726
-                  . $view_txn_lnk_url
727
-                  . '"  title="'
728
-                  . esc_attr__('View Transaction', 'event_espresso')
729
-                  . '">'
730
-                  . $item->transaction()->pretty_total()
731
-                  . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
732
-        } else {
733
-            return __("None", "event_espresso");
734
-        }
735
-    }
736
-
737
-
738
-
739
-    /**
740
-     * column_TXN_paid
741
-     *
742
-     * @access public
743
-     * @param \EE_Registration $item
744
-     * @return string
745
-     * @throws \EE_Error
746
-     */
747
-    public function column_TXN_paid(EE_Registration $item)
748
-    {
749
-        if ($item->count() === 1) {
750
-            $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
751
-            if ($transaction->paid() >= $transaction->total()) {
752
-                return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
753
-            } else {
754
-                $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
755
-                    'action' => 'view_transaction',
756
-                    'TXN_ID' => $item->transaction_ID(),
757
-                ), TXN_ADMIN_URL);
758
-                return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
759
-                    'espresso_transactions_view_transaction', $item->transaction_ID())
760
-                    ? '<span class="reg-pad-rght"><a class="status-'
761
-                      . $transaction->status_ID()
762
-                      . '" href="'
763
-                      . $view_txn_lnk_url
764
-                      . '"  title="'
765
-                      . esc_attr__('View Transaction', 'event_espresso')
766
-                      . '">'
767
-                      . $item->transaction()->pretty_paid()
768
-                      . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
769
-            }
770
-        }
771
-        return '&nbsp;';
772
-    }
773
-
774
-
775
-
776
-    /**
777
-     * column_actions
778
-     *
779
-     * @access public
780
-     * @param \EE_Registration $item
781
-     * @return string
782
-     * @throws \EE_Error
783
-     */
784
-    public function column_actions(EE_Registration $item)
785
-    {
786
-        $actions = array();
787
-        $attendee = $item->attendee();
788
-        $this->_set_related_details($item);
789
-        //Build row actions
790
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
791
-            'action'  => 'view_registration',
792
-            '_REG_ID' => $item->ID(),
793
-        ), REG_ADMIN_URL);
794
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
795
-            'action' => 'edit_attendee',
796
-            'post'   => $item->attendee_ID(),
797
-        ), REG_ADMIN_URL);
798
-        // page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
799
-        //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
800
-        $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
801
-            'action'  => 'resend_registration',
802
-            '_REG_ID' => $item->ID(),
803
-        ), REG_ADMIN_URL, true);
804
-        //Build row actions
805
-        $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
806
-            'espresso_registrations_view_registration', $item->ID()) ? '
29
+	private $_status;
30
+
31
+
32
+
33
+	/**
34
+	 * An array of transaction details for the related transaction to the registration being processed.
35
+	 * This is set via the _set_related_details method.
36
+	 *
37
+	 * @var array
38
+	 */
39
+	protected $_transaction_details = array();
40
+
41
+
42
+
43
+	/**
44
+	 * An array of event details for the related event to the registration being processed.
45
+	 * This is set via the _set_related_details method.
46
+	 *
47
+	 * @var array
48
+	 */
49
+	protected $_event_details = array();
50
+
51
+
52
+
53
+	/**
54
+	 * @param \Registrations_Admin_Page $admin_page
55
+	 */
56
+	public function __construct(Registrations_Admin_Page $admin_page)
57
+	{
58
+		if ( ! empty($_GET['event_id'])) {
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']);
62
+			}
63
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
64
+		}
65
+		parent::__construct($admin_page);
66
+		$this->_status = $this->_admin_page->get_registration_status_array();
67
+	}
68
+
69
+
70
+
71
+	/**
72
+	 *    _setup_data
73
+	 *
74
+	 * @access protected
75
+	 * @return void
76
+	 */
77
+	protected function _setup_data()
78
+	{
79
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
80
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false);
81
+	}
82
+
83
+
84
+
85
+	/**
86
+	 *    _set_properties
87
+	 *
88
+	 * @access protected
89
+	 * @return void
90
+	 */
91
+	protected function _set_properties()
92
+	{
93
+		$this->_wp_list_args = array(
94
+			'singular' => __('registration', 'event_espresso'),
95
+			'plural'   => __('registrations', 'event_espresso'),
96
+			'ajax'     => true,
97
+			'screen'   => $this->_admin_page->get_current_screen()->id,
98
+		);
99
+		$ID_column_name = __('ID', 'event_espresso');
100
+		$ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
101
+		$ID_column_name .= __('Registrant Name', 'event_espresso');
102
+		$ID_column_name .= '</span> ';
103
+		if (isset($_GET['event_id'])) {
104
+			$this->_columns = array(
105
+				'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
106
+				'_REG_ID'          => $ID_column_name,
107
+				'ATT_fname'        => __('Name', 'event_espresso'),
108
+				'ATT_email'        => __('Email', 'event_espresso'),
109
+				'_REG_date'        => __('Reg Date', 'event_espresso'),
110
+				'PRC_amount'       => __('TKT Price', 'event_espresso'),
111
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
112
+				'TXN_total'        => __('Total Txn', 'event_espresso'),
113
+				'TXN_paid'         => __('Paid', 'event_espresso'),
114
+				'actions'          => __('Actions', 'event_espresso'),
115
+			);
116
+			$this->_bottom_buttons = array(
117
+				'report' => array(
118
+					'route'         => 'registrations_report',
119
+					'extra_request' => array(
120
+						'EVT_ID'     => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
121
+						'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
122
+					),
123
+				),
124
+			);
125
+		} else {
126
+			$this->_columns = array(
127
+				'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
128
+				'_REG_ID'          => $ID_column_name,
129
+				'ATT_fname'        => __('Name', 'event_espresso'),
130
+				'_REG_date'        => __('TXN Date', 'event_espresso'),
131
+				'event_name'       => __('Event', 'event_espresso'),
132
+				'DTT_EVT_start'    => __('Event Date', 'event_espresso'),
133
+				'_REG_final_price' => __('Price', 'event_espresso'),
134
+				'_REG_paid'        => __('Paid', 'event_espresso'),
135
+				'actions'          => __('Actions', 'event_espresso'),
136
+			);
137
+			$this->_bottom_buttons = array(
138
+				'report_all' => array(
139
+					'route'         => 'registrations_report',
140
+					'extra_request' => array(
141
+						'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
142
+					),
143
+				),
144
+			);
145
+		}
146
+		$this->_bottom_buttons['report_filtered'] = array(
147
+			'route'         => 'registrations_report',
148
+			'extra_request' => array(
149
+				'use_filters' => true,
150
+				'filters'     => array_diff_key($this->_req_data, array_flip(array(
151
+							'page',
152
+							'action',
153
+							'default_nonce',
154
+						))),
155
+				'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
156
+			),
157
+		);
158
+		$this->_primary_column = '_REG_ID';
159
+		$this->_sortable_columns = array(
160
+			'_REG_date'     => array('_REG_date' => true),   //true means its already sorted
161
+			'ATT_fname'     => array('ATT_fname' => false),
162
+			'event_name'    => array('event_name' => false),
163
+			'DTT_EVT_start' => array('DTT_EVT_start' => false),
164
+			'_REG_ID'       => array('_REG_ID' => false),
165
+		);
166
+		$this->_hidden_columns = array();
167
+	}
168
+
169
+
170
+
171
+	/**
172
+	 * This simply sets up the row class for the table rows.
173
+	 * Allows for easier overriding of child methods for setting up sorting.
174
+	 *
175
+	 * @param  EE_Registration $item the current item
176
+	 * @return string
177
+	 */
178
+	protected function _get_row_class($item)
179
+	{
180
+		$class = parent::_get_row_class($item);
181
+		//add status class
182
+		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
183
+		if ($this->_has_checkbox_column) {
184
+			$class .= ' has-checkbox-column';
185
+		}
186
+		return $class;
187
+	}
188
+
189
+
190
+
191
+	/**
192
+	 * Set the $_transaction_details property if not set yet.
193
+	 *
194
+	 * @param EE_Registration $registration
195
+	 * @throws \EE_Error
196
+	 */
197
+	protected function _set_related_details(EE_Registration $registration)
198
+	{
199
+		$transaction = $registration->get_first_related('Transaction');
200
+		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID()
201
+			: EEM_Transaction::failed_status_code;
202
+		$this->_transaction_details = array(
203
+			'transaction' => $transaction,
204
+			'status'      => $status,
205
+			'id'          => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
206
+			'title_attr'  => sprintf(__('View Transaction Details (%s)', 'event_espresso'),
207
+				EEH_Template::pretty_status($status, false, 'sentence')),
208
+		);
209
+		try {
210
+			$event = $registration->event();
211
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
212
+			$event = null;
213
+		}
214
+		$status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive;
215
+		$this->_event_details = array(
216
+			'event'      => $event,
217
+			'status'     => $status,
218
+			'id'         => $event instanceof EE_Event ? $event->ID() : 0,
219
+			'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'),
220
+				EEH_Template::pretty_status($status, false, 'sentence')),
221
+		);
222
+	}
223
+
224
+
225
+
226
+	/**
227
+	 *    _get_table_filters
228
+	 *
229
+	 * @access protected
230
+	 * @return array
231
+	 */
232
+	protected function _get_table_filters()
233
+	{
234
+		$filters = array();
235
+		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
236
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
237
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
238
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
239
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
240
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
241
+		$status = array();
242
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
243
+		foreach ($this->_status as $key => $value) {
244
+			$status[] = array('id' => $key, 'text' => $value);
245
+		}
246
+		if ($this->_view !== 'incomplete') {
247
+			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status,
248
+				isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status']))
249
+					: '');
250
+		}
251
+		if (isset($this->_req_data['event_id'])) {
252
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
253
+		}
254
+		return $filters;
255
+	}
256
+
257
+
258
+
259
+	/**
260
+	 *    _add_view_counts
261
+	 *
262
+	 * @access protected
263
+	 * @return void
264
+	 * @throws \EE_Error
265
+	 */
266
+	protected function _add_view_counts()
267
+	{
268
+		$this->_views['all']['count'] = $this->_total_registrations();
269
+		$this->_views['month']['count'] = $this->_total_registrations_this_month();
270
+		$this->_views['today']['count'] = $this->_total_registrations_today();
271
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations',
272
+			'espresso_registrations_trash_registrations')
273
+		) {
274
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
275
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
276
+		}
277
+	}
278
+
279
+
280
+
281
+	/**
282
+	 * _total_registrations
283
+	 *
284
+	 * @access protected
285
+	 * @param string $view
286
+	 * @return int
287
+	 * @throws \EE_Error
288
+	 */
289
+	protected function _total_registrations($view = '')
290
+	{
291
+		$_where = array();
292
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
293
+		if ($EVT_ID) {
294
+			$_where['EVT_ID'] = $EVT_ID;
295
+		}
296
+		switch ($view) {
297
+			case 'trash' :
298
+				return EEM_Registration::instance()->count_deleted(array($_where));
299
+				break;
300
+			case 'incomplete' :
301
+				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
302
+				break;
303
+			default :
304
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
305
+		}
306
+		return EEM_Registration::instance()->count(array($_where));
307
+	}
308
+
309
+
310
+
311
+	/**
312
+	 * _total_registrations_this_month
313
+	 *
314
+	 * @access protected
315
+	 * @return int
316
+	 * @throws \EE_Error
317
+	 */
318
+	protected function _total_registrations_this_month()
319
+	{
320
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
321
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
322
+		$this_year_r = date('Y', current_time('timestamp'));
323
+		$time_start = ' 00:00:00';
324
+		$time_end = ' 23:59:59';
325
+		$this_month_r = date('m', current_time('timestamp'));
326
+		$days_this_month = date('t', current_time('timestamp'));
327
+		//setup date query.
328
+		$beginning_string = EEM_Registration::instance()
329
+											->convert_datetime_for_query('REG_date',
330
+												$this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
331
+												'Y-m-d H:i:s');
332
+		$end_string = EEM_Registration::instance()
333
+									  ->convert_datetime_for_query('REG_date',
334
+										  $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
335
+										  'Y-m-d H:i:s');
336
+		$_where['REG_date'] = array(
337
+			'BETWEEN',
338
+			array(
339
+				$beginning_string,
340
+				$end_string,
341
+			),
342
+		);
343
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
344
+		return EEM_Registration::instance()->count(array($_where));
345
+	}
346
+
347
+
348
+
349
+	/**
350
+	 * _total_registrations_today
351
+	 *
352
+	 * @access protected
353
+	 * @return int
354
+	 * @throws \EE_Error
355
+	 */
356
+	protected function _total_registrations_today()
357
+	{
358
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
359
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
360
+		$current_date = date('Y-m-d', current_time('timestamp'));
361
+		$time_start = ' 00:00:00';
362
+		$time_end = ' 23:59:59';
363
+		$_where['REG_date'] = array(
364
+			'BETWEEN',
365
+			array(
366
+				EEM_Registration::instance()
367
+								->convert_datetime_for_query('REG_date', $current_date . $time_start, 'Y-m-d H:i:s'),
368
+				EEM_Registration::instance()
369
+								->convert_datetime_for_query('REG_date', $current_date . $time_end, 'Y-m-d H:i:s'),
370
+			),
371
+		);
372
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
373
+		return EEM_Registration::instance()->count(array($_where));
374
+	}
375
+
376
+
377
+
378
+	/**
379
+	 * column_cb
380
+	 *
381
+	 * @access public
382
+	 * @param \EE_Registration $item
383
+	 * @return string
384
+	 * @throws \EE_Error
385
+	 */
386
+	public function column_cb($item)
387
+	{
388
+		/** checkbox/lock **/
389
+		$transaction = $item->get_first_related('Transaction');
390
+		$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
391
+		return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID())
392
+									. '<span class="ee-lock-icon"></span>'
393
+			: sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
394
+	}
395
+
396
+
397
+
398
+	/**
399
+	 * column__REG_ID
400
+	 *
401
+	 * @access public
402
+	 * @param \EE_Registration $item
403
+	 * @return string
404
+	 * @throws \EE_Error
405
+	 */
406
+	public function column__REG_ID(EE_Registration $item)
407
+	{
408
+		$attendee = $item->attendee();
409
+		$content = $item->ID();
410
+		$content .= '<div class="show-on-mobile-view-only">';
411
+		$content .= '<br>';
412
+		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
413
+		$content .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
414
+		$content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
415
+		$content .= '</div>';
416
+		return $content;
417
+	}
418
+
419
+
420
+
421
+	/**
422
+	 * column__REG_date
423
+	 *
424
+	 * @access public
425
+	 * @param \EE_Registration $item
426
+	 * @return string
427
+	 * @throws \EE_Error
428
+	 */
429
+	public function column__REG_date(EE_Registration $item)
430
+	{
431
+		$this->_set_related_details($item);
432
+		//Build row actions
433
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
434
+			'action' => 'view_transaction',
435
+			'TXN_ID' => $this->_transaction_details['id'],
436
+		), TXN_ADMIN_URL);
437
+		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
438
+			'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'
439
+														. $this->_transaction_details['status']
440
+														. '" href="'
441
+														. $view_lnk_url
442
+														. '" title="'
443
+														. esc_attr($this->_transaction_details['title_attr'])
444
+														. '">'
445
+														. $item->get_i18n_datetime('REG_date')
446
+														. '</a>' : $item->get_i18n_datetime('REG_date');
447
+		$view_link .= '<br><span class="ee-status-text-small">'
448
+					  . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence')
449
+					  . '</span>';
450
+		return $view_link;
451
+	}
452
+
453
+
454
+
455
+	/**
456
+	 * column_event_name
457
+	 *
458
+	 * @access public
459
+	 * @param \EE_Registration $item
460
+	 * @return string
461
+	 * @throws \EE_Error
462
+	 */
463
+	public function column_event_name(EE_Registration $item)
464
+	{
465
+		$this->_set_related_details($item);
466
+		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
467
+		$EVT_ID = $item->event_ID();
468
+		$event_name = $item->event_name();
469
+		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
470
+		$event_name = wp_trim_words($event_name, 30, '...');
471
+		if ($EVT_ID) {
472
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID),
473
+				EVENTS_ADMIN_URL);
474
+			$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
475
+				? '<a class="ee-status-color-'
476
+				  . $this->_event_details['status']
477
+				  . '" href="'
478
+				  . $edit_event_url
479
+				  . '" title="'
480
+				  . esc_attr($this->_event_details['title_attr'])
481
+				  . '">'
482
+				  . $event_name
483
+				  . '</a>' : $event_name;
484
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
485
+			$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
486
+			$actions['event_filter'] .= sprintf(esc_attr__('Filter this list to only show registrations for %s',
487
+				'event_espresso'), $event_name);
488
+			$actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
489
+		} else {
490
+			$edit_event = $event_name;
491
+			$actions['event_filter'] = '';
492
+		}
493
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
494
+	}
495
+
496
+
497
+
498
+	/**
499
+	 * column_DTT_EVT_start
500
+	 *
501
+	 * @access public
502
+	 * @param \EE_Registration $item
503
+	 * @return string
504
+	 * @throws \EE_Error
505
+	 */
506
+	public function column_DTT_EVT_start(EE_Registration $item)
507
+	{
508
+		$datetime_strings = array();
509
+		$ticket = $item->ticket(true);
510
+		if ($ticket instanceof EE_Ticket) {
511
+			$remove_defaults = array('default_where_conditions' => 'none');
512
+			$datetimes = $ticket->datetimes($remove_defaults);
513
+			foreach ($datetimes as $datetime) {
514
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
515
+			}
516
+			return implode("<br />", $datetime_strings);
517
+		} else {
518
+			return __('There is no ticket on this registration', 'event_espresso');
519
+		}
520
+	}
521
+
522
+
523
+
524
+	/**
525
+	 * column_ATT_fname
526
+	 *
527
+	 * @access public
528
+	 * @param \EE_Registration $item
529
+	 * @return string
530
+	 * @throws \EE_Error
531
+	 */
532
+	public function column_ATT_fname(EE_Registration $item)
533
+	{
534
+		$attendee = $item->attendee();
535
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
536
+			'action'  => 'view_registration',
537
+			'_REG_ID' => $item->ID(),
538
+		), REG_ADMIN_URL);
539
+		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
540
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
541
+			'espresso_registrations_view_registration', $item->ID()) ? '<a href="'
542
+																	   . $edit_lnk_url
543
+																	   . '" title="'
544
+																	   . esc_attr__('View Registration Details',
545
+				'event_espresso')
546
+																	   . '">'
547
+																	   . $attendee_name
548
+																	   . '</a>' : $attendee_name;
549
+		$link .= $item->count() === 1
550
+			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
551
+		$t = $item->get_first_related('Transaction');
552
+		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
553
+		//append group count to name
554
+		$link .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
555
+		//append reg_code
556
+		$link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
557
+		//reg status text for accessibility
558
+		$link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false,
559
+				'sentence') . '</span>';
560
+		//trash/restore/delete actions
561
+		$actions = array();
562
+		if ($this->_view !== 'trash'
563
+			&& $payment_count === 0
564
+			&& EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
565
+				'espresso_registrations_trash_registrations', $item->ID())
566
+		) {
567
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
568
+				'action'  => 'trash_registrations',
569
+				'_REG_ID' => $item->ID(),
570
+			), REG_ADMIN_URL);
571
+			$actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Trash Registration',
572
+					'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
573
+		} elseif ($this->_view === 'trash') {
574
+			// restore registration link
575
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
576
+				'espresso_registrations_restore_registrations', $item->ID())
577
+			) {
578
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
579
+					'action'  => 'restore_registrations',
580
+					'_REG_ID' => $item->ID(),
581
+				), REG_ADMIN_URL);
582
+				$actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Registration',
583
+						'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
584
+			}
585
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
586
+				'espresso_registrations_ee_delete_registrations', $item->ID())
587
+			) {
588
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
589
+					'action'  => 'delete_registrations',
590
+					'_REG_ID' => $item->ID(),
591
+				), REG_ADMIN_URL);
592
+				$actions['delete'] = '<a href="'
593
+									 . $delete_lnk_url
594
+									 . '" title="'
595
+									 . esc_attr__('Delete Registration Permanently', 'event_espresso')
596
+									 . '">'
597
+									 . __('Delete', 'event_espresso')
598
+									 . '</a>';
599
+			}
600
+		}
601
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
602
+	}
603
+
604
+
605
+
606
+	/**
607
+	 * column_ATT_email
608
+	 *
609
+	 * @access public
610
+	 * @param \EE_Registration $item
611
+	 * @return string
612
+	 * @throws \EE_Error
613
+	 */
614
+	public function column_ATT_email(EE_Registration $item)
615
+	{
616
+		$attendee = $item->get_first_related('Attendee');
617
+		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso')
618
+			: $attendee->email();
619
+	}
620
+
621
+
622
+
623
+	/**
624
+	 * column__REG_count
625
+	 *
626
+	 * @access public
627
+	 * @param \EE_Registration $item
628
+	 * @return string
629
+	 */
630
+	public function column__REG_count(EE_Registration $item)
631
+	{
632
+		return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
633
+	}
634
+
635
+
636
+
637
+	/**
638
+	 * column_PRC_amount
639
+	 *
640
+	 * @access public
641
+	 * @param \EE_Registration $item
642
+	 * @return string
643
+	 */
644
+	public function column_PRC_amount(EE_Registration $item)
645
+	{
646
+		$ticket = $item->ticket();
647
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'
648
+																			  . $ticket->name()
649
+																			  . '</span><br />' : '';
650
+		if ($item->final_price() > 0) {
651
+			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
652
+		} else {
653
+			// free event
654
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'
655
+						. __('free', 'event_espresso')
656
+						. '</span>';
657
+		}
658
+		return $content;
659
+	}
660
+
661
+
662
+
663
+	/**
664
+	 * column__REG_final_price
665
+	 *
666
+	 * @access public
667
+	 * @param \EE_Registration $item
668
+	 * @return string
669
+	 */
670
+	public function column__REG_final_price(EE_Registration $item)
671
+	{
672
+		$ticket = $item->ticket();
673
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket
674
+			? ''
675
+			: '<span class="TKT_name">'
676
+			  . $ticket->name()
677
+			  . '</span><br />';
678
+		$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
679
+		return $content;
680
+	}
681
+
682
+
683
+
684
+	/**
685
+	 * column__REG_paid
686
+	 *
687
+	 * @access public
688
+	 * @param \EE_Registration $item
689
+	 * @return string
690
+	 */
691
+	public function column__REG_paid(EE_Registration $item)
692
+	{
693
+		$payment_method = $item->payment_method();
694
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name()
695
+			: __('Unknown', 'event_espresso');
696
+		$content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';
697
+		if ($item->paid() > 0) {
698
+			$content .= '<br><span class="ee-status-text-small">' . sprintf(__('...via %s', 'event_espresso'),
699
+					$payment_method_name) . '</span>';
700
+		}
701
+		return $content;
702
+	}
703
+
704
+
705
+
706
+	/**
707
+	 * column_TXN_total
708
+	 *
709
+	 * @access public
710
+	 * @param \EE_Registration $item
711
+	 * @return string
712
+	 * @throws \EE_Error
713
+	 */
714
+	public function column_TXN_total(EE_Registration $item)
715
+	{
716
+		if ($item->transaction()) {
717
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
718
+				'action' => 'view_transaction',
719
+				'TXN_ID' => $item->transaction_ID(),
720
+			), TXN_ADMIN_URL);
721
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
722
+				'espresso_transactions_view_transaction', $item->transaction_ID())
723
+				? '<span class="reg-pad-rght"><a class="status-'
724
+				  . $item->transaction()->status_ID()
725
+				  . '" href="'
726
+				  . $view_txn_lnk_url
727
+				  . '"  title="'
728
+				  . esc_attr__('View Transaction', 'event_espresso')
729
+				  . '">'
730
+				  . $item->transaction()->pretty_total()
731
+				  . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
732
+		} else {
733
+			return __("None", "event_espresso");
734
+		}
735
+	}
736
+
737
+
738
+
739
+	/**
740
+	 * column_TXN_paid
741
+	 *
742
+	 * @access public
743
+	 * @param \EE_Registration $item
744
+	 * @return string
745
+	 * @throws \EE_Error
746
+	 */
747
+	public function column_TXN_paid(EE_Registration $item)
748
+	{
749
+		if ($item->count() === 1) {
750
+			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
751
+			if ($transaction->paid() >= $transaction->total()) {
752
+				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
753
+			} else {
754
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
755
+					'action' => 'view_transaction',
756
+					'TXN_ID' => $item->transaction_ID(),
757
+				), TXN_ADMIN_URL);
758
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
759
+					'espresso_transactions_view_transaction', $item->transaction_ID())
760
+					? '<span class="reg-pad-rght"><a class="status-'
761
+					  . $transaction->status_ID()
762
+					  . '" href="'
763
+					  . $view_txn_lnk_url
764
+					  . '"  title="'
765
+					  . esc_attr__('View Transaction', 'event_espresso')
766
+					  . '">'
767
+					  . $item->transaction()->pretty_paid()
768
+					  . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
769
+			}
770
+		}
771
+		return '&nbsp;';
772
+	}
773
+
774
+
775
+
776
+	/**
777
+	 * column_actions
778
+	 *
779
+	 * @access public
780
+	 * @param \EE_Registration $item
781
+	 * @return string
782
+	 * @throws \EE_Error
783
+	 */
784
+	public function column_actions(EE_Registration $item)
785
+	{
786
+		$actions = array();
787
+		$attendee = $item->attendee();
788
+		$this->_set_related_details($item);
789
+		//Build row actions
790
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
791
+			'action'  => 'view_registration',
792
+			'_REG_ID' => $item->ID(),
793
+		), REG_ADMIN_URL);
794
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
795
+			'action' => 'edit_attendee',
796
+			'post'   => $item->attendee_ID(),
797
+		), REG_ADMIN_URL);
798
+		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
799
+		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
800
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
801
+			'action'  => 'resend_registration',
802
+			'_REG_ID' => $item->ID(),
803
+		), REG_ADMIN_URL, true);
804
+		//Build row actions
805
+		$actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
806
+			'espresso_registrations_view_registration', $item->ID()) ? '
807 807
 			<li>
808 808
 			<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '" class="tiny-text">
809 809
 				<div class="dashicons dashicons-clipboard"></div>
810 810
 			</a>
811 811
 			</li>' : '';
812
-        $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts',
813
-            'espresso_registrations_edit_attendee')
814
-                               && $attendee instanceof EE_Attendee ? '
812
+		$actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts',
813
+			'espresso_registrations_edit_attendee')
814
+							   && $attendee instanceof EE_Attendee ? '
815 815
 			<li>
816 816
 			<a href="' . $edit_lnk_url . '" title="' . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text">
817 817
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
818 818
 			</a>
819 819
 			</li>' : '';
820
-        $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee
821
-                                     && EE_Registry::instance()->CAP->current_user_can('ee_send_message',
822
-            'espresso_registrations_resend_registration', $item->ID()) ? '
820
+		$actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee
821
+									 && EE_Registry::instance()->CAP->current_user_can('ee_send_message',
822
+			'espresso_registrations_resend_registration', $item->ID()) ? '
823 823
 			<li>
824 824
 			<a href="'
825
-                                                                         . $resend_reg_lnk_url
826
-                                                                         . '" title="'
827
-                                                                         . esc_attr__('Resend Registration Details',
828
-                'event_espresso')
829
-                                                                         . '" class="tiny-text">
825
+																		 . $resend_reg_lnk_url
826
+																		 . '" title="'
827
+																		 . esc_attr__('Resend Registration Details',
828
+				'event_espresso')
829
+																		 . '" class="tiny-text">
830 830
 				<div class="dashicons dashicons-email-alt"></div>
831 831
 			</a>
832 832
 			</li>' : '';
833
-        // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
834
-        $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
835
-            'action' => 'view_transaction',
836
-            'TXN_ID' => $this->_transaction_details['id'],
837
-        ), TXN_ADMIN_URL);
838
-        $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
839
-            'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
833
+		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
834
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
835
+			'action' => 'view_transaction',
836
+			'TXN_ID' => $this->_transaction_details['id'],
837
+		), TXN_ADMIN_URL);
838
+		$actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
839
+			'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
840 840
 			<li>
841 841
 			<a class="ee-status-color-'
842
-                                                                                           . $this->_transaction_details['status']
843
-                                                                                           . ' tiny-text" href="'
844
-                                                                                           . $view_txn_lnk_url
845
-                                                                                           . '"  title="'
846
-                                                                                           . $this->_transaction_details['title_attr']
847
-                                                                                           . '">
842
+																						   . $this->_transaction_details['status']
843
+																						   . ' tiny-text" href="'
844
+																						   . $view_txn_lnk_url
845
+																						   . '"  title="'
846
+																						   . $this->_transaction_details['title_attr']
847
+																						   . '">
848 848
 				<div class="dashicons dashicons-cart"></div>
849 849
 			</a>
850 850
 			</li>' : '';
851
-        //invoice link
852
-        $actions['dl_invoice_lnk'] = '';
853
-        $dl_invoice_lnk_url = $item->invoice_url();
854
-        //only show invoice link if message type is active.
855
-        if ($attendee instanceof EE_Attendee
856
-            && $item->is_primary_registrant()
857
-            && EEH_MSG_Template::is_mt_active('invoice')
858
-        ) {
859
-            $actions['dl_invoice_lnk'] = '
851
+		//invoice link
852
+		$actions['dl_invoice_lnk'] = '';
853
+		$dl_invoice_lnk_url = $item->invoice_url();
854
+		//only show invoice link if message type is active.
855
+		if ($attendee instanceof EE_Attendee
856
+			&& $item->is_primary_registrant()
857
+			&& EEH_MSG_Template::is_mt_active('invoice')
858
+		) {
859
+			$actions['dl_invoice_lnk'] = '
860 860
 		<li>
861 861
 			<a title="'
862
-                                         . esc_attr__('View Transaction Invoice', 'event_espresso')
863
-                                         . '" target="_blank" href="'
864
-                                         . $dl_invoice_lnk_url
865
-                                         . '" class="tiny-text">
862
+										 . esc_attr__('View Transaction Invoice', 'event_espresso')
863
+										 . '" target="_blank" href="'
864
+										 . $dl_invoice_lnk_url
865
+										 . '" class="tiny-text">
866 866
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
867 867
 			</a>
868 868
 		</li>';
869
-        }
870
-        $actions['filtered_messages_link'] = '';
871
-        //message list table link (filtered by REG_ID
872
-        if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
873
-            $actions['filtered_messages_link'] = '<li>'
874
-                                                 . EEH_MSG_Template::get_message_action_link('see_notifications_for',
875
-                    null, array(
876
-                        '_REG_ID' => $item->ID(),
877
-                    ))
878
-                                                 . '</li>';
879
-        }
880
-        $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this);
881
-        return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul');
882
-    }
869
+		}
870
+		$actions['filtered_messages_link'] = '';
871
+		//message list table link (filtered by REG_ID
872
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
873
+			$actions['filtered_messages_link'] = '<li>'
874
+												 . EEH_MSG_Template::get_message_action_link('see_notifications_for',
875
+					null, array(
876
+						'_REG_ID' => $item->ID(),
877
+					))
878
+												 . '</li>';
879
+		}
880
+		$actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this);
881
+		return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul');
882
+	}
883 883
 
884 884
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Soft_Delete_Base.model.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@
 block discarded – undo
111 111
 
112 112
 
113 113
 
114
-    /**
115
-     * Alters the query params so that only trashed/soft-deleted items are considered
116
-     * @param array $query_params like EEM_Base::get_all's $query_params
117
-     * @return array like EEM_Base::get_all's $query_params
118
-     */
114
+	/**
115
+	 * Alters the query params so that only trashed/soft-deleted items are considered
116
+	 * @param array $query_params like EEM_Base::get_all's $query_params
117
+	 * @return array like EEM_Base::get_all's $query_params
118
+	 */
119 119
 	public function alter_query_params_so_only_trashed_items_included($query_params){
120
-	    return $this->_alter_query_params_so_only_trashed_items_included($query_params);
121
-    }
120
+		return $this->_alter_query_params_so_only_trashed_items_included($query_params);
121
+	}
122 122
 
123 123
 	/**
124 124
 	 * Alters the query params so each item's deleted status is ignored.
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once( EE_MODELS . 'EEM_Base.model.php');
2
+require_once(EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  * EEM_Soft_Delete_Base
5 5
  *
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
  * @subpackage		includes/models/
26 26
  * @author				Michael Nelson
27 27
  */
28
-abstract class EEM_Soft_Delete_Base extends EEM_Base{
28
+abstract class EEM_Soft_Delete_Base extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * @param null $timezone
32 32
 	 */
33 33
 	protected function __construct($timezone = NULL) {
34
-		if( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions ){
34
+		if ( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions) {
35 35
 			$this->_default_where_conditions_strategy = new EE_Soft_Delete_Where_Conditions();
36 36
 		}
37 37
 		parent::__construct($timezone);
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 	 * @return string
43 43
 	 * @throws EE_Error
44 44
 	 */
45
-	public function deleted_field_name(){
45
+	public function deleted_field_name() {
46 46
 		$field = $this->get_a_field_of_type('EE_Trashed_Flag_Field');
47
-		if($field){
47
+		if ($field) {
48 48
 			return $field->get_name();
49
-		}else{
50
-			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
49
+		} else {
50
+			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
51 51
 		}
52 52
 	}
53 53
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param array $query_params like EEM_Base::get_all's $query_params
58 58
 	 * @return EE_Soft_Delete_Base_Class
59 59
 	 */
60
-	public function get_one_deleted($query_params = array()){
60
+	public function get_one_deleted($query_params = array()) {
61 61
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
62 62
 		return parent::get_one($query_params);
63 63
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param array $query_params like EEM_base::get_all's $query_params
68 68
 	 * @return EE_Soft_Delete_Base_Class
69 69
 	 */
70
-	public function get_one_deleted_or_undeleted($query_params = array()){
70
+	public function get_one_deleted_or_undeleted($query_params = array()) {
71 71
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
72 72
 		return parent::get_one($query_params);
73 73
 	}
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 	 * @param int|string $id
78 78
 	 * @return EE_Soft_Delete_Base_Class
79 79
 	 */
80
-	public function get_one_by_ID_but_ignore_deleted($id){
80
+	public function get_one_by_ID_but_ignore_deleted($id) {
81 81
 		return $this->get_one(
82 82
 			$this->alter_query_params_to_restrict_by_ID(
83 83
 				$id,
84
-				array( 'default_where_conditions' => 'default' )
84
+				array('default_where_conditions' => 'default')
85 85
 			)
86 86
 		);
87 87
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param bool 	 $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
94 94
 	 * @return int
95 95
 	 */
96
-	public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE){
96
+	public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE) {
97 97
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
98 98
 		return parent::count($query_params, $field_to_count, $distinct);
99 99
 	}
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 * @param array $query_params like EEM_Base::get_all's $query_params
104 104
 	 * @return array like EEM_Base::get_all's $query_params
105 105
 	 */
106
-	protected function _alter_query_params_so_only_trashed_items_included($query_params){
107
-		$deletedFlagFieldName=$this->deleted_field_name();
108
-		$query_params[0][$deletedFlagFieldName]=true;
106
+	protected function _alter_query_params_so_only_trashed_items_included($query_params) {
107
+		$deletedFlagFieldName = $this->deleted_field_name();
108
+		$query_params[0][$deletedFlagFieldName] = true;
109 109
 		return $query_params;
110 110
 	}
111 111
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param array $query_params like EEM_Base::get_all's $query_params
117 117
      * @return array like EEM_Base::get_all's $query_params
118 118
      */
119
-	public function alter_query_params_so_only_trashed_items_included($query_params){
119
+	public function alter_query_params_so_only_trashed_items_included($query_params) {
120 120
 	    return $this->_alter_query_params_so_only_trashed_items_included($query_params);
121 121
     }
122 122
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @param array $query_params
126 126
 	 * @return array
127 127
 	 */
128
-	public function alter_query_params_so_deleted_and_undeleted_items_included( $query_params = array() ){
128
+	public function alter_query_params_so_deleted_and_undeleted_items_included($query_params = array()) {
129 129
 		return $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
130 130
 	}
131 131
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @param array $query_params
135 135
 	 * @return array
136 136
 	 */
137
-	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){
138
-		if( ! isset( $query_params[ 'default_where_conditions' ] ) ) {
137
+	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) {
138
+		if ( ! isset($query_params['default_where_conditions'])) {
139 139
 			$query_params['default_where_conditions'] = 'minimum';
140 140
 		}
141 141
 		return $query_params;
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 * @param bool 	 $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
149 149
 	 * @return int
150 150
 	 */
151
-	public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE){
151
+	public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE) {
152 152
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
153
-		return parent::count($query_params,$field_to_count, $distinct);
153
+		return parent::count($query_params, $field_to_count, $distinct);
154 154
 	}
155 155
 
156 156
 	/**
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string $field_to_sum
160 160
 	 * @return int
161 161
 	 */
162
-	public function sum_deleted($query_params = null, $field_to_sum = null){
162
+	public function sum_deleted($query_params = null, $field_to_sum = null) {
163 163
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
164 164
 		return parent::sum($query_params, $field_to_sum);
165 165
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param string $field_to_sum
171 171
 	 * @return int
172 172
 	 */
173
-	public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null){
173
+	public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null) {
174 174
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
175 175
 		parent::sum($query_params, $field_to_sum);
176 176
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @param array $query_params like EEM_Base::get_all
181 181
 	 * @return EE_Soft_Delete_Base_Class[]
182 182
 	 */
183
-	public function get_all_deleted_and_undeleted($query_params = array()){
183
+	public function get_all_deleted_and_undeleted($query_params = array()) {
184 184
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
185 185
 		return parent::get_all($query_params);
186 186
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @param array $query_params like EEM_Base::get_all
191 191
 	 * @return EE_Soft_Delete_Base_Class[]
192 192
 	 */
193
-	public function get_all_deleted($query_params = array()){
193
+	public function get_all_deleted($query_params = array()) {
194 194
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
195 195
 		return parent::get_all($query_params);
196 196
 	}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
209 209
 	 * @return boolean success
210 210
 	 */
211
-	public function delete_permanently($query_params = array(), $allow_blocking = true){
211
+	public function delete_permanently($query_params = array(), $allow_blocking = true) {
212 212
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
213 213
 		return parent::delete_permanently($query_params, $allow_blocking);
214 214
 	}
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	 * @param mixed $ID int if primary key is an int, string otherwise
220 220
 	 * @return boolean success
221 221
 	 */
222
-	public function restore_by_ID($ID=FALSE){
223
-		return $this->delete_or_restore_by_ID(false,$ID);
222
+	public function restore_by_ID($ID = FALSE) {
223
+		return $this->delete_or_restore_by_ID(false, $ID);
224 224
 	}
225 225
 	/**
226 226
 	 * For deleting or restoring a particular item. Note that this model is a SOFT-DELETABLE model! However,
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
 	 * @param mixed $ID int if primary key is an int, string otherwise
230 230
 	 * @return boolean
231 231
 	 */
232
-	public function delete_or_restore_by_ID($delete=true,$ID=FALSE){
233
-		if ( ! $ID ) {
232
+	public function delete_or_restore_by_ID($delete = true, $ID = FALSE) {
233
+		if ( ! $ID) {
234 234
 			return FALSE;
235 235
 		}
236 236
 		if (
237 237
 			$this->delete_or_restore(
238 238
 				$delete,
239
-				$this->alter_query_params_to_restrict_by_ID( $ID )
239
+				$this->alter_query_params_to_restrict_by_ID($ID)
240 240
 			)
241 241
 		) {
242 242
 			return TRUE;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @param bool  $block_deletes
257 257
 	 * @return boolean
258 258
 	 */
259
-	public function delete($query_params = array(), $block_deletes = false){
259
+	public function delete($query_params = array(), $block_deletes = false) {
260 260
 		//no matter what, we WON'T block soft deletes.
261 261
 		return $this->delete_or_restore(true, $query_params);
262 262
 	}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * @param array $query_params like EEM_Base::get_all
268 268
 	 * @return boolean
269 269
 	 */
270
-	public function restore($query_params = array()){
270
+	public function restore($query_params = array()) {
271 271
 		return $this->delete_or_restore(false, $query_params);
272 272
 	}
273 273
 	/**
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 	 * @param array $query_params like EEM_Base::get_all
277 277
 	 * @return boolean
278 278
 	 */
279
-	function delete_or_restore($delete=true,$query_params = array()){
280
-		$deletedFlagFieldName=$this->deleted_field_name();
279
+	function delete_or_restore($delete = true, $query_params = array()) {
280
+		$deletedFlagFieldName = $this->deleted_field_name();
281 281
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
282
-		if ( $this->update (array($deletedFlagFieldName=>$delete), $query_params )) {
282
+		if ($this->update(array($deletedFlagFieldName=>$delete), $query_params)) {
283 283
 			return TRUE;
284 284
 		} else {
285 285
 			return FALSE;
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * be aware that model objects being used could get out-of-sync with the database
298 298
 	 * @return int number of items updated
299 299
 	 */
300
-	public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE ){
300
+	public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
301 301
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
302
-		return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync );
302
+		return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync);
303 303
 	}
304 304
 }
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/RegistrationsReport.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@
 block discarded – undo
350 350
     static function ordinalize($number){
351 351
         if(in_array(($number % 100), range(11, 13))){
352 352
             return $number . 'th';
353
-        }else{
353
+        } else{
354 354
             switch(($number % 10)){
355 355
                 case 1:
356 356
                     return $number . 'st';
Please login to merge, or discard this patch.
Indentation   +395 added lines, -396 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
18 18
 
19 19
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
-    exit('No direct script access allowed');
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -25,424 +25,423 @@  discard block
 block discarded – undo
25 25
 class RegistrationsReport extends JobHandlerFile
26 26
 {
27 27
 
28
-    /**
29
-     * Performs any necessary setup for starting the job. This is also a good
30
-     * place to setup the $job_arguments which will be used for subsequent HTTP requests
31
-     * when continue_job will be called
32
-     *
33
-     * @param JobParameters $job_parameters
34
-     * @throws BatchRequestException
35
-     * @return JobStepResponse
36
-     */
37
-    public function create_job(JobParameters $job_parameters)
38
-    {
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
-            throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso'));
42
-        }
43
-        $filepath = $this->create_file_from_job_with_name($job_parameters->job_id(),
44
-            $this->get_filename($event_id));
45
-        $job_parameters->add_extra_data('filepath', $filepath);
46
-        if ($job_parameters->request_datum('use_filters', false)) {
47
-            $query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array())));
48
-        } else {
49
-            $query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array(
50
-                array(
51
-                    'OR'                 => array(
52
-                        //don't include registrations from failed or abandoned transactions...
53
-                        'Transaction.STS_ID' => array(
54
-                            'NOT IN',
55
-                            array(
56
-                                \EEM_Transaction::failed_status_code,
57
-                                \EEM_Transaction::abandoned_status_code,
58
-                            ),
59
-                        ),
60
-                        //unless the registration is approved, in which case include it regardless of transaction status
61
-                        'STS_ID'             => \EEM_Registration::status_id_approved,
62
-                    ),
63
-                    'Ticket.TKT_deleted' => array('IN', array(true, false)),
64
-                ),
65
-                'order_by'   => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'),
66
-                'force_join' => array('Transaction', 'Ticket', 'Attendee'),
67
-                'caps'       => \EEM_Base::caps_read_admin,
68
-            ), $event_id);
69
-            if ($event_id) {
70
-                $query_params[0]['EVT_ID'] = $event_id;
71
-            } else {
72
-                $query_params['force_join'][] = 'Event';
73
-            }
74
-        }
75
-        if ( ! isset($query_params['force_join'])) {
76
-            $query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee');
77
-        }
78
-        $job_parameters->add_extra_data('query_params', $query_params);
79
-        $question_labels = $this->_get_question_labels($query_params);
80
-        $job_parameters->add_extra_data('question_labels', $question_labels);
81
-        $job_parameters->set_job_size(
82
-            \EEM_Registration::instance()->count(
83
-                array_diff_key(
84
-                    $query_params,
85
-                    array_flip(
86
-                        array( 'limit' )
87
-                    )
88
-                )
89
-            )
90
-        );
91
-        //we should also set the header columns
92
-        $csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'),
93
-            $job_parameters->extra_datum('query_params'));
94
-        \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
95
-        //if we actually processed a row there, record it
96
-        if ($job_parameters->job_size()) {
97
-            $job_parameters->mark_processed(1);
98
-        }
99
-        return new JobStepResponse($job_parameters,
100
-            __('Registrations report started successfully...', 'event_espresso'));
101
-    }
28
+	/**
29
+	 * Performs any necessary setup for starting the job. This is also a good
30
+	 * place to setup the $job_arguments which will be used for subsequent HTTP requests
31
+	 * when continue_job will be called
32
+	 *
33
+	 * @param JobParameters $job_parameters
34
+	 * @throws BatchRequestException
35
+	 * @return JobStepResponse
36
+	 */
37
+	public function create_job(JobParameters $job_parameters)
38
+	{
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
+			throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso'));
42
+		}
43
+		$filepath = $this->create_file_from_job_with_name($job_parameters->job_id(),
44
+			$this->get_filename($event_id));
45
+		$job_parameters->add_extra_data('filepath', $filepath);
46
+		if ($job_parameters->request_datum('use_filters', false)) {
47
+			$query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array())));
48
+		} else {
49
+			$query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array(
50
+				array(
51
+					'OR'                 => array(
52
+						//don't include registrations from failed or abandoned transactions...
53
+						'Transaction.STS_ID' => array(
54
+							'NOT IN',
55
+							array(
56
+								\EEM_Transaction::failed_status_code,
57
+								\EEM_Transaction::abandoned_status_code,
58
+							),
59
+						),
60
+						//unless the registration is approved, in which case include it regardless of transaction status
61
+						'STS_ID'             => \EEM_Registration::status_id_approved,
62
+					),
63
+					'Ticket.TKT_deleted' => array('IN', array(true, false)),
64
+				),
65
+				'order_by'   => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'),
66
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
67
+				'caps'       => \EEM_Base::caps_read_admin,
68
+			), $event_id);
69
+			if ($event_id) {
70
+				$query_params[0]['EVT_ID'] = $event_id;
71
+			} else {
72
+				$query_params['force_join'][] = 'Event';
73
+			}
74
+		}
75
+		if ( ! isset($query_params['force_join'])) {
76
+			$query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee');
77
+		}
78
+		$job_parameters->add_extra_data('query_params', $query_params);
79
+		$question_labels = $this->_get_question_labels($query_params);
80
+		$job_parameters->add_extra_data('question_labels', $question_labels);
81
+		$job_parameters->set_job_size(
82
+			\EEM_Registration::instance()->count(
83
+				array_diff_key(
84
+					$query_params,
85
+					array_flip(
86
+						array( 'limit' )
87
+					)
88
+				)
89
+			)
90
+		);
91
+		//we should also set the header columns
92
+		$csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'),
93
+			$job_parameters->extra_datum('query_params'));
94
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
95
+		//if we actually processed a row there, record it
96
+		if ($job_parameters->job_size()) {
97
+			$job_parameters->mark_processed(1);
98
+		}
99
+		return new JobStepResponse($job_parameters,
100
+			__('Registrations report started successfully...', 'event_espresso'));
101
+	}
102 102
 
103 103
 
104 104
 
105
-    /**
106
-     * Gets the filename
107
-     * @return string
108
-     */
109
-    protected function get_filename()
110
-    {
111
-        return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql')));
112
-    }
105
+	/**
106
+	 * Gets the filename
107
+	 * @return string
108
+	 */
109
+	protected function get_filename()
110
+	{
111
+		return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql')));
112
+	}
113 113
 
114 114
 
115 115
 
116
-    /**
117
-     * Gets the questions which are to be used for this report, so they
118
-     * can be remembered for later
119
-     *
120
-     * @param array $registration_query_params
121
-     * @return array question admin labels to be used for this report
122
-     */
123
-    protected function _get_question_labels($registration_query_params)
124
-    {
125
-        $where = isset($registration_query_params[0]) ? $registration_query_params[0] : null;
126
-        $question_query_params = array();
127
-        if ($where !== null) {
128
-            $question_query_params = array(
129
-                $this->_change_registration_where_params_to_question_where_params($registration_query_params[0]),
130
-            );
131
-        }
132
-        $question_query_params[0]['Answer.ANS_ID'] = array( 'IS_NOT_NULL' );
133
-        $question_query_params['group_by'] = array( 'QST_ID' );
134
-        return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) );
135
-    }
116
+	/**
117
+	 * Gets the questions which are to be used for this report, so they
118
+	 * can be remembered for later
119
+	 *
120
+	 * @param array $registration_query_params
121
+	 * @return array question admin labels to be used for this report
122
+	 */
123
+	protected function _get_question_labels($registration_query_params)
124
+	{
125
+		$where = isset($registration_query_params[0]) ? $registration_query_params[0] : null;
126
+		$question_query_params = array();
127
+		if ($where !== null) {
128
+			$question_query_params = array(
129
+				$this->_change_registration_where_params_to_question_where_params($registration_query_params[0]),
130
+			);
131
+		}
132
+		$question_query_params[0]['Answer.ANS_ID'] = array( 'IS_NOT_NULL' );
133
+		$question_query_params['group_by'] = array( 'QST_ID' );
134
+		return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) );
135
+	}
136 136
 
137 137
 
138 138
 
139
-    /**
140
-     * Takes where params meant for registrations and changes them to work for questions
141
-     *
142
-     * @param array $reg_where_params
143
-     * @return array
144
-     */
145
-    protected function _change_registration_where_params_to_question_where_params($reg_where_params)
146
-    {
147
-        $question_where_params = array();
148
-        foreach ($reg_where_params as $key => $val) {
149
-            if (\EEM_Registration::instance()->is_logic_query_param_key($key)) {
150
-                $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val);
151
-            } else {
152
-                //it's a normal where condition
153
-                $question_where_params['Question_Group.Event.Registration.' . $key] = $val;
154
-            }
155
-        }
156
-        return $question_where_params;
157
-    }
139
+	/**
140
+	 * Takes where params meant for registrations and changes them to work for questions
141
+	 *
142
+	 * @param array $reg_where_params
143
+	 * @return array
144
+	 */
145
+	protected function _change_registration_where_params_to_question_where_params($reg_where_params)
146
+	{
147
+		$question_where_params = array();
148
+		foreach ($reg_where_params as $key => $val) {
149
+			if (\EEM_Registration::instance()->is_logic_query_param_key($key)) {
150
+				$question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val);
151
+			} else {
152
+				//it's a normal where condition
153
+				$question_where_params['Question_Group.Event.Registration.' . $key] = $val;
154
+			}
155
+		}
156
+		return $question_where_params;
157
+	}
158 158
 
159 159
 
160 160
 
161
-    /**
162
-     * Performs another step of the job
163
-     *
164
-     * @param JobParameters $job_parameters
165
-     * @param int           $batch_size
166
-     * @return JobStepResponse
167
-     * @throws \EE_Error
168
-     */
169
-    public function continue_job(JobParameters $job_parameters, $batch_size = 50)
170
-    {
171
-        if( $job_parameters->units_processed() < $job_parameters->job_size() ) {
172
-            $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'),
173
-                $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'),
174
-                $job_parameters->extra_datum('query_params'));
175
-            \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
176
-            $units_processed = count($csv_data);
177
-        }else{
178
-            $units_processed = 0;
179
-        }
180
-        $job_parameters->mark_processed($units_processed);
181
-        $extra_response_data = array(
182
-            'file_url' => '',
183
-        );
184
-        if ($units_processed < $batch_size) {
185
-            $job_parameters->set_status(JobParameters::status_complete);
186
-            $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
187
-        }
161
+	/**
162
+	 * Performs another step of the job
163
+	 *
164
+	 * @param JobParameters $job_parameters
165
+	 * @param int           $batch_size
166
+	 * @return JobStepResponse
167
+	 * @throws \EE_Error
168
+	 */
169
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50)
170
+	{
171
+		if( $job_parameters->units_processed() < $job_parameters->job_size() ) {
172
+			$csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'),
173
+				$job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'),
174
+				$job_parameters->extra_datum('query_params'));
175
+			\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
176
+			$units_processed = count($csv_data);
177
+		}else{
178
+			$units_processed = 0;
179
+		}
180
+		$job_parameters->mark_processed($units_processed);
181
+		$extra_response_data = array(
182
+			'file_url' => '',
183
+		);
184
+		if ($units_processed < $batch_size) {
185
+			$job_parameters->set_status(JobParameters::status_complete);
186
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
187
+		}
188 188
 
189
-        return new JobStepResponse($job_parameters,
190
-            sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)),
191
-            $extra_response_data);
192
-    }
189
+		return new JobStepResponse($job_parameters,
190
+			sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)),
191
+			$extra_response_data);
192
+	}
193 193
 
194 194
 
195 195
 
196
-    /**
197
-     * Gets the csv data for a batch of registrations
198
-
199
-     *
196
+	/**
197
+	 * Gets the csv data for a batch of registrations
198
+	 *
200 199
 *@param int|null    $event_id
201
-     * @param int   $offset
202
-     * @param int   $limit
203
-     * @param array $question_labels the IDs for all the questions which were answered by someone in this selection
204
-     * @param array $query_params    for using where querying the model
205
-     * @return array top-level keys are numeric, next-level keys are column headers
206
-     */
207
-    function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params)
208
-    {
209
-        $reg_fields_to_include = array(
210
-            'TXN_ID',
211
-            'ATT_ID',
212
-            'REG_ID',
213
-            'REG_date',
214
-            'REG_code',
215
-            'REG_count',
216
-            'REG_final_price',
217
-        );
218
-        $att_fields_to_include = array(
219
-            'ATT_fname',
220
-            'ATT_lname',
221
-            'ATT_email',
222
-            'ATT_address',
223
-            'ATT_address2',
224
-            'ATT_city',
225
-            'STA_ID',
226
-            'CNT_ISO',
227
-            'ATT_zip',
228
-            'ATT_phone',
229
-        );
230
-        $registrations_csv_ready_array = array();
231
-        $reg_model = \EE_Registry::instance()->load_model('Registration');
232
-        $query_params['limit'] = array($offset, $limit);
233
-        $registration_rows = $reg_model->get_all_wpdb_results($query_params);
234
-        $registration_ids = array();
235
-        foreach ($registration_rows as $reg_row) {
236
-            $registration_ids[] = intval($reg_row['Registration.REG_ID']);
237
-        }
238
-        foreach ($registration_rows as $reg_row) {
239
-            if (is_array($reg_row)) {
240
-                $reg_csv_array = array();
241
-                if ( ! $event_id) {
242
-                    //get the event's name and Id
243
-                    $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'),
244
-                        \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name',
245
-                            $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
246
-                }
247
-                $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
248
-                /*@var $reg_row EE_Registration */
249
-                foreach ($reg_fields_to_include as $field_name) {
250
-                    $field = $reg_model->field_settings_for($field_name);
251
-                    if ($field_name == 'REG_final_price') {
252
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
253
-                            $reg_row['Registration.REG_final_price'], 'localized_float');
254
-                    } elseif ($field_name == 'REG_count') {
255
-                        $value = sprintf(__('%s of %s', 'event_espresso'),
256
-                            \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count',
257
-                                $reg_row['Registration.REG_count']),
258
-                            \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size',
259
-                                $reg_row['Registration.REG_group_size']));
260
-                    } elseif ($field_name == 'REG_date') {
261
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
262
-                            $reg_row['Registration.REG_date'], 'no_html');
263
-                    } else {
264
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
265
-                            $reg_row[$field->get_qualified_column()]);
266
-                    }
267
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
268
-                    if ($field_name == 'REG_final_price') {
269
-                        //add a column named Currency after the final price
270
-                        $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
271
-                    }
272
-                }
273
-                //get pretty status
274
-                $stati = \EEM_Status::instance()->localized_status(array(
275
-                    $reg_row['Registration.STS_ID']     => __('unknown', 'event_espresso'),
276
-                    $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'),
277
-                ), false, 'sentence');
278
-                $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
279
-                //get pretty transaction status
280
-                $reg_csv_array[__("Transaction Status",
281
-                    'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
282
-                $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg
283
-                    ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total',
284
-                        $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
285
-                $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg
286
-                    ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid',
287
-                        $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
288
-                $payment_methods = array();
289
-                $gateway_txn_ids_etc = array();
290
-                $payment_times = array();
291
-                if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
292
-                    $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array(
293
-                        array(
294
-                            'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
295
-                            'STS_ID' => \EEM_Payment::status_id_approved,
296
-                        ),
297
-                        'force_join' => array('Payment_Method'),
298
-                    ), ARRAY_A,
299
-                        'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time');
300
-                    foreach ($payments_info as $payment_method_and_gateway_txn_id) {
301
-                        $payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
302
-                            ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
303
-                        $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
304
-                            ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
305
-                        $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
306
-                            ? $payment_method_and_gateway_txn_id['payment_time'] : '';
307
-                    }
308
-                }
309
-                $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
310
-                $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
311
-                $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
312
-                //get whether or not the user has checked in
313
-                $reg_csv_array[__("Check-Ins",
314
-                    "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
315
-                //get ticket of registration and its price
316
-                $ticket_model = \EE_Registry::instance()->load_model('Ticket');
317
-                if ($reg_row['Ticket.TKT_ID']) {
318
-                    $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name',
319
-                        $reg_row['Ticket.TKT_name']);
320
-                    $datetimes_strings = array();
321
-                    foreach (
322
-                        \EEM_Datetime::instance()->get_all_wpdb_results(array(
323
-                            array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']),
324
-                            'order_by'                 => array('DTT_EVT_start' => 'ASC'),
325
-                            'default_where_conditions' => 'none',
326
-                        )) as $datetime
327
-                    ) {
328
-                        $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(),
329
-                            'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
330
-                    }
331
-                } else {
332
-                    $ticket_name = __('Unknown', 'event_espresso');
333
-                    $datetimes_strings = array(__('Unknown', 'event_espresso'));
334
-                }
335
-                $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
336
-                $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
337
-                //get datetime(s) of registration
338
-                //add attendee columns
339
-                foreach ($att_fields_to_include as $att_field_name) {
340
-                    $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
341
-                    if ($reg_row['Attendee_CPT.ID']) {
342
-                        if ($att_field_name == 'STA_ID') {
343
-                            $value = \EEM_State::instance()
344
-                                               ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])),
345
-                                                   'STA_name');
346
-                        } elseif ($att_field_name == 'CNT_ISO') {
347
-                            $value = \EEM_Country::instance()
348
-                                                 ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])),
349
-                                                     'CNT_name');
350
-                        } else {
351
-                            $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(),
352
-                                $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
353
-                        }
354
-                    } else {
355
-                        $value = '';
356
-                    }
357
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
358
-                }
359
-                //make sure each registration has the same questions in the same order
360
-                foreach ($question_labels as $question_label) {
361
-                    if ( ! isset($reg_csv_array[$question_label])) {
362
-                        $reg_csv_array[$question_label] = null;
363
-                    }
364
-                }
365
-                $answers = \EEM_Answer::instance()->get_all_wpdb_results(array(
366
-                    array('REG_ID' => $reg_row['Registration.REG_ID']),
367
-                    'force_join' => array('Question'),
368
-                ));
369
-                //now fill out the questions THEY answered
370
-                foreach ($answers as $answer_row) {
371
-                    if ($answer_row['Question.QST_ID']) {
372
-                        $question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(),
373
-                            'QST_admin_label', $answer_row['Question.QST_admin_label']);
374
-                    } else {
375
-                        $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
376
-                    }
377
-                    if (isset($answer_row['Question.QST_type'])
378
-                        && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
379
-                    ) {
380
-                        $reg_csv_array[$question_label] = \EEM_State::instance()
381
-                                                                    ->get_state_name_by_ID($answer_row['Answer.ANS_value']);
382
-                    } else {
383
-                        //this isn't for html, so don't show html entities
384
-                        $reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(),
385
-                            'ANS_value', $answer_row['Answer.ANS_value']));
386
-                    }
387
-                }
388
-                $registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array',
389
-                    $reg_csv_array, $reg_row);
390
-            }
391
-        }
392
-        //if we couldn't export anything, we want to at least show the column headers
393
-        if (empty($registrations_csv_ready_array)) {
394
-            $reg_csv_array = array();
395
-            $model_and_fields_to_include = array(
396
-                'Registration' => $reg_fields_to_include,
397
-                'Attendee'     => $att_fields_to_include,
398
-            );
399
-            foreach ($model_and_fields_to_include as $model_name => $field_list) {
400
-                $model = \EE_Registry::instance()->load_model($model_name);
401
-                foreach ($field_list as $field_name) {
402
-                    $field = $model->field_settings_for($field_name);
403
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
404
-                }
405
-            }
406
-            $registrations_csv_ready_array[] = $reg_csv_array;
407
-        }
408
-        return $registrations_csv_ready_array;
409
-    }
200
+	 * @param int   $offset
201
+	 * @param int   $limit
202
+	 * @param array $question_labels the IDs for all the questions which were answered by someone in this selection
203
+	 * @param array $query_params    for using where querying the model
204
+	 * @return array top-level keys are numeric, next-level keys are column headers
205
+	 */
206
+	function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params)
207
+	{
208
+		$reg_fields_to_include = array(
209
+			'TXN_ID',
210
+			'ATT_ID',
211
+			'REG_ID',
212
+			'REG_date',
213
+			'REG_code',
214
+			'REG_count',
215
+			'REG_final_price',
216
+		);
217
+		$att_fields_to_include = array(
218
+			'ATT_fname',
219
+			'ATT_lname',
220
+			'ATT_email',
221
+			'ATT_address',
222
+			'ATT_address2',
223
+			'ATT_city',
224
+			'STA_ID',
225
+			'CNT_ISO',
226
+			'ATT_zip',
227
+			'ATT_phone',
228
+		);
229
+		$registrations_csv_ready_array = array();
230
+		$reg_model = \EE_Registry::instance()->load_model('Registration');
231
+		$query_params['limit'] = array($offset, $limit);
232
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
233
+		$registration_ids = array();
234
+		foreach ($registration_rows as $reg_row) {
235
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
236
+		}
237
+		foreach ($registration_rows as $reg_row) {
238
+			if (is_array($reg_row)) {
239
+				$reg_csv_array = array();
240
+				if ( ! $event_id) {
241
+					//get the event's name and Id
242
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'),
243
+						\EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name',
244
+							$reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
245
+				}
246
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
247
+				/*@var $reg_row EE_Registration */
248
+				foreach ($reg_fields_to_include as $field_name) {
249
+					$field = $reg_model->field_settings_for($field_name);
250
+					if ($field_name == 'REG_final_price') {
251
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
252
+							$reg_row['Registration.REG_final_price'], 'localized_float');
253
+					} elseif ($field_name == 'REG_count') {
254
+						$value = sprintf(__('%s of %s', 'event_espresso'),
255
+							\EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count',
256
+								$reg_row['Registration.REG_count']),
257
+							\EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size',
258
+								$reg_row['Registration.REG_group_size']));
259
+					} elseif ($field_name == 'REG_date') {
260
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
261
+							$reg_row['Registration.REG_date'], 'no_html');
262
+					} else {
263
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
264
+							$reg_row[$field->get_qualified_column()]);
265
+					}
266
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
267
+					if ($field_name == 'REG_final_price') {
268
+						//add a column named Currency after the final price
269
+						$reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
270
+					}
271
+				}
272
+				//get pretty status
273
+				$stati = \EEM_Status::instance()->localized_status(array(
274
+					$reg_row['Registration.STS_ID']     => __('unknown', 'event_espresso'),
275
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'),
276
+				), false, 'sentence');
277
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
278
+				//get pretty transaction status
279
+				$reg_csv_array[__("Transaction Status",
280
+					'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
281
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg
282
+					? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total',
283
+						$reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
284
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg
285
+					? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid',
286
+						$reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
287
+				$payment_methods = array();
288
+				$gateway_txn_ids_etc = array();
289
+				$payment_times = array();
290
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
291
+					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array(
292
+						array(
293
+							'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
294
+							'STS_ID' => \EEM_Payment::status_id_approved,
295
+						),
296
+						'force_join' => array('Payment_Method'),
297
+					), ARRAY_A,
298
+						'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time');
299
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
300
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
301
+							? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
302
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
303
+							? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
304
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
305
+							? $payment_method_and_gateway_txn_id['payment_time'] : '';
306
+					}
307
+				}
308
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
309
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
310
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
311
+				//get whether or not the user has checked in
312
+				$reg_csv_array[__("Check-Ins",
313
+					"event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
314
+				//get ticket of registration and its price
315
+				$ticket_model = \EE_Registry::instance()->load_model('Ticket');
316
+				if ($reg_row['Ticket.TKT_ID']) {
317
+					$ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name',
318
+						$reg_row['Ticket.TKT_name']);
319
+					$datetimes_strings = array();
320
+					foreach (
321
+						\EEM_Datetime::instance()->get_all_wpdb_results(array(
322
+							array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']),
323
+							'order_by'                 => array('DTT_EVT_start' => 'ASC'),
324
+							'default_where_conditions' => 'none',
325
+						)) as $datetime
326
+					) {
327
+						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(),
328
+							'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
329
+					}
330
+				} else {
331
+					$ticket_name = __('Unknown', 'event_espresso');
332
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
333
+				}
334
+				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
335
+				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
336
+				//get datetime(s) of registration
337
+				//add attendee columns
338
+				foreach ($att_fields_to_include as $att_field_name) {
339
+					$field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
340
+					if ($reg_row['Attendee_CPT.ID']) {
341
+						if ($att_field_name == 'STA_ID') {
342
+							$value = \EEM_State::instance()
343
+											   ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])),
344
+												   'STA_name');
345
+						} elseif ($att_field_name == 'CNT_ISO') {
346
+							$value = \EEM_Country::instance()
347
+												 ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])),
348
+													 'CNT_name');
349
+						} else {
350
+							$value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(),
351
+								$att_field_name, $reg_row[$field_obj->get_qualified_column()]);
352
+						}
353
+					} else {
354
+						$value = '';
355
+					}
356
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
357
+				}
358
+				//make sure each registration has the same questions in the same order
359
+				foreach ($question_labels as $question_label) {
360
+					if ( ! isset($reg_csv_array[$question_label])) {
361
+						$reg_csv_array[$question_label] = null;
362
+					}
363
+				}
364
+				$answers = \EEM_Answer::instance()->get_all_wpdb_results(array(
365
+					array('REG_ID' => $reg_row['Registration.REG_ID']),
366
+					'force_join' => array('Question'),
367
+				));
368
+				//now fill out the questions THEY answered
369
+				foreach ($answers as $answer_row) {
370
+					if ($answer_row['Question.QST_ID']) {
371
+						$question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(),
372
+							'QST_admin_label', $answer_row['Question.QST_admin_label']);
373
+					} else {
374
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
375
+					}
376
+					if (isset($answer_row['Question.QST_type'])
377
+						&& $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
378
+					) {
379
+						$reg_csv_array[$question_label] = \EEM_State::instance()
380
+																	->get_state_name_by_ID($answer_row['Answer.ANS_value']);
381
+					} else {
382
+						//this isn't for html, so don't show html entities
383
+						$reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(),
384
+							'ANS_value', $answer_row['Answer.ANS_value']));
385
+					}
386
+				}
387
+				$registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array',
388
+					$reg_csv_array, $reg_row);
389
+			}
390
+		}
391
+		//if we couldn't export anything, we want to at least show the column headers
392
+		if (empty($registrations_csv_ready_array)) {
393
+			$reg_csv_array = array();
394
+			$model_and_fields_to_include = array(
395
+				'Registration' => $reg_fields_to_include,
396
+				'Attendee'     => $att_fields_to_include,
397
+			);
398
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
399
+				$model = \EE_Registry::instance()->load_model($model_name);
400
+				foreach ($field_list as $field_name) {
401
+					$field = $model->field_settings_for($field_name);
402
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
403
+				}
404
+			}
405
+			$registrations_csv_ready_array[] = $reg_csv_array;
406
+		}
407
+		return $registrations_csv_ready_array;
408
+	}
410 409
 
411 410
 
412 411
 
413
-    /**
414
-     * Counts total unit to process
415
-     *
416
-     * @deprecated since 4.9.19
417
-     * @param int|array $event_id
418
-     * @return int
419
-     */
420
-    public function count_units_to_process($event_id)
421
-    {
422
-        //use the legacy filter
423
-        if ($event_id) {
424
-            $query_params[0]['EVT_ID'] = $event_id;
425
-        } else {
426
-            $query_params['force_join'][] = 'Event';
427
-        }
428
-        return \EEM_Registration::instance()->count($query_params);
429
-    }
412
+	/**
413
+	 * Counts total unit to process
414
+	 *
415
+	 * @deprecated since 4.9.19
416
+	 * @param int|array $event_id
417
+	 * @return int
418
+	 */
419
+	public function count_units_to_process($event_id)
420
+	{
421
+		//use the legacy filter
422
+		if ($event_id) {
423
+			$query_params[0]['EVT_ID'] = $event_id;
424
+		} else {
425
+			$query_params['force_join'][] = 'Event';
426
+		}
427
+		return \EEM_Registration::instance()->count($query_params);
428
+	}
430 429
 
431 430
 
432 431
 
433
-    /**
434
-     * Performs any clean-up logic when we know the job is completed.
435
-     * In this case, we delete the temporary file
436
-     *
437
-     * @param JobParameters $job_parameters
438
-     * @return boolean
439
-     */
440
-    public function cleanup_job(JobParameters $job_parameters)
441
-    {
442
-        $this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
443
-            true, 'd');
444
-        return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
445
-    }
432
+	/**
433
+	 * Performs any clean-up logic when we know the job is completed.
434
+	 * In this case, we delete the temporary file
435
+	 *
436
+	 * @param JobParameters $job_parameters
437
+	 * @return boolean
438
+	 */
439
+	public function cleanup_job(JobParameters $job_parameters)
440
+	{
441
+		$this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
442
+			true, 'd');
443
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
444
+	}
446 445
 }
447 446
 
448 447
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 array_diff_key(
84 84
                     $query_params,
85 85
                     array_flip(
86
-                        array( 'limit' )
86
+                        array('limit')
87 87
                     )
88 88
                 )
89 89
             )
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
                 $this->_change_registration_where_params_to_question_where_params($registration_query_params[0]),
130 130
             );
131 131
         }
132
-        $question_query_params[0]['Answer.ANS_ID'] = array( 'IS_NOT_NULL' );
133
-        $question_query_params['group_by'] = array( 'QST_ID' );
134
-        return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) );
132
+        $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL');
133
+        $question_query_params['group_by'] = array('QST_ID');
134
+        return array_unique(\EEM_Question::instance()->get_col($question_query_params, 'QST_admin_label'));
135 135
     }
136 136
 
137 137
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                 $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val);
151 151
             } else {
152 152
                 //it's a normal where condition
153
-                $question_where_params['Question_Group.Event.Registration.' . $key] = $val;
153
+                $question_where_params['Question_Group.Event.Registration.'.$key] = $val;
154 154
             }
155 155
         }
156 156
         return $question_where_params;
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public function continue_job(JobParameters $job_parameters, $batch_size = 50)
170 170
     {
171
-        if( $job_parameters->units_processed() < $job_parameters->job_size() ) {
171
+        if ($job_parameters->units_processed() < $job_parameters->job_size()) {
172 172
             $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'),
173 173
                 $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'),
174 174
                 $job_parameters->extra_datum('query_params'));
175 175
             \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
176 176
             $units_processed = count($csv_data);
177
-        }else{
177
+        } else {
178 178
             $units_processed = 0;
179 179
         }
180 180
         $job_parameters->mark_processed($units_processed);
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		$this->_columns = array_merge( $columns, $this->_columns );
88 88
 		$this->_primary_column = '_REG_att_checked_in';
89 89
 		if ( ! empty( $evt_id )
90
-		     && EE_Registry::instance()->CAP->current_user_can(
90
+			 && EE_Registry::instance()->CAP->current_user_can(
91 91
 				'ee_read_registrations',
92 92
 				'espresso_registrations_registrations_reports',
93 93
 				$evt_id
@@ -104,28 +104,28 @@  discard block
 block discarded – undo
104 104
 				),
105 105
 			);
106 106
 		}
107
-        $this->_bottom_buttons['report_filtered'] = array(
108
-            'route'         => 'registrations_checkin_report',
109
-            'extra_request' => array(
110
-                'use_filters' => true,
111
-                'filters'     => array_merge(
112
-                    array(
113
-                        'EVT_ID' => $evt_id,
114
-                    ),
115
-                    array_diff_key(
116
-                        $this->_req_data,
117
-                        array_flip(
118
-                            array(
119
-                                'page',
120
-                                'action',
121
-                                'default_nonce',
122
-                            )
123
-                        )
124
-                    )
125
-                ),
126
-                'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
127
-            ),
128
-        );
107
+		$this->_bottom_buttons['report_filtered'] = array(
108
+			'route'         => 'registrations_checkin_report',
109
+			'extra_request' => array(
110
+				'use_filters' => true,
111
+				'filters'     => array_merge(
112
+					array(
113
+						'EVT_ID' => $evt_id,
114
+					),
115
+					array_diff_key(
116
+						$this->_req_data,
117
+						array_flip(
118
+							array(
119
+								'page',
120
+								'action',
121
+								'default_nonce',
122
+							)
123
+						)
124
+					)
125
+				),
126
+				'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
127
+			),
128
+		);
129 129
 		$this->_sortable_columns = array(
130 130
 			//true means its already sorted
131 131
 			'ATT_name' => array( 'ATT_name' => true ),
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 			if ( count( $this->_dtts_for_event ) > 1 ) {
212 212
 				$dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' );
213 213
 				foreach ( $this->_dtts_for_event as $dtt ) {
214
-                    $datetime_string = $dtt->name();
215
-                    $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
214
+					$datetime_string = $dtt->name();
215
+					$datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
216 216
 					$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
217 217
 					$dtts[ $dtt->ID() ] = $datetime_string;
218 218
 				}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		$checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id );
307 307
 		$nonce = wp_create_nonce( 'checkin_nonce' );
308 308
 		$toggle_active = ! empty ( $this->_cur_dtt_id )
309
-		                 && EE_Registry::instance()->CAP->current_user_can(
309
+						 && EE_Registry::instance()->CAP->current_user_can(
310 310
 			'ee_edit_checkin',
311 311
 			'espresso_registrations_toggle_checkin_status',
312 312
 			$item->ID()
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 			: '';
316 316
 		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
317 317
 		return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"'
318
-		       . ' data-_regid="' . $item->ID() . '"'
319
-		       . ' data-dttid="' . $this->_cur_dtt_id . '"'
320
-		       . ' data-nonce="' . $nonce . '">'
321
-		       . '</span>'
322
-		       . $mobile_view_content;
318
+			   . ' data-_regid="' . $item->ID() . '"'
319
+			   . ' data-dttid="' . $this->_cur_dtt_id . '"'
320
+			   . ' data-nonce="' . $nonce . '">'
321
+			   . '</span>'
322
+			   . $mobile_view_content;
323 323
 	}
324 324
 
325 325
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 			'espresso_registrations_edit_attendee'
345 345
 		)
346 346
 			? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">'
347
-			    . $item->attendee()->full_name()
348
-			    . '</a>'
347
+				. $item->attendee()->full_name()
348
+				. '</a>'
349 349
 			: $item->attendee()->full_name();
350 350
 		$name_link .= $item->count() === 1
351 351
 			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 			? $latest_related_datetime->ID()
381 381
 			: $DTT_ID;
382 382
 		if ( ! empty( $DTT_ID )
383
-		     && EE_Registry::instance()->CAP->current_user_can(
383
+			 && EE_Registry::instance()->CAP->current_user_can(
384 384
 				'ee_read_checkins',
385 385
 				'espresso_registrations_registration_checkins'
386 386
 			)
@@ -480,15 +480,15 @@  discard block
 block discarded – undo
480 480
 				) ? '
481 481
 				<span class="reg-pad-rght">
482 482
 					<a class="status-'
483
-				    . $item->transaction()->status_ID()
484
-				    . '" href="'
485
-				    . $view_txn_lnk_url
486
-				    . '"  title="'
487
-				    . esc_attr__( 'View Transaction', 'event_espresso' )
488
-				    . '">
483
+					. $item->transaction()->status_ID()
484
+					. '" href="'
485
+					. $view_txn_lnk_url
486
+					. '"  title="'
487
+					. esc_attr__( 'View Transaction', 'event_espresso' )
488
+					. '">
489 489
 						'
490
-				    . $item->transaction()->pretty_paid()
491
-				    . '
490
+					. $item->transaction()->pretty_paid()
491
+					. '
492 492
 					</a>
493 493
 				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
494 494
 			}
@@ -521,12 +521,12 @@  discard block
 block discarded – undo
521 521
 				'ee_read_transaction',
522 522
 				'espresso_transactions_view_transaction'
523 523
 			) ? '<a href="'
524
-			    . $view_txn_url
525
-			    . '" title="'
526
-			    . esc_attr__( 'View Transaction', 'event_espresso' )
527
-			    . '"><span class="reg-pad-rght">'
528
-			    . $txn_total
529
-			    . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
524
+				. $view_txn_url
525
+				. '" title="'
526
+				. esc_attr__( 'View Transaction', 'event_espresso' )
527
+				. '"><span class="reg-pad-rght">'
528
+				. $txn_total
529
+				. '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
530 530
 		} else {
531 531
 			return '<span class="reg-pad-rght"></span>';
532 532
 		}
Please login to merge, or discard this patch.
admin_pages/messages/templates/ee_msg_messages_help_tab.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 <h2><?php esc_html_e('What is the Event Espresso Messages System?', 'event_espresso'); ?></h2>
2
-<p><?php printf( esc_html__('The Event Espresso Messages system is a powerful framework that Event Espresso uses to prepare %1$smessages%2$s for different types of use (message types) and delivered by different %1$smessengers%2$s.', 'event_espresso'), '<strong>', '</strong>' ); ?></p>
2
+<p><?php printf(esc_html__('The Event Espresso Messages system is a powerful framework that Event Espresso uses to prepare %1$smessages%2$s for different types of use (message types) and delivered by different %1$smessengers%2$s.', 'event_espresso'), '<strong>', '</strong>'); ?></p>
3 3
 <p><?php esc_html_e('We\'ve intentionally created this framework so that we have as much flexibility as possible for future ideas that we think of (or customers think of) for the kinds of messages that get sent out related to your events.', 'event_espresso'); ?></p>
4 4
\ No newline at end of file
Please login to merge, or discard this patch.
messages/defaults/default/email_payment_cancelled_content.template.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -31,35 +31,35 @@  discard block
 block discarded – undo
31 31
 						<tbody>
32 32
 							<tr>
33 33
 								<td>
34
-									<h2><?php printf( esc_html__( 'Hello, %s:', 'event_espresso' ), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]' ); ?></h2>
35
-									<p class="lead"><?php printf( esc_html__( 'Your payment was %1$sCANCELLED%2$s for the following transaction and ticket purchases:', 'event_espresso' ), '<strong>', '</strong>'); ?></p>
36
-									<h3><?php esc_html_e( 'Payment Details:', 'event_espresso' ); ?></h3>
34
+									<h2><?php printf(esc_html__('Hello, %s:', 'event_espresso'), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]'); ?></h2>
35
+									<p class="lead"><?php printf(esc_html__('Your payment was %1$sCANCELLED%2$s for the following transaction and ticket purchases:', 'event_espresso'), '<strong>', '</strong>'); ?></p>
36
+									<h3><?php esc_html_e('Payment Details:', 'event_espresso'); ?></h3>
37 37
 									<ul>
38 38
 										<li>
39
-											<strong><?php esc_html_e( 'Payment Status:', 'event_espresso' ); ?></strong> [PAYMENT_STATUS]
39
+											<strong><?php esc_html_e('Payment Status:', 'event_espresso'); ?></strong> [PAYMENT_STATUS]
40 40
 										</li>
41 41
 										<li>
42
-											<strong><?php esc_html_e( 'Transaction ID:', 'event_espresso' ); ?></strong> [TXN_ID]
42
+											<strong><?php esc_html_e('Transaction ID:', 'event_espresso'); ?></strong> [TXN_ID]
43 43
 										</li>
44 44
 										<li>
45
-											<strong><?php esc_html_e( 'Total Cost:', 'event_espresso' ); ?></strong> [TOTAL_COST]
45
+											<strong><?php esc_html_e('Total Cost:', 'event_espresso'); ?></strong> [TOTAL_COST]
46 46
 										</li>
47 47
 										<li>
48
-											<strong><?php esc_html_e( 'Payment Method:', 'event_espresso' ); ?></strong> [PAYMENT_GATEWAY]
48
+											<strong><?php esc_html_e('Payment Method:', 'event_espresso'); ?></strong> [PAYMENT_GATEWAY]
49 49
 										</li>
50 50
 										<li>
51
-											<strong><?php esc_html_e( 'Payment Amount:', 'event_espresso' ); ?></strong> [AMOUNT_PAID]
51
+											<strong><?php esc_html_e('Payment Amount:', 'event_espresso'); ?></strong> [AMOUNT_PAID]
52 52
 										</li>
53 53
 										<li>
54
-											<strong><?php esc_html_e( 'Amount Due:', 'event_espresso' ); ?></strong> [TOTAL_OWING]
54
+											<strong><?php esc_html_e('Amount Due:', 'event_espresso'); ?></strong> [TOTAL_OWING]
55 55
 										</li>
56 56
 									</ul>
57 57
 									<p class="callout">
58
-										<?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?>
58
+										<?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?>
59 59
 									</p>
60 60
 									[EVENT_LIST]
61 61
 									<p class="callout">
62
-										<?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?>
62
+										<?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?>
63 63
 									</p>
64 64
 								</td>
65 65
 							</tr>
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 									<tbody>
85 85
 										<tr>
86 86
 											<td>
87
-												<h3><?php esc_html_e( 'Connect with Us:', 'event_espresso' ); ?></h3>
88
-												<a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e( 'Facebook', 'event_espresso' ); ?></a>
89
-												<a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e( 'Twitter', 'event_espresso' ); ?></a>
90
-												<a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e( 'Google+', 'event_espresso' ); ?></a>
87
+												<h3><?php esc_html_e('Connect with Us:', 'event_espresso'); ?></h3>
88
+												<a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e('Facebook', 'event_espresso'); ?></a>
89
+												<a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e('Twitter', 'event_espresso'); ?></a>
90
+												<a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e('Google+', 'event_espresso'); ?></a>
91 91
 											</td>
92 92
 										</tr>
93 93
 									</tbody>
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 									<tbody>
98 98
 										<tr>
99 99
 											<td>
100
-												<h3><?php esc_html_e( 'Contact Info:', 'event_espresso' ); ?></h3>
101
-												<?php esc_html_e( 'Phone:', 'event_espresso' ); ?> <strong>[CO_PHONE]</strong>
102
-												<?php esc_html_e( 'Email:', 'event_espresso' ); ?> <strong><a href="mailto:[CO_EMAIL]" target="_blank">[CO_EMAIL]</a></strong>
100
+												<h3><?php esc_html_e('Contact Info:', 'event_espresso'); ?></h3>
101
+												<?php esc_html_e('Phone:', 'event_espresso'); ?> <strong>[CO_PHONE]</strong>
102
+												<?php esc_html_e('Email:', 'event_espresso'); ?> <strong><a href="mailto:[CO_EMAIL]" target="_blank">[CO_EMAIL]</a></strong>
103 103
 											</td>
104 104
 										</tr>
105 105
 									</tbody>
Please login to merge, or discard this patch.
messages/defaults/default/email_payment_declined_content.template.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -31,35 +31,35 @@  discard block
 block discarded – undo
31 31
 						<tbody>
32 32
 							<tr>
33 33
 								<td>
34
-									<h2><?php printf( esc_html__( 'Hello, %s:', 'event_espresso' ), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]' ); ?></h2>
35
-									<p class="lead"><?php printf( esc_html__( 'Your payment was %1$sDECLINED%2$s for the following transaction and ticket purchases:', 'event_espresso' ), '<strong>', '</strong>') ?></p>
36
-									<h3><?php esc_html_e( 'Payment Details:', 'event_espresso' ); ?></h3>
34
+									<h2><?php printf(esc_html__('Hello, %s:', 'event_espresso'), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]'); ?></h2>
35
+									<p class="lead"><?php printf(esc_html__('Your payment was %1$sDECLINED%2$s for the following transaction and ticket purchases:', 'event_espresso'), '<strong>', '</strong>') ?></p>
36
+									<h3><?php esc_html_e('Payment Details:', 'event_espresso'); ?></h3>
37 37
 									<ul>
38 38
 										<li>
39
-											<strong><?php esc_html_e( 'Payment Status:', 'event_espresso' ); ?></strong> [PAYMENT_STATUS]
39
+											<strong><?php esc_html_e('Payment Status:', 'event_espresso'); ?></strong> [PAYMENT_STATUS]
40 40
 										</li>
41 41
 										<li>
42
-											<strong><?php esc_html_e( 'Transaction ID:', 'event_espresso' ); ?></strong> [TXN_ID]
42
+											<strong><?php esc_html_e('Transaction ID:', 'event_espresso'); ?></strong> [TXN_ID]
43 43
 										</li>
44 44
 										<li>
45
-											<strong><?php esc_html_e( 'Total Cost:', 'event_espresso' ); ?></strong> [TOTAL_COST]
45
+											<strong><?php esc_html_e('Total Cost:', 'event_espresso'); ?></strong> [TOTAL_COST]
46 46
 										</li>
47 47
 										<li>
48
-											<strong><?php esc_html_e( 'Payment Method:', 'event_espresso' ); ?></strong> [PAYMENT_GATEWAY]
48
+											<strong><?php esc_html_e('Payment Method:', 'event_espresso'); ?></strong> [PAYMENT_GATEWAY]
49 49
 										</li>
50 50
 										<li>
51
-											<strong><?php esc_html_e( 'Payment Amount:', 'event_espresso' ); ?></strong> [AMOUNT_PAID]
51
+											<strong><?php esc_html_e('Payment Amount:', 'event_espresso'); ?></strong> [AMOUNT_PAID]
52 52
 										</li>
53 53
 										<li>
54
-											<strong><?php esc_html_e( 'Amount Due:', 'event_espresso' ); ?></strong> [TOTAL_OWING]
54
+											<strong><?php esc_html_e('Amount Due:', 'event_espresso'); ?></strong> [TOTAL_OWING]
55 55
 										</li>
56 56
 									</ul>
57 57
 									<p class="callout">
58
-										<?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?>
58
+										<?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?>
59 59
 									</p>
60 60
 									[EVENT_LIST]
61 61
 									<p class="callout">
62
-										<?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?>
62
+										<?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?>
63 63
 									</p>
64 64
 								</td>
65 65
 							</tr>
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 									<tbody>
85 85
 										<tr>
86 86
 											<td>
87
-												<h3><?php esc_html_e( 'Connect with Us:', 'event_espresso' ); ?></h3>
88
-												<a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e( 'Facebook', 'event_espresso' ); ?></a>
89
-												<a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e( 'Twitter', 'event_espresso' ); ?></a>
90
-												<a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e( 'Google+', 'event_espresso' ); ?></a>
87
+												<h3><?php esc_html_e('Connect with Us:', 'event_espresso'); ?></h3>
88
+												<a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e('Facebook', 'event_espresso'); ?></a>
89
+												<a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e('Twitter', 'event_espresso'); ?></a>
90
+												<a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e('Google+', 'event_espresso'); ?></a>
91 91
 											</td>
92 92
 										</tr>
93 93
 									</tbody>
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 									<tbody>
98 98
 										<tr>
99 99
 											<td>
100
-												<h3><?php esc_html_e( 'Contact Info:', 'event_espresso' ); ?></h3>
101
-												<?php esc_html_e( 'Phone:', 'event_espresso' ); ?> <strong>[CO_PHONE]</strong>
102
-												<?php esc_html_e( 'Email:', 'event_espresso' ); ?> <strong><a href="mailto:[CO_EMAIL]" target="_blank">[CO_EMAIL]</a></strong>
100
+												<h3><?php esc_html_e('Contact Info:', 'event_espresso'); ?></h3>
101
+												<?php esc_html_e('Phone:', 'event_espresso'); ?> <strong>[CO_PHONE]</strong>
102
+												<?php esc_html_e('Email:', 'event_espresso'); ?> <strong><a href="mailto:[CO_EMAIL]" target="_blank">[CO_EMAIL]</a></strong>
103 103
 											</td>
104 104
 										</tr>
105 105
 									</tbody>
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Loader.core.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -402,21 +402,21 @@
 block discarded – undo
402 402
 		$class_name = $this->_get_classname_for_admin_init_page( $page );
403 403
  		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404 404
 		if ( ! class_exists( $class_name )) {
405
-            $inner_error_msg = '<br />' . sprintf(
406
-                esc_html__(
407
-                    'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408
-                    'event_espresso'
409
-                ),
410
-                '<strong>' . $class_name . '</strong>'
411
-            );
405
+			$inner_error_msg = '<br />' . sprintf(
406
+				esc_html__(
407
+					'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408
+					'event_espresso'
409
+				),
410
+				'<strong>' . $class_name . '</strong>'
411
+			);
412 412
 			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
413 413
 			$error_msg[] = $error_msg[0]
414
-                           . "\r\n"
415
-                           . sprintf(
416
-                               esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
417
-                               $page
418
-                           )
419
-                           . $inner_error_msg;
414
+						   . "\r\n"
415
+						   . sprintf(
416
+							   esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
417
+							   $page
418
+						   )
419
+						   . $inner_error_msg;
420 420
 			throw new EE_Error( implode( '||', $error_msg ));
421 421
 		}
422 422
 		$a = new ReflectionClass($class_name);
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 /**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 		//let's do a scan and see what installed pages we have
120 120
 		$this->_get_installed_pages();
121 121
 		//set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to).
122
-		add_action('admin_menu', array( $this, 'set_menus' ));
123
-		add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) );
122
+		add_action('admin_menu', array($this, 'set_menus'));
123
+		add_action('network_admin_menu', array($this, 'set_network_menus'));
124 124
 	}
125 125
 
126 126
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 * @return void
134 134
 	 */
135 135
 	private function _define_caffeinated_constants() {
136
-		if ( ! defined( 'EE_CORE_CAF_ADMIN'  ) ) {
137
-			define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/');
138
-			define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/');
139
-			define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/');
140
-			define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/');
141
-			define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/');
142
-			define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/');
136
+		if ( ! defined('EE_CORE_CAF_ADMIN')) {
137
+			define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/');
138
+			define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/');
139
+			define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/');
140
+			define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/');
141
+			define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/');
142
+			define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/');
143 143
 		}
144 144
 	}
145 145
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 		//set array of EE_Admin_Page_Menu_Group objects
160 160
 		$groups = array(
161
-			'main' => new EE_Admin_Page_Menu_Group( array(
161
+			'main' => new EE_Admin_Page_Menu_Group(array(
162 162
 				'menu_label' => __('Main', 'event_espresso'),
163 163
 				'show_on_menu' => EE_Admin_Page_Menu_Map::NONE,
164 164
 				'menu_slug' => 'main',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				'menu_order' => 0,
167 167
 				'parent_slug' => 'espresso_events',
168 168
 				)),
169
-			'management' => new EE_Admin_Page_Menu_Group( array(
169
+			'management' => new EE_Admin_Page_Menu_Group(array(
170 170
 				'menu_label' => __('Management', 'event_espresso'),
171 171
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
172 172
 				'menu_slug' => 'management',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				'menu_order' => 10,
175 175
 				'parent_slug' => 'espresso_events'
176 176
 				)),
177
-			'settings' => new EE_Admin_Page_Menu_Group( array(
177
+			'settings' => new EE_Admin_Page_Menu_Group(array(
178 178
 				'menu_label' => __('Settings', 'event_espresso'),
179 179
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
180 180
 				'menu_slug' => 'settings',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				'menu_order' => 30,
183 183
 				'parent_slug' => 'espresso_events'
184 184
 				)),
185
-			'templates' => new EE_Admin_Page_Menu_Group( array(
185
+			'templates' => new EE_Admin_Page_Menu_Group(array(
186 186
 				'menu_label' => __('Templates', 'event_espresso'),
187 187
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
188 188
 				'menu_slug' => 'templates',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'menu_order' => 40,
191 191
 				'parent_slug' => 'espresso_events'
192 192
 				)),
193
-			'extras' => new EE_Admin_Page_Menu_Group( array(
193
+			'extras' => new EE_Admin_Page_Menu_Group(array(
194 194
 				'menu_label' => __('Extras', 'event_espresso'),
195 195
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
196 196
 				'menu_slug' => 'extras',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				'parent_slug' => 'espresso_events',
200 200
 				'maintenance_mode_parent' => 'espresso_maintenance_settings'
201 201
 				)),
202
-			'tools' => new EE_Admin_Page_Menu_Group( array(
202
+			'tools' => new EE_Admin_Page_Menu_Group(array(
203 203
 				'menu_label' => __("Tools", "event_espresso"),
204 204
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
205 205
 				'menu_slug' => 'tools',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 				'menu_order' => 60,
208 208
 				'parent_slug' => 'espresso_events'
209 209
 				)),
210
-			'addons' => new EE_Admin_Page_Menu_Group( array(
210
+			'addons' => new EE_Admin_Page_Menu_Group(array(
211 211
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
212 212
 				'menu_label' => __('Add-ons', 'event_espresso'),
213 213
 				'menu_slug' => 'addons',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				))
218 218
 			);
219 219
 
220
-		$this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups );
220
+		$this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups);
221 221
 	}
222 222
 
223 223
 
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	private function _rearrange_menu_groups() {
236 236
 		$groups = array();
237 237
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238
-		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239
-		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
238
+		usort($this->_admin_menu_groups, array($this, '_sort_menu_maps'));
239
+		foreach ($this->_admin_menu_groups as $group) {
240
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group)
241
+				throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE)));
242 242
 			$groups[$group->menu_slug] = $group;
243 243
 		}
244 244
 		return $groups;
@@ -256,48 +256,48 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private function _get_installed_pages() {
258 258
 		$installed_refs = array();
259
-		$exclude = array( 'assets', 'templates' );
259
+		$exclude = array('assets', 'templates');
260 260
 		// grab everything in the  admin core directory
261
-		$admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR );
262
-		if ( $admin_screens ) {
263
-			foreach( $admin_screens as $admin_screen ) {
261
+		$admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR);
262
+		if ($admin_screens) {
263
+			foreach ($admin_screens as $admin_screen) {
264 264
 				// files and anything in the exclude array need not apply
265
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
265
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
266 266
 					// these folders represent the different EE admin pages
267
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
267
+					$installed_refs[basename($admin_screen)] = $admin_screen;
268 268
 				}
269 269
 			}
270 270
 		}
271 271
 
272
-		if ( empty( $installed_refs ) ) {
272
+		if (empty($installed_refs)) {
273 273
 			$error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso');
274
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES );
275
-			throw new EE_Error( implode( '||', $error_msg ));
274
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES);
275
+			throw new EE_Error(implode('||', $error_msg));
276 276
 		}
277 277
 
278 278
 		//this just checks the caffeinated folder and takes care of setting up any caffeinated stuff.
279 279
 		$installed_refs = $this->_set_caffeinated($installed_refs);
280 280
 		//allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.;
281
-		$installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs );
282
-		$this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends );
281
+		$installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs);
282
+		$this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends);
283 283
 
284 284
 		//loop through admin pages and setup the $_installed_pages array.
285 285
 		$hooks_ref = array();
286
-		foreach ( $installed_refs as $page => $path ) {
286
+		foreach ($installed_refs as $page => $path) {
287 287
 			// set autoloaders for our admin page classes based on included path information
288
-			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path );
288
+			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path);
289 289
 			// build list of installed pages
290
-			$this->_installed_pages[$page] = $this->_load_admin_page( $page, $path );
290
+			$this->_installed_pages[$page] = $this->_load_admin_page($page, $path);
291 291
 			// verify returned object
292
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
293
-				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) {
292
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
293
+				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) {
294 294
 					continue;
295 295
 				}
296 296
 
297 297
 				//skip if in full maintenance mode and maintenance_mode_parent is set
298 298
 				$maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent;
299
-				if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
300
-					unset( $installed_refs[$page] );
299
+				if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
300
+					unset($installed_refs[$page]);
301 301
 					continue;
302 302
 				}
303 303
 
@@ -305,45 +305,45 @@  discard block
 block discarded – undo
305 305
 				//flag for register hooks on extended pages b/c extended pages use the default INIT.
306 306
 				$extend = FALSE;
307 307
 				//now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals.  If there are then let's hook into the init admin filter and load our extend instead.
308
-				if ( isset( $this->_caffeinated_extends[$page] ) ) {
308
+				if (isset($this->_caffeinated_extends[$page])) {
309 309
 					$this->_current_caf_extend_slug = $page;
310
-					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
311
-					$path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";';
312
-					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
313
-					$page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";';
310
+					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
311
+					$path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";';
312
+					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
313
+					$page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";';
314 314
 
315
-					$hook_function_path = create_function( '$path_to_file', $path_runtime);
316
-					$hook_function_page = create_function( '$admin_page', $page_runtime );
315
+					$hook_function_path = create_function('$path_to_file', $path_runtime);
316
+					$hook_function_page = create_function('$admin_page', $page_runtime);
317 317
 
318
-					add_filter( $path_hook, $hook_function_path );
319
-					add_filter( $page_hook, $hook_function_page );
318
+					add_filter($path_hook, $hook_function_path);
319
+					add_filter($page_hook, $hook_function_page);
320 320
 					$extend = TRUE;
321 321
 				}
322 322
 				//let's do the registered hooks
323
-				$extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend );
323
+				$extended_hooks = $this->_installed_pages[$page]->register_hooks($extend);
324 324
 				$hooks_ref = array_merge($hooks_ref, $extended_hooks);
325 325
 			}
326 326
 		}
327 327
 
328 328
 		//the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder.  So we want to make sure we load the file for the parent.
329 329
 		//first make sure we've got unique values
330
-		$hooks_ref = array_unique( $hooks_ref );
330
+		$hooks_ref = array_unique($hooks_ref);
331 331
 		//now let's loop and require!
332
-		foreach ( $hooks_ref as $path ) {
333
-			require_once( $path );
332
+		foreach ($hooks_ref as $path) {
333
+			require_once($path);
334 334
 		}
335 335
 		//make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested.
336 336
 		global $ee_menu_slugs;
337 337
 		$ee_menu_slugs = $this->_menu_slugs;
338 338
 
339 339
 		//we need to loop again to run any early code
340
-		foreach ( $installed_refs as $page => $path ) {
341
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
340
+		foreach ($installed_refs as $page => $path) {
341
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
342 342
 				$this->_installed_pages[$page]->do_initial_loads();
343 343
 			}
344 344
 		}
345 345
 
346
-		do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages );
346
+		do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages);
347 347
 
348 348
 	}
349 349
 
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 	 * @param string $page_slug
356 356
 	 * @return EE_Admin_Page
357 357
 	 */
358
-	public function get_admin_page_object( $page_slug = '' ) {
359
-		if ( isset( $this->_installed_pages[ $page_slug ] )) {
360
-			return $this->_installed_pages[ $page_slug ]->loaded_page_object();
358
+	public function get_admin_page_object($page_slug = '') {
359
+		if (isset($this->_installed_pages[$page_slug])) {
360
+			return $this->_installed_pages[$page_slug]->loaded_page_object();
361 361
 		}
362 362
 		return NULL;
363 363
 	}
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 * @param $dir_name
371 371
 	 * @return string
372 372
 	 */
373
-	private function _get_classname_for_admin_page( $dir_name = '' ) {
374
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
375
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page';
373
+	private function _get_classname_for_admin_page($dir_name = '') {
374
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
375
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page';
376 376
 	}
377 377
 
378 378
 
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 	 * @param $dir_name
384 384
 	 * @return string
385 385
 	 */
386
-	private function _get_classname_for_admin_init_page( $dir_name = '' ) {
387
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
388
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init';
386
+	private function _get_classname_for_admin_init_page($dir_name = '') {
387
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
388
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init';
389 389
 	}
390 390
 
391 391
 
@@ -398,26 +398,26 @@  discard block
 block discarded – undo
398 398
 	 * @throws EE_Error
399 399
 	 * @return object|bool  return page object if valid, bool false if not.
400 400
 	 */
401
-	private function _load_admin_page( $page = '', $path = '' ) {
402
-		$class_name = $this->_get_classname_for_admin_init_page( $page );
403
- 		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404
-		if ( ! class_exists( $class_name )) {
405
-            $inner_error_msg = '<br />' . sprintf(
401
+	private function _load_admin_page($page = '', $path = '') {
402
+		$class_name = $this->_get_classname_for_admin_init_page($page);
403
+ 		EE_Registry::instance()->load_file($path, $class_name, 'core');
404
+		if ( ! class_exists($class_name)) {
405
+            $inner_error_msg = '<br />'.sprintf(
406 406
                 esc_html__(
407 407
                     'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
408 408
                     'event_espresso'
409 409
                 ),
410
-                '<strong>' . $class_name . '</strong>'
410
+                '<strong>'.$class_name.'</strong>'
411 411
             );
412
-			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
412
+			$error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page);
413 413
 			$error_msg[] = $error_msg[0]
414 414
                            . "\r\n"
415 415
                            . sprintf(
416
-                               esc_html__( 'There is no Init class in place for the %s admin page.', 'event_espresso'),
416
+                               esc_html__('There is no Init class in place for the %s admin page.', 'event_espresso'),
417 417
                                $page
418 418
                            )
419 419
                            . $inner_error_msg;
420
-			throw new EE_Error( implode( '||', $error_msg ));
420
+			throw new EE_Error(implode('||', $error_msg));
421 421
 		}
422 422
 		$a = new ReflectionClass($class_name);
423 423
 		return  $a->newInstance();
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
 	public function set_menus() {
437 437
 		//prep the menu pages (sort, group.)
438 438
 		$this->_prep_pages();
439
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
440
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
441
-				$menu_map->add_menu_page( FALSE );
439
+		foreach ($this->_prepped_menu_maps as $menu_map) {
440
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
441
+				$menu_map->add_menu_page(FALSE);
442 442
 			}
443 443
 		}
444 444
 	}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @return void
453 453
 	 */
454
-	public function set_network_menus(){
454
+	public function set_network_menus() {
455 455
 		$this->_prep_pages();
456
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
457
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
458
-				$menu_map->add_menu_page( TRUE );
456
+		foreach ($this->_prepped_menu_maps as $menu_map) {
457
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
458
+				$menu_map->add_menu_page(TRUE);
459 459
 			}
460 460
 		}
461 461
 	}
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
 		//rearrange _admin_menu_groups to be indexed by group slug.
477 477
 		$menu_groups = $this->_rearrange_menu_groups();
478 478
 
479
-		foreach( $this->_installed_pages as $page ) {
480
-			if ( $page instanceof EE_Admin_page_Init ) {
479
+		foreach ($this->_installed_pages as $page) {
480
+			if ($page instanceof EE_Admin_page_Init) {
481 481
 				$page_map = $page->get_menu_map();
482 482
 				//if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item.
483
-				if ( is_array( $page_map ) || empty( $page_map ) ) {
484
-					EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) );
483
+				if (is_array($page_map) || empty($page_map)) {
484
+					EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label));
485 485
 					continue;
486 486
 				}
487 487
 
488 488
 				//if page map is NOT a EE_Admin_Page_Menu_Map object then throw error.
489
-				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) {
490
-					throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) );
489
+				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) {
490
+					throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map));
491 491
 				}
492 492
 
493 493
 				//use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array.
494
-				if ( empty( $page_map->maintenance_mode_parent ) &&  EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
494
+				if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
495 495
 					continue;
496 496
 				}
497 497
 
@@ -500,21 +500,21 @@  discard block
 block discarded – undo
500 500
 			}
501 501
 		}
502 502
 
503
-		if ( empty( $pages_array )) {
504
-			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') );
503
+		if (empty($pages_array)) {
504
+			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso'));
505 505
 		}
506 506
 
507 507
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
508
-		foreach ( $pages_array as $group => $menu_maps ) {
508
+		foreach ($pages_array as $group => $menu_maps) {
509 509
 			//valid_group?
510
-			if ( ! array_key_exists( $group, $menu_groups ) )
510
+			if ( ! array_key_exists($group, $menu_groups))
511 511
 				continue;
512 512
 
513 513
 			//sort pages.
514
-			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
514
+			usort($menu_maps, array($this, '_sort_menu_maps'));
515 515
 
516 516
 			//prepend header
517
-			array_unshift( $menu_maps, $menu_groups[$group] );
517
+			array_unshift($menu_maps, $menu_groups[$group]);
518 518
 
519 519
 			//reset $pages_array with prepped data
520 520
 			$pages_array[$group] = $menu_maps;
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 
523 523
 
524 524
 		//now let's setup the _prepped_menu_maps property
525
-		foreach ( $menu_groups as $group => $group_objs ) {
526
-			if ( isset( $pages_array[$group] ) )
527
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
525
+		foreach ($menu_groups as $group => $group_objs) {
526
+			if (isset($pages_array[$group]))
527
+				$this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]);
528 528
 		}/**/
529 529
 
530 530
 	}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	 * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
545 545
 	 * @return array
546 546
 	 */
547
-	private function _set_caffeinated( $installed_refs ) {
547
+	private function _set_caffeinated($installed_refs) {
548 548
 
549 549
 		//first let's check if there IS a caffeinated folder. If there is not then lets get out.
550
-		if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) {
550
+		if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) {
551 551
 			return $installed_refs;
552 552
 		}
553 553
 
@@ -556,15 +556,15 @@  discard block
 block discarded – undo
556 556
 		$exclude = array('tickets');
557 557
 
558 558
 		//okay let's setup an "New" pages first (we'll return installed refs later)
559
-		$new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR );
560
-		if ( $new_admin_screens ) {
561
-			foreach( $new_admin_screens as $admin_screen ) {
559
+		$new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR);
560
+		if ($new_admin_screens) {
561
+			foreach ($new_admin_screens as $admin_screen) {
562 562
 				// files and anything in the exclude array need not apply
563
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
563
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
564 564
 					// these folders represent the different NEW EE admin pages
565
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
565
+					$installed_refs[basename($admin_screen)] = $admin_screen;
566 566
 					// set autoloaders for our admin page classes based on included path information
567
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen );
567
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
568 568
 //					$this->_caf_autoloader[] = array(
569 569
 //						'dir' => 'new',
570 570
 //						'folder' => basename( $admin_screen )
@@ -574,18 +574,18 @@  discard block
 block discarded – undo
574 574
 		}
575 575
 
576 576
 		//let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page)
577
-		$extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR );
578
-		if ( $extends ) {
579
-			foreach( $extends as $extend ) {
580
-				if ( is_dir( $extend ) ) {
581
-					$extend_ref = basename( $extend );
577
+		$extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR);
578
+		if ($extends) {
579
+			foreach ($extends as $extend) {
580
+				if (is_dir($extend)) {
581
+					$extend_ref = basename($extend);
582 582
 					//now let's make sure there is a file that matches the expected format
583
-					$filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) );
584
-					$filename = 'Extend_' . $filename . '_Admin_Page';
585
-					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' );
583
+					$filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
584
+					$filename = 'Extend_'.$filename.'_Admin_Page';
585
+					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php');
586 586
 					$this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
587 587
 					// set autoloaders for our admin page classes based on included path information
588
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend );
588
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
589 589
 //					$this->_caf_autoloader[] = array(
590 590
 //						'dir' => 'extend',
591 591
 //						'folder' => $extend_ref
@@ -596,22 +596,22 @@  discard block
 block discarded – undo
596 596
 
597 597
 		//let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
598 598
 		$ee_admin_hooks = array();
599
-		$hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' );
600
-		if ( $hooks ) {
601
-			foreach ( $hooks as $hook ) {
602
-				if ( is_readable( $hook ) ) {
599
+		$hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php');
600
+		if ($hooks) {
601
+			foreach ($hooks as $hook) {
602
+				if (is_readable($hook)) {
603 603
 					require_once $hook;
604
-					$classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook );
604
+					$classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook);
605 605
 					$classname = str_replace('.class.php', '', $classname);
606
-					if ( class_exists( $classname ) ) {
607
-						$a = new ReflectionClass( $classname );
606
+					if (class_exists($classname)) {
607
+						$a = new ReflectionClass($classname);
608 608
 						$ee_admin_hooks[] = $a->newInstance();
609 609
 					}
610 610
 				}
611 611
 			}
612 612
 		}/**/
613 613
 
614
-		$ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks );
614
+		$ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
615 615
 
616 616
 		return $installed_refs;
617 617
 
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
 	 * @param  EE_Admin_Page_Menu_Map $b being compared to
667 667
 	 * @return int    sort order
668 668
 	 */
669
-	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
670
-		if ( $a->menu_order == $b->menu_order )
669
+	private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) {
670
+		if ($a->menu_order == $b->menu_order)
671 671
 			return 0;
672 672
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
673 673
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Qtip_Loader.helper.php 2 patches
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function instance() {
34 34
 		// check if class object is instantiated
35
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EEH_Qtip_Loader )) {
35
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EEH_Qtip_Loader)) {
36 36
 			self::$_instance = new self();
37 37
 		}
38 38
 		return self::$_instance;
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	private function __construct() {
50 50
 		//let's just make sure this is instantiated in the right place.
51
-		if ( did_action( 'wp_print_styles' ) || did_action( 'admin_head' )) {
52
-			EE_Error::doing_it_wrong( 'EEH_Qtip_Loader', __('This helper must be instantiated before or within a callback for the WordPress wp_enqueue_scripts hook action hook.', 'event_espresso' ), '4.1' );
51
+		if (did_action('wp_print_styles') || did_action('admin_head')) {
52
+			EE_Error::doing_it_wrong('EEH_Qtip_Loader', __('This helper must be instantiated before or within a callback for the WordPress wp_enqueue_scripts hook action hook.', 'event_espresso'), '4.1');
53 53
 		}
54 54
 	}
55 55
 
@@ -61,27 +61,27 @@  discard block
 block discarded – undo
61 61
 	 * @return void
62 62
 	 */
63 63
 	public function register_and_enqueue() {
64
-		$qtips_js = !defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.js' : EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.js';
65
-		$qtip_images_loaded = EE_THIRD_PARTY_URL . 'qtip/imagesloaded.pkg.min.js';
66
-		$qtip_map = EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.map';
67
-		$qtipcss = !defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.css' : EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.css';
64
+		$qtips_js = ! defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.js' : EE_THIRD_PARTY_URL.'qtip/jquery.qtip.js';
65
+		$qtip_images_loaded = EE_THIRD_PARTY_URL.'qtip/imagesloaded.pkg.min.js';
66
+		$qtip_map = EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.map';
67
+		$qtipcss = ! defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.css' : EE_THIRD_PARTY_URL.'qtip/jquery.qtip.css';
68 68
 
69
-		wp_register_script('qtip-map', $qtip_map, array(), '3', TRUE );
70
-		wp_register_script('qtip-images-loaded', $qtip_images_loaded, array(), '2.2.0', TRUE );
71
-		wp_register_script('qtip', $qtips_js, array('jquery'), '2.2.0', TRUE );
72
-		wp_register_script('ee-qtip-helper', EE_HELPERS_ASSETS . 'ee-qtip-helper.js', array('qtip', 'jquery-cookie'), EVENT_ESPRESSO_VERSION, TRUE );
69
+		wp_register_script('qtip-map', $qtip_map, array(), '3', TRUE);
70
+		wp_register_script('qtip-images-loaded', $qtip_images_loaded, array(), '2.2.0', TRUE);
71
+		wp_register_script('qtip', $qtips_js, array('jquery'), '2.2.0', TRUE);
72
+		wp_register_script('ee-qtip-helper', EE_HELPERS_ASSETS.'ee-qtip-helper.js', array('qtip', 'jquery-cookie'), EVENT_ESPRESSO_VERSION, TRUE);
73 73
 
74
-		wp_register_style('qtip-css', $qtipcss, array(), '2.2' );
74
+		wp_register_style('qtip-css', $qtipcss, array(), '2.2');
75 75
 
76 76
 		//k now let's see if there are any registered qtips.  If there are, then we need to setup the localized script for ee-qtip-helper.js (and enqueue ee-qtip-helper.js of course!)
77
-		if ( !empty( $this->_qtips ) ) {
77
+		if ( ! empty($this->_qtips)) {
78 78
 			wp_enqueue_script('ee-qtip-helper');
79 79
 			wp_enqueue_style('qtip-css');
80 80
 			$qtips = array();
81
-			foreach ( $this->_qtips as $qtip ) {
81
+			foreach ($this->_qtips as $qtip) {
82 82
 				$qts = $qtip->get_tips();
83
-				foreach ( $qts as $qt ) {
84
-					if ( ! $qt instanceof EE_Qtip )
83
+				foreach ($qts as $qt) {
84
+					if ( ! $qt instanceof EE_Qtip)
85 85
 						continue;
86 86
 					$qtips[] = array(
87 87
 						'content_id' => $qt->content_id,
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 						);
91 91
 				}
92 92
 			}
93
-			if ( !empty($qtips) )
94
-				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
93
+			if ( ! empty($qtips))
94
+				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array('qtips' => $qtips));
95 95
 
96 96
 		} else {
97 97
 			//qtips has been requested without any registration (so assuming its just directly used in the admin).
@@ -113,24 +113,24 @@  discard block
 block discarded – undo
113 113
 	 * @param  string|array $configname name of the Qtip class (full class name is expected and will be used for looking for file, Qtip config classes must extend EE_Qtip_Config) [if this is an array, then we loop through the array to instantiate and setup the qtips]
114 114
 	 * @return void
115 115
 	 */
116
-	public function register( $configname, $paths = array() ) {
116
+	public function register($configname, $paths = array()) {
117 117
 
118 118
 		//let's just make sure this is instantiated in the right place.
119
-		if ( did_action('wp_enqueue_scripts') || did_action('admin_enqueue_scripts') ) {
120
-			EE_Error::doing_it_wrong( 'EEH_Qtip_Loader->register()', __('EE_Qtip_Config objects must be registered before wp_enqueue_scripts is called.', 'event_espresso' ), '4.1' );
119
+		if (did_action('wp_enqueue_scripts') || did_action('admin_enqueue_scripts')) {
120
+			EE_Error::doing_it_wrong('EEH_Qtip_Loader->register()', __('EE_Qtip_Config objects must be registered before wp_enqueue_scripts is called.', 'event_espresso'), '4.1');
121 121
 		}
122 122
 
123 123
 		$configname = (array) $configname; //typecast to array
124
-		foreach ( $configname as $config ) {
125
-			$this->_register( $config, $paths );
124
+		foreach ($configname as $config) {
125
+			$this->_register($config, $paths);
126 126
 		}
127 127
 
128 128
 		//hook into appropriate footer
129 129
 		$footer_action = is_admin() ? 'admin_footer' : 'wp_footer';
130
-		add_action($footer_action, array($this, 'setup_qtip'), 10 );
130
+		add_action($footer_action, array($this, 'setup_qtip'), 10);
131 131
 
132 132
 		//make sure we "turn on" qtip js.
133
-		add_filter('FHEE_load_qtip', '__return_true' );
133
+		add_filter('FHEE_load_qtip', '__return_true');
134 134
 	}
135 135
 
136 136
 
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
 	 * @throws EE_Error
145 145
 	 * @return void
146 146
 	 */
147
-	private function _register( $config, $paths ) {
147
+	private function _register($config, $paths) {
148 148
 		//before doing anything we have to make sure that EE_Qtip_Config parent is required.
149
-		EE_Registry::instance()->load_lib( 'Qtip_Config', array(), TRUE );
149
+		EE_Registry::instance()->load_lib('Qtip_Config', array(), TRUE);
150 150
 
151
-		if ( !empty( $paths ) ) {
151
+		if ( ! empty($paths)) {
152 152
 			$paths = (array) $paths;
153
-			foreach ( $paths as $path ) {
154
-				$path = $path . $config . '.lib.php';
155
-				if ( !is_readable($path ) ) {
153
+			foreach ($paths as $path) {
154
+				$path = $path.$config.'.lib.php';
155
+				if ( ! is_readable($path)) {
156 156
 					continue;
157 157
 				} else {
158 158
 					require_once $path;
@@ -161,26 +161,26 @@  discard block
 block discarded – undo
161 161
 		}
162 162
 
163 163
 		//does class exist at this point?  If it does then let's instantiate.  If it doesn't then let's continue with other paths.
164
-		if ( !class_exists($config) ) {
165
-			$path = EE_LIBRARIES . 'qtips/' . $config . '.lib.php';
166
-			if ( !is_readable($path ) ) {
167
-				throw new EE_Error( sprintf( __('Unable to load the Qtip Config registered for this page (%s) because none of the file paths attempted are readable.  Please check the spelling of the paths you\'ve used in the registration', 'event_espresso'), $config ) );
164
+		if ( ! class_exists($config)) {
165
+			$path = EE_LIBRARIES.'qtips/'.$config.'.lib.php';
166
+			if ( ! is_readable($path)) {
167
+				throw new EE_Error(sprintf(__('Unable to load the Qtip Config registered for this page (%s) because none of the file paths attempted are readable.  Please check the spelling of the paths you\'ve used in the registration', 'event_espresso'), $config));
168 168
 			} else {
169 169
 				require_once $path;
170 170
 			}
171 171
 		}
172 172
 
173 173
 		//now we attempt a class_exists one more time.
174
-		if ( !class_exists( $config ) )
175
-			throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
174
+		if ( ! class_exists($config))
175
+			throw new EE_Error(sprintf(__('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config));
176 176
 
177 177
 		//made it HERE?  FINALLY, let's get things setup.
178 178
 		$a = new ReflectionClass($config);
179 179
 		$qtip = $a->newInstance();
180 180
 
181 181
 		//verify that $qtip is a valid object
182
-		if ( ! $qtip instanceof EE_Qtip_Config )
183
-			throw new EE_Error( sprintf( esc_html__( 'The class given for the Qtip loader (%1$s) is not a child of the %2$sEE_Qtip_Config%3$s class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config, '<strong>', '</strong>' ) );
182
+		if ( ! $qtip instanceof EE_Qtip_Config)
183
+			throw new EE_Error(sprintf(esc_html__('The class given for the Qtip loader (%1$s) is not a child of the %2$sEE_Qtip_Config%3$s class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config, '<strong>', '</strong>'));
184 184
 
185 185
 		$this->_qtips[] = $a->newInstance();
186 186
 
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	 * @return void
197 197
 	 */
198 198
 	public function setup_qtip() {
199
-		if ( empty( $this->_qtips ) )
199
+		if (empty($this->_qtips))
200 200
 			return; //no qtips!
201 201
 
202 202
 		$content = array();
203 203
 
204
-		foreach ( $this->_qtips as $qtip ) {
204
+		foreach ($this->_qtips as $qtip) {
205 205
 			$content[] = $this->_generate_content_container($qtip);
206 206
 		}
207 207
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	private function _generate_content_container($qtip) {
219 219
 		$qts = $qtip->get_tips();
220 220
 		$content = array();
221
-		foreach ( $qts as $qt ) {
222
-			if ( ! $qt instanceof EE_Qtip )
221
+		foreach ($qts as $qt) {
222
+			if ( ! $qt instanceof EE_Qtip)
223 223
 				continue;
224
-			$content[] = '<div class="ee-qtip-helper-content hidden" id="' . $qt->content_id . '">' . $qt->content . '</div>';
224
+			$content[] = '<div class="ee-qtip-helper-content hidden" id="'.$qt->content_id.'">'.$qt->content.'</div>';
225 225
 		}
226 226
 
227 227
 		return implode('<br />', $content);
Please login to merge, or discard this patch.
Braces   +19 added lines, -12 removed lines patch added patch discarded remove patch
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 			foreach ( $this->_qtips as $qtip ) {
82 82
 				$qts = $qtip->get_tips();
83 83
 				foreach ( $qts as $qt ) {
84
-					if ( ! $qt instanceof EE_Qtip )
85
-						continue;
84
+					if ( ! $qt instanceof EE_Qtip ) {
85
+											continue;
86
+					}
86 87
 					$qtips[] = array(
87 88
 						'content_id' => $qt->content_id,
88 89
 						'options' => $qt->options,
@@ -90,8 +91,9 @@  discard block
 block discarded – undo
90 91
 						);
91 92
 				}
92 93
 			}
93
-			if ( !empty($qtips) )
94
-				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
94
+			if ( !empty($qtips) ) {
95
+							wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
96
+			}
95 97
 
96 98
 		} else {
97 99
 			//qtips has been requested without any registration (so assuming its just directly used in the admin).
@@ -171,16 +173,18 @@  discard block
 block discarded – undo
171 173
 		}
172 174
 
173 175
 		//now we attempt a class_exists one more time.
174
-		if ( !class_exists( $config ) )
175
-			throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
176
+		if ( !class_exists( $config ) ) {
177
+					throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
178
+		}
176 179
 
177 180
 		//made it HERE?  FINALLY, let's get things setup.
178 181
 		$a = new ReflectionClass($config);
179 182
 		$qtip = $a->newInstance();
180 183
 
181 184
 		//verify that $qtip is a valid object
182
-		if ( ! $qtip instanceof EE_Qtip_Config )
183
-			throw new EE_Error( sprintf( esc_html__( 'The class given for the Qtip loader (%1$s) is not a child of the %2$sEE_Qtip_Config%3$s class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config, '<strong>', '</strong>' ) );
185
+		if ( ! $qtip instanceof EE_Qtip_Config ) {
186
+					throw new EE_Error( sprintf( esc_html__( 'The class given for the Qtip loader (%1$s) is not a child of the %2$sEE_Qtip_Config%3$s class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config, '<strong>', '</strong>' ) );
187
+		}
184 188
 
185 189
 		$this->_qtips[] = $a->newInstance();
186 190
 
@@ -196,8 +200,10 @@  discard block
 block discarded – undo
196 200
 	 * @return void
197 201
 	 */
198 202
 	public function setup_qtip() {
199
-		if ( empty( $this->_qtips ) )
200
-			return; //no qtips!
203
+		if ( empty( $this->_qtips ) ) {
204
+					return;
205
+		}
206
+		//no qtips!
201 207
 
202 208
 		$content = array();
203 209
 
@@ -219,8 +225,9 @@  discard block
 block discarded – undo
219 225
 		$qts = $qtip->get_tips();
220 226
 		$content = array();
221 227
 		foreach ( $qts as $qt ) {
222
-			if ( ! $qt instanceof EE_Qtip )
223
-				continue;
228
+			if ( ! $qt instanceof EE_Qtip ) {
229
+							continue;
230
+			}
224 231
 			$content[] = '<div class="ee-qtip-helper-content hidden" id="' . $qt->content_id . '">' . $qt->content . '</div>';
225 232
 		}
226 233
 
Please login to merge, or discard this patch.