@@ -15,72 +15,72 @@ |
||
15 | 15 | class Google_Maps_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = esc_html__('Google Maps Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'google-maps-settings-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = esc_html__('Google Maps Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'google-maps-settings-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | - protected function _set_tour_stops() |
|
25 | - { |
|
26 | - $this->_stops = array( |
|
27 | - 10 => array( |
|
28 | - 'content' => $this->_start(), |
|
29 | - ), |
|
30 | - 20 => array( |
|
31 | - 'id' => 'use_google_maps', |
|
32 | - 'content' => $this->_use_google_maps_stop(), |
|
33 | - 'options' => array( |
|
34 | - 'tipLocation' => 'right', |
|
35 | - 'tipAdjustmentY' => -50, |
|
36 | - 'tipAdjustmentX' => 15, |
|
37 | - ), |
|
38 | - ), |
|
39 | - 30 => array( |
|
40 | - 'id' => 'event_details_map_width', |
|
41 | - 'content' => $this->_reg_page_map_settings_stop(), |
|
42 | - 'options' => array( |
|
43 | - 'tipLocation' => 'right', |
|
44 | - 'tipAdjustmentY' => -75, |
|
45 | - 'tipAdjustmentX' => 20, |
|
46 | - ), |
|
47 | - ), |
|
48 | - 40 => array( |
|
49 | - 'id' => 'event_list_map_width', |
|
50 | - 'content' => $this->_event_list_map_stop(), |
|
51 | - 'options' => array( |
|
52 | - 'tipLocation' => 'right', |
|
53 | - 'tipAdjustmentY' => -80, |
|
54 | - 'tipAdjustmentX' => 20, |
|
55 | - ), |
|
56 | - ), |
|
57 | - ); |
|
58 | - } |
|
24 | + protected function _set_tour_stops() |
|
25 | + { |
|
26 | + $this->_stops = array( |
|
27 | + 10 => array( |
|
28 | + 'content' => $this->_start(), |
|
29 | + ), |
|
30 | + 20 => array( |
|
31 | + 'id' => 'use_google_maps', |
|
32 | + 'content' => $this->_use_google_maps_stop(), |
|
33 | + 'options' => array( |
|
34 | + 'tipLocation' => 'right', |
|
35 | + 'tipAdjustmentY' => -50, |
|
36 | + 'tipAdjustmentX' => 15, |
|
37 | + ), |
|
38 | + ), |
|
39 | + 30 => array( |
|
40 | + 'id' => 'event_details_map_width', |
|
41 | + 'content' => $this->_reg_page_map_settings_stop(), |
|
42 | + 'options' => array( |
|
43 | + 'tipLocation' => 'right', |
|
44 | + 'tipAdjustmentY' => -75, |
|
45 | + 'tipAdjustmentX' => 20, |
|
46 | + ), |
|
47 | + ), |
|
48 | + 40 => array( |
|
49 | + 'id' => 'event_list_map_width', |
|
50 | + 'content' => $this->_event_list_map_stop(), |
|
51 | + 'options' => array( |
|
52 | + 'tipLocation' => 'right', |
|
53 | + 'tipAdjustmentY' => -80, |
|
54 | + 'tipAdjustmentX' => 20, |
|
55 | + ), |
|
56 | + ), |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - protected function _start() |
|
62 | - { |
|
63 | - $content = '<h3>' . esc_html__('Google Maps Settings', 'event_espresso') . '</h3>'; |
|
64 | - $content .= '<p>' |
|
65 | - . esc_html__( |
|
66 | - 'This tour of the Google Maps page will go over different areas of the screen to help you understand what they are used for.', |
|
67 | - 'event_espresso' |
|
68 | - ) . '</p>'; |
|
69 | - return $content; |
|
70 | - } |
|
61 | + protected function _start() |
|
62 | + { |
|
63 | + $content = '<h3>' . esc_html__('Google Maps Settings', 'event_espresso') . '</h3>'; |
|
64 | + $content .= '<p>' |
|
65 | + . esc_html__( |
|
66 | + 'This tour of the Google Maps page will go over different areas of the screen to help you understand what they are used for.', |
|
67 | + 'event_espresso' |
|
68 | + ) . '</p>'; |
|
69 | + return $content; |
|
70 | + } |
|
71 | 71 | |
72 | - protected function _use_google_maps_stop() |
|
73 | - { |
|
74 | - return '<p>' . esc_html__('Turn Google maps on or off site wide for Event Espresso.', 'event_espresso') . '</p>'; |
|
75 | - } |
|
72 | + protected function _use_google_maps_stop() |
|
73 | + { |
|
74 | + return '<p>' . esc_html__('Turn Google maps on or off site wide for Event Espresso.', 'event_espresso') . '</p>'; |
|
75 | + } |
|
76 | 76 | |
77 | - protected function _reg_page_map_settings_stop() |
|
78 | - { |
|
79 | - return '<p>' . esc_html__('These settings affect the single registration page maps only.', 'event_espresso') . '</p>'; |
|
80 | - } |
|
77 | + protected function _reg_page_map_settings_stop() |
|
78 | + { |
|
79 | + return '<p>' . esc_html__('These settings affect the single registration page maps only.', 'event_espresso') . '</p>'; |
|
80 | + } |
|
81 | 81 | |
82 | - protected function _event_list_map_stop() |
|
83 | - { |
|
84 | - return '<p>' . esc_html__('These setting affect the event list page maps.', 'event_espresso') . '</p>'; |
|
85 | - } |
|
82 | + protected function _event_list_map_stop() |
|
83 | + { |
|
84 | + return '<p>' . esc_html__('These setting affect the event list page maps.', 'event_espresso') . '</p>'; |
|
85 | + } |
|
86 | 86 | } |
@@ -60,27 +60,27 @@ |
||
60 | 60 | |
61 | 61 | protected function _start() |
62 | 62 | { |
63 | - $content = '<h3>' . esc_html__('Google Maps Settings', 'event_espresso') . '</h3>'; |
|
63 | + $content = '<h3>'.esc_html__('Google Maps Settings', 'event_espresso').'</h3>'; |
|
64 | 64 | $content .= '<p>' |
65 | 65 | . esc_html__( |
66 | 66 | 'This tour of the Google Maps page will go over different areas of the screen to help you understand what they are used for.', |
67 | 67 | 'event_espresso' |
68 | - ) . '</p>'; |
|
68 | + ).'</p>'; |
|
69 | 69 | return $content; |
70 | 70 | } |
71 | 71 | |
72 | 72 | protected function _use_google_maps_stop() |
73 | 73 | { |
74 | - return '<p>' . esc_html__('Turn Google maps on or off site wide for Event Espresso.', 'event_espresso') . '</p>'; |
|
74 | + return '<p>'.esc_html__('Turn Google maps on or off site wide for Event Espresso.', 'event_espresso').'</p>'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | protected function _reg_page_map_settings_stop() |
78 | 78 | { |
79 | - return '<p>' . esc_html__('These settings affect the single registration page maps only.', 'event_espresso') . '</p>'; |
|
79 | + return '<p>'.esc_html__('These settings affect the single registration page maps only.', 'event_espresso').'</p>'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | protected function _event_list_map_stop() |
83 | 83 | { |
84 | - return '<p>' . esc_html__('These setting affect the event list page maps.', 'event_espresso') . '</p>'; |
|
84 | + return '<p>'.esc_html__('These setting affect the event list page maps.', 'event_espresso').'</p>'; |
|
85 | 85 | } |
86 | 86 | } |
@@ -17,1523 +17,1523 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * _venue |
|
22 | - * This will hold the venue object for venue_details screen. |
|
23 | - * |
|
24 | - * @access protected |
|
25 | - * @var object |
|
26 | - */ |
|
27 | - protected $_venue; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * This will hold the category object for category_details screen. |
|
32 | - * |
|
33 | - * @var object |
|
34 | - */ |
|
35 | - protected $_category; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * This property will hold the venue model instance |
|
40 | - * |
|
41 | - * @var object |
|
42 | - */ |
|
43 | - protected $_venue_model; |
|
44 | - |
|
45 | - |
|
46 | - protected function _init_page_props() |
|
47 | - { |
|
48 | - require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
49 | - $this->page_slug = EE_VENUES_PG_SLUG; |
|
50 | - $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
|
51 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
52 | - $this->page_label = esc_html__('Event Venues', 'event_espresso'); |
|
53 | - $this->_cpt_model_names = array( |
|
54 | - 'create_new' => 'EEM_Venue', |
|
55 | - 'edit' => 'EEM_Venue', |
|
56 | - ); |
|
57 | - $this->_cpt_edit_routes = array( |
|
58 | - 'espresso_venues' => 'edit', |
|
59 | - ); |
|
60 | - $this->_venue_model = EEM_Venue::instance(); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - protected function _ajax_hooks() |
|
65 | - { |
|
66 | - // todo: all hooks for ee_venues ajax goes in here. |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - protected function _define_page_props() |
|
71 | - { |
|
72 | - $this->_admin_page_title = $this->page_label; |
|
73 | - $this->_labels = array( |
|
74 | - 'buttons' => array( |
|
75 | - 'add' => esc_html__('Add New Venue', 'event_espresso'), |
|
76 | - 'edit' => esc_html__('Edit Venue', 'event_espresso'), |
|
77 | - 'delete' => esc_html__('Delete Venue', 'event_espresso'), |
|
78 | - 'add_category' => esc_html__('Add New Category', 'event_espresso'), |
|
79 | - 'edit_category' => esc_html__('Edit Category', 'event_espresso'), |
|
80 | - 'delete_category' => esc_html__('Delete Category', 'event_espresso'), |
|
81 | - ), |
|
82 | - 'editor_title' => array( |
|
83 | - 'espresso_venues' => esc_html__('Enter Venue name here', 'event_espresso'), |
|
84 | - ), |
|
85 | - 'publishbox' => array( |
|
86 | - 'create_new' => esc_html__('Save New Venue', 'event_espresso'), |
|
87 | - 'edit' => esc_html__('Update Venue', 'event_espresso'), |
|
88 | - 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
|
89 | - 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
|
90 | - 'google_map_settings' => esc_html__('Update Settings', 'event_espresso'), |
|
91 | - ), |
|
92 | - ); |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - protected function _set_page_routes() |
|
97 | - { |
|
98 | - |
|
99 | - // load formatter helper |
|
100 | - // load field generator helper |
|
101 | - |
|
102 | - // is there a vnu_id in the request? |
|
103 | - $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) |
|
104 | - ? $this->_req_data['VNU_ID'] : 0; |
|
105 | - $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
106 | - |
|
107 | - $this->_page_routes = array( |
|
108 | - 'default' => array( |
|
109 | - 'func' => '_overview_list_table', |
|
110 | - 'capability' => 'ee_read_venues', |
|
111 | - ), |
|
112 | - 'create_new' => array( |
|
113 | - 'func' => '_create_new_cpt_item', |
|
114 | - 'capability' => 'ee_edit_venues', |
|
115 | - ), |
|
116 | - 'edit' => array( |
|
117 | - 'func' => '_edit_cpt_item', |
|
118 | - 'capability' => 'ee_edit_venue', |
|
119 | - 'obj_id' => $vnu_id, |
|
120 | - ), |
|
121 | - 'trash_venue' => array( |
|
122 | - 'func' => '_trash_or_restore_venue', |
|
123 | - 'args' => array('venue_status' => 'trash'), |
|
124 | - 'noheader' => true, |
|
125 | - 'capability' => 'ee_delete_venue', |
|
126 | - 'obj_id' => $vnu_id, |
|
127 | - ), |
|
128 | - 'trash_venues' => array( |
|
129 | - 'func' => '_trash_or_restore_venues', |
|
130 | - 'args' => array('venue_status' => 'trash'), |
|
131 | - 'noheader' => true, |
|
132 | - 'capability' => 'ee_delete_venues', |
|
133 | - ), |
|
134 | - 'restore_venue' => array( |
|
135 | - 'func' => '_trash_or_restore_venue', |
|
136 | - 'args' => array('venue_status' => 'draft'), |
|
137 | - 'noheader' => true, |
|
138 | - 'capability' => 'ee_delete_venue', |
|
139 | - 'obj_id' => $vnu_id, |
|
140 | - ), |
|
141 | - 'restore_venues' => array( |
|
142 | - 'func' => '_trash_or_restore_venues', |
|
143 | - 'args' => array('venue_status' => 'draft'), |
|
144 | - 'noheader' => true, |
|
145 | - 'capability' => 'ee_delete_venues', |
|
146 | - ), |
|
147 | - 'delete_venues' => array( |
|
148 | - 'func' => '_delete_venues', |
|
149 | - 'noheader' => true, |
|
150 | - 'capability' => 'ee_delete_venues', |
|
151 | - ), |
|
152 | - 'delete_venue' => array( |
|
153 | - 'func' => '_delete_venue', |
|
154 | - 'noheader' => true, |
|
155 | - 'capability' => 'ee_delete_venue', |
|
156 | - 'obj_id' => $vnu_id, |
|
157 | - ), |
|
158 | - // settings related |
|
159 | - 'google_map_settings' => array( |
|
160 | - 'func' => '_google_map_settings', |
|
161 | - 'capability' => 'manage_options', |
|
162 | - ), |
|
163 | - 'update_google_map_settings' => array( |
|
164 | - 'func' => '_update_google_map_settings', |
|
165 | - 'capability' => 'manage_options', |
|
166 | - 'noheader' => true, |
|
167 | - ), |
|
168 | - // venue category tab related |
|
169 | - 'add_category' => array( |
|
170 | - 'func' => '_category_details', |
|
171 | - 'args' => array('add'), |
|
172 | - 'capability' => 'ee_edit_venue_category', |
|
173 | - ), |
|
174 | - 'edit_category' => array( |
|
175 | - 'func' => '_category_details', |
|
176 | - 'args' => array('edit'), |
|
177 | - 'capability' => 'ee_edit_venue_category', |
|
178 | - ), |
|
179 | - 'delete_categories' => array( |
|
180 | - 'func' => '_delete_categories', |
|
181 | - 'noheader' => true, |
|
182 | - 'capability' => 'ee_delete_venue_category', |
|
183 | - ), |
|
184 | - |
|
185 | - 'delete_category' => array( |
|
186 | - 'func' => '_delete_categories', |
|
187 | - 'noheader' => true, |
|
188 | - 'capability' => 'ee_delete_venue_category', |
|
189 | - ), |
|
190 | - |
|
191 | - 'insert_category' => array( |
|
192 | - 'func' => '_insert_or_update_category', |
|
193 | - 'args' => array('new_category' => true), |
|
194 | - 'noheader' => true, |
|
195 | - 'capability' => 'ee_edit_venue_category', |
|
196 | - ), |
|
197 | - |
|
198 | - 'update_category' => array( |
|
199 | - 'func' => '_insert_or_update_category', |
|
200 | - 'args' => array('new_category' => false), |
|
201 | - 'noheader' => true, |
|
202 | - 'capability' => 'ee_edit_venue_category', |
|
203 | - ), |
|
204 | - 'export_categories' => array( |
|
205 | - 'func' => '_categories_export', |
|
206 | - 'noheader' => true, |
|
207 | - 'capability' => 'export', |
|
208 | - ), |
|
209 | - 'import_categories' => array( |
|
210 | - 'func' => '_import_categories', |
|
211 | - 'capability' => 'import', |
|
212 | - ), |
|
213 | - 'category_list' => array( |
|
214 | - 'func' => '_category_list_table', |
|
215 | - 'capability' => 'ee_manage_venue_categories', |
|
216 | - ), |
|
217 | - ); |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - protected function _set_page_config() |
|
222 | - { |
|
223 | - $this->_page_config = array( |
|
224 | - 'default' => array( |
|
225 | - 'nav' => array( |
|
226 | - 'label' => esc_html__('Overview', 'event_espresso'), |
|
227 | - 'order' => 10, |
|
228 | - ), |
|
229 | - 'list_table' => 'Venues_Admin_List_Table', |
|
230 | - 'help_tabs' => array( |
|
231 | - 'venues_overview_help_tab' => array( |
|
232 | - 'title' => esc_html__('Venues Overview', 'event_espresso'), |
|
233 | - 'filename' => 'venues_overview', |
|
234 | - ), |
|
235 | - 'venues_overview_table_column_headings_help_tab' => array( |
|
236 | - 'title' => esc_html__('Venues Overview Table Column Headings', 'event_espresso'), |
|
237 | - 'filename' => 'venues_overview_table_column_headings', |
|
238 | - ), |
|
239 | - 'venues_overview_views_bulk_actions_search_help_tab' => array( |
|
240 | - 'title' => esc_html__('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
241 | - 'filename' => 'venues_overview_views_bulk_actions_search', |
|
242 | - ), |
|
243 | - ), |
|
244 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
245 | - // 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
246 | - 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
247 | - 'require_nonce' => false, |
|
248 | - ), |
|
249 | - 'create_new' => array( |
|
250 | - 'nav' => array( |
|
251 | - 'label' => esc_html__('Add Venue', 'event_espresso'), |
|
252 | - 'order' => 5, |
|
253 | - 'persistent' => false, |
|
254 | - ), |
|
255 | - 'help_tabs' => array( |
|
256 | - 'venues_editor_help_tab' => array( |
|
257 | - 'title' => esc_html__('Venue Editor', 'event_espresso'), |
|
258 | - 'filename' => 'venues_editor', |
|
259 | - ), |
|
260 | - 'venues_editor_title_richtexteditor_help_tab' => array( |
|
261 | - 'title' => esc_html__('Venue Title & Rich Text Editor', 'event_espresso'), |
|
262 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
263 | - ), |
|
264 | - 'venues_editor_tags_categories_help_tab' => array( |
|
265 | - 'title' => esc_html__('Venue Tags & Categories', 'event_espresso'), |
|
266 | - 'filename' => 'venues_editor_tags_categories', |
|
267 | - ), |
|
268 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
269 | - 'title' => esc_html__( |
|
270 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
271 | - 'event_espresso' |
|
272 | - ), |
|
273 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
274 | - ), |
|
275 | - 'venues_editor_save_new_venue_help_tab' => array( |
|
276 | - 'title' => esc_html__('Save New Venue', 'event_espresso'), |
|
277 | - 'filename' => 'venues_editor_save_new_venue', |
|
278 | - ), |
|
279 | - 'venues_editor_other_help_tab' => array( |
|
280 | - 'title' => esc_html__('Venue Editor Other', 'event_espresso'), |
|
281 | - 'filename' => 'venues_editor_other', |
|
282 | - ), |
|
283 | - ), |
|
284 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
285 | - // 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
286 | - 'metaboxes' => array('_venue_editor_metaboxes'), |
|
287 | - 'require_nonce' => false, |
|
288 | - ), |
|
289 | - 'edit' => array( |
|
290 | - 'nav' => array( |
|
291 | - 'label' => esc_html__('Edit Venue', 'event_espresso'), |
|
292 | - 'order' => 5, |
|
293 | - 'persistent' => false, |
|
294 | - 'url' => isset($this->_req_data['post']) ? add_query_arg( |
|
295 | - array('post' => $this->_req_data['post']), |
|
296 | - $this->_current_page_view_url |
|
297 | - ) : $this->_admin_base_url, |
|
298 | - ), |
|
299 | - 'help_tabs' => array( |
|
300 | - 'venues_editor_help_tab' => array( |
|
301 | - 'title' => esc_html__('Venue Editor', 'event_espresso'), |
|
302 | - 'filename' => 'venues_editor', |
|
303 | - ), |
|
304 | - 'venues_editor_title_richtexteditor_help_tab' => array( |
|
305 | - 'title' => esc_html__('Venue Title & Rich Text Editor', 'event_espresso'), |
|
306 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
307 | - ), |
|
308 | - 'venues_editor_tags_categories_help_tab' => array( |
|
309 | - 'title' => esc_html__('Venue Tags & Categories', 'event_espresso'), |
|
310 | - 'filename' => 'venues_editor_tags_categories', |
|
311 | - ), |
|
312 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
313 | - 'title' => esc_html__( |
|
314 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
315 | - 'event_espresso' |
|
316 | - ), |
|
317 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
318 | - ), |
|
319 | - 'venues_editor_save_new_venue_help_tab' => array( |
|
320 | - 'title' => esc_html__('Save New Venue', 'event_espresso'), |
|
321 | - 'filename' => 'venues_editor_save_new_venue', |
|
322 | - ), |
|
323 | - 'venues_editor_other_help_tab' => array( |
|
324 | - 'title' => esc_html__('Venue Editor Other', 'event_espresso'), |
|
325 | - 'filename' => 'venues_editor_other', |
|
326 | - ), |
|
327 | - ), |
|
328 | - /*'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),*/ |
|
329 | - 'metaboxes' => array('_venue_editor_metaboxes'), |
|
330 | - 'require_nonce' => false, |
|
331 | - ), |
|
332 | - 'google_map_settings' => array( |
|
333 | - 'nav' => array( |
|
334 | - 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
335 | - 'order' => 40, |
|
336 | - ), |
|
337 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
338 | - 'help_tabs' => array( |
|
339 | - 'general_settings_google_maps_help_tab' => array( |
|
340 | - 'title' => esc_html__('Google Maps', 'event_espresso'), |
|
341 | - 'filename' => 'general_settings_google_maps', |
|
342 | - ), |
|
343 | - ), |
|
344 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
345 | - // 'help_tour' => array('Google_Maps_Help_Tour'), |
|
346 | - 'require_nonce' => false, |
|
347 | - ), |
|
348 | - // venue category stuff |
|
349 | - 'add_category' => array( |
|
350 | - 'nav' => array( |
|
351 | - 'label' => esc_html__('Add Category', 'event_espresso'), |
|
352 | - 'order' => 15, |
|
353 | - 'persistent' => false, |
|
354 | - ), |
|
355 | - 'metaboxes' => array('_publish_post_box'), |
|
356 | - 'help_tabs' => array( |
|
357 | - 'venues_add_category_help_tab' => array( |
|
358 | - 'title' => esc_html__('Add New Venue Category', 'event_espresso'), |
|
359 | - 'filename' => 'venues_add_category', |
|
360 | - ), |
|
361 | - ), |
|
362 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
363 | - // 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
364 | - 'require_nonce' => false, |
|
365 | - ), |
|
366 | - 'edit_category' => array( |
|
367 | - 'nav' => array( |
|
368 | - 'label' => esc_html__('Edit Category', 'event_espresso'), |
|
369 | - 'order' => 15, |
|
370 | - 'persistent' => false, |
|
371 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg( |
|
372 | - array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
373 | - $this->_current_page_view_url |
|
374 | - ) : $this->_admin_base_url, |
|
375 | - ), |
|
376 | - 'metaboxes' => array('_publish_post_box'), |
|
377 | - 'help_tabs' => array( |
|
378 | - 'venues_edit_category_help_tab' => array( |
|
379 | - 'title' => esc_html__('Edit Venue Category', 'event_espresso'), |
|
380 | - 'filename' => 'venues_edit_category', |
|
381 | - ), |
|
382 | - ), |
|
383 | - /*'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),*/ |
|
384 | - 'require_nonce' => false, |
|
385 | - ), |
|
386 | - 'category_list' => array( |
|
387 | - 'nav' => array( |
|
388 | - 'label' => esc_html__('Categories', 'event_espresso'), |
|
389 | - 'order' => 20, |
|
390 | - ), |
|
391 | - 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
392 | - 'help_tabs' => array( |
|
393 | - 'venues_categories_help_tab' => array( |
|
394 | - 'title' => esc_html__('Venue Categories', 'event_espresso'), |
|
395 | - 'filename' => 'venues_categories', |
|
396 | - ), |
|
397 | - 'venues_categories_table_column_headings_help_tab' => array( |
|
398 | - 'title' => esc_html__('Venue Categories Table Column Headings', 'event_espresso'), |
|
399 | - 'filename' => 'venues_categories_table_column_headings', |
|
400 | - ), |
|
401 | - 'venues_categories_views_help_tab' => array( |
|
402 | - 'title' => esc_html__('Venue Categories Views', 'event_espresso'), |
|
403 | - 'filename' => 'venues_categories_views', |
|
404 | - ), |
|
405 | - 'venues_categories_other_help_tab' => array( |
|
406 | - 'title' => esc_html__('Venue Categories Other', 'event_espresso'), |
|
407 | - 'filename' => 'venues_categories_other', |
|
408 | - ), |
|
409 | - ), |
|
410 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
411 | - // 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
412 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
413 | - 'require_nonce' => false, |
|
414 | - ), |
|
415 | - ); |
|
416 | - } |
|
417 | - |
|
418 | - |
|
419 | - protected function _add_screen_options() |
|
420 | - { |
|
421 | - // todo |
|
422 | - } |
|
423 | - |
|
424 | - |
|
425 | - protected function _add_screen_options_default() |
|
426 | - { |
|
427 | - $this->_per_page_screen_option(); |
|
428 | - } |
|
429 | - |
|
430 | - |
|
431 | - protected function _add_screen_options_category_list() |
|
432 | - { |
|
433 | - $page_title = $this->_admin_page_title; |
|
434 | - $this->_admin_page_title = esc_html__('Venue Categories', 'event_espresso'); |
|
435 | - $this->_per_page_screen_option(); |
|
436 | - $this->_admin_page_title = $page_title; |
|
437 | - } |
|
438 | - |
|
439 | - |
|
440 | - // none of the below group are currently used for Event Venues |
|
441 | - protected function _add_feature_pointers() |
|
442 | - { |
|
443 | - } |
|
444 | - |
|
445 | - public function admin_init() |
|
446 | - { |
|
447 | - } |
|
448 | - |
|
449 | - public function admin_notices() |
|
450 | - { |
|
451 | - } |
|
452 | - |
|
453 | - public function admin_footer_scripts() |
|
454 | - { |
|
455 | - } |
|
456 | - |
|
457 | - |
|
458 | - public function load_scripts_styles_create_new() |
|
459 | - { |
|
460 | - $this->load_scripts_styles_edit(); |
|
461 | - } |
|
462 | - |
|
463 | - |
|
464 | - public function load_scripts_styles() |
|
465 | - { |
|
466 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
467 | - wp_enqueue_style('ee-cat-admin'); |
|
468 | - } |
|
469 | - |
|
470 | - |
|
471 | - public function load_scripts_styles_add_category() |
|
472 | - { |
|
473 | - $this->load_scripts_styles_edit_category(); |
|
474 | - } |
|
475 | - |
|
476 | - |
|
477 | - public function load_scripts_styles_edit_category() |
|
478 | - { |
|
479 | - } |
|
480 | - |
|
481 | - |
|
482 | - public function load_scripts_styles_edit() |
|
483 | - { |
|
484 | - // styles |
|
485 | - wp_enqueue_style('espresso-ui-theme'); |
|
486 | - wp_register_style( |
|
487 | - 'espresso_venues', |
|
488 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
489 | - array(), |
|
490 | - EVENT_ESPRESSO_VERSION |
|
491 | - ); |
|
492 | - wp_enqueue_style('espresso_venues'); |
|
493 | - } |
|
494 | - |
|
495 | - |
|
496 | - protected function _set_list_table_views_default() |
|
497 | - { |
|
498 | - $this->_views = array( |
|
499 | - 'all' => array( |
|
500 | - 'slug' => 'all', |
|
501 | - 'label' => esc_html__('View All Venues', 'event_espresso'), |
|
502 | - 'count' => 0, |
|
503 | - 'bulk_action' => array(), |
|
504 | - ), |
|
505 | - ); |
|
506 | - |
|
507 | - if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
508 | - $this->_views['all']['bulk_action'] = array( |
|
509 | - 'trash_venues' => esc_html__('Move to Trash', 'event_espresso'), |
|
510 | - ); |
|
511 | - $this->_views['trash'] = array( |
|
512 | - 'slug' => 'trash', |
|
513 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
514 | - 'count' => 0, |
|
515 | - 'bulk_action' => array( |
|
516 | - 'restore_venues' => esc_html__('Restore from Trash', 'event_espresso'), |
|
517 | - 'delete_venues' => esc_html__('Delete', 'event_espresso'), |
|
518 | - ), |
|
519 | - ); |
|
520 | - } |
|
521 | - } |
|
522 | - |
|
523 | - |
|
524 | - protected function _set_list_table_views_category_list() |
|
525 | - { |
|
526 | - $this->_views = array( |
|
527 | - 'all' => array( |
|
528 | - 'slug' => 'all', |
|
529 | - 'label' => esc_html__('All', 'event_espresso'), |
|
530 | - 'count' => 0, |
|
531 | - 'bulk_action' => array( |
|
532 | - 'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'), |
|
533 | - ), |
|
534 | - ), |
|
535 | - ); |
|
536 | - } |
|
537 | - |
|
538 | - |
|
539 | - protected function _overview_list_table() |
|
540 | - { |
|
541 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
542 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
543 | - get_post_type_archive_link('espresso_venues'), |
|
544 | - esc_html__("View Venue Archive Page", "event_espresso"), |
|
545 | - 'button' |
|
546 | - ); |
|
547 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
548 | - $this->_search_btn_label = esc_html__('Venues', 'event_espresso'); |
|
549 | - $this->display_admin_list_table_page_with_sidebar(); |
|
550 | - } |
|
551 | - |
|
552 | - |
|
553 | - public function extra_misc_actions_publish_box() |
|
554 | - { |
|
555 | - $extra_rows = array( |
|
556 | - 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
557 | - 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
558 | - 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
559 | - ); |
|
560 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
561 | - EEH_Template::display_template($template, $extra_rows); |
|
562 | - } |
|
563 | - |
|
564 | - |
|
565 | - /************* Google Maps *************/ |
|
566 | - |
|
567 | - |
|
568 | - protected function _google_map_settings() |
|
569 | - { |
|
570 | - |
|
571 | - |
|
572 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
573 | - $default_map_settings = new stdClass(); |
|
574 | - $default_map_settings->use_google_maps = true; |
|
575 | - $default_map_settings->google_map_api_key = ''; |
|
576 | - // for event details pages (reg page) |
|
577 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
578 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
579 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
580 | - $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
581 | - $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
582 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
583 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
584 | - // for event list pages |
|
585 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
586 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
587 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
588 | - $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
589 | - $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
590 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
591 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
592 | - |
|
593 | - $this->_template_args['map_settings'] = |
|
594 | - isset(EE_Registry::instance()->CFG->map_settings) |
|
595 | - && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
596 | - ? (object) array_merge( |
|
597 | - (array) $default_map_settings, |
|
598 | - (array) EE_Registry::instance()->CFG->map_settings |
|
599 | - ) |
|
600 | - : $default_map_settings; |
|
601 | - |
|
602 | - $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
603 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
604 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
605 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
606 | - $this->_template_args, |
|
607 | - true |
|
608 | - ); |
|
609 | - $this->display_admin_page_with_sidebar(); |
|
610 | - } |
|
611 | - |
|
612 | - protected function _update_google_map_settings() |
|
613 | - { |
|
614 | - |
|
615 | - EE_Registry::instance()->CFG->map_settings->use_google_maps = |
|
616 | - isset($this->_req_data['use_google_maps']) |
|
617 | - ? absint($this->_req_data['use_google_maps']) |
|
618 | - : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
|
619 | - |
|
620 | - EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
|
621 | - isset($this->_req_data['google_map_api_key']) |
|
622 | - ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
623 | - : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
|
624 | - |
|
625 | - EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
|
626 | - isset($this->_req_data['event_details_map_width']) |
|
627 | - ? absint($this->_req_data['event_details_map_width']) |
|
628 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
|
629 | - |
|
630 | - EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
|
631 | - isset($this->_req_data['event_details_map_height']) |
|
632 | - ? absint($this->_req_data['event_details_map_height']) |
|
633 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
|
634 | - |
|
635 | - EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
|
636 | - isset($this->_req_data['event_details_map_zoom']) |
|
637 | - ? absint($this->_req_data['event_details_map_zoom']) |
|
638 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
|
639 | - |
|
640 | - EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
|
641 | - isset($this->_req_data['event_details_display_nav']) |
|
642 | - ? absint($this->_req_data['event_details_display_nav']) |
|
643 | - : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
|
644 | - |
|
645 | - EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
|
646 | - isset($this->_req_data['event_details_nav_size']) |
|
647 | - ? absint($this->_req_data['event_details_nav_size']) |
|
648 | - : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
|
649 | - |
|
650 | - EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
|
651 | - isset($this->_req_data['event_details_control_type']) |
|
652 | - ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
653 | - : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
|
654 | - |
|
655 | - EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
|
656 | - isset($this->_req_data['event_details_map_align']) |
|
657 | - ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
658 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
|
659 | - |
|
660 | - EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
|
661 | - isset($this->_req_data['event_list_map_width']) |
|
662 | - ? absint($this->_req_data['event_list_map_width']) |
|
663 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
|
664 | - |
|
665 | - EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
|
666 | - isset($this->_req_data['event_list_map_height']) |
|
667 | - ? absint($this->_req_data['event_list_map_height']) |
|
668 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
|
669 | - |
|
670 | - EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
|
671 | - isset($this->_req_data['event_list_map_zoom']) |
|
672 | - ? absint($this->_req_data['event_list_map_zoom']) |
|
673 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
|
674 | - |
|
675 | - EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
|
676 | - isset($this->_req_data['event_list_display_nav']) |
|
677 | - ? absint($this->_req_data['event_list_display_nav']) |
|
678 | - : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
|
679 | - |
|
680 | - EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
|
681 | - isset($this->_req_data['event_list_nav_size']) |
|
682 | - ? absint($this->_req_data['event_list_nav_size']) |
|
683 | - : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
|
684 | - |
|
685 | - EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
|
686 | - isset($this->_req_data['event_list_control_type']) |
|
687 | - ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
688 | - : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
|
689 | - |
|
690 | - EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
|
691 | - isset($this->_req_data['event_list_map_align']) |
|
692 | - ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
693 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
|
694 | - |
|
695 | - EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
696 | - 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
697 | - EE_Registry::instance()->CFG->map_settings |
|
698 | - ); |
|
699 | - |
|
700 | - $what = 'Google Map Settings'; |
|
701 | - $success = $this->_update_espresso_configuration( |
|
702 | - $what, |
|
703 | - EE_Registry::instance()->CFG->map_settings, |
|
704 | - __FILE__, |
|
705 | - __FUNCTION__, |
|
706 | - __LINE__ |
|
707 | - ); |
|
708 | - $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
709 | - } |
|
710 | - |
|
711 | - |
|
712 | - protected function _venue_editor_metaboxes() |
|
713 | - { |
|
714 | - $this->verify_cpt_object(); |
|
715 | - |
|
716 | - add_meta_box( |
|
717 | - 'espresso_venue_address_options', |
|
718 | - esc_html__('Physical Location', 'event_espresso'), |
|
719 | - array($this, 'venue_address_metabox'), |
|
720 | - $this->page_slug, |
|
721 | - 'side', |
|
722 | - 'default' |
|
723 | - ); |
|
724 | - add_meta_box( |
|
725 | - 'espresso_venue_gmap_options', |
|
726 | - esc_html__('Google Map', 'event_espresso'), |
|
727 | - array($this, 'venue_gmap_metabox'), |
|
728 | - $this->page_slug, |
|
729 | - 'side', |
|
730 | - 'default' |
|
731 | - ); |
|
732 | - add_meta_box( |
|
733 | - 'espresso_venue_virtual_loc_options', |
|
734 | - esc_html__('Virtual Location', 'event_espresso'), |
|
735 | - array($this, 'venue_virtual_loc_metabox'), |
|
736 | - $this->page_slug, |
|
737 | - 'side', |
|
738 | - 'default' |
|
739 | - ); |
|
740 | - } |
|
741 | - |
|
742 | - |
|
743 | - public function venue_gmap_metabox() |
|
744 | - { |
|
745 | - $template_args = array( |
|
746 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
747 | - 'vnu_enable_for_gmap', |
|
748 | - $this->get_yes_no_values(), |
|
749 | - $this->_cpt_model_obj->enable_for_gmap() |
|
750 | - ), |
|
751 | - 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
752 | - ); |
|
753 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
754 | - EEH_Template::display_template($template, $template_args); |
|
755 | - } |
|
756 | - |
|
757 | - |
|
758 | - public function venue_address_metabox() |
|
759 | - { |
|
760 | - |
|
761 | - $template_args['_venue'] = $this->_cpt_model_obj; |
|
762 | - |
|
763 | - $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
764 | - $QFI = new EE_Question_Form_Input( |
|
765 | - EE_Question::new_instance( |
|
766 | - array('QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state') |
|
767 | - ), |
|
768 | - EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), |
|
769 | - array( |
|
770 | - 'input_name' => 'sta_id', |
|
771 | - 'input_id' => 'sta_id', |
|
772 | - 'input_class' => '', |
|
773 | - 'input_prefix' => '', |
|
774 | - 'append_qstn_id' => false, |
|
775 | - ) |
|
776 | - ) |
|
777 | - ); |
|
778 | - $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
779 | - $QFI = new EE_Question_Form_Input( |
|
780 | - EE_Question::new_instance( |
|
781 | - array('QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country') |
|
782 | - ), |
|
783 | - EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), |
|
784 | - array( |
|
785 | - 'input_name' => 'cnt_iso', |
|
786 | - 'input_id' => 'cnt_iso', |
|
787 | - 'input_class' => '', |
|
788 | - 'input_prefix' => '', |
|
789 | - 'append_qstn_id' => false, |
|
790 | - ) |
|
791 | - ) |
|
792 | - ); |
|
793 | - |
|
794 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
795 | - EEH_Template::display_template($template, $template_args); |
|
796 | - } |
|
797 | - |
|
798 | - |
|
799 | - public function venue_virtual_loc_metabox() |
|
800 | - { |
|
801 | - $template_args = array( |
|
802 | - '_venue' => $this->_cpt_model_obj, |
|
803 | - ); |
|
804 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
805 | - EEH_Template::display_template($template, $template_args); |
|
806 | - } |
|
807 | - |
|
808 | - |
|
809 | - protected function _restore_cpt_item($post_id, $revision_id) |
|
810 | - { |
|
811 | - $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
812 | - |
|
813 | - // meta revision restore |
|
814 | - $venue_obj->restore_revision($revision_id); |
|
815 | - } |
|
816 | - |
|
817 | - |
|
818 | - /** |
|
819 | - * Handles updates for venue cpts |
|
820 | - * |
|
821 | - * @param int $post_id ID of Venue CPT |
|
822 | - * @param object $post Post object (with "blessed" WP properties) |
|
823 | - * @return void |
|
824 | - */ |
|
825 | - protected function _insert_update_cpt_item($post_id, $post) |
|
826 | - { |
|
827 | - |
|
828 | - if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
829 | - return;// get out we're not processing the saving of venues. |
|
830 | - } |
|
831 | - |
|
832 | - $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
833 | - |
|
834 | - $venue_values = array( |
|
835 | - 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : null, |
|
836 | - 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] |
|
837 | - : null, |
|
838 | - 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : null, |
|
839 | - 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : null, |
|
840 | - 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : null, |
|
841 | - 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : null, |
|
842 | - 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : null, |
|
843 | - 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace( |
|
844 | - ',', |
|
845 | - '', |
|
846 | - $this->_req_data['vnu_capacity'] |
|
847 | - ) : EE_INF, |
|
848 | - 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : null, |
|
849 | - 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) |
|
850 | - ? $this->_req_data['vnu_virtual_phone'] : null, |
|
851 | - 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] |
|
852 | - : null, |
|
853 | - 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? true : false, |
|
854 | - 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) |
|
855 | - ? $this->_req_data['vnu_google_map_link'] : null, |
|
856 | - ); |
|
857 | - |
|
858 | - // update venue |
|
859 | - $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
860 | - |
|
861 | - // get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
|
862 | - $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
863 | - $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
864 | - |
|
865 | - // notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
|
866 | - $venue_update_callbacks = apply_filters( |
|
867 | - 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
868 | - array() |
|
869 | - ); |
|
870 | - |
|
871 | - $att_success = true; |
|
872 | - |
|
873 | - foreach ($venue_update_callbacks as $v_callback) { |
|
874 | - $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
875 | - $att_success = ! $att_success ? $att_success |
|
876 | - : $_succ; // if ANY of these updates fail then we want the appropriate global error message |
|
877 | - } |
|
878 | - |
|
879 | - // any errors? |
|
880 | - if ($success && ! $att_success) { |
|
881 | - EE_Error::add_error( |
|
882 | - esc_html__( |
|
883 | - 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
884 | - 'event_espresso' |
|
885 | - ), |
|
886 | - __FILE__, |
|
887 | - __FUNCTION__, |
|
888 | - __LINE__ |
|
889 | - ); |
|
890 | - } elseif ($success === false) { |
|
891 | - EE_Error::add_error( |
|
892 | - esc_html__('Venue Details did not save successfully.', 'event_espresso'), |
|
893 | - __FILE__, |
|
894 | - __FUNCTION__, |
|
895 | - __LINE__ |
|
896 | - ); |
|
897 | - } |
|
898 | - } |
|
899 | - |
|
900 | - |
|
901 | - public function trash_cpt_item($post_id) |
|
902 | - { |
|
903 | - $this->_req_data['VNU_ID'] = $post_id; |
|
904 | - $this->_trash_or_restore_venue('trash', false); |
|
905 | - } |
|
906 | - |
|
907 | - |
|
908 | - public function restore_cpt_item($post_id) |
|
909 | - { |
|
910 | - $this->_req_data['VNU_ID'] = $post_id; |
|
911 | - $this->_trash_or_restore_venue('draft', false); |
|
912 | - } |
|
913 | - |
|
914 | - |
|
915 | - public function delete_cpt_item($post_id) |
|
916 | - { |
|
917 | - $this->_req_data['VNU_ID'] = $post_id; |
|
918 | - $this->_delete_venue(false); |
|
919 | - } |
|
920 | - |
|
921 | - |
|
922 | - public function get_venue_object() |
|
923 | - { |
|
924 | - return $this->_cpt_model_obj; |
|
925 | - } |
|
926 | - |
|
927 | - |
|
928 | - protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
929 | - { |
|
930 | - $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : false; |
|
931 | - |
|
932 | - // loop thru venues |
|
933 | - if ($VNU_ID) { |
|
934 | - // clean status |
|
935 | - $venue_status = sanitize_key($venue_status); |
|
936 | - // grab status |
|
937 | - if (! empty($venue_status)) { |
|
938 | - $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
939 | - } else { |
|
940 | - $success = false; |
|
941 | - $msg = esc_html__( |
|
942 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
943 | - 'event_espresso' |
|
944 | - ); |
|
945 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
946 | - } |
|
947 | - } else { |
|
948 | - $success = false; |
|
949 | - $msg = esc_html__( |
|
950 | - 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
951 | - 'event_espresso' |
|
952 | - ); |
|
953 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
954 | - } |
|
955 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
956 | - |
|
957 | - if ($redirect_after) { |
|
958 | - $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
959 | - } |
|
960 | - } |
|
961 | - |
|
962 | - |
|
963 | - protected function _trash_or_restore_venues($venue_status = 'trash') |
|
964 | - { |
|
965 | - // clean status |
|
966 | - $venue_status = sanitize_key($venue_status); |
|
967 | - // grab status |
|
968 | - if (! empty($venue_status)) { |
|
969 | - $success = true; |
|
970 | - // determine the event id and set to array. |
|
971 | - $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
972 | - // loop thru events |
|
973 | - foreach ($VNU_IDs as $VNU_ID) { |
|
974 | - if ($VNU_ID = absint($VNU_ID)) { |
|
975 | - $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
976 | - $success = $results !== false ? $success : false; |
|
977 | - } else { |
|
978 | - $msg = sprintf( |
|
979 | - esc_html__( |
|
980 | - 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
981 | - 'event_espresso' |
|
982 | - ), |
|
983 | - $VNU_ID |
|
984 | - ); |
|
985 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
986 | - $success = false; |
|
987 | - } |
|
988 | - } |
|
989 | - } else { |
|
990 | - $success = false; |
|
991 | - $msg = esc_html__( |
|
992 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
993 | - 'event_espresso' |
|
994 | - ); |
|
995 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
996 | - } |
|
997 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
998 | - $success = $success ? 2 : false; |
|
999 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
1000 | - $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
1001 | - } |
|
1002 | - |
|
1003 | - |
|
1004 | - /** |
|
1005 | - * _trash_or_restore_venues |
|
1006 | - * |
|
1007 | - * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1008 | - * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1009 | - * accepting a certain number of params. |
|
1010 | - * |
|
1011 | - * @access private |
|
1012 | - * @param int $VNU_ID |
|
1013 | - * @param string $venue_status |
|
1014 | - * @return void |
|
1015 | - */ |
|
1016 | - private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1017 | - { |
|
1018 | - // grab venue id |
|
1019 | - if (! $VNU_ID) { |
|
1020 | - $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1021 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1022 | - return false; |
|
1023 | - } |
|
1024 | - |
|
1025 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1026 | - |
|
1027 | - // clean status |
|
1028 | - $venue_status = sanitize_key($venue_status); |
|
1029 | - // grab status |
|
1030 | - if (! $venue_status) { |
|
1031 | - $msg = esc_html__('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
|
1032 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1033 | - return false; |
|
1034 | - } |
|
1035 | - |
|
1036 | - // was event trashed or restored ? |
|
1037 | - switch ($venue_status) { |
|
1038 | - case 'draft': |
|
1039 | - $action = 'restored from the trash'; |
|
1040 | - $hook = 'AHEE_venue_restored_from_trash'; |
|
1041 | - break; |
|
1042 | - case 'trash': |
|
1043 | - $action = 'moved to the trash'; |
|
1044 | - $hook = 'AHEE_venue_moved_to_trash'; |
|
1045 | - break; |
|
1046 | - default: |
|
1047 | - $action = 'updated'; |
|
1048 | - $hook = false; |
|
1049 | - } |
|
1050 | - // use class to change status |
|
1051 | - $this->_cpt_model_obj->set_status($venue_status); |
|
1052 | - $success = $this->_cpt_model_obj->save(); |
|
1053 | - |
|
1054 | - if ($success === false) { |
|
1055 | - $msg = sprintf(esc_html__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1056 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1057 | - return false; |
|
1058 | - } |
|
1059 | - if ($hook) { |
|
1060 | - do_action($hook); |
|
1061 | - } |
|
1062 | - return true; |
|
1063 | - } |
|
1064 | - |
|
1065 | - |
|
1066 | - /** |
|
1067 | - * @param bool $redirect_after |
|
1068 | - * @return void |
|
1069 | - */ |
|
1070 | - protected function _delete_venue($redirect_after = true) |
|
1071 | - { |
|
1072 | - // determine the venue id and set to array. |
|
1073 | - $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : null; |
|
1074 | - $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1075 | - |
|
1076 | - |
|
1077 | - // loop thru venues |
|
1078 | - if ($VNU_ID) { |
|
1079 | - $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1080 | - } else { |
|
1081 | - $success = false; |
|
1082 | - $msg = esc_html__( |
|
1083 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1084 | - 'event_espresso' |
|
1085 | - ); |
|
1086 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1087 | - } |
|
1088 | - if ($redirect_after) { |
|
1089 | - $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1090 | - } |
|
1091 | - } |
|
1092 | - |
|
1093 | - |
|
1094 | - protected function _delete_venues() |
|
1095 | - { |
|
1096 | - $success = true; |
|
1097 | - // determine the event id and set to array. |
|
1098 | - $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
1099 | - // loop thru events |
|
1100 | - foreach ($VNU_IDs as $VNU_ID) { |
|
1101 | - if ($VNU_ID = absint($VNU_ID)) { |
|
1102 | - $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1103 | - $success = $results !== false ? $success : false; |
|
1104 | - } else { |
|
1105 | - $success = false; |
|
1106 | - $msg = esc_html__( |
|
1107 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1108 | - 'event_espresso' |
|
1109 | - ); |
|
1110 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1111 | - } |
|
1112 | - } |
|
1113 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1114 | - $success = $success ? 2 : false; |
|
1115 | - $this->_redirect_after_action( |
|
1116 | - $success, |
|
1117 | - esc_html__('Venues', 'event_espresso'), |
|
1118 | - esc_html__('deleted', 'event_espresso'), |
|
1119 | - array('action' => 'default') |
|
1120 | - ); |
|
1121 | - } |
|
1122 | - |
|
1123 | - |
|
1124 | - // todo: put in parent |
|
1125 | - private function _delete_or_trash_venue($VNU_ID = false) |
|
1126 | - { |
|
1127 | - // grab event id |
|
1128 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1129 | - $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1130 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1131 | - return false; |
|
1132 | - } |
|
1133 | - |
|
1134 | - |
|
1135 | - $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1136 | - // first need to remove all term relationships |
|
1137 | - $venue->_remove_relations('Term_Taxonomy'); |
|
1138 | - $success = $venue->delete_permanently(); |
|
1139 | - // did it all go as planned ? |
|
1140 | - if ($success) { |
|
1141 | - $msg = sprintf(esc_html__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1142 | - EE_Error::add_success($msg); |
|
1143 | - } else { |
|
1144 | - $msg = sprintf(esc_html__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID); |
|
1145 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1146 | - return false; |
|
1147 | - } |
|
1148 | - do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1149 | - return true; |
|
1150 | - } |
|
1151 | - |
|
1152 | - |
|
1153 | - |
|
1154 | - |
|
1155 | - /***********/ |
|
1156 | - /* QUERIES */ |
|
1157 | - |
|
1158 | - |
|
1159 | - public function get_venues($per_page = 10, $count = false) |
|
1160 | - { |
|
1161 | - |
|
1162 | - $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1163 | - |
|
1164 | - switch ($_orderby) { |
|
1165 | - case 'id': |
|
1166 | - $orderby = 'VNU_ID'; |
|
1167 | - break; |
|
1168 | - |
|
1169 | - case 'capacity': |
|
1170 | - $orderby = 'VNU_capacity'; |
|
1171 | - break; |
|
1172 | - |
|
1173 | - case 'city': |
|
1174 | - $orderby = 'VNU_city'; |
|
1175 | - break; |
|
1176 | - |
|
1177 | - default: |
|
1178 | - $orderby = 'VNU_name'; |
|
1179 | - } |
|
1180 | - |
|
1181 | - |
|
1182 | - $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] |
|
1183 | - : 'ASC'; |
|
1184 | - |
|
1185 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1186 | - ? $this->_req_data['paged'] : 1; |
|
1187 | - $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1188 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1189 | - ? $this->_req_data['perpage'] : $per_page; |
|
1190 | - |
|
1191 | - |
|
1192 | - $offset = ($current_page - 1) * $per_page; |
|
1193 | - $limit = array($offset, $per_page); |
|
1194 | - |
|
1195 | - $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 |
|
1196 | - ? $this->_req_data['category'] : null; |
|
1197 | - $where = array(); |
|
1198 | - |
|
1199 | - // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1200 | - if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1201 | - $where['status'] = $this->_req_data['status']; |
|
1202 | - } |
|
1203 | - |
|
1204 | - if (isset($this->_req_data['venue_status'])) { |
|
1205 | - $where['status'] = $this->_req_data['venue_status']; |
|
1206 | - } |
|
1207 | - |
|
1208 | - |
|
1209 | - if ($category) { |
|
1210 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1211 | - $where['Term_Taxonomy.term_id'] = $category; |
|
1212 | - } |
|
1213 | - |
|
1214 | - |
|
1215 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1216 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1217 | - } else { |
|
1218 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1219 | - $where['OR'] = array( |
|
1220 | - 'status*restrict_private' => array('!=', 'private'), |
|
1221 | - 'AND' => array( |
|
1222 | - 'status*inclusive' => array('=', 'private'), |
|
1223 | - 'VNU_wp_user' => get_current_user_id(), |
|
1224 | - ), |
|
1225 | - ); |
|
1226 | - } |
|
1227 | - } |
|
1228 | - |
|
1229 | - |
|
1230 | - if (isset($this->_req_data['s'])) { |
|
1231 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1232 | - $where['OR'] = array( |
|
1233 | - 'VNU_name' => array('LIKE', $sstr), |
|
1234 | - 'VNU_desc' => array('LIKE', $sstr), |
|
1235 | - 'VNU_short_desc' => array('LIKE', $sstr), |
|
1236 | - 'VNU_address' => array('LIKE', $sstr), |
|
1237 | - 'VNU_address2' => array('LIKE', $sstr), |
|
1238 | - 'VNU_city' => array('LIKE', $sstr), |
|
1239 | - 'VNU_zip' => array('LIKE', $sstr), |
|
1240 | - 'VNU_phone' => array('LIKE', $sstr), |
|
1241 | - 'VNU_url' => array('LIKE', $sstr), |
|
1242 | - 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1243 | - 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1244 | - 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1245 | - 'Event.EVT_name' => array('LIKE', $sstr), |
|
1246 | - 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1247 | - 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1248 | - 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1249 | - ); |
|
1250 | - } |
|
20 | + /** |
|
21 | + * _venue |
|
22 | + * This will hold the venue object for venue_details screen. |
|
23 | + * |
|
24 | + * @access protected |
|
25 | + * @var object |
|
26 | + */ |
|
27 | + protected $_venue; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * This will hold the category object for category_details screen. |
|
32 | + * |
|
33 | + * @var object |
|
34 | + */ |
|
35 | + protected $_category; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * This property will hold the venue model instance |
|
40 | + * |
|
41 | + * @var object |
|
42 | + */ |
|
43 | + protected $_venue_model; |
|
44 | + |
|
45 | + |
|
46 | + protected function _init_page_props() |
|
47 | + { |
|
48 | + require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
49 | + $this->page_slug = EE_VENUES_PG_SLUG; |
|
50 | + $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
|
51 | + $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
52 | + $this->page_label = esc_html__('Event Venues', 'event_espresso'); |
|
53 | + $this->_cpt_model_names = array( |
|
54 | + 'create_new' => 'EEM_Venue', |
|
55 | + 'edit' => 'EEM_Venue', |
|
56 | + ); |
|
57 | + $this->_cpt_edit_routes = array( |
|
58 | + 'espresso_venues' => 'edit', |
|
59 | + ); |
|
60 | + $this->_venue_model = EEM_Venue::instance(); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + protected function _ajax_hooks() |
|
65 | + { |
|
66 | + // todo: all hooks for ee_venues ajax goes in here. |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + protected function _define_page_props() |
|
71 | + { |
|
72 | + $this->_admin_page_title = $this->page_label; |
|
73 | + $this->_labels = array( |
|
74 | + 'buttons' => array( |
|
75 | + 'add' => esc_html__('Add New Venue', 'event_espresso'), |
|
76 | + 'edit' => esc_html__('Edit Venue', 'event_espresso'), |
|
77 | + 'delete' => esc_html__('Delete Venue', 'event_espresso'), |
|
78 | + 'add_category' => esc_html__('Add New Category', 'event_espresso'), |
|
79 | + 'edit_category' => esc_html__('Edit Category', 'event_espresso'), |
|
80 | + 'delete_category' => esc_html__('Delete Category', 'event_espresso'), |
|
81 | + ), |
|
82 | + 'editor_title' => array( |
|
83 | + 'espresso_venues' => esc_html__('Enter Venue name here', 'event_espresso'), |
|
84 | + ), |
|
85 | + 'publishbox' => array( |
|
86 | + 'create_new' => esc_html__('Save New Venue', 'event_espresso'), |
|
87 | + 'edit' => esc_html__('Update Venue', 'event_espresso'), |
|
88 | + 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
|
89 | + 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
|
90 | + 'google_map_settings' => esc_html__('Update Settings', 'event_espresso'), |
|
91 | + ), |
|
92 | + ); |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + protected function _set_page_routes() |
|
97 | + { |
|
98 | + |
|
99 | + // load formatter helper |
|
100 | + // load field generator helper |
|
101 | + |
|
102 | + // is there a vnu_id in the request? |
|
103 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) |
|
104 | + ? $this->_req_data['VNU_ID'] : 0; |
|
105 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
106 | + |
|
107 | + $this->_page_routes = array( |
|
108 | + 'default' => array( |
|
109 | + 'func' => '_overview_list_table', |
|
110 | + 'capability' => 'ee_read_venues', |
|
111 | + ), |
|
112 | + 'create_new' => array( |
|
113 | + 'func' => '_create_new_cpt_item', |
|
114 | + 'capability' => 'ee_edit_venues', |
|
115 | + ), |
|
116 | + 'edit' => array( |
|
117 | + 'func' => '_edit_cpt_item', |
|
118 | + 'capability' => 'ee_edit_venue', |
|
119 | + 'obj_id' => $vnu_id, |
|
120 | + ), |
|
121 | + 'trash_venue' => array( |
|
122 | + 'func' => '_trash_or_restore_venue', |
|
123 | + 'args' => array('venue_status' => 'trash'), |
|
124 | + 'noheader' => true, |
|
125 | + 'capability' => 'ee_delete_venue', |
|
126 | + 'obj_id' => $vnu_id, |
|
127 | + ), |
|
128 | + 'trash_venues' => array( |
|
129 | + 'func' => '_trash_or_restore_venues', |
|
130 | + 'args' => array('venue_status' => 'trash'), |
|
131 | + 'noheader' => true, |
|
132 | + 'capability' => 'ee_delete_venues', |
|
133 | + ), |
|
134 | + 'restore_venue' => array( |
|
135 | + 'func' => '_trash_or_restore_venue', |
|
136 | + 'args' => array('venue_status' => 'draft'), |
|
137 | + 'noheader' => true, |
|
138 | + 'capability' => 'ee_delete_venue', |
|
139 | + 'obj_id' => $vnu_id, |
|
140 | + ), |
|
141 | + 'restore_venues' => array( |
|
142 | + 'func' => '_trash_or_restore_venues', |
|
143 | + 'args' => array('venue_status' => 'draft'), |
|
144 | + 'noheader' => true, |
|
145 | + 'capability' => 'ee_delete_venues', |
|
146 | + ), |
|
147 | + 'delete_venues' => array( |
|
148 | + 'func' => '_delete_venues', |
|
149 | + 'noheader' => true, |
|
150 | + 'capability' => 'ee_delete_venues', |
|
151 | + ), |
|
152 | + 'delete_venue' => array( |
|
153 | + 'func' => '_delete_venue', |
|
154 | + 'noheader' => true, |
|
155 | + 'capability' => 'ee_delete_venue', |
|
156 | + 'obj_id' => $vnu_id, |
|
157 | + ), |
|
158 | + // settings related |
|
159 | + 'google_map_settings' => array( |
|
160 | + 'func' => '_google_map_settings', |
|
161 | + 'capability' => 'manage_options', |
|
162 | + ), |
|
163 | + 'update_google_map_settings' => array( |
|
164 | + 'func' => '_update_google_map_settings', |
|
165 | + 'capability' => 'manage_options', |
|
166 | + 'noheader' => true, |
|
167 | + ), |
|
168 | + // venue category tab related |
|
169 | + 'add_category' => array( |
|
170 | + 'func' => '_category_details', |
|
171 | + 'args' => array('add'), |
|
172 | + 'capability' => 'ee_edit_venue_category', |
|
173 | + ), |
|
174 | + 'edit_category' => array( |
|
175 | + 'func' => '_category_details', |
|
176 | + 'args' => array('edit'), |
|
177 | + 'capability' => 'ee_edit_venue_category', |
|
178 | + ), |
|
179 | + 'delete_categories' => array( |
|
180 | + 'func' => '_delete_categories', |
|
181 | + 'noheader' => true, |
|
182 | + 'capability' => 'ee_delete_venue_category', |
|
183 | + ), |
|
184 | + |
|
185 | + 'delete_category' => array( |
|
186 | + 'func' => '_delete_categories', |
|
187 | + 'noheader' => true, |
|
188 | + 'capability' => 'ee_delete_venue_category', |
|
189 | + ), |
|
190 | + |
|
191 | + 'insert_category' => array( |
|
192 | + 'func' => '_insert_or_update_category', |
|
193 | + 'args' => array('new_category' => true), |
|
194 | + 'noheader' => true, |
|
195 | + 'capability' => 'ee_edit_venue_category', |
|
196 | + ), |
|
197 | + |
|
198 | + 'update_category' => array( |
|
199 | + 'func' => '_insert_or_update_category', |
|
200 | + 'args' => array('new_category' => false), |
|
201 | + 'noheader' => true, |
|
202 | + 'capability' => 'ee_edit_venue_category', |
|
203 | + ), |
|
204 | + 'export_categories' => array( |
|
205 | + 'func' => '_categories_export', |
|
206 | + 'noheader' => true, |
|
207 | + 'capability' => 'export', |
|
208 | + ), |
|
209 | + 'import_categories' => array( |
|
210 | + 'func' => '_import_categories', |
|
211 | + 'capability' => 'import', |
|
212 | + ), |
|
213 | + 'category_list' => array( |
|
214 | + 'func' => '_category_list_table', |
|
215 | + 'capability' => 'ee_manage_venue_categories', |
|
216 | + ), |
|
217 | + ); |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + protected function _set_page_config() |
|
222 | + { |
|
223 | + $this->_page_config = array( |
|
224 | + 'default' => array( |
|
225 | + 'nav' => array( |
|
226 | + 'label' => esc_html__('Overview', 'event_espresso'), |
|
227 | + 'order' => 10, |
|
228 | + ), |
|
229 | + 'list_table' => 'Venues_Admin_List_Table', |
|
230 | + 'help_tabs' => array( |
|
231 | + 'venues_overview_help_tab' => array( |
|
232 | + 'title' => esc_html__('Venues Overview', 'event_espresso'), |
|
233 | + 'filename' => 'venues_overview', |
|
234 | + ), |
|
235 | + 'venues_overview_table_column_headings_help_tab' => array( |
|
236 | + 'title' => esc_html__('Venues Overview Table Column Headings', 'event_espresso'), |
|
237 | + 'filename' => 'venues_overview_table_column_headings', |
|
238 | + ), |
|
239 | + 'venues_overview_views_bulk_actions_search_help_tab' => array( |
|
240 | + 'title' => esc_html__('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
241 | + 'filename' => 'venues_overview_views_bulk_actions_search', |
|
242 | + ), |
|
243 | + ), |
|
244 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
245 | + // 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
246 | + 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
247 | + 'require_nonce' => false, |
|
248 | + ), |
|
249 | + 'create_new' => array( |
|
250 | + 'nav' => array( |
|
251 | + 'label' => esc_html__('Add Venue', 'event_espresso'), |
|
252 | + 'order' => 5, |
|
253 | + 'persistent' => false, |
|
254 | + ), |
|
255 | + 'help_tabs' => array( |
|
256 | + 'venues_editor_help_tab' => array( |
|
257 | + 'title' => esc_html__('Venue Editor', 'event_espresso'), |
|
258 | + 'filename' => 'venues_editor', |
|
259 | + ), |
|
260 | + 'venues_editor_title_richtexteditor_help_tab' => array( |
|
261 | + 'title' => esc_html__('Venue Title & Rich Text Editor', 'event_espresso'), |
|
262 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
263 | + ), |
|
264 | + 'venues_editor_tags_categories_help_tab' => array( |
|
265 | + 'title' => esc_html__('Venue Tags & Categories', 'event_espresso'), |
|
266 | + 'filename' => 'venues_editor_tags_categories', |
|
267 | + ), |
|
268 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
269 | + 'title' => esc_html__( |
|
270 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
271 | + 'event_espresso' |
|
272 | + ), |
|
273 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
274 | + ), |
|
275 | + 'venues_editor_save_new_venue_help_tab' => array( |
|
276 | + 'title' => esc_html__('Save New Venue', 'event_espresso'), |
|
277 | + 'filename' => 'venues_editor_save_new_venue', |
|
278 | + ), |
|
279 | + 'venues_editor_other_help_tab' => array( |
|
280 | + 'title' => esc_html__('Venue Editor Other', 'event_espresso'), |
|
281 | + 'filename' => 'venues_editor_other', |
|
282 | + ), |
|
283 | + ), |
|
284 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
285 | + // 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
286 | + 'metaboxes' => array('_venue_editor_metaboxes'), |
|
287 | + 'require_nonce' => false, |
|
288 | + ), |
|
289 | + 'edit' => array( |
|
290 | + 'nav' => array( |
|
291 | + 'label' => esc_html__('Edit Venue', 'event_espresso'), |
|
292 | + 'order' => 5, |
|
293 | + 'persistent' => false, |
|
294 | + 'url' => isset($this->_req_data['post']) ? add_query_arg( |
|
295 | + array('post' => $this->_req_data['post']), |
|
296 | + $this->_current_page_view_url |
|
297 | + ) : $this->_admin_base_url, |
|
298 | + ), |
|
299 | + 'help_tabs' => array( |
|
300 | + 'venues_editor_help_tab' => array( |
|
301 | + 'title' => esc_html__('Venue Editor', 'event_espresso'), |
|
302 | + 'filename' => 'venues_editor', |
|
303 | + ), |
|
304 | + 'venues_editor_title_richtexteditor_help_tab' => array( |
|
305 | + 'title' => esc_html__('Venue Title & Rich Text Editor', 'event_espresso'), |
|
306 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
307 | + ), |
|
308 | + 'venues_editor_tags_categories_help_tab' => array( |
|
309 | + 'title' => esc_html__('Venue Tags & Categories', 'event_espresso'), |
|
310 | + 'filename' => 'venues_editor_tags_categories', |
|
311 | + ), |
|
312 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
313 | + 'title' => esc_html__( |
|
314 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
315 | + 'event_espresso' |
|
316 | + ), |
|
317 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
318 | + ), |
|
319 | + 'venues_editor_save_new_venue_help_tab' => array( |
|
320 | + 'title' => esc_html__('Save New Venue', 'event_espresso'), |
|
321 | + 'filename' => 'venues_editor_save_new_venue', |
|
322 | + ), |
|
323 | + 'venues_editor_other_help_tab' => array( |
|
324 | + 'title' => esc_html__('Venue Editor Other', 'event_espresso'), |
|
325 | + 'filename' => 'venues_editor_other', |
|
326 | + ), |
|
327 | + ), |
|
328 | + /*'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),*/ |
|
329 | + 'metaboxes' => array('_venue_editor_metaboxes'), |
|
330 | + 'require_nonce' => false, |
|
331 | + ), |
|
332 | + 'google_map_settings' => array( |
|
333 | + 'nav' => array( |
|
334 | + 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
335 | + 'order' => 40, |
|
336 | + ), |
|
337 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
338 | + 'help_tabs' => array( |
|
339 | + 'general_settings_google_maps_help_tab' => array( |
|
340 | + 'title' => esc_html__('Google Maps', 'event_espresso'), |
|
341 | + 'filename' => 'general_settings_google_maps', |
|
342 | + ), |
|
343 | + ), |
|
344 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
345 | + // 'help_tour' => array('Google_Maps_Help_Tour'), |
|
346 | + 'require_nonce' => false, |
|
347 | + ), |
|
348 | + // venue category stuff |
|
349 | + 'add_category' => array( |
|
350 | + 'nav' => array( |
|
351 | + 'label' => esc_html__('Add Category', 'event_espresso'), |
|
352 | + 'order' => 15, |
|
353 | + 'persistent' => false, |
|
354 | + ), |
|
355 | + 'metaboxes' => array('_publish_post_box'), |
|
356 | + 'help_tabs' => array( |
|
357 | + 'venues_add_category_help_tab' => array( |
|
358 | + 'title' => esc_html__('Add New Venue Category', 'event_espresso'), |
|
359 | + 'filename' => 'venues_add_category', |
|
360 | + ), |
|
361 | + ), |
|
362 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
363 | + // 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
364 | + 'require_nonce' => false, |
|
365 | + ), |
|
366 | + 'edit_category' => array( |
|
367 | + 'nav' => array( |
|
368 | + 'label' => esc_html__('Edit Category', 'event_espresso'), |
|
369 | + 'order' => 15, |
|
370 | + 'persistent' => false, |
|
371 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg( |
|
372 | + array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
373 | + $this->_current_page_view_url |
|
374 | + ) : $this->_admin_base_url, |
|
375 | + ), |
|
376 | + 'metaboxes' => array('_publish_post_box'), |
|
377 | + 'help_tabs' => array( |
|
378 | + 'venues_edit_category_help_tab' => array( |
|
379 | + 'title' => esc_html__('Edit Venue Category', 'event_espresso'), |
|
380 | + 'filename' => 'venues_edit_category', |
|
381 | + ), |
|
382 | + ), |
|
383 | + /*'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),*/ |
|
384 | + 'require_nonce' => false, |
|
385 | + ), |
|
386 | + 'category_list' => array( |
|
387 | + 'nav' => array( |
|
388 | + 'label' => esc_html__('Categories', 'event_espresso'), |
|
389 | + 'order' => 20, |
|
390 | + ), |
|
391 | + 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
392 | + 'help_tabs' => array( |
|
393 | + 'venues_categories_help_tab' => array( |
|
394 | + 'title' => esc_html__('Venue Categories', 'event_espresso'), |
|
395 | + 'filename' => 'venues_categories', |
|
396 | + ), |
|
397 | + 'venues_categories_table_column_headings_help_tab' => array( |
|
398 | + 'title' => esc_html__('Venue Categories Table Column Headings', 'event_espresso'), |
|
399 | + 'filename' => 'venues_categories_table_column_headings', |
|
400 | + ), |
|
401 | + 'venues_categories_views_help_tab' => array( |
|
402 | + 'title' => esc_html__('Venue Categories Views', 'event_espresso'), |
|
403 | + 'filename' => 'venues_categories_views', |
|
404 | + ), |
|
405 | + 'venues_categories_other_help_tab' => array( |
|
406 | + 'title' => esc_html__('Venue Categories Other', 'event_espresso'), |
|
407 | + 'filename' => 'venues_categories_other', |
|
408 | + ), |
|
409 | + ), |
|
410 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
411 | + // 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
412 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
413 | + 'require_nonce' => false, |
|
414 | + ), |
|
415 | + ); |
|
416 | + } |
|
417 | + |
|
418 | + |
|
419 | + protected function _add_screen_options() |
|
420 | + { |
|
421 | + // todo |
|
422 | + } |
|
423 | + |
|
424 | + |
|
425 | + protected function _add_screen_options_default() |
|
426 | + { |
|
427 | + $this->_per_page_screen_option(); |
|
428 | + } |
|
429 | + |
|
430 | + |
|
431 | + protected function _add_screen_options_category_list() |
|
432 | + { |
|
433 | + $page_title = $this->_admin_page_title; |
|
434 | + $this->_admin_page_title = esc_html__('Venue Categories', 'event_espresso'); |
|
435 | + $this->_per_page_screen_option(); |
|
436 | + $this->_admin_page_title = $page_title; |
|
437 | + } |
|
438 | + |
|
439 | + |
|
440 | + // none of the below group are currently used for Event Venues |
|
441 | + protected function _add_feature_pointers() |
|
442 | + { |
|
443 | + } |
|
444 | + |
|
445 | + public function admin_init() |
|
446 | + { |
|
447 | + } |
|
448 | + |
|
449 | + public function admin_notices() |
|
450 | + { |
|
451 | + } |
|
452 | + |
|
453 | + public function admin_footer_scripts() |
|
454 | + { |
|
455 | + } |
|
456 | + |
|
457 | + |
|
458 | + public function load_scripts_styles_create_new() |
|
459 | + { |
|
460 | + $this->load_scripts_styles_edit(); |
|
461 | + } |
|
462 | + |
|
463 | + |
|
464 | + public function load_scripts_styles() |
|
465 | + { |
|
466 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
467 | + wp_enqueue_style('ee-cat-admin'); |
|
468 | + } |
|
469 | + |
|
470 | + |
|
471 | + public function load_scripts_styles_add_category() |
|
472 | + { |
|
473 | + $this->load_scripts_styles_edit_category(); |
|
474 | + } |
|
475 | + |
|
476 | + |
|
477 | + public function load_scripts_styles_edit_category() |
|
478 | + { |
|
479 | + } |
|
480 | + |
|
481 | + |
|
482 | + public function load_scripts_styles_edit() |
|
483 | + { |
|
484 | + // styles |
|
485 | + wp_enqueue_style('espresso-ui-theme'); |
|
486 | + wp_register_style( |
|
487 | + 'espresso_venues', |
|
488 | + EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
489 | + array(), |
|
490 | + EVENT_ESPRESSO_VERSION |
|
491 | + ); |
|
492 | + wp_enqueue_style('espresso_venues'); |
|
493 | + } |
|
494 | + |
|
495 | + |
|
496 | + protected function _set_list_table_views_default() |
|
497 | + { |
|
498 | + $this->_views = array( |
|
499 | + 'all' => array( |
|
500 | + 'slug' => 'all', |
|
501 | + 'label' => esc_html__('View All Venues', 'event_espresso'), |
|
502 | + 'count' => 0, |
|
503 | + 'bulk_action' => array(), |
|
504 | + ), |
|
505 | + ); |
|
506 | + |
|
507 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
508 | + $this->_views['all']['bulk_action'] = array( |
|
509 | + 'trash_venues' => esc_html__('Move to Trash', 'event_espresso'), |
|
510 | + ); |
|
511 | + $this->_views['trash'] = array( |
|
512 | + 'slug' => 'trash', |
|
513 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
514 | + 'count' => 0, |
|
515 | + 'bulk_action' => array( |
|
516 | + 'restore_venues' => esc_html__('Restore from Trash', 'event_espresso'), |
|
517 | + 'delete_venues' => esc_html__('Delete', 'event_espresso'), |
|
518 | + ), |
|
519 | + ); |
|
520 | + } |
|
521 | + } |
|
522 | + |
|
523 | + |
|
524 | + protected function _set_list_table_views_category_list() |
|
525 | + { |
|
526 | + $this->_views = array( |
|
527 | + 'all' => array( |
|
528 | + 'slug' => 'all', |
|
529 | + 'label' => esc_html__('All', 'event_espresso'), |
|
530 | + 'count' => 0, |
|
531 | + 'bulk_action' => array( |
|
532 | + 'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'), |
|
533 | + ), |
|
534 | + ), |
|
535 | + ); |
|
536 | + } |
|
537 | + |
|
538 | + |
|
539 | + protected function _overview_list_table() |
|
540 | + { |
|
541 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
542 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
543 | + get_post_type_archive_link('espresso_venues'), |
|
544 | + esc_html__("View Venue Archive Page", "event_espresso"), |
|
545 | + 'button' |
|
546 | + ); |
|
547 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
548 | + $this->_search_btn_label = esc_html__('Venues', 'event_espresso'); |
|
549 | + $this->display_admin_list_table_page_with_sidebar(); |
|
550 | + } |
|
551 | + |
|
552 | + |
|
553 | + public function extra_misc_actions_publish_box() |
|
554 | + { |
|
555 | + $extra_rows = array( |
|
556 | + 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
557 | + 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
558 | + 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
559 | + ); |
|
560 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
561 | + EEH_Template::display_template($template, $extra_rows); |
|
562 | + } |
|
563 | + |
|
564 | + |
|
565 | + /************* Google Maps *************/ |
|
566 | + |
|
567 | + |
|
568 | + protected function _google_map_settings() |
|
569 | + { |
|
570 | + |
|
571 | + |
|
572 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
573 | + $default_map_settings = new stdClass(); |
|
574 | + $default_map_settings->use_google_maps = true; |
|
575 | + $default_map_settings->google_map_api_key = ''; |
|
576 | + // for event details pages (reg page) |
|
577 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
578 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
579 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
580 | + $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
581 | + $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
582 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
583 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
584 | + // for event list pages |
|
585 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
586 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
587 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
588 | + $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
589 | + $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
590 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
591 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
592 | + |
|
593 | + $this->_template_args['map_settings'] = |
|
594 | + isset(EE_Registry::instance()->CFG->map_settings) |
|
595 | + && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
596 | + ? (object) array_merge( |
|
597 | + (array) $default_map_settings, |
|
598 | + (array) EE_Registry::instance()->CFG->map_settings |
|
599 | + ) |
|
600 | + : $default_map_settings; |
|
601 | + |
|
602 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
603 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
604 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
605 | + EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
606 | + $this->_template_args, |
|
607 | + true |
|
608 | + ); |
|
609 | + $this->display_admin_page_with_sidebar(); |
|
610 | + } |
|
611 | + |
|
612 | + protected function _update_google_map_settings() |
|
613 | + { |
|
614 | + |
|
615 | + EE_Registry::instance()->CFG->map_settings->use_google_maps = |
|
616 | + isset($this->_req_data['use_google_maps']) |
|
617 | + ? absint($this->_req_data['use_google_maps']) |
|
618 | + : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
|
619 | + |
|
620 | + EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
|
621 | + isset($this->_req_data['google_map_api_key']) |
|
622 | + ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
623 | + : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
|
624 | + |
|
625 | + EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
|
626 | + isset($this->_req_data['event_details_map_width']) |
|
627 | + ? absint($this->_req_data['event_details_map_width']) |
|
628 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
|
629 | + |
|
630 | + EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
|
631 | + isset($this->_req_data['event_details_map_height']) |
|
632 | + ? absint($this->_req_data['event_details_map_height']) |
|
633 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
|
634 | + |
|
635 | + EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
|
636 | + isset($this->_req_data['event_details_map_zoom']) |
|
637 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
638 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
|
639 | + |
|
640 | + EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
|
641 | + isset($this->_req_data['event_details_display_nav']) |
|
642 | + ? absint($this->_req_data['event_details_display_nav']) |
|
643 | + : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
|
644 | + |
|
645 | + EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
|
646 | + isset($this->_req_data['event_details_nav_size']) |
|
647 | + ? absint($this->_req_data['event_details_nav_size']) |
|
648 | + : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
|
649 | + |
|
650 | + EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
|
651 | + isset($this->_req_data['event_details_control_type']) |
|
652 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
653 | + : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
|
654 | + |
|
655 | + EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
|
656 | + isset($this->_req_data['event_details_map_align']) |
|
657 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
658 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
|
659 | + |
|
660 | + EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
|
661 | + isset($this->_req_data['event_list_map_width']) |
|
662 | + ? absint($this->_req_data['event_list_map_width']) |
|
663 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
|
664 | + |
|
665 | + EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
|
666 | + isset($this->_req_data['event_list_map_height']) |
|
667 | + ? absint($this->_req_data['event_list_map_height']) |
|
668 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
|
669 | + |
|
670 | + EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
|
671 | + isset($this->_req_data['event_list_map_zoom']) |
|
672 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
673 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
|
674 | + |
|
675 | + EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
|
676 | + isset($this->_req_data['event_list_display_nav']) |
|
677 | + ? absint($this->_req_data['event_list_display_nav']) |
|
678 | + : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
|
679 | + |
|
680 | + EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
|
681 | + isset($this->_req_data['event_list_nav_size']) |
|
682 | + ? absint($this->_req_data['event_list_nav_size']) |
|
683 | + : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
|
684 | + |
|
685 | + EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
|
686 | + isset($this->_req_data['event_list_control_type']) |
|
687 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
688 | + : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
|
689 | + |
|
690 | + EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
|
691 | + isset($this->_req_data['event_list_map_align']) |
|
692 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
693 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
|
694 | + |
|
695 | + EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
696 | + 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
697 | + EE_Registry::instance()->CFG->map_settings |
|
698 | + ); |
|
699 | + |
|
700 | + $what = 'Google Map Settings'; |
|
701 | + $success = $this->_update_espresso_configuration( |
|
702 | + $what, |
|
703 | + EE_Registry::instance()->CFG->map_settings, |
|
704 | + __FILE__, |
|
705 | + __FUNCTION__, |
|
706 | + __LINE__ |
|
707 | + ); |
|
708 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
709 | + } |
|
710 | + |
|
711 | + |
|
712 | + protected function _venue_editor_metaboxes() |
|
713 | + { |
|
714 | + $this->verify_cpt_object(); |
|
715 | + |
|
716 | + add_meta_box( |
|
717 | + 'espresso_venue_address_options', |
|
718 | + esc_html__('Physical Location', 'event_espresso'), |
|
719 | + array($this, 'venue_address_metabox'), |
|
720 | + $this->page_slug, |
|
721 | + 'side', |
|
722 | + 'default' |
|
723 | + ); |
|
724 | + add_meta_box( |
|
725 | + 'espresso_venue_gmap_options', |
|
726 | + esc_html__('Google Map', 'event_espresso'), |
|
727 | + array($this, 'venue_gmap_metabox'), |
|
728 | + $this->page_slug, |
|
729 | + 'side', |
|
730 | + 'default' |
|
731 | + ); |
|
732 | + add_meta_box( |
|
733 | + 'espresso_venue_virtual_loc_options', |
|
734 | + esc_html__('Virtual Location', 'event_espresso'), |
|
735 | + array($this, 'venue_virtual_loc_metabox'), |
|
736 | + $this->page_slug, |
|
737 | + 'side', |
|
738 | + 'default' |
|
739 | + ); |
|
740 | + } |
|
741 | + |
|
742 | + |
|
743 | + public function venue_gmap_metabox() |
|
744 | + { |
|
745 | + $template_args = array( |
|
746 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
747 | + 'vnu_enable_for_gmap', |
|
748 | + $this->get_yes_no_values(), |
|
749 | + $this->_cpt_model_obj->enable_for_gmap() |
|
750 | + ), |
|
751 | + 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
752 | + ); |
|
753 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
754 | + EEH_Template::display_template($template, $template_args); |
|
755 | + } |
|
756 | + |
|
757 | + |
|
758 | + public function venue_address_metabox() |
|
759 | + { |
|
760 | + |
|
761 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
762 | + |
|
763 | + $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
764 | + $QFI = new EE_Question_Form_Input( |
|
765 | + EE_Question::new_instance( |
|
766 | + array('QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state') |
|
767 | + ), |
|
768 | + EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), |
|
769 | + array( |
|
770 | + 'input_name' => 'sta_id', |
|
771 | + 'input_id' => 'sta_id', |
|
772 | + 'input_class' => '', |
|
773 | + 'input_prefix' => '', |
|
774 | + 'append_qstn_id' => false, |
|
775 | + ) |
|
776 | + ) |
|
777 | + ); |
|
778 | + $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
779 | + $QFI = new EE_Question_Form_Input( |
|
780 | + EE_Question::new_instance( |
|
781 | + array('QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country') |
|
782 | + ), |
|
783 | + EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), |
|
784 | + array( |
|
785 | + 'input_name' => 'cnt_iso', |
|
786 | + 'input_id' => 'cnt_iso', |
|
787 | + 'input_class' => '', |
|
788 | + 'input_prefix' => '', |
|
789 | + 'append_qstn_id' => false, |
|
790 | + ) |
|
791 | + ) |
|
792 | + ); |
|
793 | + |
|
794 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
795 | + EEH_Template::display_template($template, $template_args); |
|
796 | + } |
|
797 | + |
|
798 | + |
|
799 | + public function venue_virtual_loc_metabox() |
|
800 | + { |
|
801 | + $template_args = array( |
|
802 | + '_venue' => $this->_cpt_model_obj, |
|
803 | + ); |
|
804 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
805 | + EEH_Template::display_template($template, $template_args); |
|
806 | + } |
|
807 | + |
|
808 | + |
|
809 | + protected function _restore_cpt_item($post_id, $revision_id) |
|
810 | + { |
|
811 | + $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
812 | + |
|
813 | + // meta revision restore |
|
814 | + $venue_obj->restore_revision($revision_id); |
|
815 | + } |
|
816 | + |
|
817 | + |
|
818 | + /** |
|
819 | + * Handles updates for venue cpts |
|
820 | + * |
|
821 | + * @param int $post_id ID of Venue CPT |
|
822 | + * @param object $post Post object (with "blessed" WP properties) |
|
823 | + * @return void |
|
824 | + */ |
|
825 | + protected function _insert_update_cpt_item($post_id, $post) |
|
826 | + { |
|
827 | + |
|
828 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
829 | + return;// get out we're not processing the saving of venues. |
|
830 | + } |
|
831 | + |
|
832 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
833 | + |
|
834 | + $venue_values = array( |
|
835 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : null, |
|
836 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] |
|
837 | + : null, |
|
838 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : null, |
|
839 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : null, |
|
840 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : null, |
|
841 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : null, |
|
842 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : null, |
|
843 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace( |
|
844 | + ',', |
|
845 | + '', |
|
846 | + $this->_req_data['vnu_capacity'] |
|
847 | + ) : EE_INF, |
|
848 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : null, |
|
849 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) |
|
850 | + ? $this->_req_data['vnu_virtual_phone'] : null, |
|
851 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] |
|
852 | + : null, |
|
853 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? true : false, |
|
854 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) |
|
855 | + ? $this->_req_data['vnu_google_map_link'] : null, |
|
856 | + ); |
|
857 | + |
|
858 | + // update venue |
|
859 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
860 | + |
|
861 | + // get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
|
862 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
863 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
864 | + |
|
865 | + // notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
|
866 | + $venue_update_callbacks = apply_filters( |
|
867 | + 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
868 | + array() |
|
869 | + ); |
|
870 | + |
|
871 | + $att_success = true; |
|
872 | + |
|
873 | + foreach ($venue_update_callbacks as $v_callback) { |
|
874 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
875 | + $att_success = ! $att_success ? $att_success |
|
876 | + : $_succ; // if ANY of these updates fail then we want the appropriate global error message |
|
877 | + } |
|
878 | + |
|
879 | + // any errors? |
|
880 | + if ($success && ! $att_success) { |
|
881 | + EE_Error::add_error( |
|
882 | + esc_html__( |
|
883 | + 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
884 | + 'event_espresso' |
|
885 | + ), |
|
886 | + __FILE__, |
|
887 | + __FUNCTION__, |
|
888 | + __LINE__ |
|
889 | + ); |
|
890 | + } elseif ($success === false) { |
|
891 | + EE_Error::add_error( |
|
892 | + esc_html__('Venue Details did not save successfully.', 'event_espresso'), |
|
893 | + __FILE__, |
|
894 | + __FUNCTION__, |
|
895 | + __LINE__ |
|
896 | + ); |
|
897 | + } |
|
898 | + } |
|
899 | + |
|
900 | + |
|
901 | + public function trash_cpt_item($post_id) |
|
902 | + { |
|
903 | + $this->_req_data['VNU_ID'] = $post_id; |
|
904 | + $this->_trash_or_restore_venue('trash', false); |
|
905 | + } |
|
906 | + |
|
907 | + |
|
908 | + public function restore_cpt_item($post_id) |
|
909 | + { |
|
910 | + $this->_req_data['VNU_ID'] = $post_id; |
|
911 | + $this->_trash_or_restore_venue('draft', false); |
|
912 | + } |
|
913 | + |
|
914 | + |
|
915 | + public function delete_cpt_item($post_id) |
|
916 | + { |
|
917 | + $this->_req_data['VNU_ID'] = $post_id; |
|
918 | + $this->_delete_venue(false); |
|
919 | + } |
|
920 | + |
|
921 | + |
|
922 | + public function get_venue_object() |
|
923 | + { |
|
924 | + return $this->_cpt_model_obj; |
|
925 | + } |
|
926 | + |
|
927 | + |
|
928 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
929 | + { |
|
930 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : false; |
|
931 | + |
|
932 | + // loop thru venues |
|
933 | + if ($VNU_ID) { |
|
934 | + // clean status |
|
935 | + $venue_status = sanitize_key($venue_status); |
|
936 | + // grab status |
|
937 | + if (! empty($venue_status)) { |
|
938 | + $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
939 | + } else { |
|
940 | + $success = false; |
|
941 | + $msg = esc_html__( |
|
942 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
943 | + 'event_espresso' |
|
944 | + ); |
|
945 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
946 | + } |
|
947 | + } else { |
|
948 | + $success = false; |
|
949 | + $msg = esc_html__( |
|
950 | + 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
951 | + 'event_espresso' |
|
952 | + ); |
|
953 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
954 | + } |
|
955 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
956 | + |
|
957 | + if ($redirect_after) { |
|
958 | + $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
959 | + } |
|
960 | + } |
|
961 | + |
|
962 | + |
|
963 | + protected function _trash_or_restore_venues($venue_status = 'trash') |
|
964 | + { |
|
965 | + // clean status |
|
966 | + $venue_status = sanitize_key($venue_status); |
|
967 | + // grab status |
|
968 | + if (! empty($venue_status)) { |
|
969 | + $success = true; |
|
970 | + // determine the event id and set to array. |
|
971 | + $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
972 | + // loop thru events |
|
973 | + foreach ($VNU_IDs as $VNU_ID) { |
|
974 | + if ($VNU_ID = absint($VNU_ID)) { |
|
975 | + $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
976 | + $success = $results !== false ? $success : false; |
|
977 | + } else { |
|
978 | + $msg = sprintf( |
|
979 | + esc_html__( |
|
980 | + 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
981 | + 'event_espresso' |
|
982 | + ), |
|
983 | + $VNU_ID |
|
984 | + ); |
|
985 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
986 | + $success = false; |
|
987 | + } |
|
988 | + } |
|
989 | + } else { |
|
990 | + $success = false; |
|
991 | + $msg = esc_html__( |
|
992 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
993 | + 'event_espresso' |
|
994 | + ); |
|
995 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
996 | + } |
|
997 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
998 | + $success = $success ? 2 : false; |
|
999 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
1000 | + $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
1001 | + } |
|
1002 | + |
|
1003 | + |
|
1004 | + /** |
|
1005 | + * _trash_or_restore_venues |
|
1006 | + * |
|
1007 | + * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1008 | + * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1009 | + * accepting a certain number of params. |
|
1010 | + * |
|
1011 | + * @access private |
|
1012 | + * @param int $VNU_ID |
|
1013 | + * @param string $venue_status |
|
1014 | + * @return void |
|
1015 | + */ |
|
1016 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1017 | + { |
|
1018 | + // grab venue id |
|
1019 | + if (! $VNU_ID) { |
|
1020 | + $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1021 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1022 | + return false; |
|
1023 | + } |
|
1024 | + |
|
1025 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1026 | + |
|
1027 | + // clean status |
|
1028 | + $venue_status = sanitize_key($venue_status); |
|
1029 | + // grab status |
|
1030 | + if (! $venue_status) { |
|
1031 | + $msg = esc_html__('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
|
1032 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1033 | + return false; |
|
1034 | + } |
|
1035 | + |
|
1036 | + // was event trashed or restored ? |
|
1037 | + switch ($venue_status) { |
|
1038 | + case 'draft': |
|
1039 | + $action = 'restored from the trash'; |
|
1040 | + $hook = 'AHEE_venue_restored_from_trash'; |
|
1041 | + break; |
|
1042 | + case 'trash': |
|
1043 | + $action = 'moved to the trash'; |
|
1044 | + $hook = 'AHEE_venue_moved_to_trash'; |
|
1045 | + break; |
|
1046 | + default: |
|
1047 | + $action = 'updated'; |
|
1048 | + $hook = false; |
|
1049 | + } |
|
1050 | + // use class to change status |
|
1051 | + $this->_cpt_model_obj->set_status($venue_status); |
|
1052 | + $success = $this->_cpt_model_obj->save(); |
|
1053 | + |
|
1054 | + if ($success === false) { |
|
1055 | + $msg = sprintf(esc_html__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1056 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1057 | + return false; |
|
1058 | + } |
|
1059 | + if ($hook) { |
|
1060 | + do_action($hook); |
|
1061 | + } |
|
1062 | + return true; |
|
1063 | + } |
|
1064 | + |
|
1065 | + |
|
1066 | + /** |
|
1067 | + * @param bool $redirect_after |
|
1068 | + * @return void |
|
1069 | + */ |
|
1070 | + protected function _delete_venue($redirect_after = true) |
|
1071 | + { |
|
1072 | + // determine the venue id and set to array. |
|
1073 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : null; |
|
1074 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1075 | + |
|
1076 | + |
|
1077 | + // loop thru venues |
|
1078 | + if ($VNU_ID) { |
|
1079 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1080 | + } else { |
|
1081 | + $success = false; |
|
1082 | + $msg = esc_html__( |
|
1083 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1084 | + 'event_espresso' |
|
1085 | + ); |
|
1086 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1087 | + } |
|
1088 | + if ($redirect_after) { |
|
1089 | + $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1090 | + } |
|
1091 | + } |
|
1092 | + |
|
1093 | + |
|
1094 | + protected function _delete_venues() |
|
1095 | + { |
|
1096 | + $success = true; |
|
1097 | + // determine the event id and set to array. |
|
1098 | + $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
1099 | + // loop thru events |
|
1100 | + foreach ($VNU_IDs as $VNU_ID) { |
|
1101 | + if ($VNU_ID = absint($VNU_ID)) { |
|
1102 | + $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1103 | + $success = $results !== false ? $success : false; |
|
1104 | + } else { |
|
1105 | + $success = false; |
|
1106 | + $msg = esc_html__( |
|
1107 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1108 | + 'event_espresso' |
|
1109 | + ); |
|
1110 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1111 | + } |
|
1112 | + } |
|
1113 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1114 | + $success = $success ? 2 : false; |
|
1115 | + $this->_redirect_after_action( |
|
1116 | + $success, |
|
1117 | + esc_html__('Venues', 'event_espresso'), |
|
1118 | + esc_html__('deleted', 'event_espresso'), |
|
1119 | + array('action' => 'default') |
|
1120 | + ); |
|
1121 | + } |
|
1122 | + |
|
1123 | + |
|
1124 | + // todo: put in parent |
|
1125 | + private function _delete_or_trash_venue($VNU_ID = false) |
|
1126 | + { |
|
1127 | + // grab event id |
|
1128 | + if (! $VNU_ID = absint($VNU_ID)) { |
|
1129 | + $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1130 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1131 | + return false; |
|
1132 | + } |
|
1133 | + |
|
1134 | + |
|
1135 | + $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1136 | + // first need to remove all term relationships |
|
1137 | + $venue->_remove_relations('Term_Taxonomy'); |
|
1138 | + $success = $venue->delete_permanently(); |
|
1139 | + // did it all go as planned ? |
|
1140 | + if ($success) { |
|
1141 | + $msg = sprintf(esc_html__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1142 | + EE_Error::add_success($msg); |
|
1143 | + } else { |
|
1144 | + $msg = sprintf(esc_html__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID); |
|
1145 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1146 | + return false; |
|
1147 | + } |
|
1148 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1149 | + return true; |
|
1150 | + } |
|
1151 | + |
|
1152 | + |
|
1153 | + |
|
1154 | + |
|
1155 | + /***********/ |
|
1156 | + /* QUERIES */ |
|
1157 | + |
|
1158 | + |
|
1159 | + public function get_venues($per_page = 10, $count = false) |
|
1160 | + { |
|
1161 | + |
|
1162 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1163 | + |
|
1164 | + switch ($_orderby) { |
|
1165 | + case 'id': |
|
1166 | + $orderby = 'VNU_ID'; |
|
1167 | + break; |
|
1168 | + |
|
1169 | + case 'capacity': |
|
1170 | + $orderby = 'VNU_capacity'; |
|
1171 | + break; |
|
1172 | + |
|
1173 | + case 'city': |
|
1174 | + $orderby = 'VNU_city'; |
|
1175 | + break; |
|
1176 | + |
|
1177 | + default: |
|
1178 | + $orderby = 'VNU_name'; |
|
1179 | + } |
|
1180 | + |
|
1181 | + |
|
1182 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] |
|
1183 | + : 'ASC'; |
|
1184 | + |
|
1185 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1186 | + ? $this->_req_data['paged'] : 1; |
|
1187 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1188 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1189 | + ? $this->_req_data['perpage'] : $per_page; |
|
1190 | + |
|
1191 | + |
|
1192 | + $offset = ($current_page - 1) * $per_page; |
|
1193 | + $limit = array($offset, $per_page); |
|
1194 | + |
|
1195 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 |
|
1196 | + ? $this->_req_data['category'] : null; |
|
1197 | + $where = array(); |
|
1198 | + |
|
1199 | + // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1200 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1201 | + $where['status'] = $this->_req_data['status']; |
|
1202 | + } |
|
1203 | + |
|
1204 | + if (isset($this->_req_data['venue_status'])) { |
|
1205 | + $where['status'] = $this->_req_data['venue_status']; |
|
1206 | + } |
|
1207 | + |
|
1208 | + |
|
1209 | + if ($category) { |
|
1210 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1211 | + $where['Term_Taxonomy.term_id'] = $category; |
|
1212 | + } |
|
1213 | + |
|
1214 | + |
|
1215 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1216 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1217 | + } else { |
|
1218 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1219 | + $where['OR'] = array( |
|
1220 | + 'status*restrict_private' => array('!=', 'private'), |
|
1221 | + 'AND' => array( |
|
1222 | + 'status*inclusive' => array('=', 'private'), |
|
1223 | + 'VNU_wp_user' => get_current_user_id(), |
|
1224 | + ), |
|
1225 | + ); |
|
1226 | + } |
|
1227 | + } |
|
1228 | + |
|
1229 | + |
|
1230 | + if (isset($this->_req_data['s'])) { |
|
1231 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1232 | + $where['OR'] = array( |
|
1233 | + 'VNU_name' => array('LIKE', $sstr), |
|
1234 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1235 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1236 | + 'VNU_address' => array('LIKE', $sstr), |
|
1237 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1238 | + 'VNU_city' => array('LIKE', $sstr), |
|
1239 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1240 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1241 | + 'VNU_url' => array('LIKE', $sstr), |
|
1242 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1243 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1244 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1245 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1246 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1247 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1248 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1249 | + ); |
|
1250 | + } |
|
1251 | 1251 | |
1252 | 1252 | |
1253 | - $venues = $count |
|
1254 | - ? $this->_venue_model->count(array($where), 'VNU_ID') |
|
1255 | - : $this->_venue_model->get_all( |
|
1256 | - array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort) |
|
1257 | - ); |
|
1258 | - |
|
1259 | - return $venues; |
|
1260 | - } |
|
1261 | - |
|
1262 | - |
|
1263 | - |
|
1264 | - |
|
1265 | - /** Venue Category Stuff **/ |
|
1266 | - |
|
1267 | - /** |
|
1268 | - * set the _category property with the category object for the loaded page. |
|
1269 | - * |
|
1270 | - * @access private |
|
1271 | - * @return void |
|
1272 | - */ |
|
1273 | - private function _set_category_object() |
|
1274 | - { |
|
1275 | - if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1276 | - return; |
|
1277 | - } // already have the category object so get out. |
|
1278 | - |
|
1279 | - // set default category object |
|
1280 | - $this->_set_empty_category_object(); |
|
1281 | - |
|
1282 | - // only set if we've got an id |
|
1283 | - if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1284 | - return; |
|
1285 | - } |
|
1286 | - |
|
1287 | - $category_id = absint($this->_req_data['VEN_CAT_ID']); |
|
1288 | - $term = get_term($category_id, 'espresso_venue_categories'); |
|
1289 | - |
|
1290 | - |
|
1291 | - if (! empty($term)) { |
|
1292 | - $this->_category->category_name = $term->name; |
|
1293 | - $this->_category->category_identifier = $term->slug; |
|
1294 | - $this->_category->category_desc = $term->description; |
|
1295 | - $this->_category->id = $term->term_id; |
|
1296 | - $this->_category->parent = $term->parent; |
|
1297 | - } |
|
1298 | - } |
|
1299 | - |
|
1300 | - |
|
1301 | - private function _set_empty_category_object() |
|
1302 | - { |
|
1303 | - $this->_category = new stdClass(); |
|
1304 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1305 | - $this->_category->id = $this->_category->parent = 0; |
|
1306 | - } |
|
1307 | - |
|
1308 | - |
|
1309 | - protected function _category_list_table() |
|
1310 | - { |
|
1311 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1312 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1313 | - 'add_category', |
|
1314 | - 'add_category', |
|
1315 | - array(), |
|
1316 | - 'add-new-h2' |
|
1317 | - ); |
|
1318 | - $this->_search_btn_label = esc_html__('Venue Categories', 'event_espresso'); |
|
1319 | - $this->display_admin_list_table_page_with_sidebar(); |
|
1320 | - } |
|
1321 | - |
|
1322 | - |
|
1323 | - protected function _category_details($view) |
|
1324 | - { |
|
1325 | - |
|
1326 | - // load formatter helper |
|
1327 | - // load field generator helper |
|
1328 | - |
|
1329 | - $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1330 | - $this->_set_add_edit_form_tags($route); |
|
1331 | - |
|
1332 | - $this->_set_category_object(); |
|
1333 | - $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1334 | - |
|
1335 | - $delete_action = 'delete_category'; |
|
1336 | - |
|
1337 | - $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1338 | - |
|
1339 | - $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1340 | - |
|
1341 | - // take care of contents |
|
1342 | - $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1343 | - $this->display_admin_page_with_sidebar(); |
|
1344 | - } |
|
1345 | - |
|
1346 | - |
|
1347 | - protected function _category_details_content() |
|
1348 | - { |
|
1349 | - $editor_args['category_desc'] = array( |
|
1350 | - 'type' => 'wp_editor', |
|
1351 | - 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1352 | - 'class' => 'my_editor_custom', |
|
1353 | - 'wpeditor_args' => array('media_buttons' => false), |
|
1354 | - ); |
|
1355 | - $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1356 | - |
|
1357 | - $all_terms = get_terms( |
|
1358 | - array('espresso_venue_categories'), |
|
1359 | - array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
1360 | - ); |
|
1361 | - |
|
1362 | - // setup category select for term parents. |
|
1363 | - $category_select_values[] = array( |
|
1364 | - 'text' => esc_html__('No Parent', 'event_espresso'), |
|
1365 | - 'id' => 0, |
|
1366 | - ); |
|
1367 | - foreach ($all_terms as $term) { |
|
1368 | - $category_select_values[] = array( |
|
1369 | - 'text' => $term->name, |
|
1370 | - 'id' => $term->term_id, |
|
1371 | - ); |
|
1372 | - } |
|
1373 | - |
|
1374 | - $category_select = EEH_Form_Fields::select_input( |
|
1375 | - 'category_parent', |
|
1376 | - $category_select_values, |
|
1377 | - $this->_category->parent |
|
1378 | - ); |
|
1379 | - $template_args = array( |
|
1380 | - 'category' => $this->_category, |
|
1381 | - 'category_select' => $category_select, |
|
1382 | - 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1383 | - 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1384 | - 'disable' => '', |
|
1385 | - 'disabled_message' => false, |
|
1386 | - ); |
|
1387 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1388 | - return EEH_Template::display_template($template, $template_args, true); |
|
1389 | - } |
|
1390 | - |
|
1391 | - |
|
1392 | - protected function _delete_categories() |
|
1393 | - { |
|
1394 | - $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] |
|
1395 | - : (array) $this->_req_data['category_id']; |
|
1396 | - |
|
1397 | - foreach ($cat_ids as $cat_id) { |
|
1398 | - $this->_delete_category($cat_id); |
|
1399 | - } |
|
1400 | - |
|
1401 | - // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1402 | - $query_args = array( |
|
1403 | - 'action' => 'category_list', |
|
1404 | - ); |
|
1405 | - $this->_redirect_after_action(0, '', '', $query_args); |
|
1406 | - } |
|
1407 | - |
|
1408 | - |
|
1409 | - protected function _delete_category($cat_id) |
|
1410 | - { |
|
1411 | - $cat_id = absint($cat_id); |
|
1412 | - wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1413 | - } |
|
1414 | - |
|
1415 | - |
|
1416 | - protected function _insert_or_update_category($new_category) |
|
1417 | - { |
|
1418 | - |
|
1419 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1420 | - $success = 0; // we already have a success message so lets not send another. |
|
1421 | - if ($cat_id) { |
|
1422 | - $query_args = array( |
|
1423 | - 'action' => 'edit_category', |
|
1424 | - 'VEN_CAT_ID' => $cat_id, |
|
1425 | - ); |
|
1426 | - } else { |
|
1427 | - $query_args = array('action' => 'add_category'); |
|
1428 | - } |
|
1429 | - $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1430 | - } |
|
1431 | - |
|
1432 | - |
|
1433 | - private function _insert_category($update = false) |
|
1434 | - { |
|
1435 | - $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
|
1436 | - $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1437 | - $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1438 | - $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1439 | - |
|
1440 | - if (empty($category_name)) { |
|
1441 | - $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
1442 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1443 | - return false; |
|
1444 | - } |
|
1445 | - |
|
1446 | - |
|
1447 | - $term_args = array( |
|
1448 | - 'name' => $category_name, |
|
1449 | - 'description' => $category_desc, |
|
1450 | - 'parent' => $category_parent, |
|
1451 | - ); |
|
1452 | - |
|
1453 | - $insert_ids = $update |
|
1454 | - ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) |
|
1455 | - : wp_insert_term( |
|
1456 | - $category_name, |
|
1457 | - 'espresso_venue_categories', |
|
1458 | - $term_args |
|
1459 | - ); |
|
1460 | - |
|
1461 | - if (! is_array($insert_ids)) { |
|
1462 | - $msg = esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1463 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1464 | - } else { |
|
1465 | - $cat_id = $insert_ids['term_id']; |
|
1466 | - $msg = sprintf(esc_html__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1467 | - EE_Error::add_success($msg); |
|
1468 | - } |
|
1469 | - |
|
1470 | - return $cat_id; |
|
1471 | - } |
|
1472 | - |
|
1473 | - |
|
1474 | - /** |
|
1475 | - * TODO handle category exports() |
|
1476 | - * |
|
1477 | - * @return file export |
|
1478 | - */ |
|
1479 | - protected function _categories_export() |
|
1480 | - { |
|
1481 | - |
|
1482 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1483 | - $new_request_args = array( |
|
1484 | - 'export' => 'report', |
|
1485 | - 'action' => 'categories', |
|
1486 | - 'category_ids' => $this->_req_data['VEN_CAT_ID'], |
|
1487 | - ); |
|
1488 | - |
|
1489 | - $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1490 | - |
|
1491 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1492 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1493 | - $EE_Export = EE_Export::instance($this->_req_data); |
|
1494 | - $EE_Export->export(); |
|
1495 | - } |
|
1496 | - } |
|
1497 | - |
|
1498 | - |
|
1499 | - protected function _import_categories() |
|
1500 | - { |
|
1501 | - |
|
1502 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1503 | - EE_Import::instance()->import(); |
|
1504 | - } |
|
1505 | - |
|
1506 | - |
|
1507 | - public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1508 | - { |
|
1509 | - |
|
1510 | - // testing term stuff |
|
1511 | - $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1512 | - $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1513 | - $limit = ($current_page - 1) * $per_page; |
|
1514 | - $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1515 | - if (isset($this->_req_data['s'])) { |
|
1516 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1517 | - $where['OR'] = array( |
|
1518 | - 'Term.name' => array('LIKE', $sstr), |
|
1519 | - 'description' => array('LIKE', $sstr), |
|
1520 | - ); |
|
1521 | - } |
|
1522 | - |
|
1523 | - $query_params = array( |
|
1524 | - $where, |
|
1525 | - 'order_by' => array($orderby => $order), |
|
1526 | - 'limit' => $limit . ',' . $per_page, |
|
1527 | - 'force_join' => array('Term'), |
|
1528 | - ); |
|
1529 | - |
|
1530 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1531 | - : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1532 | - |
|
1533 | - return $categories; |
|
1534 | - } |
|
1535 | - |
|
1536 | - |
|
1537 | - /* end category stuff */ |
|
1538 | - /**************/ |
|
1253 | + $venues = $count |
|
1254 | + ? $this->_venue_model->count(array($where), 'VNU_ID') |
|
1255 | + : $this->_venue_model->get_all( |
|
1256 | + array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort) |
|
1257 | + ); |
|
1258 | + |
|
1259 | + return $venues; |
|
1260 | + } |
|
1261 | + |
|
1262 | + |
|
1263 | + |
|
1264 | + |
|
1265 | + /** Venue Category Stuff **/ |
|
1266 | + |
|
1267 | + /** |
|
1268 | + * set the _category property with the category object for the loaded page. |
|
1269 | + * |
|
1270 | + * @access private |
|
1271 | + * @return void |
|
1272 | + */ |
|
1273 | + private function _set_category_object() |
|
1274 | + { |
|
1275 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1276 | + return; |
|
1277 | + } // already have the category object so get out. |
|
1278 | + |
|
1279 | + // set default category object |
|
1280 | + $this->_set_empty_category_object(); |
|
1281 | + |
|
1282 | + // only set if we've got an id |
|
1283 | + if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1284 | + return; |
|
1285 | + } |
|
1286 | + |
|
1287 | + $category_id = absint($this->_req_data['VEN_CAT_ID']); |
|
1288 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1289 | + |
|
1290 | + |
|
1291 | + if (! empty($term)) { |
|
1292 | + $this->_category->category_name = $term->name; |
|
1293 | + $this->_category->category_identifier = $term->slug; |
|
1294 | + $this->_category->category_desc = $term->description; |
|
1295 | + $this->_category->id = $term->term_id; |
|
1296 | + $this->_category->parent = $term->parent; |
|
1297 | + } |
|
1298 | + } |
|
1299 | + |
|
1300 | + |
|
1301 | + private function _set_empty_category_object() |
|
1302 | + { |
|
1303 | + $this->_category = new stdClass(); |
|
1304 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1305 | + $this->_category->id = $this->_category->parent = 0; |
|
1306 | + } |
|
1307 | + |
|
1308 | + |
|
1309 | + protected function _category_list_table() |
|
1310 | + { |
|
1311 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1312 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1313 | + 'add_category', |
|
1314 | + 'add_category', |
|
1315 | + array(), |
|
1316 | + 'add-new-h2' |
|
1317 | + ); |
|
1318 | + $this->_search_btn_label = esc_html__('Venue Categories', 'event_espresso'); |
|
1319 | + $this->display_admin_list_table_page_with_sidebar(); |
|
1320 | + } |
|
1321 | + |
|
1322 | + |
|
1323 | + protected function _category_details($view) |
|
1324 | + { |
|
1325 | + |
|
1326 | + // load formatter helper |
|
1327 | + // load field generator helper |
|
1328 | + |
|
1329 | + $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1330 | + $this->_set_add_edit_form_tags($route); |
|
1331 | + |
|
1332 | + $this->_set_category_object(); |
|
1333 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1334 | + |
|
1335 | + $delete_action = 'delete_category'; |
|
1336 | + |
|
1337 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1338 | + |
|
1339 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1340 | + |
|
1341 | + // take care of contents |
|
1342 | + $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1343 | + $this->display_admin_page_with_sidebar(); |
|
1344 | + } |
|
1345 | + |
|
1346 | + |
|
1347 | + protected function _category_details_content() |
|
1348 | + { |
|
1349 | + $editor_args['category_desc'] = array( |
|
1350 | + 'type' => 'wp_editor', |
|
1351 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1352 | + 'class' => 'my_editor_custom', |
|
1353 | + 'wpeditor_args' => array('media_buttons' => false), |
|
1354 | + ); |
|
1355 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1356 | + |
|
1357 | + $all_terms = get_terms( |
|
1358 | + array('espresso_venue_categories'), |
|
1359 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
1360 | + ); |
|
1361 | + |
|
1362 | + // setup category select for term parents. |
|
1363 | + $category_select_values[] = array( |
|
1364 | + 'text' => esc_html__('No Parent', 'event_espresso'), |
|
1365 | + 'id' => 0, |
|
1366 | + ); |
|
1367 | + foreach ($all_terms as $term) { |
|
1368 | + $category_select_values[] = array( |
|
1369 | + 'text' => $term->name, |
|
1370 | + 'id' => $term->term_id, |
|
1371 | + ); |
|
1372 | + } |
|
1373 | + |
|
1374 | + $category_select = EEH_Form_Fields::select_input( |
|
1375 | + 'category_parent', |
|
1376 | + $category_select_values, |
|
1377 | + $this->_category->parent |
|
1378 | + ); |
|
1379 | + $template_args = array( |
|
1380 | + 'category' => $this->_category, |
|
1381 | + 'category_select' => $category_select, |
|
1382 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1383 | + 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1384 | + 'disable' => '', |
|
1385 | + 'disabled_message' => false, |
|
1386 | + ); |
|
1387 | + $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1388 | + return EEH_Template::display_template($template, $template_args, true); |
|
1389 | + } |
|
1390 | + |
|
1391 | + |
|
1392 | + protected function _delete_categories() |
|
1393 | + { |
|
1394 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] |
|
1395 | + : (array) $this->_req_data['category_id']; |
|
1396 | + |
|
1397 | + foreach ($cat_ids as $cat_id) { |
|
1398 | + $this->_delete_category($cat_id); |
|
1399 | + } |
|
1400 | + |
|
1401 | + // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1402 | + $query_args = array( |
|
1403 | + 'action' => 'category_list', |
|
1404 | + ); |
|
1405 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1406 | + } |
|
1407 | + |
|
1408 | + |
|
1409 | + protected function _delete_category($cat_id) |
|
1410 | + { |
|
1411 | + $cat_id = absint($cat_id); |
|
1412 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1413 | + } |
|
1414 | + |
|
1415 | + |
|
1416 | + protected function _insert_or_update_category($new_category) |
|
1417 | + { |
|
1418 | + |
|
1419 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1420 | + $success = 0; // we already have a success message so lets not send another. |
|
1421 | + if ($cat_id) { |
|
1422 | + $query_args = array( |
|
1423 | + 'action' => 'edit_category', |
|
1424 | + 'VEN_CAT_ID' => $cat_id, |
|
1425 | + ); |
|
1426 | + } else { |
|
1427 | + $query_args = array('action' => 'add_category'); |
|
1428 | + } |
|
1429 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1430 | + } |
|
1431 | + |
|
1432 | + |
|
1433 | + private function _insert_category($update = false) |
|
1434 | + { |
|
1435 | + $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
|
1436 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1437 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1438 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1439 | + |
|
1440 | + if (empty($category_name)) { |
|
1441 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
1442 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1443 | + return false; |
|
1444 | + } |
|
1445 | + |
|
1446 | + |
|
1447 | + $term_args = array( |
|
1448 | + 'name' => $category_name, |
|
1449 | + 'description' => $category_desc, |
|
1450 | + 'parent' => $category_parent, |
|
1451 | + ); |
|
1452 | + |
|
1453 | + $insert_ids = $update |
|
1454 | + ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) |
|
1455 | + : wp_insert_term( |
|
1456 | + $category_name, |
|
1457 | + 'espresso_venue_categories', |
|
1458 | + $term_args |
|
1459 | + ); |
|
1460 | + |
|
1461 | + if (! is_array($insert_ids)) { |
|
1462 | + $msg = esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1463 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1464 | + } else { |
|
1465 | + $cat_id = $insert_ids['term_id']; |
|
1466 | + $msg = sprintf(esc_html__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1467 | + EE_Error::add_success($msg); |
|
1468 | + } |
|
1469 | + |
|
1470 | + return $cat_id; |
|
1471 | + } |
|
1472 | + |
|
1473 | + |
|
1474 | + /** |
|
1475 | + * TODO handle category exports() |
|
1476 | + * |
|
1477 | + * @return file export |
|
1478 | + */ |
|
1479 | + protected function _categories_export() |
|
1480 | + { |
|
1481 | + |
|
1482 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1483 | + $new_request_args = array( |
|
1484 | + 'export' => 'report', |
|
1485 | + 'action' => 'categories', |
|
1486 | + 'category_ids' => $this->_req_data['VEN_CAT_ID'], |
|
1487 | + ); |
|
1488 | + |
|
1489 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1490 | + |
|
1491 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1492 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1493 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1494 | + $EE_Export->export(); |
|
1495 | + } |
|
1496 | + } |
|
1497 | + |
|
1498 | + |
|
1499 | + protected function _import_categories() |
|
1500 | + { |
|
1501 | + |
|
1502 | + require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1503 | + EE_Import::instance()->import(); |
|
1504 | + } |
|
1505 | + |
|
1506 | + |
|
1507 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1508 | + { |
|
1509 | + |
|
1510 | + // testing term stuff |
|
1511 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1512 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1513 | + $limit = ($current_page - 1) * $per_page; |
|
1514 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1515 | + if (isset($this->_req_data['s'])) { |
|
1516 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1517 | + $where['OR'] = array( |
|
1518 | + 'Term.name' => array('LIKE', $sstr), |
|
1519 | + 'description' => array('LIKE', $sstr), |
|
1520 | + ); |
|
1521 | + } |
|
1522 | + |
|
1523 | + $query_params = array( |
|
1524 | + $where, |
|
1525 | + 'order_by' => array($orderby => $order), |
|
1526 | + 'limit' => $limit . ',' . $per_page, |
|
1527 | + 'force_join' => array('Term'), |
|
1528 | + ); |
|
1529 | + |
|
1530 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1531 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1532 | + |
|
1533 | + return $categories; |
|
1534 | + } |
|
1535 | + |
|
1536 | + |
|
1537 | + /* end category stuff */ |
|
1538 | + /**************/ |
|
1539 | 1539 | } |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | |
46 | 46 | protected function _init_page_props() |
47 | 47 | { |
48 | - require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
48 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
49 | 49 | $this->page_slug = EE_VENUES_PG_SLUG; |
50 | 50 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
51 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
51 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
52 | 52 | $this->page_label = esc_html__('Event Venues', 'event_espresso'); |
53 | 53 | $this->_cpt_model_names = array( |
54 | 54 | 'create_new' => 'EEM_Venue', |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | |
464 | 464 | public function load_scripts_styles() |
465 | 465 | { |
466 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
466 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
467 | 467 | wp_enqueue_style('ee-cat-admin'); |
468 | 468 | } |
469 | 469 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | wp_enqueue_style('espresso-ui-theme'); |
486 | 486 | wp_register_style( |
487 | 487 | 'espresso_venues', |
488 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
488 | + EE_VENUES_ASSETS_URL.'ee-venues-admin.css', |
|
489 | 489 | array(), |
490 | 490 | EVENT_ESPRESSO_VERSION |
491 | 491 | ); |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | esc_html__("View Venue Archive Page", "event_espresso"), |
545 | 545 | 'button' |
546 | 546 | ); |
547 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
547 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
548 | 548 | $this->_search_btn_label = esc_html__('Venues', 'event_espresso'); |
549 | 549 | $this->display_admin_list_table_page_with_sidebar(); |
550 | 550 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
558 | 558 | 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
559 | 559 | ); |
560 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
560 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
561 | 561 | EEH_Template::display_template($template, $extra_rows); |
562 | 562 | } |
563 | 563 | |
@@ -574,21 +574,21 @@ discard block |
||
574 | 574 | $default_map_settings->use_google_maps = true; |
575 | 575 | $default_map_settings->google_map_api_key = ''; |
576 | 576 | // for event details pages (reg page) |
577 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
578 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
579 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
580 | - $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
581 | - $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
582 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
583 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
577 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
578 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
579 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
580 | + $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
581 | + $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
582 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
583 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
584 | 584 | // for event list pages |
585 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
586 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
587 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
588 | - $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
589 | - $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
590 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
591 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
585 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
586 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
587 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
588 | + $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
589 | + $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
590 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
591 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
592 | 592 | |
593 | 593 | $this->_template_args['map_settings'] = |
594 | 594 | isset(EE_Registry::instance()->CFG->map_settings) |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $this->_set_add_edit_form_tags('update_google_map_settings'); |
603 | 603 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
604 | 604 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
605 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
605 | + EE_VENUES_TEMPLATE_PATH.'google_map.template.php', |
|
606 | 606 | $this->_template_args, |
607 | 607 | true |
608 | 608 | ); |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | ), |
751 | 751 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
752 | 752 | ); |
753 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
753 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
754 | 754 | EEH_Template::display_template($template, $template_args); |
755 | 755 | } |
756 | 756 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | ) |
792 | 792 | ); |
793 | 793 | |
794 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
794 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
795 | 795 | EEH_Template::display_template($template, $template_args); |
796 | 796 | } |
797 | 797 | |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | $template_args = array( |
802 | 802 | '_venue' => $this->_cpt_model_obj, |
803 | 803 | ); |
804 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
804 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
805 | 805 | EEH_Template::display_template($template, $template_args); |
806 | 806 | } |
807 | 807 | |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | { |
827 | 827 | |
828 | 828 | if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
829 | - return;// get out we're not processing the saving of venues. |
|
829 | + return; // get out we're not processing the saving of venues. |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | // clean status |
935 | 935 | $venue_status = sanitize_key($venue_status); |
936 | 936 | // grab status |
937 | - if (! empty($venue_status)) { |
|
937 | + if ( ! empty($venue_status)) { |
|
938 | 938 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
939 | 939 | } else { |
940 | 940 | $success = false; |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | // clean status |
966 | 966 | $venue_status = sanitize_key($venue_status); |
967 | 967 | // grab status |
968 | - if (! empty($venue_status)) { |
|
968 | + if ( ! empty($venue_status)) { |
|
969 | 969 | $success = true; |
970 | 970 | // determine the event id and set to array. |
971 | 971 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
1017 | 1017 | { |
1018 | 1018 | // grab venue id |
1019 | - if (! $VNU_ID) { |
|
1019 | + if ( ! $VNU_ID) { |
|
1020 | 1020 | $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1021 | 1021 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1022 | 1022 | return false; |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | // clean status |
1028 | 1028 | $venue_status = sanitize_key($venue_status); |
1029 | 1029 | // grab status |
1030 | - if (! $venue_status) { |
|
1030 | + if ( ! $venue_status) { |
|
1031 | 1031 | $msg = esc_html__('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
1032 | 1032 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1033 | 1033 | return false; |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | private function _delete_or_trash_venue($VNU_ID = false) |
1126 | 1126 | { |
1127 | 1127 | // grab event id |
1128 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1128 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1129 | 1129 | $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1130 | 1130 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1131 | 1131 | return false; |
@@ -1212,10 +1212,10 @@ discard block |
||
1212 | 1212 | } |
1213 | 1213 | |
1214 | 1214 | |
1215 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1215 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1216 | 1216 | $where['VNU_wp_user'] = get_current_user_id(); |
1217 | 1217 | } else { |
1218 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1218 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1219 | 1219 | $where['OR'] = array( |
1220 | 1220 | 'status*restrict_private' => array('!=', 'private'), |
1221 | 1221 | 'AND' => array( |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | |
1229 | 1229 | |
1230 | 1230 | if (isset($this->_req_data['s'])) { |
1231 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1231 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1232 | 1232 | $where['OR'] = array( |
1233 | 1233 | 'VNU_name' => array('LIKE', $sstr), |
1234 | 1234 | 'VNU_desc' => array('LIKE', $sstr), |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | $this->_set_empty_category_object(); |
1281 | 1281 | |
1282 | 1282 | // only set if we've got an id |
1283 | - if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1283 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1284 | 1284 | return; |
1285 | 1285 | } |
1286 | 1286 | |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | $term = get_term($category_id, 'espresso_venue_categories'); |
1289 | 1289 | |
1290 | 1290 | |
1291 | - if (! empty($term)) { |
|
1291 | + if ( ! empty($term)) { |
|
1292 | 1292 | $this->_category->category_name = $term->name; |
1293 | 1293 | $this->_category->category_identifier = $term->slug; |
1294 | 1294 | $this->_category->category_desc = $term->description; |
@@ -1309,7 +1309,7 @@ discard block |
||
1309 | 1309 | protected function _category_list_table() |
1310 | 1310 | { |
1311 | 1311 | do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
1312 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1312 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
1313 | 1313 | 'add_category', |
1314 | 1314 | 'add_category', |
1315 | 1315 | array(), |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | 'disable' => '', |
1385 | 1385 | 'disabled_message' => false, |
1386 | 1386 | ); |
1387 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1387 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1388 | 1388 | return EEH_Template::display_template($template, $template_args, true); |
1389 | 1389 | } |
1390 | 1390 | |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | $term_args |
1459 | 1459 | ); |
1460 | 1460 | |
1461 | - if (! is_array($insert_ids)) { |
|
1461 | + if ( ! is_array($insert_ids)) { |
|
1462 | 1462 | $msg = esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
1463 | 1463 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1464 | 1464 | } else { |
@@ -1488,8 +1488,8 @@ discard block |
||
1488 | 1488 | |
1489 | 1489 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
1490 | 1490 | |
1491 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1492 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1491 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1492 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1493 | 1493 | $EE_Export = EE_Export::instance($this->_req_data); |
1494 | 1494 | $EE_Export->export(); |
1495 | 1495 | } |
@@ -1499,7 +1499,7 @@ discard block |
||
1499 | 1499 | protected function _import_categories() |
1500 | 1500 | { |
1501 | 1501 | |
1502 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1502 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1503 | 1503 | EE_Import::instance()->import(); |
1504 | 1504 | } |
1505 | 1505 | |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | $limit = ($current_page - 1) * $per_page; |
1514 | 1514 | $where = array('taxonomy' => 'espresso_venue_categories'); |
1515 | 1515 | if (isset($this->_req_data['s'])) { |
1516 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1516 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1517 | 1517 | $where['OR'] = array( |
1518 | 1518 | 'Term.name' => array('LIKE', $sstr), |
1519 | 1519 | 'description' => array('LIKE', $sstr), |
@@ -1523,7 +1523,7 @@ discard block |
||
1523 | 1523 | $query_params = array( |
1524 | 1524 | $where, |
1525 | 1525 | 'order_by' => array($orderby => $order), |
1526 | - 'limit' => $limit . ',' . $per_page, |
|
1526 | + 'limit' => $limit.','.$per_page, |
|
1527 | 1527 | 'force_join' => array('Term'), |
1528 | 1528 | ); |
1529 | 1529 |
@@ -16,246 +16,246 @@ |
||
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' => esc_html__('Event Venue', 'event_espresso'), |
|
36 | - 'plural' => esc_html__('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' => esc_html__('ID', 'event_espresso'), |
|
44 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
45 | - 'address' => esc_html__('Address', 'event_espresso'), |
|
46 | - 'city' => esc_html__('City', 'event_espresso'), |
|
47 | - 'capacity' => esc_html__('Capacity', 'event_espresso'), |
|
48 | - // 'shortcode' => esc_html__('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 . '" title="' . esc_attr__( |
|
136 | - 'Edit Venue', |
|
137 | - 'event_espresso' |
|
138 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - if ( |
|
143 | - EE_Registry::instance()->CAP->current_user_can( |
|
144 | - 'ee_delete_venue', |
|
145 | - 'espresso_venues_trash_venue', |
|
146 | - $item->ID() |
|
147 | - ) |
|
148 | - ) { |
|
149 | - $trash_event_query_arg = array( |
|
150 | - 'action' => 'trash_venue', |
|
151 | - 'VNU_ID' => $item->ID(), |
|
152 | - ); |
|
153 | - $trash_venue_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_arg, EE_VENUES_ADMIN_URL); |
|
154 | - } |
|
155 | - |
|
156 | - if ( |
|
157 | - EE_Registry::instance()->CAP->current_user_can( |
|
158 | - 'ee_delete_venue', |
|
159 | - 'espresso_venues_restore_venue', |
|
160 | - $item->ID() |
|
161 | - ) |
|
162 | - ) { |
|
163 | - $restore_venue_query_args = array( |
|
164 | - 'action' => 'restore_venue', |
|
165 | - 'VNU_ID' => $item->ID(), |
|
166 | - ); |
|
167 | - $restore_venue_link = EE_Admin_Page::add_query_args_and_nonce( |
|
168 | - $restore_venue_query_args, |
|
169 | - EE_VENUES_ADMIN_URL |
|
170 | - ); |
|
171 | - } |
|
172 | - |
|
173 | - if ( |
|
174 | - EE_Registry::instance()->CAP->current_user_can( |
|
175 | - 'ee_delete_venue', |
|
176 | - 'espresso_venues_delete_venue', |
|
177 | - $item->ID() |
|
178 | - ) |
|
179 | - ) { |
|
180 | - $delete_venue_query_args = array( |
|
181 | - 'action' => 'delete_venue', |
|
182 | - 'VNU_ID' => $item->ID(), |
|
183 | - ); |
|
184 | - $delete_venue_link = EE_Admin_Page::add_query_args_and_nonce($delete_venue_query_args, EE_VENUES_ADMIN_URL); |
|
185 | - } |
|
186 | - |
|
187 | - $view_link = get_permalink($item->ID()); |
|
188 | - |
|
189 | - switch ($item->get('status')) { |
|
190 | - case 'trash': |
|
191 | - if ( |
|
192 | - EE_Registry::instance()->CAP->current_user_can( |
|
193 | - 'ee_delete_venue', |
|
194 | - 'espresso_venues_restore_venue', |
|
195 | - $item->ID() |
|
196 | - ) |
|
197 | - ) { |
|
198 | - $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '" title="' . esc_attr__( |
|
199 | - 'Restore from Trash', |
|
200 | - 'event_espresso' |
|
201 | - ) . '">' . esc_html__('Restore from Trash', 'event_espresso') . '</a>'; |
|
202 | - } |
|
203 | - if ( |
|
204 | - $item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can( |
|
205 | - 'ee_delete_venue', |
|
206 | - 'espresso_venues_delete_venue', |
|
207 | - $item->ID() |
|
208 | - ) |
|
209 | - ) { |
|
210 | - $actions['delete permanently'] = '<a href="' . $delete_venue_link . '" title="' . esc_attr__( |
|
211 | - 'Delete Permanently', |
|
212 | - 'event_espresso' |
|
213 | - ) . '">' . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
214 | - } |
|
215 | - break; |
|
216 | - default: |
|
217 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__( |
|
218 | - 'View Venue', |
|
219 | - 'event_espresso' |
|
220 | - ) . '">' . esc_html__('View', 'event_espresso') . '</a>'; |
|
221 | - if ( |
|
222 | - EE_Registry::instance()->CAP->current_user_can( |
|
223 | - 'ee_delete_venue', |
|
224 | - 'espresso_venues_trash_venue', |
|
225 | - $item->ID() |
|
226 | - ) |
|
227 | - ) { |
|
228 | - $actions['move to trash'] = '<a href="' . $trash_venue_link . '" title="' . esc_attr__( |
|
229 | - 'Trash Event', |
|
230 | - 'event_espresso' |
|
231 | - ) . '">' . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
232 | - } |
|
233 | - } |
|
234 | - return $actions; |
|
235 | - } |
|
236 | - |
|
237 | - |
|
238 | - public function column_address($item) |
|
239 | - { |
|
240 | - return $item->address(); |
|
241 | - } |
|
242 | - |
|
243 | - |
|
244 | - public function column_city($item) |
|
245 | - { |
|
246 | - return $item->city(); |
|
247 | - } |
|
248 | - |
|
249 | - |
|
250 | - public function column_capacity($item) |
|
251 | - { |
|
252 | - return $item->capacity(); |
|
253 | - } |
|
254 | - |
|
255 | - |
|
256 | - public function column_shortcode($item) |
|
257 | - { |
|
258 | - $content = '[ESPRESSO_VENUE id=' . $item->ID() . ']'; |
|
259 | - return $content; |
|
260 | - } |
|
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' => esc_html__('Event Venue', 'event_espresso'), |
|
36 | + 'plural' => esc_html__('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' => esc_html__('ID', 'event_espresso'), |
|
44 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
45 | + 'address' => esc_html__('Address', 'event_espresso'), |
|
46 | + 'city' => esc_html__('City', 'event_espresso'), |
|
47 | + 'capacity' => esc_html__('Capacity', 'event_espresso'), |
|
48 | + // 'shortcode' => esc_html__('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 . '" title="' . esc_attr__( |
|
136 | + 'Edit Venue', |
|
137 | + 'event_espresso' |
|
138 | + ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + if ( |
|
143 | + EE_Registry::instance()->CAP->current_user_can( |
|
144 | + 'ee_delete_venue', |
|
145 | + 'espresso_venues_trash_venue', |
|
146 | + $item->ID() |
|
147 | + ) |
|
148 | + ) { |
|
149 | + $trash_event_query_arg = array( |
|
150 | + 'action' => 'trash_venue', |
|
151 | + 'VNU_ID' => $item->ID(), |
|
152 | + ); |
|
153 | + $trash_venue_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_arg, EE_VENUES_ADMIN_URL); |
|
154 | + } |
|
155 | + |
|
156 | + if ( |
|
157 | + EE_Registry::instance()->CAP->current_user_can( |
|
158 | + 'ee_delete_venue', |
|
159 | + 'espresso_venues_restore_venue', |
|
160 | + $item->ID() |
|
161 | + ) |
|
162 | + ) { |
|
163 | + $restore_venue_query_args = array( |
|
164 | + 'action' => 'restore_venue', |
|
165 | + 'VNU_ID' => $item->ID(), |
|
166 | + ); |
|
167 | + $restore_venue_link = EE_Admin_Page::add_query_args_and_nonce( |
|
168 | + $restore_venue_query_args, |
|
169 | + EE_VENUES_ADMIN_URL |
|
170 | + ); |
|
171 | + } |
|
172 | + |
|
173 | + if ( |
|
174 | + EE_Registry::instance()->CAP->current_user_can( |
|
175 | + 'ee_delete_venue', |
|
176 | + 'espresso_venues_delete_venue', |
|
177 | + $item->ID() |
|
178 | + ) |
|
179 | + ) { |
|
180 | + $delete_venue_query_args = array( |
|
181 | + 'action' => 'delete_venue', |
|
182 | + 'VNU_ID' => $item->ID(), |
|
183 | + ); |
|
184 | + $delete_venue_link = EE_Admin_Page::add_query_args_and_nonce($delete_venue_query_args, EE_VENUES_ADMIN_URL); |
|
185 | + } |
|
186 | + |
|
187 | + $view_link = get_permalink($item->ID()); |
|
188 | + |
|
189 | + switch ($item->get('status')) { |
|
190 | + case 'trash': |
|
191 | + if ( |
|
192 | + EE_Registry::instance()->CAP->current_user_can( |
|
193 | + 'ee_delete_venue', |
|
194 | + 'espresso_venues_restore_venue', |
|
195 | + $item->ID() |
|
196 | + ) |
|
197 | + ) { |
|
198 | + $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '" title="' . esc_attr__( |
|
199 | + 'Restore from Trash', |
|
200 | + 'event_espresso' |
|
201 | + ) . '">' . esc_html__('Restore from Trash', 'event_espresso') . '</a>'; |
|
202 | + } |
|
203 | + if ( |
|
204 | + $item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can( |
|
205 | + 'ee_delete_venue', |
|
206 | + 'espresso_venues_delete_venue', |
|
207 | + $item->ID() |
|
208 | + ) |
|
209 | + ) { |
|
210 | + $actions['delete permanently'] = '<a href="' . $delete_venue_link . '" title="' . esc_attr__( |
|
211 | + 'Delete Permanently', |
|
212 | + 'event_espresso' |
|
213 | + ) . '">' . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
214 | + } |
|
215 | + break; |
|
216 | + default: |
|
217 | + $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__( |
|
218 | + 'View Venue', |
|
219 | + 'event_espresso' |
|
220 | + ) . '">' . esc_html__('View', 'event_espresso') . '</a>'; |
|
221 | + if ( |
|
222 | + EE_Registry::instance()->CAP->current_user_can( |
|
223 | + 'ee_delete_venue', |
|
224 | + 'espresso_venues_trash_venue', |
|
225 | + $item->ID() |
|
226 | + ) |
|
227 | + ) { |
|
228 | + $actions['move to trash'] = '<a href="' . $trash_venue_link . '" title="' . esc_attr__( |
|
229 | + 'Trash Event', |
|
230 | + 'event_espresso' |
|
231 | + ) . '">' . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
232 | + } |
|
233 | + } |
|
234 | + return $actions; |
|
235 | + } |
|
236 | + |
|
237 | + |
|
238 | + public function column_address($item) |
|
239 | + { |
|
240 | + return $item->address(); |
|
241 | + } |
|
242 | + |
|
243 | + |
|
244 | + public function column_city($item) |
|
245 | + { |
|
246 | + return $item->city(); |
|
247 | + } |
|
248 | + |
|
249 | + |
|
250 | + public function column_capacity($item) |
|
251 | + { |
|
252 | + return $item->capacity(); |
|
253 | + } |
|
254 | + |
|
255 | + |
|
256 | + public function column_shortcode($item) |
|
257 | + { |
|
258 | + $content = '[ESPRESSO_VENUE id=' . $item->ID() . ']'; |
|
259 | + return $content; |
|
260 | + } |
|
261 | 261 | } |
@@ -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,10 +132,10 @@ 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 . '" title="' . esc_attr__( |
|
135 | + $actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__( |
|
136 | 136 | 'Edit Venue', |
137 | 137 | 'event_espresso' |
138 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
138 | + ).'">'.esc_html__('Edit', 'event_espresso').'</a>'; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | $item->ID() |
196 | 196 | ) |
197 | 197 | ) { |
198 | - $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '" title="' . esc_attr__( |
|
198 | + $actions['restore_from_trash'] = '<a href="'.$restore_venue_link.'" title="'.esc_attr__( |
|
199 | 199 | 'Restore from Trash', |
200 | 200 | 'event_espresso' |
201 | - ) . '">' . esc_html__('Restore from Trash', 'event_espresso') . '</a>'; |
|
201 | + ).'">'.esc_html__('Restore from Trash', 'event_espresso').'</a>'; |
|
202 | 202 | } |
203 | 203 | if ( |
204 | 204 | $item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can( |
@@ -207,17 +207,17 @@ discard block |
||
207 | 207 | $item->ID() |
208 | 208 | ) |
209 | 209 | ) { |
210 | - $actions['delete permanently'] = '<a href="' . $delete_venue_link . '" title="' . esc_attr__( |
|
210 | + $actions['delete permanently'] = '<a href="'.$delete_venue_link.'" title="'.esc_attr__( |
|
211 | 211 | 'Delete Permanently', |
212 | 212 | 'event_espresso' |
213 | - ) . '">' . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
213 | + ).'">'.esc_html__('Delete Permanently', 'event_espresso').'</a>'; |
|
214 | 214 | } |
215 | 215 | break; |
216 | 216 | default: |
217 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__( |
|
217 | + $actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__( |
|
218 | 218 | 'View Venue', |
219 | 219 | 'event_espresso' |
220 | - ) . '">' . esc_html__('View', 'event_espresso') . '</a>'; |
|
220 | + ).'">'.esc_html__('View', 'event_espresso').'</a>'; |
|
221 | 221 | if ( |
222 | 222 | EE_Registry::instance()->CAP->current_user_can( |
223 | 223 | 'ee_delete_venue', |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | $item->ID() |
226 | 226 | ) |
227 | 227 | ) { |
228 | - $actions['move to trash'] = '<a href="' . $trash_venue_link . '" title="' . esc_attr__( |
|
228 | + $actions['move to trash'] = '<a href="'.$trash_venue_link.'" title="'.esc_attr__( |
|
229 | 229 | 'Trash Event', |
230 | 230 | 'event_espresso' |
231 | - ) . '">' . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
231 | + ).'">'.esc_html__('Trash', 'event_espresso').'</a>'; |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | return $actions; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | public function column_shortcode($item) |
257 | 257 | { |
258 | - $content = '[ESPRESSO_VENUE id=' . $item->ID() . ']'; |
|
258 | + $content = '[ESPRESSO_VENUE id='.$item->ID().']'; |
|
259 | 259 | return $content; |
260 | 260 | } |
261 | 261 | } |
@@ -17,120 +17,120 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - protected function _setup_data() |
|
21 | - { |
|
22 | - $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
23 | - $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, true); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _set_properties() |
|
28 | - { |
|
29 | - $this->_wp_list_args = array( |
|
30 | - 'singular' => esc_html__('venue category', 'event_espresso'), |
|
31 | - 'plural' => esc_html__('venue categories', 'event_espresso'), |
|
32 | - 'ajax' => true, // for now, |
|
33 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
34 | - ); |
|
35 | - |
|
36 | - $this->_columns = array( |
|
37 | - 'cb' => '<input type="checkbox" />', |
|
38 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
39 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
40 | - // 'shortcode' => esc_html__('Shortcode', 'event_espresso'), |
|
41 | - 'count' => esc_html__('Venues', 'event_espresso'), |
|
42 | - ); |
|
43 | - |
|
44 | - $this->_sortable_columns = array( |
|
45 | - 'id' => array('Term.term_id' => true), |
|
46 | - 'name' => array('Term.slug' => false), |
|
47 | - 'count' => array('term_count' => false), |
|
48 | - ); |
|
49 | - |
|
50 | - $this->_hidden_columns = array(); |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - // not needed |
|
55 | - protected function _get_table_filters() |
|
56 | - { |
|
57 | - return array(); |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - protected function _add_view_counts() |
|
62 | - { |
|
63 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - public function column_cb($item) |
|
68 | - { |
|
69 | - return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - public function column_id($item) |
|
74 | - { |
|
75 | - $content = $item->get('term_id'); |
|
76 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
77 | - 'name' |
|
78 | - ) . '</span>'; |
|
79 | - return $content; |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - public function column_name($item) |
|
84 | - { |
|
85 | - $edit_query_args = array( |
|
86 | - 'action' => 'edit_category', |
|
87 | - 'VEN_CAT_ID' => $item->get('term_id'), |
|
88 | - ); |
|
89 | - |
|
90 | - $delete_query_args = array( |
|
91 | - 'action' => 'delete_category', |
|
92 | - 'VEN_CAT_ID' => $item->get('term_id'), |
|
93 | - ); |
|
94 | - |
|
95 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
96 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
97 | - |
|
98 | - $actions = array( |
|
99 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__( |
|
100 | - 'Edit Category', |
|
101 | - 'event_espresso' |
|
102 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
103 | - ); |
|
104 | - |
|
105 | - |
|
106 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__( |
|
107 | - 'Delete Category', |
|
108 | - 'event_espresso' |
|
109 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
110 | - |
|
111 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
112 | - 'name' |
|
113 | - ) . '</a></strong>'; |
|
114 | - $content .= $this->row_actions($actions); |
|
115 | - return $content; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - public function column_shortcode($item) |
|
120 | - { |
|
121 | - $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
122 | - return $content; |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - public function column_count($item) |
|
127 | - { |
|
128 | - $e_args = array( |
|
129 | - 'action' => 'default', |
|
130 | - 'category' => $item->get_first_related('Term')->ID(), |
|
131 | - ); |
|
132 | - $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL); |
|
133 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
134 | - return $content; |
|
135 | - } |
|
20 | + protected function _setup_data() |
|
21 | + { |
|
22 | + $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
23 | + $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, true); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _set_properties() |
|
28 | + { |
|
29 | + $this->_wp_list_args = array( |
|
30 | + 'singular' => esc_html__('venue category', 'event_espresso'), |
|
31 | + 'plural' => esc_html__('venue categories', 'event_espresso'), |
|
32 | + 'ajax' => true, // for now, |
|
33 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
34 | + ); |
|
35 | + |
|
36 | + $this->_columns = array( |
|
37 | + 'cb' => '<input type="checkbox" />', |
|
38 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
39 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
40 | + // 'shortcode' => esc_html__('Shortcode', 'event_espresso'), |
|
41 | + 'count' => esc_html__('Venues', 'event_espresso'), |
|
42 | + ); |
|
43 | + |
|
44 | + $this->_sortable_columns = array( |
|
45 | + 'id' => array('Term.term_id' => true), |
|
46 | + 'name' => array('Term.slug' => false), |
|
47 | + 'count' => array('term_count' => false), |
|
48 | + ); |
|
49 | + |
|
50 | + $this->_hidden_columns = array(); |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + // not needed |
|
55 | + protected function _get_table_filters() |
|
56 | + { |
|
57 | + return array(); |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + protected function _add_view_counts() |
|
62 | + { |
|
63 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + public function column_cb($item) |
|
68 | + { |
|
69 | + return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + public function column_id($item) |
|
74 | + { |
|
75 | + $content = $item->get('term_id'); |
|
76 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
77 | + 'name' |
|
78 | + ) . '</span>'; |
|
79 | + return $content; |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + public function column_name($item) |
|
84 | + { |
|
85 | + $edit_query_args = array( |
|
86 | + 'action' => 'edit_category', |
|
87 | + 'VEN_CAT_ID' => $item->get('term_id'), |
|
88 | + ); |
|
89 | + |
|
90 | + $delete_query_args = array( |
|
91 | + 'action' => 'delete_category', |
|
92 | + 'VEN_CAT_ID' => $item->get('term_id'), |
|
93 | + ); |
|
94 | + |
|
95 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
96 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
97 | + |
|
98 | + $actions = array( |
|
99 | + 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__( |
|
100 | + 'Edit Category', |
|
101 | + 'event_espresso' |
|
102 | + ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
103 | + ); |
|
104 | + |
|
105 | + |
|
106 | + $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__( |
|
107 | + 'Delete Category', |
|
108 | + 'event_espresso' |
|
109 | + ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
110 | + |
|
111 | + $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
112 | + 'name' |
|
113 | + ) . '</a></strong>'; |
|
114 | + $content .= $this->row_actions($actions); |
|
115 | + return $content; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + public function column_shortcode($item) |
|
120 | + { |
|
121 | + $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
122 | + return $content; |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + public function column_count($item) |
|
127 | + { |
|
128 | + $e_args = array( |
|
129 | + 'action' => 'default', |
|
130 | + 'category' => $item->get_first_related('Term')->ID(), |
|
131 | + ); |
|
132 | + $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL); |
|
133 | + $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
134 | + return $content; |
|
135 | + } |
|
136 | 136 | } |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | public function column_id($item) |
74 | 74 | { |
75 | 75 | $content = $item->get('term_id'); |
76 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
76 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->get_first_related('Term')->get( |
|
77 | 77 | 'name' |
78 | - ) . '</span>'; |
|
78 | + ).'</span>'; |
|
79 | 79 | return $content; |
80 | 80 | } |
81 | 81 | |
@@ -96,21 +96,21 @@ discard block |
||
96 | 96 | $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
97 | 97 | |
98 | 98 | $actions = array( |
99 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__( |
|
99 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__( |
|
100 | 100 | 'Edit Category', |
101 | 101 | 'event_espresso' |
102 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
102 | + ).'">'.esc_html__('Edit', 'event_espresso').'</a>', |
|
103 | 103 | ); |
104 | 104 | |
105 | 105 | |
106 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__( |
|
106 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__( |
|
107 | 107 | 'Delete Category', |
108 | 108 | 'event_espresso' |
109 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
109 | + ).'">'.esc_html__('Delete', 'event_espresso').'</a>'; |
|
110 | 110 | |
111 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
111 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->get_first_related('Term')->get( |
|
112 | 112 | 'name' |
113 | - ) . '</a></strong>'; |
|
113 | + ).'</a></strong>'; |
|
114 | 114 | $content .= $this->row_actions($actions); |
115 | 115 | return $content; |
116 | 116 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function column_shortcode($item) |
120 | 120 | { |
121 | - $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
121 | + $content = '[EVENT_ESPRESSO_CATEGORY category_id="'.$item->get_first_related('Term')->get('slug').'"]'; |
|
122 | 122 | return $content; |
123 | 123 | } |
124 | 124 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | 'category' => $item->get_first_related('Term')->ID(), |
131 | 131 | ); |
132 | 132 | $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL); |
133 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
133 | + $content = '<a href="'.$e_link.'">'.$item->get('term_count').'</a>'; |
|
134 | 134 | return $content; |
135 | 135 | } |
136 | 136 | } |
@@ -16,207 +16,207 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - protected $_event; |
|
20 | - |
|
21 | - |
|
22 | - public function __construct(EE_Admin_Page $admin_page) |
|
23 | - { |
|
24 | - parent::__construct($admin_page); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - protected function _set_hooks_properties() |
|
29 | - { |
|
30 | - $this->_name = 'venues'; |
|
31 | - |
|
32 | - $this->_metaboxes = array( |
|
33 | - 0 => array( |
|
34 | - 'page_route' => array('edit', 'create_new'), |
|
35 | - 'func' => 'venue_metabox', |
|
36 | - 'label' => esc_html__('Venue Details', 'event_espresso'), |
|
37 | - 'priority' => 'high', |
|
38 | - 'context' => 'normal', |
|
39 | - ), |
|
40 | - );/**/ |
|
41 | - |
|
42 | - $this->_scripts_styles = array( |
|
43 | - 'registers' => array( |
|
44 | - 'ee_event_venues' => array( |
|
45 | - 'type' => 'js', |
|
46 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
47 | - 'depends' => array('jquery'), |
|
48 | - ), |
|
49 | - 'ee_event_venues_css' => array( |
|
50 | - 'type' => 'css', |
|
51 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
52 | - ), |
|
53 | - ), |
|
54 | - 'enqueues' => array( |
|
55 | - 'ee_event_venues' => array('edit', 'create_new'), |
|
56 | - 'ee_event_venues_css' => array('edit', 'create_new'), |
|
57 | - ), |
|
58 | - ); |
|
59 | - |
|
60 | - // hook into the handler for saving venue |
|
61 | - add_filter( |
|
62 | - 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
63 | - array($this, 'modify_callbacks'), |
|
64 | - 10 |
|
65 | - ); |
|
66 | - |
|
67 | - // remove default ee_autosave returns for DECAF venues (not needed for CAF venues cause we have a dropdown selector) |
|
68 | - add_filter('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false'); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - public function modify_callbacks($callbacks) |
|
73 | - { |
|
74 | - // first remove default venue callback |
|
75 | - foreach ($callbacks as $key => $callback) { |
|
76 | - if ($callback[1] == '_default_venue_update') { |
|
77 | - unset($callbacks[ $key ]); |
|
78 | - } |
|
79 | - } |
|
80 | - |
|
81 | - // now let's add the caf version |
|
82 | - $callbacks[] = array($this, 'caf_venue_update'); |
|
83 | - return $callbacks; |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - public function venue_metabox() |
|
88 | - { |
|
89 | - $evt_obj = $this->_adminpage_obj->get_event_object(); |
|
90 | - $evt_id = $evt_obj->ID(); |
|
91 | - |
|
92 | - // first let's see if we have a venue already |
|
93 | - $evt_venues = ! empty($evt_id) ? $evt_obj->venues() : array(); |
|
94 | - $evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null; |
|
95 | - $evt_venue_id = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null; |
|
96 | - |
|
97 | - // possibly private venues. |
|
98 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
99 | - $vnu_where['status'] = array('IN', array('publish', 'private')); |
|
100 | - } else { |
|
101 | - $vnu_where['status'] = 'publish'; |
|
102 | - } |
|
103 | - |
|
104 | - // cap checks |
|
105 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
106 | - $vnu_where['VNU_wp_user'] = get_current_user_id(); |
|
107 | - } |
|
108 | - |
|
109 | - $vnumdl = EE_Registry::instance()->load_model('Venue'); |
|
110 | - $venues = $vnumdl->get_all(array($vnu_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
111 | - |
|
112 | - $ven_select = array(); |
|
113 | - $ven_select[0] = esc_html__('Select a Venue', 'event_espresso'); |
|
114 | - // setup venues for selector |
|
115 | - foreach ($venues as $venue) { |
|
116 | - $ven_select[ $venue->ID() ] = $venue->name(); |
|
117 | - } |
|
118 | - |
|
119 | - // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
|
120 | - // show existing attached venues even if it's trashed (or some other restricted status). |
|
121 | - |
|
122 | - if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
123 | - $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
124 | - $venues = array_merge($venues, array($evt_venue)); |
|
125 | - } |
|
126 | - |
|
127 | - $template_args['venues'] = $venues; |
|
128 | - $template_args['evt_venue_id'] = $evt_venue_id; |
|
129 | - $venue_selector = new EE_Select_Input( |
|
130 | - $ven_select, |
|
131 | - array( |
|
132 | - 'html_name' => 'venue_id', |
|
133 | - 'html_id' => 'venue_id', |
|
134 | - 'html_class' => 'wide', |
|
135 | - 'default' => $evt_venue_id ? $evt_venue_id : '0' |
|
136 | - ) |
|
137 | - ); |
|
138 | - $template_args['venue_selector'] = $venue_selector->get_html_for_input(); |
|
139 | - $enable_for_gmap = new EE_Yes_No_Input( |
|
140 | - array( |
|
141 | - 'html_name' => 'enable_for_gmap', |
|
142 | - 'html_id' => 'enable_for_gmap', |
|
143 | - 'default' => $evt_venue instanceof EE_Venue ? $evt_venue->enable_for_gmap() : false |
|
144 | - ) |
|
145 | - ); |
|
146 | - $template_args['enable_for_gmap'] = $enable_for_gmap->get_html_for_input(); |
|
147 | - $template_args['new_venue_link'] = EEH_HTML::link( |
|
148 | - EE_Admin_Page::add_query_args_and_nonce( |
|
149 | - array('action' => 'create_new'), |
|
150 | - EE_VENUES_ADMIN_URL |
|
151 | - ), |
|
152 | - esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
153 | - esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
154 | - 'ev_new_venue_link', |
|
155 | - 'button', |
|
156 | - 'margin-left:10px;', |
|
157 | - 'target="_blank"' |
|
158 | - ); |
|
159 | - |
|
160 | - // Decide on an info text when there are no venues to display. |
|
161 | - $no_venues_info_txt = esc_html_x( |
|
162 | - 'You have not created any venues yet.', |
|
163 | - 'Information text displayed in the venues metabox when there are no venues to display', |
|
164 | - 'event_espresso' |
|
165 | - ); |
|
166 | - if (empty($venues)) { |
|
167 | - $unpublished_where = $vnu_where; |
|
168 | - $unpublished_where['status'] = 'draft'; |
|
169 | - $unpublished_venues = $vnumdl->get_all(array($unpublished_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
170 | - if (count($unpublished_venues) > 0) { |
|
171 | - $no_venues_info_txt = esc_html_x( |
|
172 | - // @codingStandardsIgnoreStart |
|
173 | - 'Use the link below to publish your venue through the venue editor so it appears here for selection.', |
|
174 | - // @codingStandardsIgnoreEnd |
|
175 | - 'Information text displayed in the venues metabox when there are no venues to display', |
|
176 | - 'event_espresso' |
|
177 | - ); |
|
178 | - } |
|
179 | - } |
|
180 | - $template_args['no_venues_info'] = EEH_HTML::p( |
|
181 | - EEH_HTML::strong($no_venues_info_txt), |
|
182 | - 'no_venues_info', |
|
183 | - 'info' |
|
184 | - ); |
|
185 | - |
|
186 | - $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
|
187 | - : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
188 | - |
|
189 | - // Allow events venue metabox template args filtering. |
|
190 | - $template_args = apply_filters( |
|
191 | - 'FHEE__espresso_events_Venues_Hooks___venue_metabox__template_args', |
|
192 | - $template_args, |
|
193 | - $template_path |
|
194 | - ); |
|
195 | - |
|
196 | - EEH_Template::display_template($template_path, $template_args); |
|
197 | - } |
|
198 | - |
|
199 | - |
|
200 | - public function caf_venue_update($evtobj, $data) |
|
201 | - { |
|
202 | - EE_Registry::instance()->load_model('Venue'); |
|
203 | - $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
204 | - |
|
205 | - |
|
206 | - // first let's check if the selected venue matches any existing venue attached to the event |
|
207 | - $evt_venue = $evtobj->venues(); |
|
208 | - $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
|
209 | - |
|
210 | - if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
211 | - $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
|
212 | - } |
|
213 | - |
|
214 | - if (empty($venue_id)) { |
|
215 | - return true; |
|
216 | - } //no venue to attach |
|
217 | - |
|
218 | - // this should take care of adding to revisions as well as main post object |
|
219 | - $success = $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
220 | - return ! empty($success) ? true : false; |
|
221 | - } |
|
19 | + protected $_event; |
|
20 | + |
|
21 | + |
|
22 | + public function __construct(EE_Admin_Page $admin_page) |
|
23 | + { |
|
24 | + parent::__construct($admin_page); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + protected function _set_hooks_properties() |
|
29 | + { |
|
30 | + $this->_name = 'venues'; |
|
31 | + |
|
32 | + $this->_metaboxes = array( |
|
33 | + 0 => array( |
|
34 | + 'page_route' => array('edit', 'create_new'), |
|
35 | + 'func' => 'venue_metabox', |
|
36 | + 'label' => esc_html__('Venue Details', 'event_espresso'), |
|
37 | + 'priority' => 'high', |
|
38 | + 'context' => 'normal', |
|
39 | + ), |
|
40 | + );/**/ |
|
41 | + |
|
42 | + $this->_scripts_styles = array( |
|
43 | + 'registers' => array( |
|
44 | + 'ee_event_venues' => array( |
|
45 | + 'type' => 'js', |
|
46 | + 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
47 | + 'depends' => array('jquery'), |
|
48 | + ), |
|
49 | + 'ee_event_venues_css' => array( |
|
50 | + 'type' => 'css', |
|
51 | + 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
52 | + ), |
|
53 | + ), |
|
54 | + 'enqueues' => array( |
|
55 | + 'ee_event_venues' => array('edit', 'create_new'), |
|
56 | + 'ee_event_venues_css' => array('edit', 'create_new'), |
|
57 | + ), |
|
58 | + ); |
|
59 | + |
|
60 | + // hook into the handler for saving venue |
|
61 | + add_filter( |
|
62 | + 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
63 | + array($this, 'modify_callbacks'), |
|
64 | + 10 |
|
65 | + ); |
|
66 | + |
|
67 | + // remove default ee_autosave returns for DECAF venues (not needed for CAF venues cause we have a dropdown selector) |
|
68 | + add_filter('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false'); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + public function modify_callbacks($callbacks) |
|
73 | + { |
|
74 | + // first remove default venue callback |
|
75 | + foreach ($callbacks as $key => $callback) { |
|
76 | + if ($callback[1] == '_default_venue_update') { |
|
77 | + unset($callbacks[ $key ]); |
|
78 | + } |
|
79 | + } |
|
80 | + |
|
81 | + // now let's add the caf version |
|
82 | + $callbacks[] = array($this, 'caf_venue_update'); |
|
83 | + return $callbacks; |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + public function venue_metabox() |
|
88 | + { |
|
89 | + $evt_obj = $this->_adminpage_obj->get_event_object(); |
|
90 | + $evt_id = $evt_obj->ID(); |
|
91 | + |
|
92 | + // first let's see if we have a venue already |
|
93 | + $evt_venues = ! empty($evt_id) ? $evt_obj->venues() : array(); |
|
94 | + $evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null; |
|
95 | + $evt_venue_id = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null; |
|
96 | + |
|
97 | + // possibly private venues. |
|
98 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
99 | + $vnu_where['status'] = array('IN', array('publish', 'private')); |
|
100 | + } else { |
|
101 | + $vnu_where['status'] = 'publish'; |
|
102 | + } |
|
103 | + |
|
104 | + // cap checks |
|
105 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
106 | + $vnu_where['VNU_wp_user'] = get_current_user_id(); |
|
107 | + } |
|
108 | + |
|
109 | + $vnumdl = EE_Registry::instance()->load_model('Venue'); |
|
110 | + $venues = $vnumdl->get_all(array($vnu_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
111 | + |
|
112 | + $ven_select = array(); |
|
113 | + $ven_select[0] = esc_html__('Select a Venue', 'event_espresso'); |
|
114 | + // setup venues for selector |
|
115 | + foreach ($venues as $venue) { |
|
116 | + $ven_select[ $venue->ID() ] = $venue->name(); |
|
117 | + } |
|
118 | + |
|
119 | + // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
|
120 | + // show existing attached venues even if it's trashed (or some other restricted status). |
|
121 | + |
|
122 | + if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
123 | + $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
124 | + $venues = array_merge($venues, array($evt_venue)); |
|
125 | + } |
|
126 | + |
|
127 | + $template_args['venues'] = $venues; |
|
128 | + $template_args['evt_venue_id'] = $evt_venue_id; |
|
129 | + $venue_selector = new EE_Select_Input( |
|
130 | + $ven_select, |
|
131 | + array( |
|
132 | + 'html_name' => 'venue_id', |
|
133 | + 'html_id' => 'venue_id', |
|
134 | + 'html_class' => 'wide', |
|
135 | + 'default' => $evt_venue_id ? $evt_venue_id : '0' |
|
136 | + ) |
|
137 | + ); |
|
138 | + $template_args['venue_selector'] = $venue_selector->get_html_for_input(); |
|
139 | + $enable_for_gmap = new EE_Yes_No_Input( |
|
140 | + array( |
|
141 | + 'html_name' => 'enable_for_gmap', |
|
142 | + 'html_id' => 'enable_for_gmap', |
|
143 | + 'default' => $evt_venue instanceof EE_Venue ? $evt_venue->enable_for_gmap() : false |
|
144 | + ) |
|
145 | + ); |
|
146 | + $template_args['enable_for_gmap'] = $enable_for_gmap->get_html_for_input(); |
|
147 | + $template_args['new_venue_link'] = EEH_HTML::link( |
|
148 | + EE_Admin_Page::add_query_args_and_nonce( |
|
149 | + array('action' => 'create_new'), |
|
150 | + EE_VENUES_ADMIN_URL |
|
151 | + ), |
|
152 | + esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
153 | + esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
154 | + 'ev_new_venue_link', |
|
155 | + 'button', |
|
156 | + 'margin-left:10px;', |
|
157 | + 'target="_blank"' |
|
158 | + ); |
|
159 | + |
|
160 | + // Decide on an info text when there are no venues to display. |
|
161 | + $no_venues_info_txt = esc_html_x( |
|
162 | + 'You have not created any venues yet.', |
|
163 | + 'Information text displayed in the venues metabox when there are no venues to display', |
|
164 | + 'event_espresso' |
|
165 | + ); |
|
166 | + if (empty($venues)) { |
|
167 | + $unpublished_where = $vnu_where; |
|
168 | + $unpublished_where['status'] = 'draft'; |
|
169 | + $unpublished_venues = $vnumdl->get_all(array($unpublished_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
170 | + if (count($unpublished_venues) > 0) { |
|
171 | + $no_venues_info_txt = esc_html_x( |
|
172 | + // @codingStandardsIgnoreStart |
|
173 | + 'Use the link below to publish your venue through the venue editor so it appears here for selection.', |
|
174 | + // @codingStandardsIgnoreEnd |
|
175 | + 'Information text displayed in the venues metabox when there are no venues to display', |
|
176 | + 'event_espresso' |
|
177 | + ); |
|
178 | + } |
|
179 | + } |
|
180 | + $template_args['no_venues_info'] = EEH_HTML::p( |
|
181 | + EEH_HTML::strong($no_venues_info_txt), |
|
182 | + 'no_venues_info', |
|
183 | + 'info' |
|
184 | + ); |
|
185 | + |
|
186 | + $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
|
187 | + : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
188 | + |
|
189 | + // Allow events venue metabox template args filtering. |
|
190 | + $template_args = apply_filters( |
|
191 | + 'FHEE__espresso_events_Venues_Hooks___venue_metabox__template_args', |
|
192 | + $template_args, |
|
193 | + $template_path |
|
194 | + ); |
|
195 | + |
|
196 | + EEH_Template::display_template($template_path, $template_args); |
|
197 | + } |
|
198 | + |
|
199 | + |
|
200 | + public function caf_venue_update($evtobj, $data) |
|
201 | + { |
|
202 | + EE_Registry::instance()->load_model('Venue'); |
|
203 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
204 | + |
|
205 | + |
|
206 | + // first let's check if the selected venue matches any existing venue attached to the event |
|
207 | + $evt_venue = $evtobj->venues(); |
|
208 | + $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
|
209 | + |
|
210 | + if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
211 | + $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
|
212 | + } |
|
213 | + |
|
214 | + if (empty($venue_id)) { |
|
215 | + return true; |
|
216 | + } //no venue to attach |
|
217 | + |
|
218 | + // this should take care of adding to revisions as well as main post object |
|
219 | + $success = $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
220 | + return ! empty($success) ? true : false; |
|
221 | + } |
|
222 | 222 | } |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | 'priority' => 'high', |
38 | 38 | 'context' => 'normal', |
39 | 39 | ), |
40 | - );/**/ |
|
40 | + ); /**/ |
|
41 | 41 | |
42 | 42 | $this->_scripts_styles = array( |
43 | 43 | 'registers' => array( |
44 | 44 | 'ee_event_venues' => array( |
45 | 45 | 'type' => 'js', |
46 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
46 | + 'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.js', |
|
47 | 47 | 'depends' => array('jquery'), |
48 | 48 | ), |
49 | 49 | 'ee_event_venues_css' => array( |
50 | 50 | 'type' => 'css', |
51 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
51 | + 'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.css', |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | 'enqueues' => array( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | // first remove default venue callback |
75 | 75 | foreach ($callbacks as $key => $callback) { |
76 | 76 | if ($callback[1] == '_default_venue_update') { |
77 | - unset($callbacks[ $key ]); |
|
77 | + unset($callbacks[$key]); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | // cap checks |
105 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
105 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
106 | 106 | $vnu_where['VNU_wp_user'] = get_current_user_id(); |
107 | 107 | } |
108 | 108 | |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | $ven_select[0] = esc_html__('Select a Venue', 'event_espresso'); |
114 | 114 | // setup venues for selector |
115 | 115 | foreach ($venues as $venue) { |
116 | - $ven_select[ $venue->ID() ] = $venue->name(); |
|
116 | + $ven_select[$venue->ID()] = $venue->name(); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
120 | 120 | // show existing attached venues even if it's trashed (or some other restricted status). |
121 | 121 | |
122 | - if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
123 | - $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
122 | + if ($evt_venue_id && ! isset($ven_select[$evt_venue_id])) { |
|
123 | + $ven_select[$evt_venue_id] = $evt_venue->name(); |
|
124 | 124 | $venues = array_merge($venues, array($evt_venue)); |
125 | 125 | } |
126 | 126 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | ); |
185 | 185 | |
186 | 186 | $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
187 | - : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
187 | + : EE_VENUES_TEMPLATE_PATH.'event_venues_metabox_content_from_manager.template.php'; |
|
188 | 188 | |
189 | 189 | // Allow events venue metabox template args filtering. |
190 | 190 | $template_args = apply_filters( |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $evt_venue = $evtobj->venues(); |
208 | 208 | $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
209 | 209 | |
210 | - if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
210 | + if ( ! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
211 | 211 | $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
212 | 212 | } |
213 | 213 |
@@ -15,37 +15,37 @@ |
||
15 | 15 | class About_Admin_Page_Init extends EE_Admin_Page_Init |
16 | 16 | { |
17 | 17 | |
18 | - public function __construct() |
|
19 | - { |
|
20 | - // define some events related constants |
|
21 | - define('EE_ABOUT_PG_SLUG', 'espresso_about'); |
|
22 | - define('EE_ABOUT_LABEL', esc_html__('About', 'event_espresso')); |
|
23 | - define('EE_ABOUT_ADMIN', EE_ADMIN_PAGES . 'about/'); |
|
24 | - define('EE_ABOUT_ADMIN_URL', admin_url('admin.php?page=' . EE_ABOUT_PG_SLUG)); |
|
25 | - define('EE_ABOUT_TEMPLATE_PATH', EE_ABOUT_ADMIN . 'templates/'); |
|
26 | - define('EE_ABOUT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'about/assets/'); |
|
27 | - parent::__construct(); |
|
28 | - } |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + // define some events related constants |
|
21 | + define('EE_ABOUT_PG_SLUG', 'espresso_about'); |
|
22 | + define('EE_ABOUT_LABEL', esc_html__('About', 'event_espresso')); |
|
23 | + define('EE_ABOUT_ADMIN', EE_ADMIN_PAGES . 'about/'); |
|
24 | + define('EE_ABOUT_ADMIN_URL', admin_url('admin.php?page=' . EE_ABOUT_PG_SLUG)); |
|
25 | + define('EE_ABOUT_TEMPLATE_PATH', EE_ABOUT_ADMIN . 'templates/'); |
|
26 | + define('EE_ABOUT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'about/assets/'); |
|
27 | + parent::__construct(); |
|
28 | + } |
|
29 | 29 | |
30 | - protected function _set_init_properties() |
|
31 | - { |
|
32 | - $this->label = esc_html__('About Event Espresso', 'event_espresso'); |
|
33 | - } |
|
30 | + protected function _set_init_properties() |
|
31 | + { |
|
32 | + $this->label = esc_html__('About Event Espresso', 'event_espresso'); |
|
33 | + } |
|
34 | 34 | |
35 | - protected function _set_menu_map() |
|
36 | - { |
|
37 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
38 | - array( |
|
39 | - 'menu_group' => 'extras', |
|
40 | - 'menu_order' => 40, |
|
41 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
|
42 | - 'parent_slug' => 'espresso_events', |
|
43 | - 'menu_slug' => 'espresso_about', |
|
44 | - 'menu_label' => EE_ABOUT_LABEL, |
|
45 | - 'capability' => 'manage_options', |
|
46 | - 'maintenance_mode_parent' => 'espresso_maintenance_settings', |
|
47 | - 'admin_init_page' => $this, |
|
48 | - ) |
|
49 | - ); |
|
50 | - } |
|
35 | + protected function _set_menu_map() |
|
36 | + { |
|
37 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
38 | + array( |
|
39 | + 'menu_group' => 'extras', |
|
40 | + 'menu_order' => 40, |
|
41 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
|
42 | + 'parent_slug' => 'espresso_events', |
|
43 | + 'menu_slug' => 'espresso_about', |
|
44 | + 'menu_label' => EE_ABOUT_LABEL, |
|
45 | + 'capability' => 'manage_options', |
|
46 | + 'maintenance_mode_parent' => 'espresso_maintenance_settings', |
|
47 | + 'admin_init_page' => $this, |
|
48 | + ) |
|
49 | + ); |
|
50 | + } |
|
51 | 51 | } |
@@ -20,10 +20,10 @@ |
||
20 | 20 | // define some events related constants |
21 | 21 | define('EE_ABOUT_PG_SLUG', 'espresso_about'); |
22 | 22 | define('EE_ABOUT_LABEL', esc_html__('About', 'event_espresso')); |
23 | - define('EE_ABOUT_ADMIN', EE_ADMIN_PAGES . 'about/'); |
|
24 | - define('EE_ABOUT_ADMIN_URL', admin_url('admin.php?page=' . EE_ABOUT_PG_SLUG)); |
|
25 | - define('EE_ABOUT_TEMPLATE_PATH', EE_ABOUT_ADMIN . 'templates/'); |
|
26 | - define('EE_ABOUT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'about/assets/'); |
|
23 | + define('EE_ABOUT_ADMIN', EE_ADMIN_PAGES.'about/'); |
|
24 | + define('EE_ABOUT_ADMIN_URL', admin_url('admin.php?page='.EE_ABOUT_PG_SLUG)); |
|
25 | + define('EE_ABOUT_TEMPLATE_PATH', EE_ABOUT_ADMIN.'templates/'); |
|
26 | + define('EE_ABOUT_ASSETS_URL', EE_ADMIN_PAGES_URL.'about/assets/'); |
|
27 | 27 | parent::__construct(); |
28 | 28 | } |
29 | 29 |
@@ -15,80 +15,80 @@ |
||
15 | 15 | class Countries_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = esc_html__('Countries Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'countries-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = esc_html__('Countries Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'countries-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | - protected function _set_tour_stops() |
|
25 | - { |
|
26 | - $this->_stops = array( |
|
27 | - 10 => array( |
|
28 | - 'content' => $this->_start(), |
|
29 | - ), |
|
30 | - 20 => array( |
|
31 | - 'id' => 'country', |
|
32 | - 'content' => $this->_country_selector_stop(), |
|
33 | - 'options' => array( |
|
34 | - 'tipLocation' => 'right', |
|
35 | - 'tipAdjustmentY' => -50, |
|
36 | - 'tipAdjustmentX' => 15, |
|
37 | - ), |
|
38 | - ), |
|
39 | - 30 => array( |
|
40 | - 'id' => 'country-details-dv', |
|
41 | - 'content' => $this->_country_details_stop(), |
|
42 | - 'options' => array( |
|
43 | - 'tipLocation' => 'top', |
|
44 | - 'tipAdjustmentY' => -80, |
|
45 | - 'tipAdjustmentX' => 0, |
|
46 | - ), |
|
47 | - ), |
|
48 | - 40 => array( |
|
49 | - 'id' => 'country-states-settings-dv', |
|
50 | - 'content' => $this->_country_states_settings_stop(), |
|
51 | - 'options' => array( |
|
52 | - 'tipLocation' => 'top', |
|
53 | - 'tipAdjustmentY' => -20, |
|
54 | - 'tipAdjustmentX' => 50, |
|
55 | - ), |
|
56 | - ), |
|
57 | - ); |
|
58 | - } |
|
24 | + protected function _set_tour_stops() |
|
25 | + { |
|
26 | + $this->_stops = array( |
|
27 | + 10 => array( |
|
28 | + 'content' => $this->_start(), |
|
29 | + ), |
|
30 | + 20 => array( |
|
31 | + 'id' => 'country', |
|
32 | + 'content' => $this->_country_selector_stop(), |
|
33 | + 'options' => array( |
|
34 | + 'tipLocation' => 'right', |
|
35 | + 'tipAdjustmentY' => -50, |
|
36 | + 'tipAdjustmentX' => 15, |
|
37 | + ), |
|
38 | + ), |
|
39 | + 30 => array( |
|
40 | + 'id' => 'country-details-dv', |
|
41 | + 'content' => $this->_country_details_stop(), |
|
42 | + 'options' => array( |
|
43 | + 'tipLocation' => 'top', |
|
44 | + 'tipAdjustmentY' => -80, |
|
45 | + 'tipAdjustmentX' => 0, |
|
46 | + ), |
|
47 | + ), |
|
48 | + 40 => array( |
|
49 | + 'id' => 'country-states-settings-dv', |
|
50 | + 'content' => $this->_country_states_settings_stop(), |
|
51 | + 'options' => array( |
|
52 | + 'tipLocation' => 'top', |
|
53 | + 'tipAdjustmentY' => -20, |
|
54 | + 'tipAdjustmentX' => 50, |
|
55 | + ), |
|
56 | + ), |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - protected function _start() |
|
62 | - { |
|
63 | - $content = '<h3>' . esc_html__('Countries Settings', 'event_espresso') . '</h3>'; |
|
64 | - $content .= '<p>' |
|
65 | - . esc_html__( |
|
66 | - 'This tour of the Countries Page will go over different areas of the screen to help you understand what they are used for.', |
|
67 | - 'event_espresso' |
|
68 | - ) . '</p>'; |
|
69 | - return $content; |
|
70 | - } |
|
61 | + protected function _start() |
|
62 | + { |
|
63 | + $content = '<h3>' . esc_html__('Countries Settings', 'event_espresso') . '</h3>'; |
|
64 | + $content .= '<p>' |
|
65 | + . esc_html__( |
|
66 | + 'This tour of the Countries Page will go over different areas of the screen to help you understand what they are used for.', |
|
67 | + 'event_espresso' |
|
68 | + ) . '</p>'; |
|
69 | + return $content; |
|
70 | + } |
|
71 | 71 | |
72 | - protected function _country_selector_stop() |
|
73 | - { |
|
74 | - return '<p>' |
|
75 | - . esc_html__( |
|
76 | - 'Select the country where your business or organization is located. This affects the currency that is used in Event Espresso.', |
|
77 | - 'event_espresso' |
|
78 | - ) . '</p>'; |
|
79 | - } |
|
72 | + protected function _country_selector_stop() |
|
73 | + { |
|
74 | + return '<p>' |
|
75 | + . esc_html__( |
|
76 | + 'Select the country where your business or organization is located. This affects the currency that is used in Event Espresso.', |
|
77 | + 'event_espresso' |
|
78 | + ) . '</p>'; |
|
79 | + } |
|
80 | 80 | |
81 | - protected function _country_details_stop() |
|
82 | - { |
|
83 | - return '<p>' . esc_html__('Here you can fine tune country and currency settings.', 'event_espresso') . '</p>'; |
|
84 | - } |
|
81 | + protected function _country_details_stop() |
|
82 | + { |
|
83 | + return '<p>' . esc_html__('Here you can fine tune country and currency settings.', 'event_espresso') . '</p>'; |
|
84 | + } |
|
85 | 85 | |
86 | - protected function _country_states_settings_stop() |
|
87 | - { |
|
88 | - return '<p>' |
|
89 | - . esc_html__( |
|
90 | - 'Used in certain areas of the plugin, here you can define what states/provinces will be displayed in case you do not do business in certain areas.', |
|
91 | - 'event_espresso' |
|
92 | - ) . '</p>'; |
|
93 | - } |
|
86 | + protected function _country_states_settings_stop() |
|
87 | + { |
|
88 | + return '<p>' |
|
89 | + . esc_html__( |
|
90 | + 'Used in certain areas of the plugin, here you can define what states/provinces will be displayed in case you do not do business in certain areas.', |
|
91 | + 'event_espresso' |
|
92 | + ) . '</p>'; |
|
93 | + } |
|
94 | 94 | } |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | |
61 | 61 | protected function _start() |
62 | 62 | { |
63 | - $content = '<h3>' . esc_html__('Countries Settings', 'event_espresso') . '</h3>'; |
|
63 | + $content = '<h3>'.esc_html__('Countries Settings', 'event_espresso').'</h3>'; |
|
64 | 64 | $content .= '<p>' |
65 | 65 | . esc_html__( |
66 | 66 | 'This tour of the Countries Page will go over different areas of the screen to help you understand what they are used for.', |
67 | 67 | 'event_espresso' |
68 | - ) . '</p>'; |
|
68 | + ).'</p>'; |
|
69 | 69 | return $content; |
70 | 70 | } |
71 | 71 | |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | . esc_html__( |
76 | 76 | 'Select the country where your business or organization is located. This affects the currency that is used in Event Espresso.', |
77 | 77 | 'event_espresso' |
78 | - ) . '</p>'; |
|
78 | + ).'</p>'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | protected function _country_details_stop() |
82 | 82 | { |
83 | - return '<p>' . esc_html__('Here you can fine tune country and currency settings.', 'event_espresso') . '</p>'; |
|
83 | + return '<p>'.esc_html__('Here you can fine tune country and currency settings.', 'event_espresso').'</p>'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | protected function _country_states_settings_stop() |
@@ -89,6 +89,6 @@ discard block |
||
89 | 89 | . esc_html__( |
90 | 90 | 'Used in certain areas of the plugin, here you can define what states/provinces will be displayed in case you do not do business in certain areas.', |
91 | 91 | 'event_espresso' |
92 | - ) . '</p>'; |
|
92 | + ).'</p>'; |
|
93 | 93 | } |
94 | 94 | } |
@@ -15,107 +15,107 @@ |
||
15 | 15 | class Critical_Pages_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = esc_html__('Critical Pages Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'critical-pages-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = esc_html__('Critical Pages Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'critical-pages-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | - protected function _set_tour_stops() |
|
25 | - { |
|
26 | - $this->_stops = array( |
|
27 | - 10 => array( |
|
28 | - 'content' => $this->_start(), |
|
29 | - ), |
|
30 | - 20 => array( |
|
31 | - 'id' => 'reg_page_id', |
|
32 | - 'content' => $this->_reg_page_id_stop(), |
|
33 | - 'options' => array( |
|
34 | - 'tipLocation' => 'right', |
|
35 | - 'tipAdjustmentY' => -50, |
|
36 | - 'tipAdjustmentX' => 15, |
|
37 | - ), |
|
38 | - ), |
|
39 | - 30 => array( |
|
40 | - 'id' => 'txn_page_id', |
|
41 | - 'content' => $this->_txn_page_id_stop(), |
|
42 | - 'options' => array( |
|
43 | - 'tipLocation' => 'right', |
|
44 | - 'tipAdjustmentY' => -50, |
|
45 | - 'tipAdjustmentX' => 15, |
|
46 | - ), |
|
47 | - ), |
|
48 | - 40 => array( |
|
49 | - 'id' => 'thank_you_page_id', |
|
50 | - 'content' => $this->_thank_you_page_id_stop(), |
|
51 | - 'options' => array( |
|
52 | - 'tipLocation' => 'right', |
|
53 | - 'tipAdjustmentY' => -50, |
|
54 | - 'tipAdjustmentX' => 15, |
|
55 | - ), |
|
56 | - ), |
|
57 | - 50 => array( |
|
58 | - 'id' => 'cancel_page_id', |
|
59 | - 'content' => $this->_cancel_page_id_stop(), |
|
60 | - 'options' => array( |
|
61 | - 'tipLocation' => 'right', |
|
62 | - 'tipAdjustmentY' => -50, |
|
63 | - 'tipAdjustmentX' => 15, |
|
64 | - ), |
|
65 | - ), |
|
66 | - ); |
|
67 | - } |
|
24 | + protected function _set_tour_stops() |
|
25 | + { |
|
26 | + $this->_stops = array( |
|
27 | + 10 => array( |
|
28 | + 'content' => $this->_start(), |
|
29 | + ), |
|
30 | + 20 => array( |
|
31 | + 'id' => 'reg_page_id', |
|
32 | + 'content' => $this->_reg_page_id_stop(), |
|
33 | + 'options' => array( |
|
34 | + 'tipLocation' => 'right', |
|
35 | + 'tipAdjustmentY' => -50, |
|
36 | + 'tipAdjustmentX' => 15, |
|
37 | + ), |
|
38 | + ), |
|
39 | + 30 => array( |
|
40 | + 'id' => 'txn_page_id', |
|
41 | + 'content' => $this->_txn_page_id_stop(), |
|
42 | + 'options' => array( |
|
43 | + 'tipLocation' => 'right', |
|
44 | + 'tipAdjustmentY' => -50, |
|
45 | + 'tipAdjustmentX' => 15, |
|
46 | + ), |
|
47 | + ), |
|
48 | + 40 => array( |
|
49 | + 'id' => 'thank_you_page_id', |
|
50 | + 'content' => $this->_thank_you_page_id_stop(), |
|
51 | + 'options' => array( |
|
52 | + 'tipLocation' => 'right', |
|
53 | + 'tipAdjustmentY' => -50, |
|
54 | + 'tipAdjustmentX' => 15, |
|
55 | + ), |
|
56 | + ), |
|
57 | + 50 => array( |
|
58 | + 'id' => 'cancel_page_id', |
|
59 | + 'content' => $this->_cancel_page_id_stop(), |
|
60 | + 'options' => array( |
|
61 | + 'tipLocation' => 'right', |
|
62 | + 'tipAdjustmentY' => -50, |
|
63 | + 'tipAdjustmentX' => 15, |
|
64 | + ), |
|
65 | + ), |
|
66 | + ); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - protected function _start() |
|
71 | - { |
|
72 | - $content = '<h3>' . esc_html__('Critical Pages', 'event_espresso') . '</h3>'; |
|
73 | - $content .= '<p>' |
|
74 | - . esc_html__( |
|
75 | - 'This section lists the pages that Event Espresso needs in order to function. Should you wish to change a page that is used you will need to move the shortcode to the new page and then allocate it here. Otherwise your registrations will not work correctly.', |
|
76 | - 'event_espresso' |
|
77 | - ) . '</p>'; |
|
78 | - $content .= '<p>' |
|
79 | - . esc_html__( |
|
80 | - 'This section also provides a status of the page to show you at a glance if something is not right.', |
|
81 | - 'event_espresso' |
|
82 | - ) . '</p>'; |
|
83 | - return $content; |
|
84 | - } |
|
70 | + protected function _start() |
|
71 | + { |
|
72 | + $content = '<h3>' . esc_html__('Critical Pages', 'event_espresso') . '</h3>'; |
|
73 | + $content .= '<p>' |
|
74 | + . esc_html__( |
|
75 | + 'This section lists the pages that Event Espresso needs in order to function. Should you wish to change a page that is used you will need to move the shortcode to the new page and then allocate it here. Otherwise your registrations will not work correctly.', |
|
76 | + 'event_espresso' |
|
77 | + ) . '</p>'; |
|
78 | + $content .= '<p>' |
|
79 | + . esc_html__( |
|
80 | + 'This section also provides a status of the page to show you at a glance if something is not right.', |
|
81 | + 'event_espresso' |
|
82 | + ) . '</p>'; |
|
83 | + return $content; |
|
84 | + } |
|
85 | 85 | |
86 | - protected function _reg_page_id_stop() |
|
87 | - { |
|
88 | - return '<p>' |
|
89 | - . esc_html__( |
|
90 | - 'This page processes the registrations and is required, even if it is not visible in your menus. ', |
|
91 | - 'event_espresso' |
|
92 | - ) . '</p>'; |
|
93 | - } |
|
86 | + protected function _reg_page_id_stop() |
|
87 | + { |
|
88 | + return '<p>' |
|
89 | + . esc_html__( |
|
90 | + 'This page processes the registrations and is required, even if it is not visible in your menus. ', |
|
91 | + 'event_espresso' |
|
92 | + ) . '</p>'; |
|
93 | + } |
|
94 | 94 | |
95 | - protected function _txn_page_id_stop() |
|
96 | - { |
|
97 | - return '<p>' |
|
98 | - . esc_html__( |
|
99 | - 'This page processes payments. It should not be visible on your menus, and the page should not contain anything other than the shortcode.', |
|
100 | - 'event_espresso' |
|
101 | - ) . '</p>'; |
|
102 | - } |
|
95 | + protected function _txn_page_id_stop() |
|
96 | + { |
|
97 | + return '<p>' |
|
98 | + . esc_html__( |
|
99 | + 'This page processes payments. It should not be visible on your menus, and the page should not contain anything other than the shortcode.', |
|
100 | + 'event_espresso' |
|
101 | + ) . '</p>'; |
|
102 | + } |
|
103 | 103 | |
104 | - protected function _thank_you_page_id_stop() |
|
105 | - { |
|
106 | - return '<p>' |
|
107 | - . esc_html__( |
|
108 | - 'This page is displayed after a successful transaction. Feel free to add extra content to this page to personalise it!', |
|
109 | - 'event_espresso' |
|
110 | - ) . '</p>'; |
|
111 | - } |
|
104 | + protected function _thank_you_page_id_stop() |
|
105 | + { |
|
106 | + return '<p>' |
|
107 | + . esc_html__( |
|
108 | + 'This page is displayed after a successful transaction. Feel free to add extra content to this page to personalise it!', |
|
109 | + 'event_espresso' |
|
110 | + ) . '</p>'; |
|
111 | + } |
|
112 | 112 | |
113 | - protected function _cancel_page_id_stop() |
|
114 | - { |
|
115 | - return '<p>' |
|
116 | - . esc_html__( |
|
117 | - 'This page is displayed after an unsuccessful transaction. Feel free to add extra content to this page to personalise it!', |
|
118 | - 'event_espresso' |
|
119 | - ) . '</p>'; |
|
120 | - } |
|
113 | + protected function _cancel_page_id_stop() |
|
114 | + { |
|
115 | + return '<p>' |
|
116 | + . esc_html__( |
|
117 | + 'This page is displayed after an unsuccessful transaction. Feel free to add extra content to this page to personalise it!', |
|
118 | + 'event_espresso' |
|
119 | + ) . '</p>'; |
|
120 | + } |
|
121 | 121 | } |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | |
70 | 70 | protected function _start() |
71 | 71 | { |
72 | - $content = '<h3>' . esc_html__('Critical Pages', 'event_espresso') . '</h3>'; |
|
72 | + $content = '<h3>'.esc_html__('Critical Pages', 'event_espresso').'</h3>'; |
|
73 | 73 | $content .= '<p>' |
74 | 74 | . esc_html__( |
75 | 75 | 'This section lists the pages that Event Espresso needs in order to function. Should you wish to change a page that is used you will need to move the shortcode to the new page and then allocate it here. Otherwise your registrations will not work correctly.', |
76 | 76 | 'event_espresso' |
77 | - ) . '</p>'; |
|
77 | + ).'</p>'; |
|
78 | 78 | $content .= '<p>' |
79 | 79 | . esc_html__( |
80 | 80 | 'This section also provides a status of the page to show you at a glance if something is not right.', |
81 | 81 | 'event_espresso' |
82 | - ) . '</p>'; |
|
82 | + ).'</p>'; |
|
83 | 83 | return $content; |
84 | 84 | } |
85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | . esc_html__( |
90 | 90 | 'This page processes the registrations and is required, even if it is not visible in your menus. ', |
91 | 91 | 'event_espresso' |
92 | - ) . '</p>'; |
|
92 | + ).'</p>'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | protected function _txn_page_id_stop() |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | . esc_html__( |
99 | 99 | 'This page processes payments. It should not be visible on your menus, and the page should not contain anything other than the shortcode.', |
100 | 100 | 'event_espresso' |
101 | - ) . '</p>'; |
|
101 | + ).'</p>'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | protected function _thank_you_page_id_stop() |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | . esc_html__( |
108 | 108 | 'This page is displayed after a successful transaction. Feel free to add extra content to this page to personalise it!', |
109 | 109 | 'event_espresso' |
110 | - ) . '</p>'; |
|
110 | + ).'</p>'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | protected function _cancel_page_id_stop() |
@@ -116,6 +116,6 @@ discard block |
||
116 | 116 | . esc_html__( |
117 | 117 | 'This page is displayed after an unsuccessful transaction. Feel free to add extra content to this page to personalise it!', |
118 | 118 | 'event_espresso' |
119 | - ) . '</p>'; |
|
119 | + ).'</p>'; |
|
120 | 120 | } |
121 | 121 | } |
@@ -15,136 +15,136 @@ |
||
15 | 15 | class Your_Organization_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = esc_html__('Your Organization Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'your-organization-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = esc_html__('Your Organization Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'your-organization-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - protected function _set_tour_stops() |
|
26 | - { |
|
27 | - $this->_stops = array( |
|
28 | - 10 => array( |
|
29 | - 'content' => $this->_start(), |
|
30 | - ), |
|
31 | - 30 => array( |
|
32 | - 'id' => 'contact_info_h4', |
|
33 | - 'content' => $this->_contact_information_stop(), |
|
34 | - 'options' => array( |
|
35 | - 'tipLocation' => 'left', |
|
36 | - 'tipAdjustmentY' => -50, |
|
37 | - 'tipAdjustmentX' => 15, |
|
38 | - ), |
|
39 | - ), |
|
40 | - 40 => array( |
|
41 | - 'id' => 'upload_image', |
|
42 | - 'content' => $this->_upload_image_stop(), |
|
43 | - 'options' => array( |
|
44 | - 'tipLocation' => 'right', |
|
45 | - 'tipAdjustmentY' => -50, |
|
46 | - 'tipAdjustmentX' => 15, |
|
47 | - ), |
|
48 | - ), |
|
49 | - 50 => array( |
|
50 | - 'id' => 'organization_facebook', |
|
51 | - 'content' => $this->_organization_facebook_stop(), |
|
52 | - 'options' => array( |
|
53 | - 'tipLocation' => 'right', |
|
54 | - 'tipAdjustmentY' => -50, |
|
55 | - 'tipAdjustmentX' => 15, |
|
56 | - ), |
|
57 | - ), |
|
58 | - 60 => array( |
|
59 | - 'id' => 'ueip_optin', |
|
60 | - 'content' => $this->_ueip_option_stop(), |
|
61 | - 'options' => array( |
|
62 | - 'tipLocation' => 'right', |
|
63 | - 'tipAdjustmentY' => -50, |
|
64 | - 'tipAdjustmentX' => 15, |
|
65 | - ), |
|
66 | - ), |
|
67 | - 70 => array( |
|
68 | - 'id' => 'espresso_major_buttons_wrapper', |
|
69 | - 'content' => $this->_end_tour_stop(), |
|
70 | - 'options' => array( |
|
71 | - 'tipLocation' => 'right', |
|
72 | - 'tipAdjustmentY' => -50, |
|
73 | - 'tipAdjustmentX' => 185, |
|
74 | - ), |
|
75 | - ), |
|
76 | - ); |
|
25 | + protected function _set_tour_stops() |
|
26 | + { |
|
27 | + $this->_stops = array( |
|
28 | + 10 => array( |
|
29 | + 'content' => $this->_start(), |
|
30 | + ), |
|
31 | + 30 => array( |
|
32 | + 'id' => 'contact_info_h4', |
|
33 | + 'content' => $this->_contact_information_stop(), |
|
34 | + 'options' => array( |
|
35 | + 'tipLocation' => 'left', |
|
36 | + 'tipAdjustmentY' => -50, |
|
37 | + 'tipAdjustmentX' => 15, |
|
38 | + ), |
|
39 | + ), |
|
40 | + 40 => array( |
|
41 | + 'id' => 'upload_image', |
|
42 | + 'content' => $this->_upload_image_stop(), |
|
43 | + 'options' => array( |
|
44 | + 'tipLocation' => 'right', |
|
45 | + 'tipAdjustmentY' => -50, |
|
46 | + 'tipAdjustmentX' => 15, |
|
47 | + ), |
|
48 | + ), |
|
49 | + 50 => array( |
|
50 | + 'id' => 'organization_facebook', |
|
51 | + 'content' => $this->_organization_facebook_stop(), |
|
52 | + 'options' => array( |
|
53 | + 'tipLocation' => 'right', |
|
54 | + 'tipAdjustmentY' => -50, |
|
55 | + 'tipAdjustmentX' => 15, |
|
56 | + ), |
|
57 | + ), |
|
58 | + 60 => array( |
|
59 | + 'id' => 'ueip_optin', |
|
60 | + 'content' => $this->_ueip_option_stop(), |
|
61 | + 'options' => array( |
|
62 | + 'tipLocation' => 'right', |
|
63 | + 'tipAdjustmentY' => -50, |
|
64 | + 'tipAdjustmentX' => 15, |
|
65 | + ), |
|
66 | + ), |
|
67 | + 70 => array( |
|
68 | + 'id' => 'espresso_major_buttons_wrapper', |
|
69 | + 'content' => $this->_end_tour_stop(), |
|
70 | + 'options' => array( |
|
71 | + 'tipLocation' => 'right', |
|
72 | + 'tipAdjustmentY' => -50, |
|
73 | + 'tipAdjustmentX' => 185, |
|
74 | + ), |
|
75 | + ), |
|
76 | + ); |
|
77 | 77 | |
78 | - if (is_main_site()) { |
|
79 | - $this->_stops[20] = array( |
|
80 | - 'id' => 'site_license_key', |
|
81 | - 'content' => $this->_site_license_key_stop(), |
|
82 | - 'options' => array( |
|
83 | - 'tipLocation' => 'right', |
|
84 | - 'tipAdjustmentY' => -50, |
|
85 | - 'tipAdjustmentX' => 15, |
|
86 | - ), |
|
87 | - ); |
|
88 | - } |
|
89 | - ksort($this->_stops); |
|
90 | - } |
|
78 | + if (is_main_site()) { |
|
79 | + $this->_stops[20] = array( |
|
80 | + 'id' => 'site_license_key', |
|
81 | + 'content' => $this->_site_license_key_stop(), |
|
82 | + 'options' => array( |
|
83 | + 'tipLocation' => 'right', |
|
84 | + 'tipAdjustmentY' => -50, |
|
85 | + 'tipAdjustmentX' => 15, |
|
86 | + ), |
|
87 | + ); |
|
88 | + } |
|
89 | + ksort($this->_stops); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | - protected function _start() |
|
94 | - { |
|
95 | - $content = '<h3>' . esc_html__('Organization Settings', 'event_espresso') . '</h3>'; |
|
96 | - $content .= '<p>' |
|
97 | - . esc_html__( |
|
98 | - 'This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
|
99 | - 'event_espresso' |
|
100 | - ) . '</p>'; |
|
93 | + protected function _start() |
|
94 | + { |
|
95 | + $content = '<h3>' . esc_html__('Organization Settings', 'event_espresso') . '</h3>'; |
|
96 | + $content .= '<p>' |
|
97 | + . esc_html__( |
|
98 | + 'This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
|
99 | + 'event_espresso' |
|
100 | + ) . '</p>'; |
|
101 | 101 | |
102 | - return $content; |
|
103 | - } |
|
102 | + return $content; |
|
103 | + } |
|
104 | 104 | |
105 | - protected function _site_license_key_stop() |
|
106 | - { |
|
107 | - return '<p>' |
|
108 | - . esc_html__( |
|
109 | - 'Enter your support license key here to enable one-click updates.', |
|
110 | - 'event_espresso' |
|
111 | - ) . '</p>'; |
|
112 | - } |
|
105 | + protected function _site_license_key_stop() |
|
106 | + { |
|
107 | + return '<p>' |
|
108 | + . esc_html__( |
|
109 | + 'Enter your support license key here to enable one-click updates.', |
|
110 | + 'event_espresso' |
|
111 | + ) . '</p>'; |
|
112 | + } |
|
113 | 113 | |
114 | - protected function _contact_information_stop() |
|
115 | - { |
|
116 | - return '<p>' |
|
117 | - . esc_html__( |
|
118 | - 'You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
|
119 | - 'event_espresso' |
|
120 | - ) . '</p>'; |
|
121 | - } |
|
114 | + protected function _contact_information_stop() |
|
115 | + { |
|
116 | + return '<p>' |
|
117 | + . esc_html__( |
|
118 | + 'You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
|
119 | + 'event_espresso' |
|
120 | + ) . '</p>'; |
|
121 | + } |
|
122 | 122 | |
123 | - protected function _upload_image_stop() |
|
124 | - { |
|
125 | - return '<p>' . esc_html__('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
126 | - } |
|
123 | + protected function _upload_image_stop() |
|
124 | + { |
|
125 | + return '<p>' . esc_html__('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
126 | + } |
|
127 | 127 | |
128 | - protected function _organization_facebook_stop() |
|
129 | - { |
|
130 | - return '<p>' . esc_html__('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
131 | - } |
|
128 | + protected function _organization_facebook_stop() |
|
129 | + { |
|
130 | + return '<p>' . esc_html__('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
131 | + } |
|
132 | 132 | |
133 | - protected function _ueip_option_stop() |
|
134 | - { |
|
135 | - return '<p>' |
|
136 | - . esc_html__( |
|
137 | - 'Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
|
138 | - 'event_espresso' |
|
139 | - ) . '</p>'; |
|
140 | - } |
|
133 | + protected function _ueip_option_stop() |
|
134 | + { |
|
135 | + return '<p>' |
|
136 | + . esc_html__( |
|
137 | + 'Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
|
138 | + 'event_espresso' |
|
139 | + ) . '</p>'; |
|
140 | + } |
|
141 | 141 | |
142 | - protected function _end_tour_stop() |
|
143 | - { |
|
144 | - return '<p>' |
|
145 | - . esc_html__( |
|
146 | - 'You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
|
147 | - 'event_espresso' |
|
148 | - ) . '</p>'; |
|
149 | - } |
|
142 | + protected function _end_tour_stop() |
|
143 | + { |
|
144 | + return '<p>' |
|
145 | + . esc_html__( |
|
146 | + 'You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
|
147 | + 'event_espresso' |
|
148 | + ) . '</p>'; |
|
149 | + } |
|
150 | 150 | } |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function _start() |
94 | 94 | { |
95 | - $content = '<h3>' . esc_html__('Organization Settings', 'event_espresso') . '</h3>'; |
|
95 | + $content = '<h3>'.esc_html__('Organization Settings', 'event_espresso').'</h3>'; |
|
96 | 96 | $content .= '<p>' |
97 | 97 | . esc_html__( |
98 | 98 | 'This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
99 | 99 | 'event_espresso' |
100 | - ) . '</p>'; |
|
100 | + ).'</p>'; |
|
101 | 101 | |
102 | 102 | return $content; |
103 | 103 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | . esc_html__( |
109 | 109 | 'Enter your support license key here to enable one-click updates.', |
110 | 110 | 'event_espresso' |
111 | - ) . '</p>'; |
|
111 | + ).'</p>'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | protected function _contact_information_stop() |
@@ -117,17 +117,17 @@ discard block |
||
117 | 117 | . esc_html__( |
118 | 118 | 'You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
119 | 119 | 'event_espresso' |
120 | - ) . '</p>'; |
|
120 | + ).'</p>'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | protected function _upload_image_stop() |
124 | 124 | { |
125 | - return '<p>' . esc_html__('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
125 | + return '<p>'.esc_html__('Add a logo. This can be used for invoices and tickets.', 'event_espresso').'</p>'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | protected function _organization_facebook_stop() |
129 | 129 | { |
130 | - return '<p>' . esc_html__('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
130 | + return '<p>'.esc_html__('Add links to various social media networks.', 'event_espresso').'</p>'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | protected function _ueip_option_stop() |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | . esc_html__( |
137 | 137 | 'Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
138 | 138 | 'event_espresso' |
139 | - ) . '</p>'; |
|
139 | + ).'</p>'; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | protected function _end_tour_stop() |
@@ -145,6 +145,6 @@ discard block |
||
145 | 145 | . esc_html__( |
146 | 146 | 'You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
147 | 147 | 'event_espresso' |
148 | - ) . '</p>'; |
|
148 | + ).'</p>'; |
|
149 | 149 | } |
150 | 150 | } |