Completed
Pull Request — master (#1070)
by Darren
20:57 queued 10:09
created
admin_pages/events/Events_Admin_List_Table.class.php 2 patches
Indentation   +549 added lines, -549 removed lines patch added patch discarded remove patch
@@ -15,553 +15,553 @@
 block discarded – undo
15 15
 class Events_Admin_List_Table extends EE_Admin_List_Table
16 16
 {
17 17
 
18
-    /**
19
-     * @var EE_Datetime
20
-     */
21
-    private $_dtt;
22
-
23
-
24
-    /**
25
-     * Initial setup of data properties for the list table.
26
-     */
27
-    protected function _setup_data()
28
-    {
29
-        $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page);
30
-        $this->_all_data_count = $this->_admin_page->get_events(0, 0, true);
31
-    }
32
-
33
-
34
-    /**
35
-     * Set up of additional properties for the list table.
36
-     */
37
-    protected function _set_properties()
38
-    {
39
-        $this->_wp_list_args = array(
40
-            'singular' => esc_html__('event', 'event_espresso'),
41
-            'plural'   => esc_html__('events', 'event_espresso'),
42
-            'ajax'     => true, // for now
43
-            'screen'   => $this->_admin_page->get_current_screen()->id,
44
-        );
45
-        $this->_columns = array(
46
-            'cb'              => '<input type="checkbox" />',
47
-            'id'              => esc_html__('ID', 'event_espresso'),
48
-            'name'            => esc_html__('Name', 'event_espresso'),
49
-            'author'          => esc_html__('Author', 'event_espresso'),
50
-            'venue'           => esc_html__('Venue', 'event_espresso'),
51
-            'start_date_time' => esc_html__('Event Start', 'event_espresso'),
52
-            'reg_begins'      => esc_html__('On Sale', 'event_espresso'),
53
-            'attendees'       => '<span class="dashicons dashicons-groups ee-icon-color-ee-green ee-icon-size-20">'
54
-                                 . '<span class="screen-reader-text">'
55
-                                 . esc_html__('Approved Registrations', 'event_espresso')
56
-                                 . '</span>'
57
-                                 . '</span>',
58
-            // 'tkts_sold' => esc_html__('Tickets Sold', 'event_espresso'),
59
-            'actions'         => esc_html__('Actions', 'event_espresso'),
60
-        );
61
-        $this->addConditionalColumns();
62
-        $this->_sortable_columns = array(
63
-            'id'              => array('EVT_ID' => true),
64
-            'name'            => array('EVT_name' => false),
65
-            'author'          => array('EVT_wp_user' => false),
66
-            'venue'           => array('Venue.VNU_name' => false),
67
-            'start_date_time' => array('Datetime.DTT_EVT_start' => false),
68
-            'reg_begins'      => array('Datetime.Ticket.TKT_start_date' => false),
69
-        );
70
-
71
-        $this->_primary_column = 'id';
72
-        $this->_hidden_columns = array('author', 'event_category');
73
-    }
74
-
75
-
76
-    /**
77
-     * @return array
78
-     */
79
-    protected function _get_table_filters()
80
-    {
81
-        return array(); // no filters with decaf
82
-    }
83
-
84
-
85
-    /**
86
-     * Setup of views properties.
87
-     *
88
-     * @throws InvalidDataTypeException
89
-     * @throws InvalidInterfaceException
90
-     * @throws InvalidArgumentException
91
-     */
92
-    protected function _add_view_counts()
93
-    {
94
-        $this->_views['all']['count'] = $this->_admin_page->total_events();
95
-        $this->_views['draft']['count'] = $this->_admin_page->total_events_draft();
96
-        if (EE_Registry::instance()->CAP->current_user_can(
97
-            'ee_delete_events',
98
-            'espresso_events_trash_events'
99
-        )) {
100
-            $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events();
101
-        }
102
-    }
103
-
104
-
105
-    /**
106
-     * @param EE_Event $item
107
-     * @return string
108
-     * @throws EE_Error
109
-     */
110
-    protected function _get_row_class($item)
111
-    {
112
-        $class = parent::_get_row_class($item);
113
-        // add status class
114
-        $class .= $item instanceof EE_Event
115
-            ? ' ee-status-strip event-status-' . $item->get_active_status()
116
-            : '';
117
-        if ($this->_has_checkbox_column) {
118
-            $class .= ' has-checkbox-column';
119
-        }
120
-        return $class;
121
-    }
122
-
123
-
124
-    /**
125
-     * @param EE_Event $item
126
-     * @return string
127
-     * @throws EE_Error
128
-     */
129
-    public function column_status(EE_Event $item)
130
-    {
131
-        return '<span class="ee-status-strip ee-status-strip-td event-status-'
132
-               . $item->get_active_status()
133
-               . '"></span>';
134
-    }
135
-
136
-
137
-    /**
138
-     * @param  EE_Event $item
139
-     * @return string
140
-     * @throws EE_Error
141
-     */
142
-    public function column_cb($item)
143
-    {
144
-        if (! $item instanceof EE_Event) {
145
-            return '';
146
-        }
147
-        $this->_dtt = $item->primary_datetime(); // set this for use in other columns
148
-        // does event have any attached registrations?
149
-        $regs = $item->count_related('Registration');
150
-        return $regs > 0 && $this->_view === 'trash'
151
-            ? '<span class="ee-lock-icon"></span>'
152
-            : sprintf(
153
-                '<input type="checkbox" name="EVT_IDs[]" value="%s" />',
154
-                $item->ID()
155
-            );
156
-    }
157
-
158
-
159
-    /**
160
-     * @param EE_Event $item
161
-     * @return mixed|string
162
-     * @throws EE_Error
163
-     */
164
-    public function column_id(EE_Event $item)
165
-    {
166
-        $content = $item->ID();
167
-        $content .= '  <span class="show-on-mobile-view-only">' . $item->name() . '</span>';
168
-        return $content;
169
-    }
170
-
171
-
172
-    /**
173
-     * @param EE_Event $item
174
-     * @return string
175
-     * @throws EE_Error
176
-     * @throws InvalidArgumentException
177
-     * @throws InvalidDataTypeException
178
-     * @throws InvalidInterfaceException
179
-     */
180
-    public function column_name(EE_Event $item)
181
-    {
182
-        $edit_query_args = array(
183
-            'action' => 'edit',
184
-            'post'   => $item->ID(),
185
-        );
186
-        $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
187
-        $actions = $this->_column_name_action_setup($item);
188
-        $status = ''; // $item->status() !== 'publish' ? ' (' . $item->status() . ')' : '';
189
-        $content = '<strong><a class="row-title" href="'
190
-                   . $edit_link . '">'
191
-                   . $item->name()
192
-                   . '</a></strong>'
193
-                   . $status;
194
-        $content .= '<br><span class="ee-status-text-small">'
195
-                    . EEH_Template::pretty_status(
196
-                        $item->get_active_status(),
197
-                        false,
198
-                        'sentence'
199
-                    )
200
-                    . '</span>';
201
-        $content .= $this->row_actions($actions);
202
-        return $content;
203
-    }
204
-
205
-
206
-    /**
207
-     * Just a method for setting up the actions for the name column
208
-     *
209
-     * @param EE_Event $item
210
-     * @return array array of actions
211
-     * @throws EE_Error
212
-     * @throws InvalidArgumentException
213
-     * @throws InvalidDataTypeException
214
-     * @throws InvalidInterfaceException
215
-     */
216
-    protected function _column_name_action_setup(EE_Event $item)
217
-    {
218
-        // todo: remove when attendees is active
219
-        if (! defined('REG_ADMIN_URL')) {
220
-            define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
221
-        }
222
-        $actions = array();
223
-        $restore_event_link = '';
224
-        $delete_event_link = '';
225
-        $trash_event_link = '';
226
-        if (EE_Registry::instance()->CAP->current_user_can(
227
-            'ee_edit_event',
228
-            'espresso_events_edit',
229
-            $item->ID()
230
-        )) {
231
-            $edit_query_args = array(
232
-                'action' => 'edit',
233
-                'post'   => $item->ID(),
234
-            );
235
-            $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
236
-            $actions['edit'] = '<a href="' . $edit_link . '"'
237
-                               . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">'
238
-                               . esc_html__('Edit', 'event_espresso')
239
-                               . '</a>';
240
-        }
241
-        if (EE_Registry::instance()->CAP->current_user_can(
242
-            'ee_read_registrations',
243
-            'espresso_registrations_view_registration'
244
-        )
245
-            && EE_Registry::instance()->CAP->current_user_can(
246
-                'ee_read_event',
247
-                'espresso_registrations_view_registration',
248
-                $item->ID()
249
-            )
250
-        ) {
251
-            $attendees_query_args = array(
252
-                'action'   => 'default',
253
-                'event_id' => $item->ID(),
254
-            );
255
-            $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
256
-            $actions['attendees'] = '<a href="' . $attendees_link . '"'
257
-                                    . ' title="' . esc_attr__('View Registrations', 'event_espresso') . '">'
258
-                                    . esc_html__('Registrations', 'event_espresso')
259
-                                    . '</a>';
260
-        }
261
-        if (EE_Registry::instance()->CAP->current_user_can(
262
-            'ee_delete_event',
263
-            'espresso_events_trash_event',
264
-            $item->ID()
265
-        )) {
266
-            $trash_event_query_args = array(
267
-                'action' => 'trash_event',
268
-                'EVT_ID' => $item->ID(),
269
-            );
270
-            $trash_event_link = EE_Admin_Page::add_query_args_and_nonce(
271
-                $trash_event_query_args,
272
-                EVENTS_ADMIN_URL
273
-            );
274
-        }
275
-        if (EE_Registry::instance()->CAP->current_user_can(
276
-            'ee_delete_event',
277
-            'espresso_events_restore_event',
278
-            $item->ID()
279
-        )) {
280
-            $restore_event_query_args = array(
281
-                'action' => 'restore_event',
282
-                'EVT_ID' => $item->ID(),
283
-            );
284
-            $restore_event_link = EE_Admin_Page::add_query_args_and_nonce(
285
-                $restore_event_query_args,
286
-                EVENTS_ADMIN_URL
287
-            );
288
-        }
289
-        if (EE_Registry::instance()->CAP->current_user_can(
290
-            'ee_delete_event',
291
-            'espresso_events_delete_event',
292
-            $item->ID()
293
-        )) {
294
-            $delete_event_query_args = array(
295
-                'action' => 'delete_event',
296
-                'EVT_ID' => $item->ID(),
297
-            );
298
-            $delete_event_link = EE_Admin_Page::add_query_args_and_nonce(
299
-                $delete_event_query_args,
300
-                EVENTS_ADMIN_URL
301
-            );
302
-        }
303
-        $view_link = get_permalink($item->ID());
304
-        $actions['view'] = '<a href="' . $view_link . '"'
305
-                           . ' title="' . esc_attr__('View Event', 'event_espresso') . '">'
306
-                           . esc_html__('View', 'event_espresso')
307
-                           . '</a>';
308
-        if ($item->get('status') === 'trash') {
309
-            if (EE_Registry::instance()->CAP->current_user_can(
310
-                'ee_delete_event',
311
-                'espresso_events_restore_event',
312
-                $item->ID()
313
-            )) {
314
-                $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '"'
315
-                                                 . ' title="' . esc_attr__('Restore from Trash', 'event_espresso')
316
-                                                 . '">'
317
-                                                 . esc_html__('Restore from Trash', 'event_espresso')
318
-                                                 . '</a>';
319
-            }
320
-            if ($item->count_related('Registration') === 0
321
-                && EE_Registry::instance()->CAP->current_user_can(
322
-                    'ee_delete_event',
323
-                    'espresso_events_delete_event',
324
-                    $item->ID()
325
-                )
326
-            ) {
327
-                $actions['delete'] = '<a href="' . $delete_event_link . '"'
328
-                                     . ' title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">'
329
-                                     . esc_html__('Delete Permanently', 'event_espresso')
330
-                                     . '</a>';
331
-            }
332
-        } else {
333
-            if (EE_Registry::instance()->CAP->current_user_can(
334
-                'ee_delete_event',
335
-                'espresso_events_trash_event',
336
-                $item->ID()
337
-            )) {
338
-                $actions['move to trash'] = '<a href="' . $trash_event_link . '"'
339
-                                            . ' title="' . esc_attr__('Trash Event', 'event_espresso') . '">'
340
-                                            . esc_html__('Trash', 'event_espresso')
341
-                                            . '</a>';
342
-            }
343
-        }
344
-        return $actions;
345
-    }
346
-
347
-
348
-    /**
349
-     * @param EE_Event $item
350
-     * @return string
351
-     * @throws EE_Error
352
-     */
353
-    public function column_author(EE_Event $item)
354
-    {
355
-        // user author info
356
-        $event_author = get_userdata($item->wp_user());
357
-        $gravatar = get_avatar($item->wp_user(), '15');
358
-        // filter link
359
-        $query_args = array(
360
-            'action'      => 'default',
361
-            'EVT_wp_user' => $item->wp_user(),
362
-        );
363
-        $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL);
364
-        return $gravatar . '  <a href="' . $filter_url . '"'
365
-               . ' title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">'
366
-               . $event_author->display_name
367
-               . '</a>';
368
-    }
369
-
370
-
371
-    /**
372
-     * @param EE_Event $event
373
-     * @return string
374
-     * @throws EE_Error
375
-     */
376
-    public function column_event_category(EE_Event $event)
377
-    {
378
-        $event_categories = $event->get_all_event_categories();
379
-        return implode(
380
-            ', ',
381
-            array_map(
382
-                function (EE_Term $category) {
383
-                    return $category->name();
384
-                },
385
-                $event_categories
386
-            )
387
-        );
388
-    }
389
-
390
-
391
-    /**
392
-     * @param EE_Event $item
393
-     * @return string
394
-     * @throws EE_Error
395
-     */
396
-    public function column_venue(EE_Event $item)
397
-    {
398
-        $venue = $item->get_first_related('Venue');
399
-        return ! empty($venue)
400
-            ? $venue->name()
401
-            : '';
402
-    }
403
-
404
-
405
-    /**
406
-     * @param EE_Event $item
407
-     * @return string
408
-     * @throws EE_Error
409
-     */
410
-    public function column_start_date_time(EE_Event $item)
411
-    {
412
-        return $this->_dtt instanceof EE_Datetime
413
-            ? $this->_dtt->get_i18n_datetime('DTT_EVT_start')
414
-            : esc_html__('No Date was saved for this Event', 'event_espresso');
415
-    }
416
-
417
-
418
-    /**
419
-     * @param EE_Event $item
420
-     * @return string
421
-     * @throws EE_Error
422
-     */
423
-    public function column_reg_begins(EE_Event $item)
424
-    {
425
-        $reg_start = $item->get_ticket_with_earliest_start_time();
426
-        return $reg_start instanceof EE_Ticket
427
-            ? $reg_start->get_i18n_datetime('TKT_start_date')
428
-            : esc_html__('No Tickets have been setup for this Event', 'event_espresso');
429
-    }
430
-
431
-
432
-    /**
433
-     * @param EE_Event $item
434
-     * @return int|string
435
-     * @throws EE_Error
436
-     * @throws InvalidArgumentException
437
-     * @throws InvalidDataTypeException
438
-     * @throws InvalidInterfaceException
439
-     */
440
-    public function column_attendees(EE_Event $item)
441
-    {
442
-        $attendees_query_args = array(
443
-            'action'   => 'default',
444
-            'event_id' => $item->ID(),
445
-        );
446
-        $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
447
-        $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID());
448
-        return EE_Registry::instance()->CAP->current_user_can(
449
-            'ee_read_event',
450
-            'espresso_registrations_view_registration',
451
-            $item->ID()
452
-        )
453
-               && EE_Registry::instance()->CAP->current_user_can(
454
-                   'ee_read_registrations',
455
-                   'espresso_registrations_view_registration'
456
-               )
457
-            ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>'
458
-            : $registered_attendees;
459
-    }
460
-
461
-
462
-    /**
463
-     * @param EE_Event $item
464
-     * @return float
465
-     * @throws EE_Error
466
-     * @throws InvalidArgumentException
467
-     * @throws InvalidDataTypeException
468
-     * @throws InvalidInterfaceException
469
-     */
470
-    public function column_tkts_sold(EE_Event $item)
471
-    {
472
-        return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold');
473
-    }
474
-
475
-
476
-    /**
477
-     * @param EE_Event $item
478
-     * @return string
479
-     * @throws EE_Error
480
-     * @throws InvalidArgumentException
481
-     * @throws InvalidDataTypeException
482
-     * @throws InvalidInterfaceException
483
-     */
484
-    public function column_actions(EE_Event $item)
485
-    {
486
-        // todo: remove when attendees is active
487
-        if (! defined('REG_ADMIN_URL')) {
488
-            define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
489
-        }
490
-        $action_links = array();
491
-        $view_link = get_permalink($item->ID());
492
-        $action_links[] = '<a href="' . $view_link . '"'
493
-                          . ' title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">';
494
-        $action_links[] = '<div class="dashicons dashicons-search"></div></a>';
495
-        if (EE_Registry::instance()->CAP->current_user_can(
496
-            'ee_edit_event',
497
-            'espresso_events_edit',
498
-            $item->ID()
499
-        )) {
500
-            $edit_query_args = array(
501
-                'action' => 'edit',
502
-                'post'   => $item->ID(),
503
-            );
504
-            $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
505
-            $action_links[] = '<a href="' . $edit_link . '"'
506
-                              . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">'
507
-                              . '<div class="ee-icon ee-icon-calendar-edit"></div>'
508
-                              . '</a>';
509
-        }
510
-        if (EE_Registry::instance()->CAP->current_user_can(
511
-            'ee_read_registrations',
512
-            'espresso_registrations_view_registration'
513
-        ) && EE_Registry::instance()->CAP->current_user_can(
514
-            'ee_read_event',
515
-            'espresso_registrations_view_registration',
516
-            $item->ID()
517
-        )
518
-        ) {
519
-            $attendees_query_args = array(
520
-                'action'   => 'default',
521
-                'event_id' => $item->ID(),
522
-            );
523
-            $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
524
-            $action_links[] = '<a href="' . $attendees_link . '"'
525
-                              . ' title="' . esc_attr__('View Registrants', 'event_espresso') . '">'
526
-                              . '<div class="dashicons dashicons-groups"></div>'
527
-                              . '</a>';
528
-        }
529
-        $action_links = apply_filters(
530
-            'FHEE__Events_Admin_List_Table__column_actions__action_links',
531
-            $action_links,
532
-            $item
533
-        );
534
-        return $this->_action_string(
535
-            implode("\n\t", $action_links),
536
-            $item,
537
-            'div'
538
-        );
539
-    }
540
-
541
-
542
-    /**
543
-     * Helper for adding columns conditionally
544
-     *
545
-     * @throws EE_Error
546
-     * @throws InvalidArgumentException
547
-     * @throws InvalidDataTypeException
548
-     * @throws InvalidInterfaceException
549
-     */
550
-    private function addConditionalColumns()
551
-    {
552
-        $event_category_count = EEM_Term::instance()->count(
553
-            [['Term_Taxonomy.taxonomy' => 'espresso_event_categories']]
554
-        );
555
-        if ($event_category_count === 0) {
556
-            return;
557
-        }
558
-        $column_array = [];
559
-        foreach ($this->_columns as $column => $column_label) {
560
-            $column_array[ $column ] = $column_label;
561
-            if ($column === 'venue') {
562
-                $column_array['event_category'] = esc_html__('Event Category', 'event_espresso');
563
-            }
564
-        }
565
-        $this->_columns = $column_array;
566
-    }
18
+	/**
19
+	 * @var EE_Datetime
20
+	 */
21
+	private $_dtt;
22
+
23
+
24
+	/**
25
+	 * Initial setup of data properties for the list table.
26
+	 */
27
+	protected function _setup_data()
28
+	{
29
+		$this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page);
30
+		$this->_all_data_count = $this->_admin_page->get_events(0, 0, true);
31
+	}
32
+
33
+
34
+	/**
35
+	 * Set up of additional properties for the list table.
36
+	 */
37
+	protected function _set_properties()
38
+	{
39
+		$this->_wp_list_args = array(
40
+			'singular' => esc_html__('event', 'event_espresso'),
41
+			'plural'   => esc_html__('events', 'event_espresso'),
42
+			'ajax'     => true, // for now
43
+			'screen'   => $this->_admin_page->get_current_screen()->id,
44
+		);
45
+		$this->_columns = array(
46
+			'cb'              => '<input type="checkbox" />',
47
+			'id'              => esc_html__('ID', 'event_espresso'),
48
+			'name'            => esc_html__('Name', 'event_espresso'),
49
+			'author'          => esc_html__('Author', 'event_espresso'),
50
+			'venue'           => esc_html__('Venue', 'event_espresso'),
51
+			'start_date_time' => esc_html__('Event Start', 'event_espresso'),
52
+			'reg_begins'      => esc_html__('On Sale', 'event_espresso'),
53
+			'attendees'       => '<span class="dashicons dashicons-groups ee-icon-color-ee-green ee-icon-size-20">'
54
+								 . '<span class="screen-reader-text">'
55
+								 . esc_html__('Approved Registrations', 'event_espresso')
56
+								 . '</span>'
57
+								 . '</span>',
58
+			// 'tkts_sold' => esc_html__('Tickets Sold', 'event_espresso'),
59
+			'actions'         => esc_html__('Actions', 'event_espresso'),
60
+		);
61
+		$this->addConditionalColumns();
62
+		$this->_sortable_columns = array(
63
+			'id'              => array('EVT_ID' => true),
64
+			'name'            => array('EVT_name' => false),
65
+			'author'          => array('EVT_wp_user' => false),
66
+			'venue'           => array('Venue.VNU_name' => false),
67
+			'start_date_time' => array('Datetime.DTT_EVT_start' => false),
68
+			'reg_begins'      => array('Datetime.Ticket.TKT_start_date' => false),
69
+		);
70
+
71
+		$this->_primary_column = 'id';
72
+		$this->_hidden_columns = array('author', 'event_category');
73
+	}
74
+
75
+
76
+	/**
77
+	 * @return array
78
+	 */
79
+	protected function _get_table_filters()
80
+	{
81
+		return array(); // no filters with decaf
82
+	}
83
+
84
+
85
+	/**
86
+	 * Setup of views properties.
87
+	 *
88
+	 * @throws InvalidDataTypeException
89
+	 * @throws InvalidInterfaceException
90
+	 * @throws InvalidArgumentException
91
+	 */
92
+	protected function _add_view_counts()
93
+	{
94
+		$this->_views['all']['count'] = $this->_admin_page->total_events();
95
+		$this->_views['draft']['count'] = $this->_admin_page->total_events_draft();
96
+		if (EE_Registry::instance()->CAP->current_user_can(
97
+			'ee_delete_events',
98
+			'espresso_events_trash_events'
99
+		)) {
100
+			$this->_views['trash']['count'] = $this->_admin_page->total_trashed_events();
101
+		}
102
+	}
103
+
104
+
105
+	/**
106
+	 * @param EE_Event $item
107
+	 * @return string
108
+	 * @throws EE_Error
109
+	 */
110
+	protected function _get_row_class($item)
111
+	{
112
+		$class = parent::_get_row_class($item);
113
+		// add status class
114
+		$class .= $item instanceof EE_Event
115
+			? ' ee-status-strip event-status-' . $item->get_active_status()
116
+			: '';
117
+		if ($this->_has_checkbox_column) {
118
+			$class .= ' has-checkbox-column';
119
+		}
120
+		return $class;
121
+	}
122
+
123
+
124
+	/**
125
+	 * @param EE_Event $item
126
+	 * @return string
127
+	 * @throws EE_Error
128
+	 */
129
+	public function column_status(EE_Event $item)
130
+	{
131
+		return '<span class="ee-status-strip ee-status-strip-td event-status-'
132
+			   . $item->get_active_status()
133
+			   . '"></span>';
134
+	}
135
+
136
+
137
+	/**
138
+	 * @param  EE_Event $item
139
+	 * @return string
140
+	 * @throws EE_Error
141
+	 */
142
+	public function column_cb($item)
143
+	{
144
+		if (! $item instanceof EE_Event) {
145
+			return '';
146
+		}
147
+		$this->_dtt = $item->primary_datetime(); // set this for use in other columns
148
+		// does event have any attached registrations?
149
+		$regs = $item->count_related('Registration');
150
+		return $regs > 0 && $this->_view === 'trash'
151
+			? '<span class="ee-lock-icon"></span>'
152
+			: sprintf(
153
+				'<input type="checkbox" name="EVT_IDs[]" value="%s" />',
154
+				$item->ID()
155
+			);
156
+	}
157
+
158
+
159
+	/**
160
+	 * @param EE_Event $item
161
+	 * @return mixed|string
162
+	 * @throws EE_Error
163
+	 */
164
+	public function column_id(EE_Event $item)
165
+	{
166
+		$content = $item->ID();
167
+		$content .= '  <span class="show-on-mobile-view-only">' . $item->name() . '</span>';
168
+		return $content;
169
+	}
170
+
171
+
172
+	/**
173
+	 * @param EE_Event $item
174
+	 * @return string
175
+	 * @throws EE_Error
176
+	 * @throws InvalidArgumentException
177
+	 * @throws InvalidDataTypeException
178
+	 * @throws InvalidInterfaceException
179
+	 */
180
+	public function column_name(EE_Event $item)
181
+	{
182
+		$edit_query_args = array(
183
+			'action' => 'edit',
184
+			'post'   => $item->ID(),
185
+		);
186
+		$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
187
+		$actions = $this->_column_name_action_setup($item);
188
+		$status = ''; // $item->status() !== 'publish' ? ' (' . $item->status() . ')' : '';
189
+		$content = '<strong><a class="row-title" href="'
190
+				   . $edit_link . '">'
191
+				   . $item->name()
192
+				   . '</a></strong>'
193
+				   . $status;
194
+		$content .= '<br><span class="ee-status-text-small">'
195
+					. EEH_Template::pretty_status(
196
+						$item->get_active_status(),
197
+						false,
198
+						'sentence'
199
+					)
200
+					. '</span>';
201
+		$content .= $this->row_actions($actions);
202
+		return $content;
203
+	}
204
+
205
+
206
+	/**
207
+	 * Just a method for setting up the actions for the name column
208
+	 *
209
+	 * @param EE_Event $item
210
+	 * @return array array of actions
211
+	 * @throws EE_Error
212
+	 * @throws InvalidArgumentException
213
+	 * @throws InvalidDataTypeException
214
+	 * @throws InvalidInterfaceException
215
+	 */
216
+	protected function _column_name_action_setup(EE_Event $item)
217
+	{
218
+		// todo: remove when attendees is active
219
+		if (! defined('REG_ADMIN_URL')) {
220
+			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
221
+		}
222
+		$actions = array();
223
+		$restore_event_link = '';
224
+		$delete_event_link = '';
225
+		$trash_event_link = '';
226
+		if (EE_Registry::instance()->CAP->current_user_can(
227
+			'ee_edit_event',
228
+			'espresso_events_edit',
229
+			$item->ID()
230
+		)) {
231
+			$edit_query_args = array(
232
+				'action' => 'edit',
233
+				'post'   => $item->ID(),
234
+			);
235
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
236
+			$actions['edit'] = '<a href="' . $edit_link . '"'
237
+							   . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">'
238
+							   . esc_html__('Edit', 'event_espresso')
239
+							   . '</a>';
240
+		}
241
+		if (EE_Registry::instance()->CAP->current_user_can(
242
+			'ee_read_registrations',
243
+			'espresso_registrations_view_registration'
244
+		)
245
+			&& EE_Registry::instance()->CAP->current_user_can(
246
+				'ee_read_event',
247
+				'espresso_registrations_view_registration',
248
+				$item->ID()
249
+			)
250
+		) {
251
+			$attendees_query_args = array(
252
+				'action'   => 'default',
253
+				'event_id' => $item->ID(),
254
+			);
255
+			$attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
256
+			$actions['attendees'] = '<a href="' . $attendees_link . '"'
257
+									. ' title="' . esc_attr__('View Registrations', 'event_espresso') . '">'
258
+									. esc_html__('Registrations', 'event_espresso')
259
+									. '</a>';
260
+		}
261
+		if (EE_Registry::instance()->CAP->current_user_can(
262
+			'ee_delete_event',
263
+			'espresso_events_trash_event',
264
+			$item->ID()
265
+		)) {
266
+			$trash_event_query_args = array(
267
+				'action' => 'trash_event',
268
+				'EVT_ID' => $item->ID(),
269
+			);
270
+			$trash_event_link = EE_Admin_Page::add_query_args_and_nonce(
271
+				$trash_event_query_args,
272
+				EVENTS_ADMIN_URL
273
+			);
274
+		}
275
+		if (EE_Registry::instance()->CAP->current_user_can(
276
+			'ee_delete_event',
277
+			'espresso_events_restore_event',
278
+			$item->ID()
279
+		)) {
280
+			$restore_event_query_args = array(
281
+				'action' => 'restore_event',
282
+				'EVT_ID' => $item->ID(),
283
+			);
284
+			$restore_event_link = EE_Admin_Page::add_query_args_and_nonce(
285
+				$restore_event_query_args,
286
+				EVENTS_ADMIN_URL
287
+			);
288
+		}
289
+		if (EE_Registry::instance()->CAP->current_user_can(
290
+			'ee_delete_event',
291
+			'espresso_events_delete_event',
292
+			$item->ID()
293
+		)) {
294
+			$delete_event_query_args = array(
295
+				'action' => 'delete_event',
296
+				'EVT_ID' => $item->ID(),
297
+			);
298
+			$delete_event_link = EE_Admin_Page::add_query_args_and_nonce(
299
+				$delete_event_query_args,
300
+				EVENTS_ADMIN_URL
301
+			);
302
+		}
303
+		$view_link = get_permalink($item->ID());
304
+		$actions['view'] = '<a href="' . $view_link . '"'
305
+						   . ' title="' . esc_attr__('View Event', 'event_espresso') . '">'
306
+						   . esc_html__('View', 'event_espresso')
307
+						   . '</a>';
308
+		if ($item->get('status') === 'trash') {
309
+			if (EE_Registry::instance()->CAP->current_user_can(
310
+				'ee_delete_event',
311
+				'espresso_events_restore_event',
312
+				$item->ID()
313
+			)) {
314
+				$actions['restore_from_trash'] = '<a href="' . $restore_event_link . '"'
315
+												 . ' title="' . esc_attr__('Restore from Trash', 'event_espresso')
316
+												 . '">'
317
+												 . esc_html__('Restore from Trash', 'event_espresso')
318
+												 . '</a>';
319
+			}
320
+			if ($item->count_related('Registration') === 0
321
+				&& EE_Registry::instance()->CAP->current_user_can(
322
+					'ee_delete_event',
323
+					'espresso_events_delete_event',
324
+					$item->ID()
325
+				)
326
+			) {
327
+				$actions['delete'] = '<a href="' . $delete_event_link . '"'
328
+									 . ' title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">'
329
+									 . esc_html__('Delete Permanently', 'event_espresso')
330
+									 . '</a>';
331
+			}
332
+		} else {
333
+			if (EE_Registry::instance()->CAP->current_user_can(
334
+				'ee_delete_event',
335
+				'espresso_events_trash_event',
336
+				$item->ID()
337
+			)) {
338
+				$actions['move to trash'] = '<a href="' . $trash_event_link . '"'
339
+											. ' title="' . esc_attr__('Trash Event', 'event_espresso') . '">'
340
+											. esc_html__('Trash', 'event_espresso')
341
+											. '</a>';
342
+			}
343
+		}
344
+		return $actions;
345
+	}
346
+
347
+
348
+	/**
349
+	 * @param EE_Event $item
350
+	 * @return string
351
+	 * @throws EE_Error
352
+	 */
353
+	public function column_author(EE_Event $item)
354
+	{
355
+		// user author info
356
+		$event_author = get_userdata($item->wp_user());
357
+		$gravatar = get_avatar($item->wp_user(), '15');
358
+		// filter link
359
+		$query_args = array(
360
+			'action'      => 'default',
361
+			'EVT_wp_user' => $item->wp_user(),
362
+		);
363
+		$filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL);
364
+		return $gravatar . '  <a href="' . $filter_url . '"'
365
+			   . ' title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">'
366
+			   . $event_author->display_name
367
+			   . '</a>';
368
+	}
369
+
370
+
371
+	/**
372
+	 * @param EE_Event $event
373
+	 * @return string
374
+	 * @throws EE_Error
375
+	 */
376
+	public function column_event_category(EE_Event $event)
377
+	{
378
+		$event_categories = $event->get_all_event_categories();
379
+		return implode(
380
+			', ',
381
+			array_map(
382
+				function (EE_Term $category) {
383
+					return $category->name();
384
+				},
385
+				$event_categories
386
+			)
387
+		);
388
+	}
389
+
390
+
391
+	/**
392
+	 * @param EE_Event $item
393
+	 * @return string
394
+	 * @throws EE_Error
395
+	 */
396
+	public function column_venue(EE_Event $item)
397
+	{
398
+		$venue = $item->get_first_related('Venue');
399
+		return ! empty($venue)
400
+			? $venue->name()
401
+			: '';
402
+	}
403
+
404
+
405
+	/**
406
+	 * @param EE_Event $item
407
+	 * @return string
408
+	 * @throws EE_Error
409
+	 */
410
+	public function column_start_date_time(EE_Event $item)
411
+	{
412
+		return $this->_dtt instanceof EE_Datetime
413
+			? $this->_dtt->get_i18n_datetime('DTT_EVT_start')
414
+			: esc_html__('No Date was saved for this Event', 'event_espresso');
415
+	}
416
+
417
+
418
+	/**
419
+	 * @param EE_Event $item
420
+	 * @return string
421
+	 * @throws EE_Error
422
+	 */
423
+	public function column_reg_begins(EE_Event $item)
424
+	{
425
+		$reg_start = $item->get_ticket_with_earliest_start_time();
426
+		return $reg_start instanceof EE_Ticket
427
+			? $reg_start->get_i18n_datetime('TKT_start_date')
428
+			: esc_html__('No Tickets have been setup for this Event', 'event_espresso');
429
+	}
430
+
431
+
432
+	/**
433
+	 * @param EE_Event $item
434
+	 * @return int|string
435
+	 * @throws EE_Error
436
+	 * @throws InvalidArgumentException
437
+	 * @throws InvalidDataTypeException
438
+	 * @throws InvalidInterfaceException
439
+	 */
440
+	public function column_attendees(EE_Event $item)
441
+	{
442
+		$attendees_query_args = array(
443
+			'action'   => 'default',
444
+			'event_id' => $item->ID(),
445
+		);
446
+		$attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
447
+		$registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID());
448
+		return EE_Registry::instance()->CAP->current_user_can(
449
+			'ee_read_event',
450
+			'espresso_registrations_view_registration',
451
+			$item->ID()
452
+		)
453
+			   && EE_Registry::instance()->CAP->current_user_can(
454
+				   'ee_read_registrations',
455
+				   'espresso_registrations_view_registration'
456
+			   )
457
+			? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>'
458
+			: $registered_attendees;
459
+	}
460
+
461
+
462
+	/**
463
+	 * @param EE_Event $item
464
+	 * @return float
465
+	 * @throws EE_Error
466
+	 * @throws InvalidArgumentException
467
+	 * @throws InvalidDataTypeException
468
+	 * @throws InvalidInterfaceException
469
+	 */
470
+	public function column_tkts_sold(EE_Event $item)
471
+	{
472
+		return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold');
473
+	}
474
+
475
+
476
+	/**
477
+	 * @param EE_Event $item
478
+	 * @return string
479
+	 * @throws EE_Error
480
+	 * @throws InvalidArgumentException
481
+	 * @throws InvalidDataTypeException
482
+	 * @throws InvalidInterfaceException
483
+	 */
484
+	public function column_actions(EE_Event $item)
485
+	{
486
+		// todo: remove when attendees is active
487
+		if (! defined('REG_ADMIN_URL')) {
488
+			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
489
+		}
490
+		$action_links = array();
491
+		$view_link = get_permalink($item->ID());
492
+		$action_links[] = '<a href="' . $view_link . '"'
493
+						  . ' title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">';
494
+		$action_links[] = '<div class="dashicons dashicons-search"></div></a>';
495
+		if (EE_Registry::instance()->CAP->current_user_can(
496
+			'ee_edit_event',
497
+			'espresso_events_edit',
498
+			$item->ID()
499
+		)) {
500
+			$edit_query_args = array(
501
+				'action' => 'edit',
502
+				'post'   => $item->ID(),
503
+			);
504
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
505
+			$action_links[] = '<a href="' . $edit_link . '"'
506
+							  . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">'
507
+							  . '<div class="ee-icon ee-icon-calendar-edit"></div>'
508
+							  . '</a>';
509
+		}
510
+		if (EE_Registry::instance()->CAP->current_user_can(
511
+			'ee_read_registrations',
512
+			'espresso_registrations_view_registration'
513
+		) && EE_Registry::instance()->CAP->current_user_can(
514
+			'ee_read_event',
515
+			'espresso_registrations_view_registration',
516
+			$item->ID()
517
+		)
518
+		) {
519
+			$attendees_query_args = array(
520
+				'action'   => 'default',
521
+				'event_id' => $item->ID(),
522
+			);
523
+			$attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
524
+			$action_links[] = '<a href="' . $attendees_link . '"'
525
+							  . ' title="' . esc_attr__('View Registrants', 'event_espresso') . '">'
526
+							  . '<div class="dashicons dashicons-groups"></div>'
527
+							  . '</a>';
528
+		}
529
+		$action_links = apply_filters(
530
+			'FHEE__Events_Admin_List_Table__column_actions__action_links',
531
+			$action_links,
532
+			$item
533
+		);
534
+		return $this->_action_string(
535
+			implode("\n\t", $action_links),
536
+			$item,
537
+			'div'
538
+		);
539
+	}
540
+
541
+
542
+	/**
543
+	 * Helper for adding columns conditionally
544
+	 *
545
+	 * @throws EE_Error
546
+	 * @throws InvalidArgumentException
547
+	 * @throws InvalidDataTypeException
548
+	 * @throws InvalidInterfaceException
549
+	 */
550
+	private function addConditionalColumns()
551
+	{
552
+		$event_category_count = EEM_Term::instance()->count(
553
+			[['Term_Taxonomy.taxonomy' => 'espresso_event_categories']]
554
+		);
555
+		if ($event_category_count === 0) {
556
+			return;
557
+		}
558
+		$column_array = [];
559
+		foreach ($this->_columns as $column => $column_label) {
560
+			$column_array[ $column ] = $column_label;
561
+			if ($column === 'venue') {
562
+				$column_array['event_category'] = esc_html__('Event Category', 'event_espresso');
563
+			}
564
+		}
565
+		$this->_columns = $column_array;
566
+	}
567 567
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $class = parent::_get_row_class($item);
113 113
         // add status class
114 114
         $class .= $item instanceof EE_Event
115
-            ? ' ee-status-strip event-status-' . $item->get_active_status()
115
+            ? ' ee-status-strip event-status-'.$item->get_active_status()
116 116
             : '';
117 117
         if ($this->_has_checkbox_column) {
118 118
             $class .= ' has-checkbox-column';
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function column_cb($item)
143 143
     {
144
-        if (! $item instanceof EE_Event) {
144
+        if ( ! $item instanceof EE_Event) {
145 145
             return '';
146 146
         }
147 147
         $this->_dtt = $item->primary_datetime(); // set this for use in other columns
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     public function column_id(EE_Event $item)
165 165
     {
166 166
         $content = $item->ID();
167
-        $content .= '  <span class="show-on-mobile-view-only">' . $item->name() . '</span>';
167
+        $content .= '  <span class="show-on-mobile-view-only">'.$item->name().'</span>';
168 168
         return $content;
169 169
     }
170 170
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $actions = $this->_column_name_action_setup($item);
188 188
         $status = ''; // $item->status() !== 'publish' ? ' (' . $item->status() . ')' : '';
189 189
         $content = '<strong><a class="row-title" href="'
190
-                   . $edit_link . '">'
190
+                   . $edit_link.'">'
191 191
                    . $item->name()
192 192
                    . '</a></strong>'
193 193
                    . $status;
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     protected function _column_name_action_setup(EE_Event $item)
217 217
     {
218 218
         // todo: remove when attendees is active
219
-        if (! defined('REG_ADMIN_URL')) {
219
+        if ( ! defined('REG_ADMIN_URL')) {
220 220
             define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
221 221
         }
222 222
         $actions = array();
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
                 'post'   => $item->ID(),
234 234
             );
235 235
             $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
236
-            $actions['edit'] = '<a href="' . $edit_link . '"'
237
-                               . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">'
236
+            $actions['edit'] = '<a href="'.$edit_link.'"'
237
+                               . ' title="'.esc_attr__('Edit Event', 'event_espresso').'">'
238 238
                                . esc_html__('Edit', 'event_espresso')
239 239
                                . '</a>';
240 240
         }
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
                 'event_id' => $item->ID(),
254 254
             );
255 255
             $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
256
-            $actions['attendees'] = '<a href="' . $attendees_link . '"'
257
-                                    . ' title="' . esc_attr__('View Registrations', 'event_espresso') . '">'
256
+            $actions['attendees'] = '<a href="'.$attendees_link.'"'
257
+                                    . ' title="'.esc_attr__('View Registrations', 'event_espresso').'">'
258 258
                                     . esc_html__('Registrations', 'event_espresso')
259 259
                                     . '</a>';
260 260
         }
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
             );
302 302
         }
303 303
         $view_link = get_permalink($item->ID());
304
-        $actions['view'] = '<a href="' . $view_link . '"'
305
-                           . ' title="' . esc_attr__('View Event', 'event_espresso') . '">'
304
+        $actions['view'] = '<a href="'.$view_link.'"'
305
+                           . ' title="'.esc_attr__('View Event', 'event_espresso').'">'
306 306
                            . esc_html__('View', 'event_espresso')
307 307
                            . '</a>';
308 308
         if ($item->get('status') === 'trash') {
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
                 'espresso_events_restore_event',
312 312
                 $item->ID()
313 313
             )) {
314
-                $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '"'
315
-                                                 . ' title="' . esc_attr__('Restore from Trash', 'event_espresso')
314
+                $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'"'
315
+                                                 . ' title="'.esc_attr__('Restore from Trash', 'event_espresso')
316 316
                                                  . '">'
317 317
                                                  . esc_html__('Restore from Trash', 'event_espresso')
318 318
                                                  . '</a>';
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
                     $item->ID()
325 325
                 )
326 326
             ) {
327
-                $actions['delete'] = '<a href="' . $delete_event_link . '"'
328
-                                     . ' title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">'
327
+                $actions['delete'] = '<a href="'.$delete_event_link.'"'
328
+                                     . ' title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'
329 329
                                      . esc_html__('Delete Permanently', 'event_espresso')
330 330
                                      . '</a>';
331 331
             }
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
                 'espresso_events_trash_event',
336 336
                 $item->ID()
337 337
             )) {
338
-                $actions['move to trash'] = '<a href="' . $trash_event_link . '"'
339
-                                            . ' title="' . esc_attr__('Trash Event', 'event_espresso') . '">'
338
+                $actions['move to trash'] = '<a href="'.$trash_event_link.'"'
339
+                                            . ' title="'.esc_attr__('Trash Event', 'event_espresso').'">'
340 340
                                             . esc_html__('Trash', 'event_espresso')
341 341
                                             . '</a>';
342 342
             }
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
             'EVT_wp_user' => $item->wp_user(),
362 362
         );
363 363
         $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL);
364
-        return $gravatar . '  <a href="' . $filter_url . '"'
365
-               . ' title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">'
364
+        return $gravatar.'  <a href="'.$filter_url.'"'
365
+               . ' title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'
366 366
                . $event_author->display_name
367 367
                . '</a>';
368 368
     }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
         return implode(
380 380
             ', ',
381 381
             array_map(
382
-                function (EE_Term $category) {
382
+                function(EE_Term $category) {
383 383
                     return $category->name();
384 384
                 },
385 385
                 $event_categories
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
                    'ee_read_registrations',
455 455
                    'espresso_registrations_view_registration'
456 456
                )
457
-            ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>'
457
+            ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>'
458 458
             : $registered_attendees;
459 459
     }
460 460
 
@@ -484,13 +484,13 @@  discard block
 block discarded – undo
484 484
     public function column_actions(EE_Event $item)
485 485
     {
486 486
         // todo: remove when attendees is active
487
-        if (! defined('REG_ADMIN_URL')) {
487
+        if ( ! defined('REG_ADMIN_URL')) {
488 488
             define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
489 489
         }
490 490
         $action_links = array();
491 491
         $view_link = get_permalink($item->ID());
492
-        $action_links[] = '<a href="' . $view_link . '"'
493
-                          . ' title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">';
492
+        $action_links[] = '<a href="'.$view_link.'"'
493
+                          . ' title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">';
494 494
         $action_links[] = '<div class="dashicons dashicons-search"></div></a>';
495 495
         if (EE_Registry::instance()->CAP->current_user_can(
496 496
             'ee_edit_event',
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
                 'post'   => $item->ID(),
503 503
             );
504 504
             $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
505
-            $action_links[] = '<a href="' . $edit_link . '"'
506
-                              . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">'
505
+            $action_links[] = '<a href="'.$edit_link.'"'
506
+                              . ' title="'.esc_attr__('Edit Event', 'event_espresso').'">'
507 507
                               . '<div class="ee-icon ee-icon-calendar-edit"></div>'
508 508
                               . '</a>';
509 509
         }
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
                 'event_id' => $item->ID(),
522 522
             );
523 523
             $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
524
-            $action_links[] = '<a href="' . $attendees_link . '"'
525
-                              . ' title="' . esc_attr__('View Registrants', 'event_espresso') . '">'
524
+            $action_links[] = '<a href="'.$attendees_link.'"'
525
+                              . ' title="'.esc_attr__('View Registrants', 'event_espresso').'">'
526 526
                               . '<div class="dashicons dashicons-groups"></div>'
527 527
                               . '</a>';
528 528
         }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         }
558 558
         $column_array = [];
559 559
         foreach ($this->_columns as $column => $column_label) {
560
-            $column_array[ $column ] = $column_label;
560
+            $column_array[$column] = $column_label;
561 561
             if ($column === 'venue') {
562 562
                 $column_array['event_category'] = esc_html__('Event Category', 'event_espresso');
563 563
             }
Please login to merge, or discard this patch.