@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.79.rc.012'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.79.rc.012'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
@@ -16,261 +16,261 @@ |
||
16 | 16 | class Venues_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_venues($this->_per_page); |
|
28 | - $this->_all_data_count = $this->_admin_page->get_venues($this->_per_page, true); |
|
29 | - } |
|
30 | - |
|
31 | - |
|
32 | - protected function _set_properties() |
|
33 | - { |
|
34 | - $this->_wp_list_args = array( |
|
35 | - 'singular' => __('Event Venue', 'event_espresso'), |
|
36 | - 'plural' => __('Event Venues', 'event_espresso'), |
|
37 | - 'ajax' => true, // for now, |
|
38 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
39 | - ); |
|
40 | - |
|
41 | - $this->_columns = array( |
|
42 | - 'cb' => '<input type="checkbox" />', |
|
43 | - 'id' => __('ID', 'event_espresso'), |
|
44 | - 'name' => __('Name', 'event_espresso'), |
|
45 | - 'address' => __('Address', 'event_espresso'), |
|
46 | - 'city' => __('City', 'event_espresso'), |
|
47 | - 'capacity' => __('Capacity', 'event_espresso'), |
|
48 | - // 'shortcode' => __('Shortcode', 'event_espresso'), |
|
49 | - ); |
|
50 | - |
|
51 | - $this->_sortable_columns = array( |
|
52 | - 'id' => array('id' => true), |
|
53 | - 'name' => array('name' => false), |
|
54 | - 'city' => array('city' => false), |
|
55 | - 'capacity' => array('capacity' => false), |
|
56 | - ); |
|
57 | - |
|
58 | - $this->_hidden_columns = array(); |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - // todo... add _venue_status in here (which we'll define a EE_Admin_CPT_List_Table for common properties) |
|
63 | - protected function _get_table_filters() |
|
64 | - { |
|
65 | - return array(); |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - protected function _add_view_counts() |
|
70 | - { |
|
71 | - $this->_views['all']['count'] = EEM_Venue::instance()->count(); |
|
72 | - if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
73 | - $this->_views['trash']['count'] = EEM_Venue::instance()->count_deleted(); |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - public function column_cb($item) |
|
79 | - { |
|
80 | - |
|
81 | - return $item->count_related('Event') > 0 && $item->get('status') === 'trash' |
|
82 | - ? '<span class="ee-lock-icon"></span>' |
|
83 | - : sprintf( |
|
84 | - '<input type="checkbox" name="venue_id[]" value="%s" />', |
|
85 | - $item->ID() |
|
86 | - ); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - public function column_id($item) |
|
91 | - { |
|
92 | - $content = $item->ID(); |
|
93 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
94 | - return $content; |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - public function column_name($item) |
|
99 | - { |
|
100 | - $edit_query_args = array( |
|
101 | - 'action' => 'edit', |
|
102 | - 'post' => $item->ID(), |
|
103 | - ); |
|
104 | - |
|
105 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
106 | - |
|
107 | - $statuses = EEM_Venue::instance()->get_status_array(); |
|
108 | - $actions = $this->_column_name_action_setup($item); |
|
109 | - $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID()) |
|
110 | - ? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep( |
|
111 | - $item->name() |
|
112 | - ) . '</a></strong>' : $item->name(); |
|
113 | - $content .= $item->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : ''; |
|
114 | - $content .= $this->row_actions($actions); |
|
115 | - return $content; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * Used to setup the actions for the Venue name column |
|
121 | - * |
|
122 | - * @param EE_Venue $item |
|
123 | - * @return array() |
|
124 | - */ |
|
125 | - protected function _column_name_action_setup(EE_Venue $item) |
|
126 | - { |
|
127 | - $actions = array(); |
|
128 | - |
|
129 | - if (EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID())) { |
|
130 | - $edit_query_args = array( |
|
131 | - 'action' => 'edit', |
|
132 | - 'post' => $item->ID(), |
|
133 | - ); |
|
134 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
135 | - $actions['edit'] = '<a href="' . $edit_link . '"' |
|
136 | - . 'aria-label="' |
|
137 | - /* Translators: The name of the venue */ |
|
138 | - . sprintf(esc_attr__('Edit Venue (%s)', 'event_espresso'), $item->name()) |
|
139 | - . '">' |
|
140 | - . esc_html__('Edit', 'event_espresso') |
|
141 | - . '</a>'; |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
146 | - 'ee_delete_venue', |
|
147 | - 'espresso_venues_trash_venue', |
|
148 | - $item->ID() |
|
149 | - )) { |
|
150 | - $trash_event_query_arg = array( |
|
151 | - 'action' => 'trash_venue', |
|
152 | - 'VNU_ID' => $item->ID(), |
|
153 | - ); |
|
154 | - $trash_venue_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_arg, EE_VENUES_ADMIN_URL); |
|
155 | - } |
|
156 | - |
|
157 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
158 | - 'ee_delete_venue', |
|
159 | - 'espresso_venues_restore_venue', |
|
160 | - $item->ID() |
|
161 | - )) { |
|
162 | - $restore_venue_query_args = array( |
|
163 | - 'action' => 'restore_venue', |
|
164 | - 'VNU_ID' => $item->ID(), |
|
165 | - ); |
|
166 | - $restore_venue_link = EE_Admin_Page::add_query_args_and_nonce( |
|
167 | - $restore_venue_query_args, |
|
168 | - EE_VENUES_ADMIN_URL |
|
169 | - ); |
|
170 | - } |
|
171 | - |
|
172 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
173 | - 'ee_delete_venue', |
|
174 | - 'espresso_venues_delete_venue', |
|
175 | - $item->ID() |
|
176 | - )) { |
|
177 | - $delete_venue_query_args = array( |
|
178 | - 'action' => 'delete_venue', |
|
179 | - 'VNU_ID' => $item->ID(), |
|
180 | - ); |
|
181 | - $delete_venue_link = EE_Admin_Page::add_query_args_and_nonce($delete_venue_query_args, EE_VENUES_ADMIN_URL); |
|
182 | - } |
|
183 | - |
|
184 | - $view_link = get_permalink($item->ID()); |
|
185 | - |
|
186 | - switch ($item->get('status')) { |
|
187 | - case 'trash': |
|
188 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
189 | - 'ee_delete_venue', |
|
190 | - 'espresso_venues_restore_venue', |
|
191 | - $item->ID() |
|
192 | - )) { |
|
193 | - $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '"' |
|
194 | - . ' aria-label="' |
|
195 | - . sprintf( |
|
196 | - /* Translators: The name of the venue */ |
|
197 | - esc_attr__( |
|
198 | - 'Restore from Trash the venue: %s', |
|
199 | - 'event_espresso' |
|
200 | - ), |
|
201 | - $item->name() |
|
202 | - ) |
|
203 | - . '">' |
|
204 | - . esc_html__('Restore from Trash', 'event_espresso') |
|
205 | - . '</a>'; |
|
206 | - } |
|
207 | - if ($item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can( |
|
208 | - 'ee_delete_venue', |
|
209 | - 'espresso_venues_delete_venue', |
|
210 | - $item->ID() |
|
211 | - )) { |
|
212 | - $actions['delete permanently'] = '<a href="' . $delete_venue_link . '"' |
|
213 | - . ' aria-label="' |
|
214 | - . sprintf( |
|
215 | - /* Translators: The name of the venue. */ |
|
216 | - esc_attr__('Delete Permanently the venue: %s', 'event_espresso'), |
|
217 | - $item->name() |
|
218 | - ) |
|
219 | - . '">' |
|
220 | - . esc_html__('Delete Permanently', 'event_espresso') |
|
221 | - . '</a>'; |
|
222 | - } |
|
223 | - break; |
|
224 | - default: |
|
225 | - $actions['view'] = '<a href="' . $view_link . '"' |
|
226 | - . ' aria-label="' |
|
227 | - /* Translators: The name of the venue */ |
|
228 | - . sprintf(esc_attr__('View Venue (%s)', 'event_espresso'), $item->name()) |
|
229 | - . '">' |
|
230 | - . esc_html__('View', 'event_espresso') |
|
231 | - . '</a>'; |
|
232 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
233 | - 'ee_delete_venue', |
|
234 | - 'espresso_venues_trash_venue', |
|
235 | - $item->ID() |
|
236 | - )) { |
|
237 | - $actions['move to trash'] = '<a href="' . $trash_venue_link . '"' |
|
238 | - . ' aria-label="' |
|
239 | - . sprintf( |
|
240 | - /* Translators: The name of the venue */ |
|
241 | - esc_attr__('Move the venue %s to the trash.', 'event_espresso'), |
|
242 | - $item->name() |
|
243 | - ) |
|
244 | - . '">' |
|
245 | - . esc_html__('Trash', 'event_espresso') |
|
246 | - . '</a>'; |
|
247 | - } |
|
248 | - } |
|
249 | - return $actions; |
|
250 | - } |
|
251 | - |
|
252 | - |
|
253 | - public function column_address($item) |
|
254 | - { |
|
255 | - return $item->address(); |
|
256 | - } |
|
257 | - |
|
258 | - |
|
259 | - public function column_city($item) |
|
260 | - { |
|
261 | - return $item->city(); |
|
262 | - } |
|
263 | - |
|
264 | - |
|
265 | - public function column_capacity($item) |
|
266 | - { |
|
267 | - return $item->capacity(); |
|
268 | - } |
|
269 | - |
|
270 | - |
|
271 | - public function column_shortcode($item) |
|
272 | - { |
|
273 | - $content = '[ESPRESSO_VENUE id=' . $item->ID() . ']'; |
|
274 | - return $content; |
|
275 | - } |
|
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_venues($this->_per_page); |
|
28 | + $this->_all_data_count = $this->_admin_page->get_venues($this->_per_page, true); |
|
29 | + } |
|
30 | + |
|
31 | + |
|
32 | + protected function _set_properties() |
|
33 | + { |
|
34 | + $this->_wp_list_args = array( |
|
35 | + 'singular' => __('Event Venue', 'event_espresso'), |
|
36 | + 'plural' => __('Event Venues', 'event_espresso'), |
|
37 | + 'ajax' => true, // for now, |
|
38 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
39 | + ); |
|
40 | + |
|
41 | + $this->_columns = array( |
|
42 | + 'cb' => '<input type="checkbox" />', |
|
43 | + 'id' => __('ID', 'event_espresso'), |
|
44 | + 'name' => __('Name', 'event_espresso'), |
|
45 | + 'address' => __('Address', 'event_espresso'), |
|
46 | + 'city' => __('City', 'event_espresso'), |
|
47 | + 'capacity' => __('Capacity', 'event_espresso'), |
|
48 | + // 'shortcode' => __('Shortcode', 'event_espresso'), |
|
49 | + ); |
|
50 | + |
|
51 | + $this->_sortable_columns = array( |
|
52 | + 'id' => array('id' => true), |
|
53 | + 'name' => array('name' => false), |
|
54 | + 'city' => array('city' => false), |
|
55 | + 'capacity' => array('capacity' => false), |
|
56 | + ); |
|
57 | + |
|
58 | + $this->_hidden_columns = array(); |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + // todo... add _venue_status in here (which we'll define a EE_Admin_CPT_List_Table for common properties) |
|
63 | + protected function _get_table_filters() |
|
64 | + { |
|
65 | + return array(); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + protected function _add_view_counts() |
|
70 | + { |
|
71 | + $this->_views['all']['count'] = EEM_Venue::instance()->count(); |
|
72 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
73 | + $this->_views['trash']['count'] = EEM_Venue::instance()->count_deleted(); |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + public function column_cb($item) |
|
79 | + { |
|
80 | + |
|
81 | + return $item->count_related('Event') > 0 && $item->get('status') === 'trash' |
|
82 | + ? '<span class="ee-lock-icon"></span>' |
|
83 | + : sprintf( |
|
84 | + '<input type="checkbox" name="venue_id[]" value="%s" />', |
|
85 | + $item->ID() |
|
86 | + ); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + public function column_id($item) |
|
91 | + { |
|
92 | + $content = $item->ID(); |
|
93 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
94 | + return $content; |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + public function column_name($item) |
|
99 | + { |
|
100 | + $edit_query_args = array( |
|
101 | + 'action' => 'edit', |
|
102 | + 'post' => $item->ID(), |
|
103 | + ); |
|
104 | + |
|
105 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
106 | + |
|
107 | + $statuses = EEM_Venue::instance()->get_status_array(); |
|
108 | + $actions = $this->_column_name_action_setup($item); |
|
109 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID()) |
|
110 | + ? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep( |
|
111 | + $item->name() |
|
112 | + ) . '</a></strong>' : $item->name(); |
|
113 | + $content .= $item->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : ''; |
|
114 | + $content .= $this->row_actions($actions); |
|
115 | + return $content; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * Used to setup the actions for the Venue name column |
|
121 | + * |
|
122 | + * @param EE_Venue $item |
|
123 | + * @return array() |
|
124 | + */ |
|
125 | + protected function _column_name_action_setup(EE_Venue $item) |
|
126 | + { |
|
127 | + $actions = array(); |
|
128 | + |
|
129 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID())) { |
|
130 | + $edit_query_args = array( |
|
131 | + 'action' => 'edit', |
|
132 | + 'post' => $item->ID(), |
|
133 | + ); |
|
134 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
135 | + $actions['edit'] = '<a href="' . $edit_link . '"' |
|
136 | + . 'aria-label="' |
|
137 | + /* Translators: The name of the venue */ |
|
138 | + . sprintf(esc_attr__('Edit Venue (%s)', 'event_espresso'), $item->name()) |
|
139 | + . '">' |
|
140 | + . esc_html__('Edit', 'event_espresso') |
|
141 | + . '</a>'; |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
146 | + 'ee_delete_venue', |
|
147 | + 'espresso_venues_trash_venue', |
|
148 | + $item->ID() |
|
149 | + )) { |
|
150 | + $trash_event_query_arg = array( |
|
151 | + 'action' => 'trash_venue', |
|
152 | + 'VNU_ID' => $item->ID(), |
|
153 | + ); |
|
154 | + $trash_venue_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_arg, EE_VENUES_ADMIN_URL); |
|
155 | + } |
|
156 | + |
|
157 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
158 | + 'ee_delete_venue', |
|
159 | + 'espresso_venues_restore_venue', |
|
160 | + $item->ID() |
|
161 | + )) { |
|
162 | + $restore_venue_query_args = array( |
|
163 | + 'action' => 'restore_venue', |
|
164 | + 'VNU_ID' => $item->ID(), |
|
165 | + ); |
|
166 | + $restore_venue_link = EE_Admin_Page::add_query_args_and_nonce( |
|
167 | + $restore_venue_query_args, |
|
168 | + EE_VENUES_ADMIN_URL |
|
169 | + ); |
|
170 | + } |
|
171 | + |
|
172 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
173 | + 'ee_delete_venue', |
|
174 | + 'espresso_venues_delete_venue', |
|
175 | + $item->ID() |
|
176 | + )) { |
|
177 | + $delete_venue_query_args = array( |
|
178 | + 'action' => 'delete_venue', |
|
179 | + 'VNU_ID' => $item->ID(), |
|
180 | + ); |
|
181 | + $delete_venue_link = EE_Admin_Page::add_query_args_and_nonce($delete_venue_query_args, EE_VENUES_ADMIN_URL); |
|
182 | + } |
|
183 | + |
|
184 | + $view_link = get_permalink($item->ID()); |
|
185 | + |
|
186 | + switch ($item->get('status')) { |
|
187 | + case 'trash': |
|
188 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
189 | + 'ee_delete_venue', |
|
190 | + 'espresso_venues_restore_venue', |
|
191 | + $item->ID() |
|
192 | + )) { |
|
193 | + $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '"' |
|
194 | + . ' aria-label="' |
|
195 | + . sprintf( |
|
196 | + /* Translators: The name of the venue */ |
|
197 | + esc_attr__( |
|
198 | + 'Restore from Trash the venue: %s', |
|
199 | + 'event_espresso' |
|
200 | + ), |
|
201 | + $item->name() |
|
202 | + ) |
|
203 | + . '">' |
|
204 | + . esc_html__('Restore from Trash', 'event_espresso') |
|
205 | + . '</a>'; |
|
206 | + } |
|
207 | + if ($item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can( |
|
208 | + 'ee_delete_venue', |
|
209 | + 'espresso_venues_delete_venue', |
|
210 | + $item->ID() |
|
211 | + )) { |
|
212 | + $actions['delete permanently'] = '<a href="' . $delete_venue_link . '"' |
|
213 | + . ' aria-label="' |
|
214 | + . sprintf( |
|
215 | + /* Translators: The name of the venue. */ |
|
216 | + esc_attr__('Delete Permanently the venue: %s', 'event_espresso'), |
|
217 | + $item->name() |
|
218 | + ) |
|
219 | + . '">' |
|
220 | + . esc_html__('Delete Permanently', 'event_espresso') |
|
221 | + . '</a>'; |
|
222 | + } |
|
223 | + break; |
|
224 | + default: |
|
225 | + $actions['view'] = '<a href="' . $view_link . '"' |
|
226 | + . ' aria-label="' |
|
227 | + /* Translators: The name of the venue */ |
|
228 | + . sprintf(esc_attr__('View Venue (%s)', 'event_espresso'), $item->name()) |
|
229 | + . '">' |
|
230 | + . esc_html__('View', 'event_espresso') |
|
231 | + . '</a>'; |
|
232 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
233 | + 'ee_delete_venue', |
|
234 | + 'espresso_venues_trash_venue', |
|
235 | + $item->ID() |
|
236 | + )) { |
|
237 | + $actions['move to trash'] = '<a href="' . $trash_venue_link . '"' |
|
238 | + . ' aria-label="' |
|
239 | + . sprintf( |
|
240 | + /* Translators: The name of the venue */ |
|
241 | + esc_attr__('Move the venue %s to the trash.', 'event_espresso'), |
|
242 | + $item->name() |
|
243 | + ) |
|
244 | + . '">' |
|
245 | + . esc_html__('Trash', 'event_espresso') |
|
246 | + . '</a>'; |
|
247 | + } |
|
248 | + } |
|
249 | + return $actions; |
|
250 | + } |
|
251 | + |
|
252 | + |
|
253 | + public function column_address($item) |
|
254 | + { |
|
255 | + return $item->address(); |
|
256 | + } |
|
257 | + |
|
258 | + |
|
259 | + public function column_city($item) |
|
260 | + { |
|
261 | + return $item->city(); |
|
262 | + } |
|
263 | + |
|
264 | + |
|
265 | + public function column_capacity($item) |
|
266 | + { |
|
267 | + return $item->capacity(); |
|
268 | + } |
|
269 | + |
|
270 | + |
|
271 | + public function column_shortcode($item) |
|
272 | + { |
|
273 | + $content = '[ESPRESSO_VENUE id=' . $item->ID() . ']'; |
|
274 | + return $content; |
|
275 | + } |
|
276 | 276 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public function column_id($item) |
91 | 91 | { |
92 | 92 | $content = $item->ID(); |
93 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
93 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
94 | 94 | return $content; |
95 | 95 | } |
96 | 96 | |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | $statuses = EEM_Venue::instance()->get_status_array(); |
108 | 108 | $actions = $this->_column_name_action_setup($item); |
109 | 109 | $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID()) |
110 | - ? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep( |
|
110 | + ? '<strong><a class="row-title" href="'.$edit_link.'">'.stripslashes_deep( |
|
111 | 111 | $item->name() |
112 | - ) . '</a></strong>' : $item->name(); |
|
113 | - $content .= $item->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : ''; |
|
112 | + ).'</a></strong>' : $item->name(); |
|
113 | + $content .= $item->status() == 'draft' ? ' - <span class="post-state">'.$statuses['draft'].'</span>' : ''; |
|
114 | 114 | $content .= $this->row_actions($actions); |
115 | 115 | return $content; |
116 | 116 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | 'post' => $item->ID(), |
133 | 133 | ); |
134 | 134 | $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
135 | - $actions['edit'] = '<a href="' . $edit_link . '"' |
|
135 | + $actions['edit'] = '<a href="'.$edit_link.'"' |
|
136 | 136 | . 'aria-label="' |
137 | 137 | /* Translators: The name of the venue */ |
138 | 138 | . sprintf(esc_attr__('Edit Venue (%s)', 'event_espresso'), $item->name()) |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | 'espresso_venues_restore_venue', |
191 | 191 | $item->ID() |
192 | 192 | )) { |
193 | - $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '"' |
|
193 | + $actions['restore_from_trash'] = '<a href="'.$restore_venue_link.'"' |
|
194 | 194 | . ' aria-label="' |
195 | 195 | . sprintf( |
196 | 196 | /* Translators: The name of the venue */ |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'espresso_venues_delete_venue', |
210 | 210 | $item->ID() |
211 | 211 | )) { |
212 | - $actions['delete permanently'] = '<a href="' . $delete_venue_link . '"' |
|
212 | + $actions['delete permanently'] = '<a href="'.$delete_venue_link.'"' |
|
213 | 213 | . ' aria-label="' |
214 | 214 | . sprintf( |
215 | 215 | /* Translators: The name of the venue. */ |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | break; |
224 | 224 | default: |
225 | - $actions['view'] = '<a href="' . $view_link . '"' |
|
225 | + $actions['view'] = '<a href="'.$view_link.'"' |
|
226 | 226 | . ' aria-label="' |
227 | 227 | /* Translators: The name of the venue */ |
228 | 228 | . sprintf(esc_attr__('View Venue (%s)', 'event_espresso'), $item->name()) |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | 'espresso_venues_trash_venue', |
235 | 235 | $item->ID() |
236 | 236 | )) { |
237 | - $actions['move to trash'] = '<a href="' . $trash_venue_link . '"' |
|
237 | + $actions['move to trash'] = '<a href="'.$trash_venue_link.'"' |
|
238 | 238 | . ' aria-label="' |
239 | 239 | . sprintf( |
240 | 240 | /* Translators: The name of the venue */ |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | public function column_shortcode($item) |
272 | 272 | { |
273 | - $content = '[ESPRESSO_VENUE id=' . $item->ID() . ']'; |
|
273 | + $content = '[ESPRESSO_VENUE id='.$item->ID().']'; |
|
274 | 274 | return $content; |
275 | 275 | } |
276 | 276 | } |