@@ -16,142 +16,142 @@ |
||
16 | 16 | class Event_Categories_Admin_List_Table extends EE_Admin_List_Table |
17 | 17 | { |
18 | 18 | |
19 | - public function __construct($admin_page) |
|
20 | - { |
|
21 | - parent::__construct($admin_page); |
|
22 | - } |
|
23 | - |
|
24 | - |
|
25 | - protected function _setup_data() |
|
26 | - { |
|
27 | - $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
28 | - $this->_all_data_count = EEM_Term_Taxonomy::instance()->count( |
|
29 | - array(array('taxonomy' => 'espresso_event_categories')) |
|
30 | - ); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - protected function _set_properties() |
|
35 | - { |
|
36 | - $this->_wp_list_args = array( |
|
37 | - 'singular' => esc_html__('event category', 'event_espresso'), |
|
38 | - 'plural' => esc_html__('event categories', 'event_espresso'), |
|
39 | - 'ajax' => true, // for now, |
|
40 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
41 | - ); |
|
42 | - |
|
43 | - $this->_columns = array( |
|
44 | - 'cb' => '<input type="checkbox" />', |
|
45 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
46 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
47 | - 'shortcode' => esc_html__('Shortcode', 'event_espresso'), |
|
48 | - 'count' => esc_html__('Events', 'event_espresso'), |
|
49 | - ); |
|
50 | - |
|
51 | - $this->_sortable_columns = array( |
|
52 | - 'id' => array('Term.term_id' => true), |
|
53 | - 'name' => array('Term.slug' => false), |
|
54 | - 'count' => array('term_count' => false), |
|
55 | - ); |
|
56 | - |
|
57 | - $this->_primary_column = 'id'; |
|
58 | - |
|
59 | - $this->_hidden_columns = array(); |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - // not needed |
|
64 | - protected function _get_table_filters() |
|
65 | - { |
|
66 | - return array(); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - protected function _add_view_counts() |
|
71 | - { |
|
72 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - public function column_cb($item) |
|
77 | - { |
|
78 | - return sprintf('<input type="checkbox" name="EVT_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - public function column_id($item) |
|
83 | - { |
|
84 | - $content = $item->get('term_id'); |
|
85 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
86 | - 'name' |
|
87 | - ) . '</span>'; |
|
88 | - return $content; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - public function column_name($item) |
|
93 | - { |
|
94 | - $edit_query_args = array( |
|
95 | - 'action' => 'edit_category', |
|
96 | - 'EVT_CAT_ID' => $item->get('term_id'), |
|
97 | - ); |
|
98 | - |
|
99 | - $delete_query_args = array( |
|
100 | - 'action' => 'delete_category', |
|
101 | - 'EVT_CAT_ID' => $item->get('term_id'), |
|
102 | - ); |
|
103 | - |
|
104 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
105 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EVENTS_ADMIN_URL); |
|
106 | - |
|
107 | - $actions = array( |
|
108 | - 'edit' => '<a href="' . $edit_link . '" aria-label="' . esc_attr__( |
|
109 | - 'Edit Category', |
|
110 | - 'event_espresso' |
|
111 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
112 | - ); |
|
113 | - |
|
114 | - $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . esc_attr__( |
|
115 | - 'Delete Category', |
|
116 | - 'event_espresso' |
|
117 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
118 | - |
|
119 | - $actions['view'] = sprintf( |
|
120 | - '<a href="%s" aria-label="%s">%s</a>', |
|
121 | - get_term_link($item->get('term_id')), |
|
122 | - esc_attr( |
|
123 | - sprintf( |
|
124 | - /* translators: %s: event category name */ |
|
125 | - __('View “%s” archive', 'event_espresso'), |
|
126 | - $item->get_first_related('Term')->get('name') |
|
127 | - ) |
|
128 | - ), |
|
129 | - esc_html__('View', 'event_espresso') |
|
130 | - ); |
|
131 | - |
|
132 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
133 | - 'name' |
|
134 | - ) . '</a></strong>'; |
|
135 | - $content .= $this->row_actions($actions); |
|
136 | - return $content; |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - public function column_shortcode($item) |
|
141 | - { |
|
142 | - $content = '[ESPRESSO_EVENTS category_slug=' . $item->get_first_related('Term')->get('slug') . ']'; |
|
143 | - return $content; |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - public function column_count($item) |
|
148 | - { |
|
149 | - $e_args = array( |
|
150 | - 'action' => 'default', |
|
151 | - 'EVT_CAT' => $item->get_first_related('Term')->ID(), |
|
152 | - ); |
|
153 | - $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EVENTS_ADMIN_URL); |
|
154 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
155 | - return $content; |
|
156 | - } |
|
19 | + public function __construct($admin_page) |
|
20 | + { |
|
21 | + parent::__construct($admin_page); |
|
22 | + } |
|
23 | + |
|
24 | + |
|
25 | + protected function _setup_data() |
|
26 | + { |
|
27 | + $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
28 | + $this->_all_data_count = EEM_Term_Taxonomy::instance()->count( |
|
29 | + array(array('taxonomy' => 'espresso_event_categories')) |
|
30 | + ); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + protected function _set_properties() |
|
35 | + { |
|
36 | + $this->_wp_list_args = array( |
|
37 | + 'singular' => esc_html__('event category', 'event_espresso'), |
|
38 | + 'plural' => esc_html__('event categories', 'event_espresso'), |
|
39 | + 'ajax' => true, // for now, |
|
40 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
41 | + ); |
|
42 | + |
|
43 | + $this->_columns = array( |
|
44 | + 'cb' => '<input type="checkbox" />', |
|
45 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
46 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
47 | + 'shortcode' => esc_html__('Shortcode', 'event_espresso'), |
|
48 | + 'count' => esc_html__('Events', 'event_espresso'), |
|
49 | + ); |
|
50 | + |
|
51 | + $this->_sortable_columns = array( |
|
52 | + 'id' => array('Term.term_id' => true), |
|
53 | + 'name' => array('Term.slug' => false), |
|
54 | + 'count' => array('term_count' => false), |
|
55 | + ); |
|
56 | + |
|
57 | + $this->_primary_column = 'id'; |
|
58 | + |
|
59 | + $this->_hidden_columns = array(); |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + // not needed |
|
64 | + protected function _get_table_filters() |
|
65 | + { |
|
66 | + return array(); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + protected function _add_view_counts() |
|
71 | + { |
|
72 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + public function column_cb($item) |
|
77 | + { |
|
78 | + return sprintf('<input type="checkbox" name="EVT_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + public function column_id($item) |
|
83 | + { |
|
84 | + $content = $item->get('term_id'); |
|
85 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
86 | + 'name' |
|
87 | + ) . '</span>'; |
|
88 | + return $content; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + public function column_name($item) |
|
93 | + { |
|
94 | + $edit_query_args = array( |
|
95 | + 'action' => 'edit_category', |
|
96 | + 'EVT_CAT_ID' => $item->get('term_id'), |
|
97 | + ); |
|
98 | + |
|
99 | + $delete_query_args = array( |
|
100 | + 'action' => 'delete_category', |
|
101 | + 'EVT_CAT_ID' => $item->get('term_id'), |
|
102 | + ); |
|
103 | + |
|
104 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
105 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EVENTS_ADMIN_URL); |
|
106 | + |
|
107 | + $actions = array( |
|
108 | + 'edit' => '<a href="' . $edit_link . '" aria-label="' . esc_attr__( |
|
109 | + 'Edit Category', |
|
110 | + 'event_espresso' |
|
111 | + ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
112 | + ); |
|
113 | + |
|
114 | + $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . esc_attr__( |
|
115 | + 'Delete Category', |
|
116 | + 'event_espresso' |
|
117 | + ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
118 | + |
|
119 | + $actions['view'] = sprintf( |
|
120 | + '<a href="%s" aria-label="%s">%s</a>', |
|
121 | + get_term_link($item->get('term_id')), |
|
122 | + esc_attr( |
|
123 | + sprintf( |
|
124 | + /* translators: %s: event category name */ |
|
125 | + __('View “%s” archive', 'event_espresso'), |
|
126 | + $item->get_first_related('Term')->get('name') |
|
127 | + ) |
|
128 | + ), |
|
129 | + esc_html__('View', 'event_espresso') |
|
130 | + ); |
|
131 | + |
|
132 | + $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
133 | + 'name' |
|
134 | + ) . '</a></strong>'; |
|
135 | + $content .= $this->row_actions($actions); |
|
136 | + return $content; |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + public function column_shortcode($item) |
|
141 | + { |
|
142 | + $content = '[ESPRESSO_EVENTS category_slug=' . $item->get_first_related('Term')->get('slug') . ']'; |
|
143 | + return $content; |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + public function column_count($item) |
|
148 | + { |
|
149 | + $e_args = array( |
|
150 | + 'action' => 'default', |
|
151 | + 'EVT_CAT' => $item->get_first_related('Term')->ID(), |
|
152 | + ); |
|
153 | + $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EVENTS_ADMIN_URL); |
|
154 | + $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
155 | + return $content; |
|
156 | + } |
|
157 | 157 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | public function column_id($item) |
83 | 83 | { |
84 | 84 | $content = $item->get('term_id'); |
85 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
85 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->get_first_related('Term')->get( |
|
86 | 86 | 'name' |
87 | - ) . '</span>'; |
|
87 | + ).'</span>'; |
|
88 | 88 | return $content; |
89 | 89 | } |
90 | 90 | |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EVENTS_ADMIN_URL); |
106 | 106 | |
107 | 107 | $actions = array( |
108 | - 'edit' => '<a href="' . $edit_link . '" aria-label="' . esc_attr__( |
|
108 | + 'edit' => '<a href="'.$edit_link.'" aria-label="'.esc_attr__( |
|
109 | 109 | 'Edit Category', |
110 | 110 | 'event_espresso' |
111 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
111 | + ).'">'.esc_html__('Edit', 'event_espresso').'</a>', |
|
112 | 112 | ); |
113 | 113 | |
114 | - $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . esc_attr__( |
|
114 | + $actions['delete'] = '<a href="'.$delete_link.'" aria-label="'.esc_attr__( |
|
115 | 115 | 'Delete Category', |
116 | 116 | 'event_espresso' |
117 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
117 | + ).'">'.esc_html__('Delete', 'event_espresso').'</a>'; |
|
118 | 118 | |
119 | 119 | $actions['view'] = sprintf( |
120 | 120 | '<a href="%s" aria-label="%s">%s</a>', |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | esc_html__('View', 'event_espresso') |
130 | 130 | ); |
131 | 131 | |
132 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
132 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->get_first_related('Term')->get( |
|
133 | 133 | 'name' |
134 | - ) . '</a></strong>'; |
|
134 | + ).'</a></strong>'; |
|
135 | 135 | $content .= $this->row_actions($actions); |
136 | 136 | return $content; |
137 | 137 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | public function column_shortcode($item) |
141 | 141 | { |
142 | - $content = '[ESPRESSO_EVENTS category_slug=' . $item->get_first_related('Term')->get('slug') . ']'; |
|
142 | + $content = '[ESPRESSO_EVENTS category_slug='.$item->get_first_related('Term')->get('slug').']'; |
|
143 | 143 | return $content; |
144 | 144 | } |
145 | 145 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | 'EVT_CAT' => $item->get_first_related('Term')->ID(), |
152 | 152 | ); |
153 | 153 | $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EVENTS_ADMIN_URL); |
154 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
154 | + $content = '<a href="'.$e_link.'">'.$item->get('term_count').'</a>'; |
|
155 | 155 | return $content; |
156 | 156 | } |
157 | 157 | } |