@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (! class_exists('WP_List_Table')) { |
4 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
4 | + require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | |
@@ -20,847 +20,847 @@ discard block |
||
20 | 20 | abstract class EE_Admin_List_Table extends WP_List_Table |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * holds the data that will be processed for the table |
|
25 | - * |
|
26 | - * @var array $_data |
|
27 | - */ |
|
28 | - protected $_data; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * This holds the value of all the data available for the given view (for all pages). |
|
33 | - * |
|
34 | - * @var int $_all_data_count |
|
35 | - */ |
|
36 | - protected $_all_data_count; |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * Will contain the count of trashed items for the view label. |
|
41 | - * |
|
42 | - * @var int $_trashed_count |
|
43 | - */ |
|
44 | - protected $_trashed_count; |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * This is what will be referenced as the slug for the current screen |
|
49 | - * |
|
50 | - * @var string $_screen |
|
51 | - */ |
|
52 | - protected $_screen; |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * this is the EE_Admin_Page object |
|
57 | - * |
|
58 | - * @var EE_Admin_Page $_admin_page |
|
59 | - */ |
|
60 | - protected $_admin_page; |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * The current view |
|
65 | - * |
|
66 | - * @var string $_view |
|
67 | - */ |
|
68 | - protected $_view; |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * array of possible views for this table |
|
73 | - * |
|
74 | - * @var array $_views |
|
75 | - */ |
|
76 | - protected $_views; |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * An array of key => value pairs containing information about the current table |
|
81 | - * array( |
|
82 | - * 'plural' => 'plural label', |
|
83 | - * 'singular' => 'singular label', |
|
84 | - * 'ajax' => false, //whether to use ajax or not |
|
85 | - * 'screen' => null, //string used to reference what screen this is |
|
86 | - * (WP_List_table converts to screen object) |
|
87 | - * ) |
|
88 | - * |
|
89 | - * @var array $_wp_list_args |
|
90 | - */ |
|
91 | - protected $_wp_list_args; |
|
92 | - |
|
93 | - /** |
|
94 | - * an array of column names |
|
95 | - * array( |
|
96 | - * 'internal-name' => 'Title' |
|
97 | - * ) |
|
98 | - * |
|
99 | - * @var array $_columns |
|
100 | - */ |
|
101 | - protected $_columns; |
|
102 | - |
|
103 | - /** |
|
104 | - * An array of sortable columns |
|
105 | - * array( |
|
106 | - * 'internal-name' => 'orderby' //or |
|
107 | - * 'internal-name' => array( 'orderby', true ) |
|
108 | - * ) |
|
109 | - * |
|
110 | - * @var array $_sortable_columns |
|
111 | - */ |
|
112 | - protected $_sortable_columns; |
|
113 | - |
|
114 | - /** |
|
115 | - * callback method used to perform AJAX row reordering |
|
116 | - * |
|
117 | - * @var string $_ajax_sorting_callback |
|
118 | - */ |
|
119 | - protected $_ajax_sorting_callback; |
|
120 | - |
|
121 | - /** |
|
122 | - * An array of hidden columns (if needed) |
|
123 | - * array('internal-name', 'internal-name') |
|
124 | - * |
|
125 | - * @var array $_hidden_columns |
|
126 | - */ |
|
127 | - protected $_hidden_columns; |
|
128 | - |
|
129 | - /** |
|
130 | - * holds the per_page value |
|
131 | - * |
|
132 | - * @var int $_per_page |
|
133 | - */ |
|
134 | - protected $_per_page; |
|
135 | - |
|
136 | - /** |
|
137 | - * holds what page number is currently being viewed |
|
138 | - * |
|
139 | - * @var int $_current_page |
|
140 | - */ |
|
141 | - protected $_current_page; |
|
142 | - |
|
143 | - /** |
|
144 | - * the reference string for the nonce_action |
|
145 | - * |
|
146 | - * @var string $_nonce_action_ref |
|
147 | - */ |
|
148 | - protected $_nonce_action_ref; |
|
149 | - |
|
150 | - /** |
|
151 | - * property to hold incoming request data (as set by the admin_page_core) |
|
152 | - * |
|
153 | - * @var array $_req_data |
|
154 | - */ |
|
155 | - protected $_req_data; |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * yes / no array for admin form fields |
|
160 | - * |
|
161 | - * @var array $_yes_no |
|
162 | - */ |
|
163 | - protected $_yes_no = array(); |
|
164 | - |
|
165 | - /** |
|
166 | - * Array describing buttons that should appear at the bottom of the page |
|
167 | - * Keys are strings that represent the button's function (specifically a key in _labels['buttons']), |
|
168 | - * and the values are another array with the following keys |
|
169 | - * array( |
|
170 | - * 'route' => 'page_route', |
|
171 | - * 'extra_request' => array('evt_id' => 1 ); //extra request vars that need to be included in the button. |
|
172 | - * ) |
|
173 | - * |
|
174 | - * @var array $_bottom_buttons |
|
175 | - */ |
|
176 | - protected $_bottom_buttons = array(); |
|
177 | - |
|
178 | - |
|
179 | - /** |
|
180 | - * Used to indicate what should be the primary column for the list table. |
|
181 | - * If not present then falls back to what WP calculates |
|
182 | - * as the primary column. |
|
183 | - * |
|
184 | - * @type string $_primary_column |
|
185 | - */ |
|
186 | - protected $_primary_column = ''; |
|
187 | - |
|
188 | - |
|
189 | - /** |
|
190 | - * Used to indicate whether the table has a checkbox column or not. |
|
191 | - * |
|
192 | - * @type bool $_has_checkbox_column |
|
193 | - */ |
|
194 | - protected $_has_checkbox_column = false; |
|
195 | - |
|
196 | - |
|
197 | - /** |
|
198 | - * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table |
|
199 | - */ |
|
200 | - public function __construct(EE_Admin_Page $admin_page) |
|
201 | - { |
|
202 | - $this->_admin_page = $admin_page; |
|
203 | - $this->_req_data = $this->_admin_page->get_request_data(); |
|
204 | - $this->_view = $this->_admin_page->get_view(); |
|
205 | - $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
206 | - $this->_current_page = $this->get_pagenum(); |
|
207 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
208 | - $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
209 | - |
|
210 | - $this->_per_page = $this->get_items_per_page($this->_screen . '_per_page', 20); |
|
211 | - |
|
212 | - $this->_setup_data(); |
|
213 | - $this->_add_view_counts(); |
|
214 | - |
|
215 | - $this->_nonce_action_ref = $this->_view; |
|
216 | - |
|
217 | - $this->_set_properties(); |
|
218 | - |
|
219 | - // set primary column |
|
220 | - add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
221 | - |
|
222 | - // set parent defaults |
|
223 | - parent::__construct($this->_wp_list_args); |
|
224 | - |
|
225 | - $this->prepare_items(); |
|
226 | - } |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * _setup_data |
|
231 | - * this method is used to setup the $_data, $_all_data_count, and _per_page properties |
|
232 | - * |
|
233 | - * @uses $this->_admin_page |
|
234 | - * @return void |
|
235 | - */ |
|
236 | - abstract protected function _setup_data(); |
|
237 | - |
|
238 | - |
|
239 | - /** |
|
240 | - * set the properties that this class needs to be able to execute wp_list_table properly |
|
241 | - * properties set: |
|
242 | - * _wp_list_args = what the arguments required for the parent _wp_list_table. |
|
243 | - * _columns = set the columns in an array. |
|
244 | - * _sortable_columns = columns that are sortable (array). |
|
245 | - * _hidden_columns = columns that are hidden (array) |
|
246 | - * _default_orderby = the default orderby for sorting. |
|
247 | - * |
|
248 | - * @abstract |
|
249 | - * @access protected |
|
250 | - * @return void |
|
251 | - */ |
|
252 | - abstract protected function _set_properties(); |
|
253 | - |
|
254 | - |
|
255 | - /** |
|
256 | - * _get_table_filters |
|
257 | - * We use this to assemble and return any filters that are associated with this table that help further refine what |
|
258 | - * get's shown in the table. |
|
259 | - * |
|
260 | - * @abstract |
|
261 | - * @access protected |
|
262 | - * @return string |
|
263 | - */ |
|
264 | - abstract protected function _get_table_filters(); |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * this is a method that child class will do to add counts to the views array so when views are displayed the |
|
269 | - * counts of the views is accurate. |
|
270 | - * |
|
271 | - * @abstract |
|
272 | - * @access protected |
|
273 | - * @return void |
|
274 | - */ |
|
275 | - abstract protected function _add_view_counts(); |
|
276 | - |
|
277 | - |
|
278 | - /** |
|
279 | - * _get_hidden_fields |
|
280 | - * returns a html string of hidden fields so if any table filters are used the current view will be respected. |
|
281 | - * |
|
282 | - * @return string |
|
283 | - */ |
|
284 | - protected function _get_hidden_fields() |
|
285 | - { |
|
286 | - $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
287 | - $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
288 | - // if action is STILL empty, then we set it to default |
|
289 | - $action = empty($action) ? 'default' : $action; |
|
290 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
291 | - $field .= '<input type="hidden" name="route" value="' . $action . '" />' . "\n";/**/ |
|
292 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
293 | - |
|
294 | - $bulk_actions = $this->_get_bulk_actions(); |
|
295 | - foreach ($bulk_actions as $bulk_action => $label) { |
|
296 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce"' |
|
297 | - . ' value="' . wp_create_nonce($bulk_action . '_nonce') . '" />' . "\n"; |
|
298 | - } |
|
299 | - |
|
300 | - return $field; |
|
301 | - } |
|
302 | - |
|
303 | - |
|
304 | - /** |
|
305 | - * _set_column_info |
|
306 | - * we're using this to set the column headers property. |
|
307 | - * |
|
308 | - * @access protected |
|
309 | - * @return void |
|
310 | - */ |
|
311 | - protected function _set_column_info() |
|
312 | - { |
|
313 | - $columns = $this->get_columns(); |
|
314 | - $hidden = $this->get_hidden_columns(); |
|
315 | - $_sortable = $this->get_sortable_columns(); |
|
316 | - |
|
317 | - /** |
|
318 | - * Dynamic hook allowing for adding sortable columns in this list table. |
|
319 | - * Note that $this->screen->id is in the format |
|
320 | - * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}. So for the messages list |
|
321 | - * table it is: event-espresso_page_espresso_messages. |
|
322 | - * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the |
|
323 | - * hook prefix ("event-espresso") will be different. |
|
324 | - * |
|
325 | - * @var array |
|
326 | - */ |
|
327 | - $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
328 | - |
|
329 | - $sortable = array(); |
|
330 | - foreach ($_sortable as $id => $data) { |
|
331 | - if (empty($data)) { |
|
332 | - continue; |
|
333 | - } |
|
334 | - // fix for offset errors with WP_List_Table default get_columninfo() |
|
335 | - if (is_array($data)) { |
|
336 | - $_data[0] = key($data); |
|
337 | - $_data[1] = isset($data[1]) ? $data[1] : false; |
|
338 | - } else { |
|
339 | - $_data[0] = $data; |
|
340 | - } |
|
341 | - |
|
342 | - $data = (array) $data; |
|
343 | - |
|
344 | - if (! isset($data[1])) { |
|
345 | - $_data[1] = false; |
|
346 | - } |
|
347 | - |
|
348 | - $sortable[ $id ] = $_data; |
|
349 | - } |
|
350 | - $primary = $this->get_primary_column_name(); |
|
351 | - $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
352 | - } |
|
353 | - |
|
354 | - |
|
355 | - /** |
|
356 | - * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814) |
|
357 | - * |
|
358 | - * @return string |
|
359 | - */ |
|
360 | - protected function get_primary_column_name() |
|
361 | - { |
|
362 | - foreach (class_parents($this) as $parent) { |
|
363 | - if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) { |
|
364 | - return parent::get_primary_column_name(); |
|
365 | - } |
|
366 | - } |
|
367 | - return $this->_primary_column; |
|
368 | - } |
|
369 | - |
|
370 | - |
|
371 | - /** |
|
372 | - * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814) |
|
373 | - * |
|
374 | - * @param EE_Base_Class $item |
|
375 | - * @param string $column_name |
|
376 | - * @param string $primary |
|
377 | - * @return string |
|
378 | - */ |
|
379 | - protected function handle_row_actions($item, $column_name, $primary) |
|
380 | - { |
|
381 | - foreach (class_parents($this) as $parent) { |
|
382 | - if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) { |
|
383 | - return parent::handle_row_actions($item, $column_name, $primary); |
|
384 | - } |
|
385 | - } |
|
386 | - return ''; |
|
387 | - } |
|
388 | - |
|
389 | - |
|
390 | - /** |
|
391 | - * _get_bulk_actions |
|
392 | - * This is a wrapper called by WP_List_Table::get_bulk_actions() |
|
393 | - * |
|
394 | - * @access protected |
|
395 | - * @return array bulk_actions |
|
396 | - */ |
|
397 | - protected function _get_bulk_actions() |
|
398 | - { |
|
399 | - $actions = array(); |
|
400 | - // the _views property should have the bulk_actions, so let's go through and extract them into a properly |
|
401 | - // formatted array for the wp_list_table(); |
|
402 | - foreach ($this->_views as $view => $args) { |
|
403 | - if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) { |
|
404 | - // each bulk action will correspond with a admin page route, so we can check whatever the capability is |
|
405 | - // for that page route and skip adding the bulk action if no access for the current logged in user. |
|
406 | - foreach ($args['bulk_action'] as $route => $label) { |
|
407 | - if ($this->_admin_page->check_user_access($route, true)) { |
|
408 | - $actions[ $route ] = $label; |
|
409 | - } |
|
410 | - } |
|
411 | - } |
|
412 | - } |
|
413 | - return $actions; |
|
414 | - } |
|
415 | - |
|
416 | - |
|
417 | - /** |
|
418 | - * Generate the table navigation above or below the table. |
|
419 | - * Overrides the parent table nav in WP_List_Table so we can hide the bulk action div if there are no bulk actions. |
|
420 | - * |
|
421 | - * @since 4.9.44.rc.001 |
|
422 | - */ |
|
423 | - public function display_tablenav($which) |
|
424 | - { |
|
425 | - if ('top' === $which) { |
|
426 | - wp_nonce_field('bulk-' . $this->_args['plural']); |
|
427 | - } |
|
428 | - ?> |
|
23 | + /** |
|
24 | + * holds the data that will be processed for the table |
|
25 | + * |
|
26 | + * @var array $_data |
|
27 | + */ |
|
28 | + protected $_data; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * This holds the value of all the data available for the given view (for all pages). |
|
33 | + * |
|
34 | + * @var int $_all_data_count |
|
35 | + */ |
|
36 | + protected $_all_data_count; |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * Will contain the count of trashed items for the view label. |
|
41 | + * |
|
42 | + * @var int $_trashed_count |
|
43 | + */ |
|
44 | + protected $_trashed_count; |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * This is what will be referenced as the slug for the current screen |
|
49 | + * |
|
50 | + * @var string $_screen |
|
51 | + */ |
|
52 | + protected $_screen; |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * this is the EE_Admin_Page object |
|
57 | + * |
|
58 | + * @var EE_Admin_Page $_admin_page |
|
59 | + */ |
|
60 | + protected $_admin_page; |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * The current view |
|
65 | + * |
|
66 | + * @var string $_view |
|
67 | + */ |
|
68 | + protected $_view; |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * array of possible views for this table |
|
73 | + * |
|
74 | + * @var array $_views |
|
75 | + */ |
|
76 | + protected $_views; |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * An array of key => value pairs containing information about the current table |
|
81 | + * array( |
|
82 | + * 'plural' => 'plural label', |
|
83 | + * 'singular' => 'singular label', |
|
84 | + * 'ajax' => false, //whether to use ajax or not |
|
85 | + * 'screen' => null, //string used to reference what screen this is |
|
86 | + * (WP_List_table converts to screen object) |
|
87 | + * ) |
|
88 | + * |
|
89 | + * @var array $_wp_list_args |
|
90 | + */ |
|
91 | + protected $_wp_list_args; |
|
92 | + |
|
93 | + /** |
|
94 | + * an array of column names |
|
95 | + * array( |
|
96 | + * 'internal-name' => 'Title' |
|
97 | + * ) |
|
98 | + * |
|
99 | + * @var array $_columns |
|
100 | + */ |
|
101 | + protected $_columns; |
|
102 | + |
|
103 | + /** |
|
104 | + * An array of sortable columns |
|
105 | + * array( |
|
106 | + * 'internal-name' => 'orderby' //or |
|
107 | + * 'internal-name' => array( 'orderby', true ) |
|
108 | + * ) |
|
109 | + * |
|
110 | + * @var array $_sortable_columns |
|
111 | + */ |
|
112 | + protected $_sortable_columns; |
|
113 | + |
|
114 | + /** |
|
115 | + * callback method used to perform AJAX row reordering |
|
116 | + * |
|
117 | + * @var string $_ajax_sorting_callback |
|
118 | + */ |
|
119 | + protected $_ajax_sorting_callback; |
|
120 | + |
|
121 | + /** |
|
122 | + * An array of hidden columns (if needed) |
|
123 | + * array('internal-name', 'internal-name') |
|
124 | + * |
|
125 | + * @var array $_hidden_columns |
|
126 | + */ |
|
127 | + protected $_hidden_columns; |
|
128 | + |
|
129 | + /** |
|
130 | + * holds the per_page value |
|
131 | + * |
|
132 | + * @var int $_per_page |
|
133 | + */ |
|
134 | + protected $_per_page; |
|
135 | + |
|
136 | + /** |
|
137 | + * holds what page number is currently being viewed |
|
138 | + * |
|
139 | + * @var int $_current_page |
|
140 | + */ |
|
141 | + protected $_current_page; |
|
142 | + |
|
143 | + /** |
|
144 | + * the reference string for the nonce_action |
|
145 | + * |
|
146 | + * @var string $_nonce_action_ref |
|
147 | + */ |
|
148 | + protected $_nonce_action_ref; |
|
149 | + |
|
150 | + /** |
|
151 | + * property to hold incoming request data (as set by the admin_page_core) |
|
152 | + * |
|
153 | + * @var array $_req_data |
|
154 | + */ |
|
155 | + protected $_req_data; |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * yes / no array for admin form fields |
|
160 | + * |
|
161 | + * @var array $_yes_no |
|
162 | + */ |
|
163 | + protected $_yes_no = array(); |
|
164 | + |
|
165 | + /** |
|
166 | + * Array describing buttons that should appear at the bottom of the page |
|
167 | + * Keys are strings that represent the button's function (specifically a key in _labels['buttons']), |
|
168 | + * and the values are another array with the following keys |
|
169 | + * array( |
|
170 | + * 'route' => 'page_route', |
|
171 | + * 'extra_request' => array('evt_id' => 1 ); //extra request vars that need to be included in the button. |
|
172 | + * ) |
|
173 | + * |
|
174 | + * @var array $_bottom_buttons |
|
175 | + */ |
|
176 | + protected $_bottom_buttons = array(); |
|
177 | + |
|
178 | + |
|
179 | + /** |
|
180 | + * Used to indicate what should be the primary column for the list table. |
|
181 | + * If not present then falls back to what WP calculates |
|
182 | + * as the primary column. |
|
183 | + * |
|
184 | + * @type string $_primary_column |
|
185 | + */ |
|
186 | + protected $_primary_column = ''; |
|
187 | + |
|
188 | + |
|
189 | + /** |
|
190 | + * Used to indicate whether the table has a checkbox column or not. |
|
191 | + * |
|
192 | + * @type bool $_has_checkbox_column |
|
193 | + */ |
|
194 | + protected $_has_checkbox_column = false; |
|
195 | + |
|
196 | + |
|
197 | + /** |
|
198 | + * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table |
|
199 | + */ |
|
200 | + public function __construct(EE_Admin_Page $admin_page) |
|
201 | + { |
|
202 | + $this->_admin_page = $admin_page; |
|
203 | + $this->_req_data = $this->_admin_page->get_request_data(); |
|
204 | + $this->_view = $this->_admin_page->get_view(); |
|
205 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
206 | + $this->_current_page = $this->get_pagenum(); |
|
207 | + $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
208 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
209 | + |
|
210 | + $this->_per_page = $this->get_items_per_page($this->_screen . '_per_page', 20); |
|
211 | + |
|
212 | + $this->_setup_data(); |
|
213 | + $this->_add_view_counts(); |
|
214 | + |
|
215 | + $this->_nonce_action_ref = $this->_view; |
|
216 | + |
|
217 | + $this->_set_properties(); |
|
218 | + |
|
219 | + // set primary column |
|
220 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
221 | + |
|
222 | + // set parent defaults |
|
223 | + parent::__construct($this->_wp_list_args); |
|
224 | + |
|
225 | + $this->prepare_items(); |
|
226 | + } |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * _setup_data |
|
231 | + * this method is used to setup the $_data, $_all_data_count, and _per_page properties |
|
232 | + * |
|
233 | + * @uses $this->_admin_page |
|
234 | + * @return void |
|
235 | + */ |
|
236 | + abstract protected function _setup_data(); |
|
237 | + |
|
238 | + |
|
239 | + /** |
|
240 | + * set the properties that this class needs to be able to execute wp_list_table properly |
|
241 | + * properties set: |
|
242 | + * _wp_list_args = what the arguments required for the parent _wp_list_table. |
|
243 | + * _columns = set the columns in an array. |
|
244 | + * _sortable_columns = columns that are sortable (array). |
|
245 | + * _hidden_columns = columns that are hidden (array) |
|
246 | + * _default_orderby = the default orderby for sorting. |
|
247 | + * |
|
248 | + * @abstract |
|
249 | + * @access protected |
|
250 | + * @return void |
|
251 | + */ |
|
252 | + abstract protected function _set_properties(); |
|
253 | + |
|
254 | + |
|
255 | + /** |
|
256 | + * _get_table_filters |
|
257 | + * We use this to assemble and return any filters that are associated with this table that help further refine what |
|
258 | + * get's shown in the table. |
|
259 | + * |
|
260 | + * @abstract |
|
261 | + * @access protected |
|
262 | + * @return string |
|
263 | + */ |
|
264 | + abstract protected function _get_table_filters(); |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * this is a method that child class will do to add counts to the views array so when views are displayed the |
|
269 | + * counts of the views is accurate. |
|
270 | + * |
|
271 | + * @abstract |
|
272 | + * @access protected |
|
273 | + * @return void |
|
274 | + */ |
|
275 | + abstract protected function _add_view_counts(); |
|
276 | + |
|
277 | + |
|
278 | + /** |
|
279 | + * _get_hidden_fields |
|
280 | + * returns a html string of hidden fields so if any table filters are used the current view will be respected. |
|
281 | + * |
|
282 | + * @return string |
|
283 | + */ |
|
284 | + protected function _get_hidden_fields() |
|
285 | + { |
|
286 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
287 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
288 | + // if action is STILL empty, then we set it to default |
|
289 | + $action = empty($action) ? 'default' : $action; |
|
290 | + $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
291 | + $field .= '<input type="hidden" name="route" value="' . $action . '" />' . "\n";/**/ |
|
292 | + $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
293 | + |
|
294 | + $bulk_actions = $this->_get_bulk_actions(); |
|
295 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
296 | + $field .= '<input type="hidden" name="' . $bulk_action . '_nonce"' |
|
297 | + . ' value="' . wp_create_nonce($bulk_action . '_nonce') . '" />' . "\n"; |
|
298 | + } |
|
299 | + |
|
300 | + return $field; |
|
301 | + } |
|
302 | + |
|
303 | + |
|
304 | + /** |
|
305 | + * _set_column_info |
|
306 | + * we're using this to set the column headers property. |
|
307 | + * |
|
308 | + * @access protected |
|
309 | + * @return void |
|
310 | + */ |
|
311 | + protected function _set_column_info() |
|
312 | + { |
|
313 | + $columns = $this->get_columns(); |
|
314 | + $hidden = $this->get_hidden_columns(); |
|
315 | + $_sortable = $this->get_sortable_columns(); |
|
316 | + |
|
317 | + /** |
|
318 | + * Dynamic hook allowing for adding sortable columns in this list table. |
|
319 | + * Note that $this->screen->id is in the format |
|
320 | + * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}. So for the messages list |
|
321 | + * table it is: event-espresso_page_espresso_messages. |
|
322 | + * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the |
|
323 | + * hook prefix ("event-espresso") will be different. |
|
324 | + * |
|
325 | + * @var array |
|
326 | + */ |
|
327 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
328 | + |
|
329 | + $sortable = array(); |
|
330 | + foreach ($_sortable as $id => $data) { |
|
331 | + if (empty($data)) { |
|
332 | + continue; |
|
333 | + } |
|
334 | + // fix for offset errors with WP_List_Table default get_columninfo() |
|
335 | + if (is_array($data)) { |
|
336 | + $_data[0] = key($data); |
|
337 | + $_data[1] = isset($data[1]) ? $data[1] : false; |
|
338 | + } else { |
|
339 | + $_data[0] = $data; |
|
340 | + } |
|
341 | + |
|
342 | + $data = (array) $data; |
|
343 | + |
|
344 | + if (! isset($data[1])) { |
|
345 | + $_data[1] = false; |
|
346 | + } |
|
347 | + |
|
348 | + $sortable[ $id ] = $_data; |
|
349 | + } |
|
350 | + $primary = $this->get_primary_column_name(); |
|
351 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
352 | + } |
|
353 | + |
|
354 | + |
|
355 | + /** |
|
356 | + * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814) |
|
357 | + * |
|
358 | + * @return string |
|
359 | + */ |
|
360 | + protected function get_primary_column_name() |
|
361 | + { |
|
362 | + foreach (class_parents($this) as $parent) { |
|
363 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) { |
|
364 | + return parent::get_primary_column_name(); |
|
365 | + } |
|
366 | + } |
|
367 | + return $this->_primary_column; |
|
368 | + } |
|
369 | + |
|
370 | + |
|
371 | + /** |
|
372 | + * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814) |
|
373 | + * |
|
374 | + * @param EE_Base_Class $item |
|
375 | + * @param string $column_name |
|
376 | + * @param string $primary |
|
377 | + * @return string |
|
378 | + */ |
|
379 | + protected function handle_row_actions($item, $column_name, $primary) |
|
380 | + { |
|
381 | + foreach (class_parents($this) as $parent) { |
|
382 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) { |
|
383 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
384 | + } |
|
385 | + } |
|
386 | + return ''; |
|
387 | + } |
|
388 | + |
|
389 | + |
|
390 | + /** |
|
391 | + * _get_bulk_actions |
|
392 | + * This is a wrapper called by WP_List_Table::get_bulk_actions() |
|
393 | + * |
|
394 | + * @access protected |
|
395 | + * @return array bulk_actions |
|
396 | + */ |
|
397 | + protected function _get_bulk_actions() |
|
398 | + { |
|
399 | + $actions = array(); |
|
400 | + // the _views property should have the bulk_actions, so let's go through and extract them into a properly |
|
401 | + // formatted array for the wp_list_table(); |
|
402 | + foreach ($this->_views as $view => $args) { |
|
403 | + if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) { |
|
404 | + // each bulk action will correspond with a admin page route, so we can check whatever the capability is |
|
405 | + // for that page route and skip adding the bulk action if no access for the current logged in user. |
|
406 | + foreach ($args['bulk_action'] as $route => $label) { |
|
407 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
408 | + $actions[ $route ] = $label; |
|
409 | + } |
|
410 | + } |
|
411 | + } |
|
412 | + } |
|
413 | + return $actions; |
|
414 | + } |
|
415 | + |
|
416 | + |
|
417 | + /** |
|
418 | + * Generate the table navigation above or below the table. |
|
419 | + * Overrides the parent table nav in WP_List_Table so we can hide the bulk action div if there are no bulk actions. |
|
420 | + * |
|
421 | + * @since 4.9.44.rc.001 |
|
422 | + */ |
|
423 | + public function display_tablenav($which) |
|
424 | + { |
|
425 | + if ('top' === $which) { |
|
426 | + wp_nonce_field('bulk-' . $this->_args['plural']); |
|
427 | + } |
|
428 | + ?> |
|
429 | 429 | <div class="tablenav <?php echo esc_attr($which); ?>"> |
430 | 430 | <?php if ($this->_get_bulk_actions()) { ?> |
431 | 431 | <div class="alignleft actions bulkactions"> |
432 | 432 | <?php $this->bulk_actions(); ?> |
433 | 433 | </div> |
434 | 434 | <?php } |
435 | - $this->extra_tablenav($which); |
|
436 | - $this->pagination($which); |
|
437 | - ?> |
|
435 | + $this->extra_tablenav($which); |
|
436 | + $this->pagination($which); |
|
437 | + ?> |
|
438 | 438 | |
439 | 439 | <br class="clear"/> |
440 | 440 | </div> |
441 | 441 | <?php |
442 | - } |
|
443 | - |
|
444 | - |
|
445 | - /** |
|
446 | - * _filters |
|
447 | - * This receives the filters array from children _get_table_filters() and assembles the string including the filter |
|
448 | - * button. |
|
449 | - * |
|
450 | - * @access private |
|
451 | - * @return string html showing filters |
|
452 | - */ |
|
453 | - private function _filters() |
|
454 | - { |
|
455 | - $classname = get_class($this); |
|
456 | - $filters = apply_filters( |
|
457 | - "FHEE__{$classname}__filters", |
|
458 | - (array) $this->_get_table_filters(), |
|
459 | - $this, |
|
460 | - $this->_screen |
|
461 | - ); |
|
462 | - |
|
463 | - if (empty($filters)) { |
|
464 | - return; |
|
465 | - } |
|
466 | - foreach ($filters as $filter) { |
|
467 | - echo $filter; |
|
468 | - } |
|
469 | - // add filter button at end |
|
470 | - echo '<input type="submit" class="button-secondary" value="' |
|
471 | - . esc_html__('Filter', 'event_espresso') |
|
472 | - . '" id="post-query-submit" />'; |
|
473 | - // add reset filters button at end |
|
474 | - echo '<a class="button button-secondary" href="' |
|
475 | - . $this->_admin_page->get_current_page_view_url() |
|
476 | - . '" style="display:inline-block">' |
|
477 | - . esc_html__('Reset Filters', 'event_espresso') |
|
478 | - . '</a>'; |
|
479 | - } |
|
480 | - |
|
481 | - |
|
482 | - /** |
|
483 | - * Callback for 'list_table_primary_column' WordPress filter |
|
484 | - * If child EE_Admin_List_Table classes set the _primary_column property then that will be set as the primary |
|
485 | - * column when class is instantiated. |
|
486 | - * |
|
487 | - * @see WP_List_Table::get_primary_column_name |
|
488 | - * @param string $column_name |
|
489 | - * @return string |
|
490 | - */ |
|
491 | - public function set_primary_column($column_name) |
|
492 | - { |
|
493 | - return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
494 | - } |
|
495 | - |
|
496 | - |
|
497 | - /** |
|
498 | - * |
|
499 | - */ |
|
500 | - public function prepare_items() |
|
501 | - { |
|
502 | - |
|
503 | - $this->_set_column_info(); |
|
504 | - // $this->_column_headers = $this->get_column_info(); |
|
505 | - $total_items = $this->_all_data_count; |
|
506 | - $this->process_bulk_action(); |
|
507 | - |
|
508 | - $this->items = $this->_data; |
|
509 | - $this->set_pagination_args( |
|
510 | - array( |
|
511 | - 'total_items' => $total_items, |
|
512 | - 'per_page' => $this->_per_page, |
|
513 | - 'total_pages' => ceil($total_items / $this->_per_page), |
|
514 | - ) |
|
515 | - ); |
|
516 | - } |
|
517 | - |
|
518 | - |
|
519 | - /** |
|
520 | - * This column is the default for when there is no defined column method for a registered column. |
|
521 | - * This can be overridden by child classes, but allows for hooking in for custom columns. |
|
522 | - * |
|
523 | - * @param EE_Base_Class $item |
|
524 | - * @param string $column_name The column being called. |
|
525 | - * @return string html content for the column |
|
526 | - */ |
|
527 | - public function column_default($item, $column_name) |
|
528 | - { |
|
529 | - /** |
|
530 | - * Dynamic hook allowing for adding additional column content in this list table. |
|
531 | - * Note that $this->screen->id is in the format |
|
532 | - * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}. So for the messages list |
|
533 | - * table it is: event-espresso_page_espresso_messages. |
|
534 | - * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the |
|
535 | - * hook prefix ("event-espresso") will be different. |
|
536 | - */ |
|
537 | - do_action( |
|
538 | - 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, |
|
539 | - $item, |
|
540 | - $this->_screen |
|
541 | - ); |
|
542 | - } |
|
543 | - |
|
544 | - |
|
545 | - /** |
|
546 | - * Get a list of columns. The format is: |
|
547 | - * 'internal-name' => 'Title' |
|
548 | - * |
|
549 | - * @since 3.1.0 |
|
550 | - * @access public |
|
551 | - * @abstract |
|
552 | - * @return array |
|
553 | - */ |
|
554 | - public function get_columns() |
|
555 | - { |
|
556 | - /** |
|
557 | - * Dynamic hook allowing for adding additional columns in this list table. |
|
558 | - * Note that $this->screen->id is in the format |
|
559 | - * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}. So for the messages list |
|
560 | - * table it is: event-espresso_page_espresso_messages. |
|
561 | - * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the |
|
562 | - * hook prefix ("event-espresso") will be different. |
|
563 | - * |
|
564 | - * @var array |
|
565 | - */ |
|
566 | - $columns = apply_filters('FHEE_manage_' . $this->screen->id . '_columns', $this->_columns, $this->_screen); |
|
567 | - return $columns; |
|
568 | - } |
|
569 | - |
|
570 | - |
|
571 | - /** |
|
572 | - * Get an associative array ( id => link ) with the list |
|
573 | - * of views available on this table. |
|
574 | - * |
|
575 | - * @since 3.1.0 |
|
576 | - * @access protected |
|
577 | - * @return array |
|
578 | - */ |
|
579 | - public function get_views() |
|
580 | - { |
|
581 | - return $this->_views; |
|
582 | - } |
|
583 | - |
|
584 | - |
|
585 | - /** |
|
586 | - * Generate the views html. |
|
587 | - */ |
|
588 | - public function display_views() |
|
589 | - { |
|
590 | - $views = $this->get_views(); |
|
591 | - $assembled_views = array(); |
|
592 | - |
|
593 | - if (empty($views)) { |
|
594 | - return; |
|
595 | - } |
|
596 | - echo "<ul class='subsubsub'>\n"; |
|
597 | - foreach ($views as $view) { |
|
598 | - $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
599 | - if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) { |
|
600 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" |
|
601 | - . '<a href="' . $view['url'] . '">' . $view['label'] . '</a>' |
|
602 | - . ' <span class="count">(' . $count . ')</span>'; |
|
603 | - } |
|
604 | - } |
|
605 | - |
|
606 | - echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views) . "</li>\n" : ''; |
|
607 | - echo "</ul>"; |
|
608 | - } |
|
609 | - |
|
610 | - |
|
611 | - /** |
|
612 | - * Generates content for a single row of the table |
|
613 | - * |
|
614 | - * @since 4.1 |
|
615 | - * @access public |
|
616 | - * @param EE_Base_Class $item The current item |
|
617 | - */ |
|
618 | - public function single_row($item) |
|
619 | - { |
|
620 | - $row_class = $this->_get_row_class($item); |
|
621 | - echo '<tr class="' . esc_attr($row_class) . '">'; |
|
622 | - $this->single_row_columns($item); |
|
623 | - echo '</tr>'; |
|
624 | - } |
|
625 | - |
|
626 | - |
|
627 | - /** |
|
628 | - * This simply sets up the row class for the table rows. |
|
629 | - * Allows for easier overriding of child methods for setting up sorting. |
|
630 | - * |
|
631 | - * @param EE_Base_Class $item the current item |
|
632 | - * @return string |
|
633 | - */ |
|
634 | - protected function _get_row_class($item) |
|
635 | - { |
|
636 | - static $row_class = ''; |
|
637 | - $row_class = ($row_class === '' ? 'alternate' : ''); |
|
638 | - |
|
639 | - $new_row_class = $row_class; |
|
640 | - |
|
641 | - if (! empty($this->_ajax_sorting_callback)) { |
|
642 | - $new_row_class .= ' rowsortable'; |
|
643 | - } |
|
644 | - |
|
645 | - return $new_row_class; |
|
646 | - } |
|
647 | - |
|
648 | - |
|
649 | - /** |
|
650 | - * @return array |
|
651 | - */ |
|
652 | - public function get_sortable_columns() |
|
653 | - { |
|
654 | - return (array) $this->_sortable_columns; |
|
655 | - } |
|
656 | - |
|
657 | - |
|
658 | - /** |
|
659 | - * @return string |
|
660 | - */ |
|
661 | - public function get_ajax_sorting_callback() |
|
662 | - { |
|
663 | - return $this->_ajax_sorting_callback; |
|
664 | - } |
|
665 | - |
|
666 | - |
|
667 | - /** |
|
668 | - * @return array |
|
669 | - */ |
|
670 | - public function get_hidden_columns() |
|
671 | - { |
|
672 | - $user_id = get_current_user_id(); |
|
673 | - $has_default = get_user_option('default' . $this->screen->id . 'columnshidden', $user_id); |
|
674 | - if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
675 | - update_user_option($user_id, 'default' . $this->screen->id . 'columnshidden', true); |
|
676 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, true); |
|
677 | - } |
|
678 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
679 | - return (array) get_user_option($ref, $user_id); |
|
680 | - } |
|
681 | - |
|
682 | - |
|
683 | - /** |
|
684 | - * Generates the columns for a single row of the table. |
|
685 | - * Overridden from wp_list_table so as to allow us to filter the column content for a given |
|
686 | - * column. |
|
687 | - * |
|
688 | - * @since 3.1.0 |
|
689 | - * @param EE_Base_Class $item The current item |
|
690 | - */ |
|
691 | - public function single_row_columns($item) |
|
692 | - { |
|
693 | - list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
694 | - |
|
695 | - global $wp_version; |
|
696 | - $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
697 | - |
|
698 | - foreach ($columns as $column_name => $column_display_name) { |
|
699 | - |
|
700 | - /** |
|
701 | - * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns |
|
702 | - * are hidden or not instead of using "display:none;". This bit of code provides backward compat. |
|
703 | - */ |
|
704 | - $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
705 | - $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
706 | - |
|
707 | - $classes = $column_name . ' column-' . $column_name . $hidden_class; |
|
708 | - if ($primary === $column_name) { |
|
709 | - $classes .= ' has-row-actions column-primary'; |
|
710 | - } |
|
711 | - |
|
712 | - $data = ' data-colname="' . wp_strip_all_tags($column_display_name) . '"'; |
|
713 | - |
|
714 | - $class = "class='$classes'"; |
|
715 | - |
|
716 | - $attributes = "$class$style$data"; |
|
717 | - |
|
718 | - if ($column_name === 'cb') { |
|
719 | - echo '<th scope="row" class="check-column">'; |
|
720 | - echo apply_filters( |
|
721 | - 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', |
|
722 | - $this->column_cb($item), |
|
723 | - $item, |
|
724 | - $this |
|
725 | - ); |
|
726 | - echo '</th>'; |
|
727 | - } elseif (method_exists($this, 'column_' . $column_name)) { |
|
728 | - echo "<td $attributes>"; |
|
729 | - echo apply_filters( |
|
730 | - 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', |
|
731 | - call_user_func(array($this, 'column_' . $column_name), $item), |
|
732 | - $item, |
|
733 | - $this |
|
734 | - ); |
|
735 | - echo $this->handle_row_actions($item, $column_name, $primary); |
|
736 | - echo "</td>"; |
|
737 | - } else { |
|
738 | - echo "<td $attributes>"; |
|
739 | - echo apply_filters( |
|
740 | - 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', |
|
741 | - $this->column_default($item, $column_name), |
|
742 | - $item, |
|
743 | - $column_name, |
|
744 | - $this |
|
745 | - ); |
|
746 | - echo $this->handle_row_actions($item, $column_name, $primary); |
|
747 | - echo "</td>"; |
|
748 | - } |
|
749 | - } |
|
750 | - } |
|
751 | - |
|
752 | - |
|
753 | - /** |
|
754 | - * Extra controls to be displayed between bulk actions and pagination |
|
755 | - * |
|
756 | - * @access public |
|
757 | - * @param string $which |
|
758 | - * @throws \EE_Error |
|
759 | - */ |
|
760 | - public function extra_tablenav($which) |
|
761 | - { |
|
762 | - if ($which === 'top') { |
|
763 | - $this->_filters(); |
|
764 | - echo $this->_get_hidden_fields(); |
|
765 | - } else { |
|
766 | - echo '<div class="list-table-bottom-buttons alignleft actions">'; |
|
767 | - foreach ($this->_bottom_buttons as $type => $action) { |
|
768 | - $route = isset($action['route']) ? $action['route'] : ''; |
|
769 | - $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
770 | - echo $this->_admin_page->get_action_link_or_button( |
|
771 | - $route, |
|
772 | - $type, |
|
773 | - $extra_request, |
|
774 | - 'button button-secondary', |
|
775 | - '', |
|
776 | - false |
|
777 | - ); |
|
778 | - } |
|
779 | - do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
780 | - echo '</div>'; |
|
781 | - } |
|
782 | - // echo $this->_entries_per_page_dropdown; |
|
783 | - } |
|
784 | - |
|
785 | - |
|
786 | - /** |
|
787 | - * Get an associative array ( option_name => option_title ) with the list |
|
788 | - * of bulk actions available on this table. |
|
789 | - * |
|
790 | - * @since 3.1.0 |
|
791 | - * @access protected |
|
792 | - * @return array |
|
793 | - */ |
|
794 | - public function get_bulk_actions() |
|
795 | - { |
|
796 | - return (array) $this->_get_bulk_actions(); |
|
797 | - } |
|
798 | - |
|
799 | - /** |
|
800 | - * Processing bulk actions. |
|
801 | - */ |
|
802 | - public function process_bulk_action() |
|
803 | - { |
|
804 | - // this is not used it is handled by the child EE_Admin_Page class (routes). However, including here for |
|
805 | - // reference in case there is a case where it gets used. |
|
806 | - } |
|
807 | - |
|
808 | - |
|
809 | - /** |
|
810 | - * returns the EE admin page this list table is associated with |
|
811 | - * |
|
812 | - * @return EE_Admin_Page |
|
813 | - */ |
|
814 | - public function get_admin_page() |
|
815 | - { |
|
816 | - return $this->_admin_page; |
|
817 | - } |
|
818 | - |
|
819 | - |
|
820 | - /** |
|
821 | - * A "helper" function for all children to provide an html string of |
|
822 | - * actions to output in their content. It is preferable for child classes |
|
823 | - * to use this method for generating their actions content so that it's |
|
824 | - * filterable by plugins |
|
825 | - * |
|
826 | - * @param string $action_container what are the html container |
|
827 | - * elements for this actions string? |
|
828 | - * @param string $action_class What class is for the container |
|
829 | - * element. |
|
830 | - * @param string $action_items The contents for the action items |
|
831 | - * container. This is filtered before |
|
832 | - * returned. |
|
833 | - * @param string $action_id What id (optional) is used for the |
|
834 | - * container element. |
|
835 | - * @param EE_Base_Class $item The object for the column displaying |
|
836 | - * the actions. |
|
837 | - * @return string The assembled action elements container. |
|
838 | - */ |
|
839 | - protected function _action_string( |
|
840 | - $action_items, |
|
841 | - $item, |
|
842 | - $action_container = 'ul', |
|
843 | - $action_class = '', |
|
844 | - $action_id = '' |
|
845 | - ) { |
|
846 | - $content = ''; |
|
847 | - $action_class = ! empty($action_class) ? ' class="' . $action_class . '"' : ''; |
|
848 | - $action_id = ! empty($action_id) ? ' id="' . $action_id . '"' : ''; |
|
849 | - $content .= ! empty($action_container) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
850 | - try { |
|
851 | - $content .= apply_filters( |
|
852 | - 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
853 | - $action_items, |
|
854 | - $item, |
|
855 | - $this |
|
856 | - ); |
|
857 | - } catch (\Exception $e) { |
|
858 | - if (WP_DEBUG) { |
|
859 | - \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
860 | - } |
|
861 | - $content .= $action_items; |
|
862 | - } |
|
863 | - $content .= ! empty($action_container) ? '</' . $action_container . '>' : ''; |
|
864 | - return $content; |
|
865 | - } |
|
442 | + } |
|
443 | + |
|
444 | + |
|
445 | + /** |
|
446 | + * _filters |
|
447 | + * This receives the filters array from children _get_table_filters() and assembles the string including the filter |
|
448 | + * button. |
|
449 | + * |
|
450 | + * @access private |
|
451 | + * @return string html showing filters |
|
452 | + */ |
|
453 | + private function _filters() |
|
454 | + { |
|
455 | + $classname = get_class($this); |
|
456 | + $filters = apply_filters( |
|
457 | + "FHEE__{$classname}__filters", |
|
458 | + (array) $this->_get_table_filters(), |
|
459 | + $this, |
|
460 | + $this->_screen |
|
461 | + ); |
|
462 | + |
|
463 | + if (empty($filters)) { |
|
464 | + return; |
|
465 | + } |
|
466 | + foreach ($filters as $filter) { |
|
467 | + echo $filter; |
|
468 | + } |
|
469 | + // add filter button at end |
|
470 | + echo '<input type="submit" class="button-secondary" value="' |
|
471 | + . esc_html__('Filter', 'event_espresso') |
|
472 | + . '" id="post-query-submit" />'; |
|
473 | + // add reset filters button at end |
|
474 | + echo '<a class="button button-secondary" href="' |
|
475 | + . $this->_admin_page->get_current_page_view_url() |
|
476 | + . '" style="display:inline-block">' |
|
477 | + . esc_html__('Reset Filters', 'event_espresso') |
|
478 | + . '</a>'; |
|
479 | + } |
|
480 | + |
|
481 | + |
|
482 | + /** |
|
483 | + * Callback for 'list_table_primary_column' WordPress filter |
|
484 | + * If child EE_Admin_List_Table classes set the _primary_column property then that will be set as the primary |
|
485 | + * column when class is instantiated. |
|
486 | + * |
|
487 | + * @see WP_List_Table::get_primary_column_name |
|
488 | + * @param string $column_name |
|
489 | + * @return string |
|
490 | + */ |
|
491 | + public function set_primary_column($column_name) |
|
492 | + { |
|
493 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
494 | + } |
|
495 | + |
|
496 | + |
|
497 | + /** |
|
498 | + * |
|
499 | + */ |
|
500 | + public function prepare_items() |
|
501 | + { |
|
502 | + |
|
503 | + $this->_set_column_info(); |
|
504 | + // $this->_column_headers = $this->get_column_info(); |
|
505 | + $total_items = $this->_all_data_count; |
|
506 | + $this->process_bulk_action(); |
|
507 | + |
|
508 | + $this->items = $this->_data; |
|
509 | + $this->set_pagination_args( |
|
510 | + array( |
|
511 | + 'total_items' => $total_items, |
|
512 | + 'per_page' => $this->_per_page, |
|
513 | + 'total_pages' => ceil($total_items / $this->_per_page), |
|
514 | + ) |
|
515 | + ); |
|
516 | + } |
|
517 | + |
|
518 | + |
|
519 | + /** |
|
520 | + * This column is the default for when there is no defined column method for a registered column. |
|
521 | + * This can be overridden by child classes, but allows for hooking in for custom columns. |
|
522 | + * |
|
523 | + * @param EE_Base_Class $item |
|
524 | + * @param string $column_name The column being called. |
|
525 | + * @return string html content for the column |
|
526 | + */ |
|
527 | + public function column_default($item, $column_name) |
|
528 | + { |
|
529 | + /** |
|
530 | + * Dynamic hook allowing for adding additional column content in this list table. |
|
531 | + * Note that $this->screen->id is in the format |
|
532 | + * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}. So for the messages list |
|
533 | + * table it is: event-espresso_page_espresso_messages. |
|
534 | + * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the |
|
535 | + * hook prefix ("event-espresso") will be different. |
|
536 | + */ |
|
537 | + do_action( |
|
538 | + 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, |
|
539 | + $item, |
|
540 | + $this->_screen |
|
541 | + ); |
|
542 | + } |
|
543 | + |
|
544 | + |
|
545 | + /** |
|
546 | + * Get a list of columns. The format is: |
|
547 | + * 'internal-name' => 'Title' |
|
548 | + * |
|
549 | + * @since 3.1.0 |
|
550 | + * @access public |
|
551 | + * @abstract |
|
552 | + * @return array |
|
553 | + */ |
|
554 | + public function get_columns() |
|
555 | + { |
|
556 | + /** |
|
557 | + * Dynamic hook allowing for adding additional columns in this list table. |
|
558 | + * Note that $this->screen->id is in the format |
|
559 | + * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}. So for the messages list |
|
560 | + * table it is: event-espresso_page_espresso_messages. |
|
561 | + * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the |
|
562 | + * hook prefix ("event-espresso") will be different. |
|
563 | + * |
|
564 | + * @var array |
|
565 | + */ |
|
566 | + $columns = apply_filters('FHEE_manage_' . $this->screen->id . '_columns', $this->_columns, $this->_screen); |
|
567 | + return $columns; |
|
568 | + } |
|
569 | + |
|
570 | + |
|
571 | + /** |
|
572 | + * Get an associative array ( id => link ) with the list |
|
573 | + * of views available on this table. |
|
574 | + * |
|
575 | + * @since 3.1.0 |
|
576 | + * @access protected |
|
577 | + * @return array |
|
578 | + */ |
|
579 | + public function get_views() |
|
580 | + { |
|
581 | + return $this->_views; |
|
582 | + } |
|
583 | + |
|
584 | + |
|
585 | + /** |
|
586 | + * Generate the views html. |
|
587 | + */ |
|
588 | + public function display_views() |
|
589 | + { |
|
590 | + $views = $this->get_views(); |
|
591 | + $assembled_views = array(); |
|
592 | + |
|
593 | + if (empty($views)) { |
|
594 | + return; |
|
595 | + } |
|
596 | + echo "<ul class='subsubsub'>\n"; |
|
597 | + foreach ($views as $view) { |
|
598 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
599 | + if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) { |
|
600 | + $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" |
|
601 | + . '<a href="' . $view['url'] . '">' . $view['label'] . '</a>' |
|
602 | + . ' <span class="count">(' . $count . ')</span>'; |
|
603 | + } |
|
604 | + } |
|
605 | + |
|
606 | + echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views) . "</li>\n" : ''; |
|
607 | + echo "</ul>"; |
|
608 | + } |
|
609 | + |
|
610 | + |
|
611 | + /** |
|
612 | + * Generates content for a single row of the table |
|
613 | + * |
|
614 | + * @since 4.1 |
|
615 | + * @access public |
|
616 | + * @param EE_Base_Class $item The current item |
|
617 | + */ |
|
618 | + public function single_row($item) |
|
619 | + { |
|
620 | + $row_class = $this->_get_row_class($item); |
|
621 | + echo '<tr class="' . esc_attr($row_class) . '">'; |
|
622 | + $this->single_row_columns($item); |
|
623 | + echo '</tr>'; |
|
624 | + } |
|
625 | + |
|
626 | + |
|
627 | + /** |
|
628 | + * This simply sets up the row class for the table rows. |
|
629 | + * Allows for easier overriding of child methods for setting up sorting. |
|
630 | + * |
|
631 | + * @param EE_Base_Class $item the current item |
|
632 | + * @return string |
|
633 | + */ |
|
634 | + protected function _get_row_class($item) |
|
635 | + { |
|
636 | + static $row_class = ''; |
|
637 | + $row_class = ($row_class === '' ? 'alternate' : ''); |
|
638 | + |
|
639 | + $new_row_class = $row_class; |
|
640 | + |
|
641 | + if (! empty($this->_ajax_sorting_callback)) { |
|
642 | + $new_row_class .= ' rowsortable'; |
|
643 | + } |
|
644 | + |
|
645 | + return $new_row_class; |
|
646 | + } |
|
647 | + |
|
648 | + |
|
649 | + /** |
|
650 | + * @return array |
|
651 | + */ |
|
652 | + public function get_sortable_columns() |
|
653 | + { |
|
654 | + return (array) $this->_sortable_columns; |
|
655 | + } |
|
656 | + |
|
657 | + |
|
658 | + /** |
|
659 | + * @return string |
|
660 | + */ |
|
661 | + public function get_ajax_sorting_callback() |
|
662 | + { |
|
663 | + return $this->_ajax_sorting_callback; |
|
664 | + } |
|
665 | + |
|
666 | + |
|
667 | + /** |
|
668 | + * @return array |
|
669 | + */ |
|
670 | + public function get_hidden_columns() |
|
671 | + { |
|
672 | + $user_id = get_current_user_id(); |
|
673 | + $has_default = get_user_option('default' . $this->screen->id . 'columnshidden', $user_id); |
|
674 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
675 | + update_user_option($user_id, 'default' . $this->screen->id . 'columnshidden', true); |
|
676 | + update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, true); |
|
677 | + } |
|
678 | + $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
679 | + return (array) get_user_option($ref, $user_id); |
|
680 | + } |
|
681 | + |
|
682 | + |
|
683 | + /** |
|
684 | + * Generates the columns for a single row of the table. |
|
685 | + * Overridden from wp_list_table so as to allow us to filter the column content for a given |
|
686 | + * column. |
|
687 | + * |
|
688 | + * @since 3.1.0 |
|
689 | + * @param EE_Base_Class $item The current item |
|
690 | + */ |
|
691 | + public function single_row_columns($item) |
|
692 | + { |
|
693 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
694 | + |
|
695 | + global $wp_version; |
|
696 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
697 | + |
|
698 | + foreach ($columns as $column_name => $column_display_name) { |
|
699 | + |
|
700 | + /** |
|
701 | + * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns |
|
702 | + * are hidden or not instead of using "display:none;". This bit of code provides backward compat. |
|
703 | + */ |
|
704 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
705 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
706 | + |
|
707 | + $classes = $column_name . ' column-' . $column_name . $hidden_class; |
|
708 | + if ($primary === $column_name) { |
|
709 | + $classes .= ' has-row-actions column-primary'; |
|
710 | + } |
|
711 | + |
|
712 | + $data = ' data-colname="' . wp_strip_all_tags($column_display_name) . '"'; |
|
713 | + |
|
714 | + $class = "class='$classes'"; |
|
715 | + |
|
716 | + $attributes = "$class$style$data"; |
|
717 | + |
|
718 | + if ($column_name === 'cb') { |
|
719 | + echo '<th scope="row" class="check-column">'; |
|
720 | + echo apply_filters( |
|
721 | + 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', |
|
722 | + $this->column_cb($item), |
|
723 | + $item, |
|
724 | + $this |
|
725 | + ); |
|
726 | + echo '</th>'; |
|
727 | + } elseif (method_exists($this, 'column_' . $column_name)) { |
|
728 | + echo "<td $attributes>"; |
|
729 | + echo apply_filters( |
|
730 | + 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', |
|
731 | + call_user_func(array($this, 'column_' . $column_name), $item), |
|
732 | + $item, |
|
733 | + $this |
|
734 | + ); |
|
735 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
736 | + echo "</td>"; |
|
737 | + } else { |
|
738 | + echo "<td $attributes>"; |
|
739 | + echo apply_filters( |
|
740 | + 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', |
|
741 | + $this->column_default($item, $column_name), |
|
742 | + $item, |
|
743 | + $column_name, |
|
744 | + $this |
|
745 | + ); |
|
746 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
747 | + echo "</td>"; |
|
748 | + } |
|
749 | + } |
|
750 | + } |
|
751 | + |
|
752 | + |
|
753 | + /** |
|
754 | + * Extra controls to be displayed between bulk actions and pagination |
|
755 | + * |
|
756 | + * @access public |
|
757 | + * @param string $which |
|
758 | + * @throws \EE_Error |
|
759 | + */ |
|
760 | + public function extra_tablenav($which) |
|
761 | + { |
|
762 | + if ($which === 'top') { |
|
763 | + $this->_filters(); |
|
764 | + echo $this->_get_hidden_fields(); |
|
765 | + } else { |
|
766 | + echo '<div class="list-table-bottom-buttons alignleft actions">'; |
|
767 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
768 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
769 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
770 | + echo $this->_admin_page->get_action_link_or_button( |
|
771 | + $route, |
|
772 | + $type, |
|
773 | + $extra_request, |
|
774 | + 'button button-secondary', |
|
775 | + '', |
|
776 | + false |
|
777 | + ); |
|
778 | + } |
|
779 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
780 | + echo '</div>'; |
|
781 | + } |
|
782 | + // echo $this->_entries_per_page_dropdown; |
|
783 | + } |
|
784 | + |
|
785 | + |
|
786 | + /** |
|
787 | + * Get an associative array ( option_name => option_title ) with the list |
|
788 | + * of bulk actions available on this table. |
|
789 | + * |
|
790 | + * @since 3.1.0 |
|
791 | + * @access protected |
|
792 | + * @return array |
|
793 | + */ |
|
794 | + public function get_bulk_actions() |
|
795 | + { |
|
796 | + return (array) $this->_get_bulk_actions(); |
|
797 | + } |
|
798 | + |
|
799 | + /** |
|
800 | + * Processing bulk actions. |
|
801 | + */ |
|
802 | + public function process_bulk_action() |
|
803 | + { |
|
804 | + // this is not used it is handled by the child EE_Admin_Page class (routes). However, including here for |
|
805 | + // reference in case there is a case where it gets used. |
|
806 | + } |
|
807 | + |
|
808 | + |
|
809 | + /** |
|
810 | + * returns the EE admin page this list table is associated with |
|
811 | + * |
|
812 | + * @return EE_Admin_Page |
|
813 | + */ |
|
814 | + public function get_admin_page() |
|
815 | + { |
|
816 | + return $this->_admin_page; |
|
817 | + } |
|
818 | + |
|
819 | + |
|
820 | + /** |
|
821 | + * A "helper" function for all children to provide an html string of |
|
822 | + * actions to output in their content. It is preferable for child classes |
|
823 | + * to use this method for generating their actions content so that it's |
|
824 | + * filterable by plugins |
|
825 | + * |
|
826 | + * @param string $action_container what are the html container |
|
827 | + * elements for this actions string? |
|
828 | + * @param string $action_class What class is for the container |
|
829 | + * element. |
|
830 | + * @param string $action_items The contents for the action items |
|
831 | + * container. This is filtered before |
|
832 | + * returned. |
|
833 | + * @param string $action_id What id (optional) is used for the |
|
834 | + * container element. |
|
835 | + * @param EE_Base_Class $item The object for the column displaying |
|
836 | + * the actions. |
|
837 | + * @return string The assembled action elements container. |
|
838 | + */ |
|
839 | + protected function _action_string( |
|
840 | + $action_items, |
|
841 | + $item, |
|
842 | + $action_container = 'ul', |
|
843 | + $action_class = '', |
|
844 | + $action_id = '' |
|
845 | + ) { |
|
846 | + $content = ''; |
|
847 | + $action_class = ! empty($action_class) ? ' class="' . $action_class . '"' : ''; |
|
848 | + $action_id = ! empty($action_id) ? ' id="' . $action_id . '"' : ''; |
|
849 | + $content .= ! empty($action_container) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
850 | + try { |
|
851 | + $content .= apply_filters( |
|
852 | + 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
853 | + $action_items, |
|
854 | + $item, |
|
855 | + $this |
|
856 | + ); |
|
857 | + } catch (\Exception $e) { |
|
858 | + if (WP_DEBUG) { |
|
859 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
860 | + } |
|
861 | + $content .= $action_items; |
|
862 | + } |
|
863 | + $content .= ! empty($action_container) ? '</' . $action_container . '>' : ''; |
|
864 | + return $content; |
|
865 | + } |
|
866 | 866 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! class_exists('WP_List_Table')) { |
|
4 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
3 | +if ( ! class_exists('WP_List_Table')) { |
|
4 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | $this->_view = $this->_admin_page->get_view(); |
205 | 205 | $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
206 | 206 | $this->_current_page = $this->get_pagenum(); |
207 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
207 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
208 | 208 | $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
209 | 209 | |
210 | - $this->_per_page = $this->get_items_per_page($this->_screen . '_per_page', 20); |
|
210 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 20); |
|
211 | 211 | |
212 | 212 | $this->_setup_data(); |
213 | 213 | $this->_add_view_counts(); |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
288 | 288 | // if action is STILL empty, then we set it to default |
289 | 289 | $action = empty($action) ? 'default' : $action; |
290 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
291 | - $field .= '<input type="hidden" name="route" value="' . $action . '" />' . "\n";/**/ |
|
292 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
290 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
291 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
292 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
293 | 293 | |
294 | 294 | $bulk_actions = $this->_get_bulk_actions(); |
295 | 295 | foreach ($bulk_actions as $bulk_action => $label) { |
296 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce"' |
|
297 | - . ' value="' . wp_create_nonce($bulk_action . '_nonce') . '" />' . "\n"; |
|
296 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce"' |
|
297 | + . ' value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $field; |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | |
342 | 342 | $data = (array) $data; |
343 | 343 | |
344 | - if (! isset($data[1])) { |
|
344 | + if ( ! isset($data[1])) { |
|
345 | 345 | $_data[1] = false; |
346 | 346 | } |
347 | 347 | |
348 | - $sortable[ $id ] = $_data; |
|
348 | + $sortable[$id] = $_data; |
|
349 | 349 | } |
350 | 350 | $primary = $this->get_primary_column_name(); |
351 | 351 | $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | // for that page route and skip adding the bulk action if no access for the current logged in user. |
406 | 406 | foreach ($args['bulk_action'] as $route => $label) { |
407 | 407 | if ($this->_admin_page->check_user_access($route, true)) { |
408 | - $actions[ $route ] = $label; |
|
408 | + $actions[$route] = $label; |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | public function display_tablenav($which) |
424 | 424 | { |
425 | 425 | if ('top' === $which) { |
426 | - wp_nonce_field('bulk-' . $this->_args['plural']); |
|
426 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
427 | 427 | } |
428 | 428 | ?> |
429 | 429 | <div class="tablenav <?php echo esc_attr($which); ?>"> |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * hook prefix ("event-espresso") will be different. |
536 | 536 | */ |
537 | 537 | do_action( |
538 | - 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, |
|
538 | + 'AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, |
|
539 | 539 | $item, |
540 | 540 | $this->_screen |
541 | 541 | ); |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * |
564 | 564 | * @var array |
565 | 565 | */ |
566 | - $columns = apply_filters('FHEE_manage_' . $this->screen->id . '_columns', $this->_columns, $this->_screen); |
|
566 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
567 | 567 | return $columns; |
568 | 568 | } |
569 | 569 | |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | foreach ($views as $view) { |
598 | 598 | $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
599 | 599 | if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) { |
600 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" |
|
601 | - . '<a href="' . $view['url'] . '">' . $view['label'] . '</a>' |
|
602 | - . ' <span class="count">(' . $count . ')</span>'; |
|
600 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>" |
|
601 | + . '<a href="'.$view['url'].'">'.$view['label'].'</a>' |
|
602 | + . ' <span class="count">('.$count.')</span>'; |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | |
606 | - echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views) . "</li>\n" : ''; |
|
606 | + echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
607 | 607 | echo "</ul>"; |
608 | 608 | } |
609 | 609 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | public function single_row($item) |
619 | 619 | { |
620 | 620 | $row_class = $this->_get_row_class($item); |
621 | - echo '<tr class="' . esc_attr($row_class) . '">'; |
|
621 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
622 | 622 | $this->single_row_columns($item); |
623 | 623 | echo '</tr>'; |
624 | 624 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | |
639 | 639 | $new_row_class = $row_class; |
640 | 640 | |
641 | - if (! empty($this->_ajax_sorting_callback)) { |
|
641 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
642 | 642 | $new_row_class .= ' rowsortable'; |
643 | 643 | } |
644 | 644 | |
@@ -670,12 +670,12 @@ discard block |
||
670 | 670 | public function get_hidden_columns() |
671 | 671 | { |
672 | 672 | $user_id = get_current_user_id(); |
673 | - $has_default = get_user_option('default' . $this->screen->id . 'columnshidden', $user_id); |
|
673 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
674 | 674 | if (empty($has_default) && ! empty($this->_hidden_columns)) { |
675 | - update_user_option($user_id, 'default' . $this->screen->id . 'columnshidden', true); |
|
676 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, true); |
|
675 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', true); |
|
676 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, true); |
|
677 | 677 | } |
678 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
678 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
679 | 679 | return (array) get_user_option($ref, $user_id); |
680 | 680 | } |
681 | 681 | |
@@ -704,12 +704,12 @@ discard block |
||
704 | 704 | $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
705 | 705 | $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
706 | 706 | |
707 | - $classes = $column_name . ' column-' . $column_name . $hidden_class; |
|
707 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
708 | 708 | if ($primary === $column_name) { |
709 | 709 | $classes .= ' has-row-actions column-primary'; |
710 | 710 | } |
711 | 711 | |
712 | - $data = ' data-colname="' . wp_strip_all_tags($column_display_name) . '"'; |
|
712 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
713 | 713 | |
714 | 714 | $class = "class='$classes'"; |
715 | 715 | |
@@ -724,11 +724,11 @@ discard block |
||
724 | 724 | $this |
725 | 725 | ); |
726 | 726 | echo '</th>'; |
727 | - } elseif (method_exists($this, 'column_' . $column_name)) { |
|
727 | + } elseif (method_exists($this, 'column_'.$column_name)) { |
|
728 | 728 | echo "<td $attributes>"; |
729 | 729 | echo apply_filters( |
730 | - 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', |
|
731 | - call_user_func(array($this, 'column_' . $column_name), $item), |
|
730 | + 'FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', |
|
731 | + call_user_func(array($this, 'column_'.$column_name), $item), |
|
732 | 732 | $item, |
733 | 733 | $this |
734 | 734 | ); |
@@ -844,9 +844,9 @@ discard block |
||
844 | 844 | $action_id = '' |
845 | 845 | ) { |
846 | 846 | $content = ''; |
847 | - $action_class = ! empty($action_class) ? ' class="' . $action_class . '"' : ''; |
|
848 | - $action_id = ! empty($action_id) ? ' id="' . $action_id . '"' : ''; |
|
849 | - $content .= ! empty($action_container) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
847 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
848 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
849 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
850 | 850 | try { |
851 | 851 | $content .= apply_filters( |
852 | 852 | 'FHEE__EE_Admin_List_Table___action_string__action_items', |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | } |
861 | 861 | $content .= $action_items; |
862 | 862 | } |
863 | - $content .= ! empty($action_container) ? '</' . $action_container . '>' : ''; |
|
863 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
864 | 864 | return $content; |
865 | 865 | } |
866 | 866 | } |
@@ -14,27 +14,27 @@ |
||
14 | 14 | class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param array $input_settings |
|
19 | - * @throws InvalidArgumentException |
|
20 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
21 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
22 | - */ |
|
23 | - public function __construct($input_settings = array()) |
|
24 | - { |
|
25 | - $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
|
26 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
27 | - $this->_add_validation_strategy( |
|
28 | - LoaderFactory::getLoader()->getNew( |
|
29 | - 'EE_URL_Validation_Strategy', |
|
30 | - array( |
|
31 | - isset($input_settings['validation_error_message']) |
|
32 | - ? $input_settings['validation_error_message'] |
|
33 | - : null, |
|
34 | - false |
|
35 | - ) |
|
36 | - ) |
|
37 | - ); |
|
38 | - parent::__construct($input_settings); |
|
39 | - } |
|
17 | + /** |
|
18 | + * @param array $input_settings |
|
19 | + * @throws InvalidArgumentException |
|
20 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
21 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
22 | + */ |
|
23 | + public function __construct($input_settings = array()) |
|
24 | + { |
|
25 | + $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
|
26 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
27 | + $this->_add_validation_strategy( |
|
28 | + LoaderFactory::getLoader()->getNew( |
|
29 | + 'EE_URL_Validation_Strategy', |
|
30 | + array( |
|
31 | + isset($input_settings['validation_error_message']) |
|
32 | + ? $input_settings['validation_error_message'] |
|
33 | + : null, |
|
34 | + false |
|
35 | + ) |
|
36 | + ) |
|
37 | + ); |
|
38 | + parent::__construct($input_settings); |
|
39 | + } |
|
40 | 40 | } |
@@ -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 | } |
@@ -12,173 +12,173 @@ |
||
12 | 12 | class EEH_Maps |
13 | 13 | { |
14 | 14 | |
15 | - // array of map settings |
|
16 | - public static $gmap_vars = array(); |
|
17 | - |
|
18 | - |
|
19 | - /** |
|
20 | - * google_map - creates a Google Map Link |
|
21 | - * |
|
22 | - * @param array $ee_gmaps_opts array of attributes required for the map link generation |
|
23 | - * @return string (link to map!) |
|
24 | - */ |
|
25 | - public static function google_map($ee_gmaps_opts) |
|
26 | - { |
|
27 | - |
|
28 | - $ee_map_width = ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300'; |
|
29 | - $ee_map_height = ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185'; |
|
30 | - $ee_map_zoom = ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12'; |
|
31 | - $ee_map_nav_display = ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false'; |
|
32 | - $ee_map_nav_size = ! empty($ee_gmaps_opts['ee_map_nav_size']) |
|
33 | - ? $ee_gmaps_opts['ee_map_nav_size'] |
|
34 | - : 'default'; |
|
35 | - $ee_map_type_control = ! empty($ee_gmaps_opts['ee_map_type_control']) |
|
36 | - ? $ee_gmaps_opts['ee_map_type_control'] |
|
37 | - : 'default'; |
|
38 | - $static_url = ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : false; |
|
39 | - |
|
40 | - if (! empty($ee_gmaps_opts['ee_map_align'])) { |
|
41 | - switch ($ee_gmaps_opts['ee_map_align']) { |
|
42 | - case "left": |
|
43 | - $map_align = 'ee-gmap-align-left left'; |
|
44 | - break; |
|
45 | - case "right": |
|
46 | - $map_align = 'ee-gmap-align-right right'; |
|
47 | - break; |
|
48 | - case "center": |
|
49 | - $map_align = 'ee-gmap-align-center center'; |
|
50 | - break; |
|
51 | - case "none": |
|
52 | - default: |
|
53 | - $map_align = 'ee-gmap-align-none'; |
|
54 | - } |
|
55 | - } else { |
|
56 | - $map_align = 'ee-gmap-align-none'; |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - // Determine whether user has set a hardoded url to use and |
|
61 | - // if so display a Google static iframe map else run V3 api |
|
62 | - if ($static_url) { |
|
63 | - $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">'; |
|
64 | - $html .= '<iframe src="' . $static_url . '&output=embed"' |
|
65 | - . ' style="width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;"' |
|
66 | - . ' frameborder="0" scrolling="no">'; |
|
67 | - $html .= '</iframe>'; |
|
68 | - $html .= '<a href="' . $static_url . '">View Large map</a>'; |
|
69 | - $html .= '</div>'; |
|
70 | - return $html; |
|
71 | - } else { |
|
72 | - EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array( |
|
73 | - 'map_ID' => $ee_gmaps_opts['map_ID'], |
|
74 | - 'ee_map_zoom' => $ee_map_zoom, |
|
75 | - 'ee_map_nav_display' => $ee_map_nav_display, |
|
76 | - 'ee_map_nav_size' => $ee_map_nav_size, |
|
77 | - 'ee_map_type_control' => $ee_map_type_control, |
|
78 | - 'location' => $ee_gmaps_opts['location'], |
|
79 | - ); |
|
80 | - |
|
81 | - $style = 'width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;'; |
|
82 | - $html = '<div class="ee-gmap-wrapper ' . $map_align . '">' |
|
83 | - . '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] . '"' |
|
84 | - . ' style="' . $style . '"></div>' |
|
85 | - . '</div>'; |
|
86 | - |
|
87 | - wp_enqueue_script('gmap_api'); |
|
88 | - wp_enqueue_script('ee_gmap'); |
|
89 | - add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script')); |
|
90 | - |
|
91 | - return $html; |
|
92 | - } // end auto map or static url map check |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * enqueue_script |
|
98 | - * |
|
99 | - * @return void |
|
100 | - */ |
|
101 | - public static function footer_enqueue_script() |
|
102 | - { |
|
103 | - wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars); |
|
104 | - } |
|
105 | - |
|
106 | - |
|
107 | - /** |
|
108 | - * registers scripts for maps |
|
109 | - */ |
|
110 | - public static function espresso_google_map_js() |
|
111 | - { |
|
112 | - $api_url = sprintf( |
|
113 | - "https://maps.googleapis.com/maps/api/js?key=%s", |
|
114 | - apply_filters( |
|
115 | - 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', |
|
116 | - EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
117 | - ) |
|
118 | - ); |
|
119 | - wp_register_script('gmap_api', $api_url, array('jquery'), null, true); |
|
120 | - wp_register_script('ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', true); |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * creates a Google Map Link |
|
125 | - * |
|
126 | - * @param array $atts array of attributes required for the map link generation |
|
127 | - * @return string (link to map!) |
|
128 | - */ |
|
129 | - public static function google_map_link($atts) |
|
130 | - { |
|
131 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
132 | - extract($atts); |
|
133 | - /** @var string $address */ |
|
134 | - /** @var string $city */ |
|
135 | - /** @var string $state */ |
|
136 | - /** @var string $zip */ |
|
137 | - /** @var string $country */ |
|
138 | - $address = "{$address}"; |
|
139 | - $city = "{$city}"; |
|
140 | - $state = "{$state}"; |
|
141 | - $zip = "{$zip}"; |
|
142 | - $country = "{$country}"; |
|
143 | - $text = isset($text) ? "{$text}" : ""; |
|
144 | - $type = isset($type) ? "{$type}" : ""; |
|
145 | - $map_w = isset($map_w) ? "{$map_w}" : 400; |
|
146 | - $map_h = isset($map_h) ? "{$map_h}" : 400; |
|
147 | - $id = isset($id) ? $id : 'not_set'; |
|
148 | - $map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view'; |
|
149 | - |
|
150 | - $address_string = ($address != '' ? $address : '') |
|
151 | - . ($city != '' ? ',' . $city : '') |
|
152 | - . ($state != '' ? ',' . $state : '') |
|
153 | - . ($zip != '' ? ',' . $zip : '') |
|
154 | - . ($country != '' ? ',' . $country : ''); |
|
155 | - |
|
156 | - $google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode($address_string)); |
|
157 | - |
|
158 | - switch ($type) { |
|
159 | - case 'text': |
|
160 | - default: |
|
161 | - $text = $text == '' ? esc_html__('Map and Directions', 'event_espresso') : $text; |
|
162 | - break; |
|
163 | - |
|
164 | - case 'url_only': |
|
165 | - case 'url': |
|
166 | - $text = $google_map; |
|
167 | - break; |
|
168 | - |
|
169 | - case 'map': |
|
170 | - $scheme = is_ssl() ? 'https://' : 'http://'; |
|
171 | - |
|
172 | - $api_key = apply_filters( |
|
173 | - 'FHEE__EEH_Maps__espresso_google_maps_link__api_key', |
|
174 | - EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
175 | - ); |
|
176 | - |
|
177 | - return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2($scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode($address_string) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode($address_string) . '&sensor=false&key=' . $api_key) . '" /></a>'; |
|
178 | - } |
|
179 | - |
|
180 | - return $type === 'url_only' |
|
181 | - ? $text |
|
182 | - : '<a href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . $text . '</a>'; |
|
183 | - } |
|
15 | + // array of map settings |
|
16 | + public static $gmap_vars = array(); |
|
17 | + |
|
18 | + |
|
19 | + /** |
|
20 | + * google_map - creates a Google Map Link |
|
21 | + * |
|
22 | + * @param array $ee_gmaps_opts array of attributes required for the map link generation |
|
23 | + * @return string (link to map!) |
|
24 | + */ |
|
25 | + public static function google_map($ee_gmaps_opts) |
|
26 | + { |
|
27 | + |
|
28 | + $ee_map_width = ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300'; |
|
29 | + $ee_map_height = ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185'; |
|
30 | + $ee_map_zoom = ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12'; |
|
31 | + $ee_map_nav_display = ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false'; |
|
32 | + $ee_map_nav_size = ! empty($ee_gmaps_opts['ee_map_nav_size']) |
|
33 | + ? $ee_gmaps_opts['ee_map_nav_size'] |
|
34 | + : 'default'; |
|
35 | + $ee_map_type_control = ! empty($ee_gmaps_opts['ee_map_type_control']) |
|
36 | + ? $ee_gmaps_opts['ee_map_type_control'] |
|
37 | + : 'default'; |
|
38 | + $static_url = ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : false; |
|
39 | + |
|
40 | + if (! empty($ee_gmaps_opts['ee_map_align'])) { |
|
41 | + switch ($ee_gmaps_opts['ee_map_align']) { |
|
42 | + case "left": |
|
43 | + $map_align = 'ee-gmap-align-left left'; |
|
44 | + break; |
|
45 | + case "right": |
|
46 | + $map_align = 'ee-gmap-align-right right'; |
|
47 | + break; |
|
48 | + case "center": |
|
49 | + $map_align = 'ee-gmap-align-center center'; |
|
50 | + break; |
|
51 | + case "none": |
|
52 | + default: |
|
53 | + $map_align = 'ee-gmap-align-none'; |
|
54 | + } |
|
55 | + } else { |
|
56 | + $map_align = 'ee-gmap-align-none'; |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + // Determine whether user has set a hardoded url to use and |
|
61 | + // if so display a Google static iframe map else run V3 api |
|
62 | + if ($static_url) { |
|
63 | + $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">'; |
|
64 | + $html .= '<iframe src="' . $static_url . '&output=embed"' |
|
65 | + . ' style="width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;"' |
|
66 | + . ' frameborder="0" scrolling="no">'; |
|
67 | + $html .= '</iframe>'; |
|
68 | + $html .= '<a href="' . $static_url . '">View Large map</a>'; |
|
69 | + $html .= '</div>'; |
|
70 | + return $html; |
|
71 | + } else { |
|
72 | + EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array( |
|
73 | + 'map_ID' => $ee_gmaps_opts['map_ID'], |
|
74 | + 'ee_map_zoom' => $ee_map_zoom, |
|
75 | + 'ee_map_nav_display' => $ee_map_nav_display, |
|
76 | + 'ee_map_nav_size' => $ee_map_nav_size, |
|
77 | + 'ee_map_type_control' => $ee_map_type_control, |
|
78 | + 'location' => $ee_gmaps_opts['location'], |
|
79 | + ); |
|
80 | + |
|
81 | + $style = 'width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;'; |
|
82 | + $html = '<div class="ee-gmap-wrapper ' . $map_align . '">' |
|
83 | + . '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] . '"' |
|
84 | + . ' style="' . $style . '"></div>' |
|
85 | + . '</div>'; |
|
86 | + |
|
87 | + wp_enqueue_script('gmap_api'); |
|
88 | + wp_enqueue_script('ee_gmap'); |
|
89 | + add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script')); |
|
90 | + |
|
91 | + return $html; |
|
92 | + } // end auto map or static url map check |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * enqueue_script |
|
98 | + * |
|
99 | + * @return void |
|
100 | + */ |
|
101 | + public static function footer_enqueue_script() |
|
102 | + { |
|
103 | + wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars); |
|
104 | + } |
|
105 | + |
|
106 | + |
|
107 | + /** |
|
108 | + * registers scripts for maps |
|
109 | + */ |
|
110 | + public static function espresso_google_map_js() |
|
111 | + { |
|
112 | + $api_url = sprintf( |
|
113 | + "https://maps.googleapis.com/maps/api/js?key=%s", |
|
114 | + apply_filters( |
|
115 | + 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', |
|
116 | + EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
117 | + ) |
|
118 | + ); |
|
119 | + wp_register_script('gmap_api', $api_url, array('jquery'), null, true); |
|
120 | + wp_register_script('ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', true); |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * creates a Google Map Link |
|
125 | + * |
|
126 | + * @param array $atts array of attributes required for the map link generation |
|
127 | + * @return string (link to map!) |
|
128 | + */ |
|
129 | + public static function google_map_link($atts) |
|
130 | + { |
|
131 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
132 | + extract($atts); |
|
133 | + /** @var string $address */ |
|
134 | + /** @var string $city */ |
|
135 | + /** @var string $state */ |
|
136 | + /** @var string $zip */ |
|
137 | + /** @var string $country */ |
|
138 | + $address = "{$address}"; |
|
139 | + $city = "{$city}"; |
|
140 | + $state = "{$state}"; |
|
141 | + $zip = "{$zip}"; |
|
142 | + $country = "{$country}"; |
|
143 | + $text = isset($text) ? "{$text}" : ""; |
|
144 | + $type = isset($type) ? "{$type}" : ""; |
|
145 | + $map_w = isset($map_w) ? "{$map_w}" : 400; |
|
146 | + $map_h = isset($map_h) ? "{$map_h}" : 400; |
|
147 | + $id = isset($id) ? $id : 'not_set'; |
|
148 | + $map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view'; |
|
149 | + |
|
150 | + $address_string = ($address != '' ? $address : '') |
|
151 | + . ($city != '' ? ',' . $city : '') |
|
152 | + . ($state != '' ? ',' . $state : '') |
|
153 | + . ($zip != '' ? ',' . $zip : '') |
|
154 | + . ($country != '' ? ',' . $country : ''); |
|
155 | + |
|
156 | + $google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode($address_string)); |
|
157 | + |
|
158 | + switch ($type) { |
|
159 | + case 'text': |
|
160 | + default: |
|
161 | + $text = $text == '' ? esc_html__('Map and Directions', 'event_espresso') : $text; |
|
162 | + break; |
|
163 | + |
|
164 | + case 'url_only': |
|
165 | + case 'url': |
|
166 | + $text = $google_map; |
|
167 | + break; |
|
168 | + |
|
169 | + case 'map': |
|
170 | + $scheme = is_ssl() ? 'https://' : 'http://'; |
|
171 | + |
|
172 | + $api_key = apply_filters( |
|
173 | + 'FHEE__EEH_Maps__espresso_google_maps_link__api_key', |
|
174 | + EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
175 | + ); |
|
176 | + |
|
177 | + return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2($scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode($address_string) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode($address_string) . '&sensor=false&key=' . $api_key) . '" /></a>'; |
|
178 | + } |
|
179 | + |
|
180 | + return $type === 'url_only' |
|
181 | + ? $text |
|
182 | + : '<a href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . $text . '</a>'; |
|
183 | + } |
|
184 | 184 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | : 'default'; |
38 | 38 | $static_url = ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : false; |
39 | 39 | |
40 | - if (! empty($ee_gmaps_opts['ee_map_align'])) { |
|
40 | + if ( ! empty($ee_gmaps_opts['ee_map_align'])) { |
|
41 | 41 | switch ($ee_gmaps_opts['ee_map_align']) { |
42 | 42 | case "left": |
43 | 43 | $map_align = 'ee-gmap-align-left left'; |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | // Determine whether user has set a hardoded url to use and |
61 | 61 | // if so display a Google static iframe map else run V3 api |
62 | 62 | if ($static_url) { |
63 | - $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">'; |
|
64 | - $html .= '<iframe src="' . $static_url . '&output=embed"' |
|
65 | - . ' style="width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;"' |
|
63 | + $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">'; |
|
64 | + $html .= '<iframe src="'.$static_url.'&output=embed"' |
|
65 | + . ' style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"' |
|
66 | 66 | . ' frameborder="0" scrolling="no">'; |
67 | 67 | $html .= '</iframe>'; |
68 | - $html .= '<a href="' . $static_url . '">View Large map</a>'; |
|
68 | + $html .= '<a href="'.$static_url.'">View Large map</a>'; |
|
69 | 69 | $html .= '</div>'; |
70 | 70 | return $html; |
71 | 71 | } else { |
72 | - EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array( |
|
72 | + EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array( |
|
73 | 73 | 'map_ID' => $ee_gmaps_opts['map_ID'], |
74 | 74 | 'ee_map_zoom' => $ee_map_zoom, |
75 | 75 | 'ee_map_nav_display' => $ee_map_nav_display, |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | 'location' => $ee_gmaps_opts['location'], |
79 | 79 | ); |
80 | 80 | |
81 | - $style = 'width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;'; |
|
82 | - $html = '<div class="ee-gmap-wrapper ' . $map_align . '">' |
|
83 | - . '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] . '"' |
|
84 | - . ' style="' . $style . '"></div>' |
|
81 | + $style = 'width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;'; |
|
82 | + $html = '<div class="ee-gmap-wrapper '.$map_align.'">' |
|
83 | + . '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'"' |
|
84 | + . ' style="'.$style.'"></div>' |
|
85 | 85 | . '</div>'; |
86 | 86 | |
87 | 87 | wp_enqueue_script('gmap_api'); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ) |
118 | 118 | ); |
119 | 119 | wp_register_script('gmap_api', $api_url, array('jquery'), null, true); |
120 | - wp_register_script('ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', true); |
|
120 | + wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', true); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | $map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view'; |
149 | 149 | |
150 | 150 | $address_string = ($address != '' ? $address : '') |
151 | - . ($city != '' ? ',' . $city : '') |
|
152 | - . ($state != '' ? ',' . $state : '') |
|
153 | - . ($zip != '' ? ',' . $zip : '') |
|
154 | - . ($country != '' ? ',' . $country : ''); |
|
151 | + . ($city != '' ? ','.$city : '') |
|
152 | + . ($state != '' ? ','.$state : '') |
|
153 | + . ($zip != '' ? ','.$zip : '') |
|
154 | + . ($country != '' ? ','.$country : ''); |
|
155 | 155 | |
156 | - $google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode($address_string)); |
|
156 | + $google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string)); |
|
157 | 157 | |
158 | 158 | switch ($type) { |
159 | 159 | case 'text': |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | EE_Registry::instance()->CFG->map_settings->google_map_api_key |
175 | 175 | ); |
176 | 176 | |
177 | - return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2($scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode($address_string) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode($address_string) . '&sensor=false&key=' . $api_key) . '" /></a>'; |
|
177 | + return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank" rel="noopener noreferrer">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&zoom=14&size='.$map_w.'x'.$map_h.'&markers=color:green|label:|'.urlencode($address_string).'&sensor=false&key='.$api_key).'" /></a>'; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | return $type === 'url_only' |
181 | 181 | ? $text |
182 | - : '<a href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . $text . '</a>'; |
|
182 | + : '<a href="'.$google_map.'" target="_blank" rel="noopener noreferrer">'.$text.'</a>'; |
|
183 | 183 | } |
184 | 184 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <div class="padding"> |
2 | 2 | <p><?php |
3 | - printf( |
|
4 | - esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), |
|
5 | - '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank" rel="noopener noreferrer">', |
|
6 | - '</a>' |
|
7 | - ); ?></p> |
|
3 | + printf( |
|
4 | + esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), |
|
5 | + '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank" rel="noopener noreferrer">', |
|
6 | + '</a>' |
|
7 | + ); ?></p> |
|
8 | 8 | </div> |
9 | 9 | \ No newline at end of file |
@@ -16,39 +16,39 @@ discard block |
||
16 | 16 | <div class="sandbox-panel"> |
17 | 17 | <h2 class="section-title"><?php _e('PayPal Sandbox Mode', 'event_espresso'); ?></h2> |
18 | 18 | <h3 style="color:#ff0000;"><?php |
19 | - _e( |
|
20 | - 'Debug Mode Is Turned On. Payments will not be processed', |
|
21 | - 'event_espresso' |
|
22 | - ); ?></h3> |
|
19 | + _e( |
|
20 | + 'Debug Mode Is Turned On. Payments will not be processed', |
|
21 | + 'event_espresso' |
|
22 | + ); ?></h3> |
|
23 | 23 | |
24 | 24 | <p class="test-credit-cards-info-pg" style="margin-bottom:0;"> |
25 | 25 | <strong><?php _e('Testing Guidelines', 'event_espresso'); ?></strong> |
26 | 26 | </p> |
27 | 27 | <ul style="margin:1em 2em 1.5em; line-height:1.2em;"> |
28 | 28 | <li><?php |
29 | - _e( |
|
30 | - 'While testing, use the credit card number associated with your sandbox account.', |
|
31 | - 'event_espresso' |
|
32 | - ); ?></li> |
|
29 | + _e( |
|
30 | + 'While testing, use the credit card number associated with your sandbox account.', |
|
31 | + 'event_espresso' |
|
32 | + ); ?></li> |
|
33 | 33 | <li><?php |
34 | - printf( |
|
35 | - __( |
|
36 | - 'To find the sandbox account\'s credit card, go to %1$s, then "Dashboard", then under Sandbox click "Accounts", then click your account and click "Profile", then in the popup that appears click on the "Funding" tab. Your testing card is listed there.', |
|
37 | - 'event_espresso' |
|
38 | - ), |
|
39 | - '<a href="http://developer.paypal.com">developer.paypal.com</a>' |
|
40 | - ); ?></li> |
|
34 | + printf( |
|
35 | + __( |
|
36 | + 'To find the sandbox account\'s credit card, go to %1$s, then "Dashboard", then under Sandbox click "Accounts", then click your account and click "Profile", then in the popup that appears click on the "Funding" tab. Your testing card is listed there.', |
|
37 | + 'event_espresso' |
|
38 | + ), |
|
39 | + '<a href="http://developer.paypal.com">developer.paypal.com</a>' |
|
40 | + ); ?></li> |
|
41 | 41 | <li><?php |
42 | - esc_html_e('CVV2 should be 115', 'event_espresso'); ?></li> |
|
42 | + esc_html_e('CVV2 should be 115', 'event_espresso'); ?></li> |
|
43 | 43 | </ul> |
44 | 44 | |
45 | 45 | <p class="test-credit-cards-info-pg"> |
46 | 46 | <strong><?php _e('Credit Card Numbers Used for Testing', 'event_espresso'); ?></strong><br/> |
47 | 47 | <span class="small-text"><?php |
48 | - _e( |
|
49 | - 'Use the following credit card numbers for testing. Any other card number produces a general failure.', |
|
50 | - 'event_espresso' |
|
51 | - ); ?></span> |
|
48 | + _e( |
|
49 | + 'Use the following credit card numbers for testing. Any other card number produces a general failure.', |
|
50 | + 'event_espresso' |
|
51 | + ); ?></span> |
|
52 | 52 | </p> |
53 | 53 | |
54 | 54 | <div class="tbl-wrap"> |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | <p class="test-credit-cards-info-pg"> |
73 | 73 | <strong><?php _e('Testing Result Code Responses', 'event_espresso'); ?></strong><br/> |
74 | 74 | <span class="small-text"><?php |
75 | - printf( |
|
76 | - __( |
|
77 | - 'You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s', |
|
78 | - 'event_espresso' |
|
79 | - ), |
|
80 | - "<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>", |
|
81 | - "</a>", |
|
82 | - "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>", |
|
83 | - "</a>", |
|
84 | - "<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>", |
|
85 | - "</a>" |
|
86 | - ); ?></span> |
|
75 | + printf( |
|
76 | + __( |
|
77 | + 'You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s', |
|
78 | + 'event_espresso' |
|
79 | + ), |
|
80 | + "<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>", |
|
81 | + "</a>", |
|
82 | + "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>", |
|
83 | + "</a>", |
|
84 | + "<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>", |
|
85 | + "</a>" |
|
86 | + ); ?></span> |
|
87 | 87 | </p> |
88 | 88 | |
89 | 89 | <div class="tbl-wrap"> |
@@ -3,10 +3,10 @@ |
||
3 | 3 | <?php esc_html_e('This page shows options for Email Validation, the EE "Bot Trap" and reCAPTCHA which can help prevent SPAM registrations on your site.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <div id="email_validation_info"> |
6 | -<p><strong><?php esc_html_e('Email Validation', 'event_espresso');?></strong></p> |
|
6 | +<p><strong><?php esc_html_e('Email Validation', 'event_espresso'); ?></strong></p> |
|
7 | 7 | <p><?php esc_html_e("Validating an email address is extremely difficult to do correctly. Your server's configuration, as well as your own tolerances and needs, can affect the type of validation needed. We offer different types of validation so that you can control how strict your registration form responds to entered email addresses. If you are receiving too many bogus email addresses, then you can try the WordPress Default validation setting. If you find that the form validation is blocking a valid email address you can try the Basic setting, or if available, the International validation settings.", 'event_espresso'); ?> |
8 | 8 | </p> |
9 | -<p><strong><?php esc_html_e('Validation Options:', 'event_espresso');?></strong></p> |
|
9 | +<p><strong><?php esc_html_e('Validation Options:', 'event_espresso'); ?></strong></p> |
|
10 | 10 | <ul> |
11 | 11 | <li> |
12 | 12 | <?php esc_html_e('"Basic" - only checks that an email address follows the most basic structure guidelines ( ie: [email protected] ). Will work with the widest range of email addresses but will also allow the most garbage through.', 'event_espresso'); ?></li> |
@@ -1,93 +1,93 @@ |
||
1 | 1 | <div class="padding"> |
2 | 2 | <?php esc_html_e( |
3 | - 'If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', |
|
4 | - 'event_espresso' |
|
5 | - ); ?> |
|
3 | + 'If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', |
|
4 | + 'event_espresso' |
|
5 | + ); ?> |
|
6 | 6 | <h2><?php esc_html_e('Developer Resources', 'event_espresso'); ?></h2> |
7 | 7 | <ul> |
8 | 8 | <li> |
9 | 9 | <?php printf( |
10 | - esc_html__('%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso'), |
|
11 | - '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank" rel="noopener noreferrer">', |
|
12 | - '</a>' |
|
13 | - ); ?></li> |
|
10 | + esc_html__('%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso'), |
|
11 | + '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank" rel="noopener noreferrer">', |
|
12 | + '</a>' |
|
13 | + ); ?></li> |
|
14 | 14 | <li> |
15 | 15 | <?php printf( |
16 | - esc_html__('%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso'), |
|
17 | - '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
18 | - '</a>' |
|
19 | - ); ?></li> |
|
16 | + esc_html__('%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso'), |
|
17 | + '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
18 | + '</a>' |
|
19 | + ); ?></li> |
|
20 | 20 | <li> |
21 | 21 | <?php printf( |
22 | - esc_html__('%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso'), |
|
23 | - '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
24 | - '</a>', |
|
25 | - '<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">' |
|
26 | - ); ?></li> |
|
22 | + esc_html__('%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso'), |
|
23 | + '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
24 | + '</a>', |
|
25 | + '<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">' |
|
26 | + ); ?></li> |
|
27 | 27 | </ul> |
28 | 28 | |
29 | 29 | <h2><?php esc_html_e('Event Espresso 4 Articles for Developers', 'event_espresso'); ?></h2> |
30 | 30 | <ul> |
31 | 31 | <li> |
32 | 32 | <?php printf( |
33 | - esc_html__('%1$sCustom Post Types Usage%2$s', 'event_espresso'), |
|
34 | - '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
35 | - '</a>' |
|
36 | - ); ?></li> |
|
33 | + esc_html__('%1$sCustom Post Types Usage%2$s', 'event_espresso'), |
|
34 | + '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
35 | + '</a>' |
|
36 | + ); ?></li> |
|
37 | 37 | <li> |
38 | 38 | <?php printf( |
39 | - esc_html__('%1$sTheme Development%2$s', 'event_espresso'), |
|
40 | - '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
41 | - '</a>' |
|
42 | - ); ?></li> |
|
39 | + esc_html__('%1$sTheme Development%2$s', 'event_espresso'), |
|
40 | + '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
41 | + '</a>' |
|
42 | + ); ?></li> |
|
43 | 43 | <li> |
44 | 44 | <?php printf( |
45 | - esc_html__('%1$sCapability System%2$s', 'event_espresso'), |
|
46 | - '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
47 | - '</a>' |
|
48 | - ); ?></li> |
|
45 | + esc_html__('%1$sCapability System%2$s', 'event_espresso'), |
|
46 | + '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
47 | + '</a>' |
|
48 | + ); ?></li> |
|
49 | 49 | <li> |
50 | 50 | <?php printf( |
51 | - esc_html__('%1$sPayment Method Development%2$s', 'event_espresso'), |
|
52 | - '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank" rel="noopener noreferrer">', |
|
53 | - '</a>' |
|
54 | - ); ?></li> |
|
51 | + esc_html__('%1$sPayment Method Development%2$s', 'event_espresso'), |
|
52 | + '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank" rel="noopener noreferrer">', |
|
53 | + '</a>' |
|
54 | + ); ?></li> |
|
55 | 55 | <li> |
56 | 56 | <?php printf( |
57 | - esc_html__('%1$sMessages System in Event Espresso 4%2$s', 'event_espresso'), |
|
58 | - '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
59 | - '</a>' |
|
60 | - ); ?></li> |
|
57 | + esc_html__('%1$sMessages System in Event Espresso 4%2$s', 'event_espresso'), |
|
58 | + '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
59 | + '</a>' |
|
60 | + ); ?></li> |
|
61 | 61 | <li> |
62 | 62 | <?php printf( |
63 | - esc_html__( |
|
64 | - '%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', |
|
65 | - 'event_espresso' |
|
66 | - ), |
|
67 | - '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
68 | - '</a>' |
|
69 | - ); ?></li> |
|
63 | + esc_html__( |
|
64 | + '%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
68 | + '</a>' |
|
69 | + ); ?></li> |
|
70 | 70 | </ul> |
71 | 71 | |
72 | 72 | <h2><?php esc_html_e('REST API Resources', 'event_espresso'); ?></h2> |
73 | 73 | <ul> |
74 | 74 | <li> |
75 | 75 | <?php printf( |
76 | - esc_html__('%1$sREST API: Introduction%2$s', 'event_espresso'), |
|
77 | - '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank" rel="noopener noreferrer">', |
|
78 | - '</a>' |
|
79 | - ); ?></li> |
|
76 | + esc_html__('%1$sREST API: Introduction%2$s', 'event_espresso'), |
|
77 | + '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank" rel="noopener noreferrer">', |
|
78 | + '</a>' |
|
79 | + ); ?></li> |
|
80 | 80 | <li> |
81 | 81 | <?php printf( |
82 | - esc_html__('%1$sREST API: Reading Data%2$s', 'event_espresso'), |
|
83 | - '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank" rel="noopener noreferrer">', |
|
84 | - '</a>' |
|
85 | - ); ?></li> |
|
82 | + esc_html__('%1$sREST API: Reading Data%2$s', 'event_espresso'), |
|
83 | + '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank" rel="noopener noreferrer">', |
|
84 | + '</a>' |
|
85 | + ); ?></li> |
|
86 | 86 | <li> |
87 | 87 | <?php printf( |
88 | - esc_html__('%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso'), |
|
89 | - '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank" rel="noopener noreferrer">', |
|
90 | - '</a>' |
|
91 | - ); ?></li> |
|
88 | + esc_html__('%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso'), |
|
89 | + '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank" rel="noopener noreferrer">', |
|
90 | + '</a>' |
|
91 | + ); ?></li> |
|
92 | 92 | </ul> |
93 | 93 | </div> |
94 | 94 | \ No newline at end of file |
@@ -11,20 +11,20 @@ discard block |
||
11 | 11 | </th> |
12 | 12 | <td> |
13 | 13 | <?php echo EEH_Form_Fields::select_input( |
14 | - 'use_google_maps', |
|
15 | - $values, |
|
16 | - $map_settings->use_google_maps, |
|
17 | - 'id="ee-display-map-no-shortcodes"' |
|
18 | - ); ?> |
|
14 | + 'use_google_maps', |
|
15 | + $values, |
|
16 | + $map_settings->use_google_maps, |
|
17 | + 'id="ee-display-map-no-shortcodes"' |
|
18 | + ); ?> |
|
19 | 19 | <p class="description"> |
20 | 20 | <?php esc_html_e( |
21 | - 'Turn Google maps on or off site wide for Event Espresso.', |
|
22 | - 'event_espresso' |
|
23 | - ); ?></p> |
|
21 | + 'Turn Google maps on or off site wide for Event Espresso.', |
|
22 | + 'event_espresso' |
|
23 | + ); ?></p> |
|
24 | 24 | </td> |
25 | 25 | </tr> |
26 | 26 | <?php |
27 | - if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?> |
|
27 | + if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | 30 | <label for="ee-google-map-api-key"> |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | value="<?php echo $map_settings->google_map_api_key; ?>"/> |
37 | 37 | <p class="description"> |
38 | 38 | <?php |
39 | - printf( |
|
40 | - __( |
|
41 | - 'An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', |
|
42 | - 'event_espresso' |
|
43 | - ), |
|
44 | - '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank" rel="noopener noreferrer">', |
|
45 | - '</a>' |
|
46 | - ); |
|
47 | - ?> |
|
39 | + printf( |
|
40 | + __( |
|
41 | + 'An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', |
|
42 | + 'event_espresso' |
|
43 | + ), |
|
44 | + '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank" rel="noopener noreferrer">', |
|
45 | + '</a>' |
|
46 | + ); |
|
47 | + ?> |
|
48 | 48 | </p> |
49 | 49 | </td> |
50 | 50 | </tr> |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | </th> |
106 | 106 | <td> |
107 | 107 | <?php echo EEH_Form_Fields::select_input( |
108 | - 'event_details_display_nav', |
|
109 | - $values, |
|
110 | - $map_settings->event_details_display_nav, |
|
111 | - 'id="event_details_display_nav" ' |
|
112 | - ); ?> |
|
108 | + 'event_details_display_nav', |
|
109 | + $values, |
|
110 | + $map_settings->event_details_display_nav, |
|
111 | + 'id="event_details_display_nav" ' |
|
112 | + ); ?> |
|
113 | 113 | </td> |
114 | 114 | </tr> |
115 | 115 | |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | </th> |
122 | 122 | <td> |
123 | 123 | <?php echo EEH_Form_Fields::select_input( |
124 | - 'event_details_nav_size', |
|
125 | - $values, |
|
126 | - $map_settings->event_details_nav_size, |
|
127 | - 'id="event_details_nav_size"' |
|
128 | - ); ?> |
|
124 | + 'event_details_nav_size', |
|
125 | + $values, |
|
126 | + $map_settings->event_details_nav_size, |
|
127 | + 'id="event_details_nav_size"' |
|
128 | + ); ?> |
|
129 | 129 | </td> |
130 | 130 | </tr> |
131 | 131 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | <td> |
137 | 137 | <label for="event_details_control_type-default" class="ee-admin-radio-lbl"> |
138 | 138 | <?php $checked = $map_settings->event_details_control_type == 'default' ? 'checked="checked"' |
139 | - : ''; ?> |
|
139 | + : ''; ?> |
|
140 | 140 | <input id="event_details_control_type-default" type="radio" name="event_details_control_type" |
141 | 141 | value="default"<?php echo $checked; ?>/> |
142 | 142 | <?php esc_html_e(' Default', 'event_espresso') ?> |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | <label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl"> |
146 | 146 | <?php $checked = $map_settings->event_details_control_type == 'horizontal' ? 'checked="checked"' |
147 | - : ''; ?> |
|
147 | + : ''; ?> |
|
148 | 148 | <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" |
149 | 149 | value="horizontal"<?php echo $checked; ?>/> |
150 | 150 | <?php esc_html_e(' Horizontal', 'event_espresso') ?> |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | <label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl"> |
154 | 154 | <?php $checked = $map_settings->event_details_control_type == 'dropdown' ? 'checked="checked"' |
155 | - : ''; ?> |
|
155 | + : ''; ?> |
|
156 | 156 | <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" |
157 | 157 | value="dropdown"<?php echo $checked; ?>/> |
158 | 158 | <?php esc_html_e(' Dropdown', 'event_espresso') ?> |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | </th> |
247 | 247 | <td> |
248 | 248 | <?php echo EEH_Form_Fields::select_input( |
249 | - 'event_list_display_nav', |
|
250 | - $values, |
|
251 | - $map_settings->event_list_display_nav, |
|
252 | - 'id="event_list_display_nav"' |
|
253 | - ); ?> |
|
249 | + 'event_list_display_nav', |
|
250 | + $values, |
|
251 | + $map_settings->event_list_display_nav, |
|
252 | + 'id="event_list_display_nav"' |
|
253 | + ); ?> |
|
254 | 254 | </td> |
255 | 255 | </tr> |
256 | 256 | |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | </th> |
263 | 263 | <td> |
264 | 264 | <?php echo EEH_Form_Fields::select_input( |
265 | - 'event_list_nav_size', |
|
266 | - $values, |
|
267 | - $map_settings->event_list_nav_size, |
|
268 | - 'id="event_list_nav_size"' |
|
269 | - ); ?> |
|
265 | + 'event_list_nav_size', |
|
266 | + $values, |
|
267 | + $map_settings->event_list_nav_size, |
|
268 | + 'id="event_list_nav_size"' |
|
269 | + ); ?> |
|
270 | 270 | </td> |
271 | 271 | </tr> |
272 | 272 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | <label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl"> |
286 | 286 | <?php $checked = $map_settings->event_list_control_type == 'horizontal' ? 'checked="checked"' |
287 | - : ''; ?> |
|
287 | + : ''; ?> |
|
288 | 288 | <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" |
289 | 289 | value="horizontal"<?php echo $checked; ?>/> |
290 | 290 | <?php esc_html_e(' Horizontal', 'event_espresso') ?> |