@@ -36,7 +36,7 @@ |
||
36 | 36 | $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
37 | 37 | foreach ($notices->getError() as $notice) { |
38 | 38 | if ($this->getThrowExceptions()) { |
39 | - $error_string .= '<br />' . $notice->message(); |
|
39 | + $error_string .= '<br />'.$notice->message(); |
|
40 | 40 | } else { |
41 | 41 | new AdminNotice($notice); |
42 | 42 | } |
@@ -14,42 +14,42 @@ |
||
14 | 14 | class ConvertNoticesToAdminNotices extends NoticeConverter |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Converts Notice objects into AdminNotice notifications |
|
19 | - * |
|
20 | - * @param NoticesContainerInterface $notices |
|
21 | - * @throws DomainException |
|
22 | - */ |
|
23 | - public function process(NoticesContainerInterface $notices) |
|
24 | - { |
|
25 | - if ($notices->hasAttention()) { |
|
26 | - foreach ($notices->getAttention() as $notice) { |
|
27 | - new AdminNotice($notice); |
|
28 | - } |
|
29 | - } |
|
30 | - if ($notices->hasError()) { |
|
31 | - $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
|
32 | - foreach ($notices->getError() as $notice) { |
|
33 | - if ($this->getThrowExceptions()) { |
|
34 | - $error_string .= '<br />' . $notice->message(); |
|
35 | - } else { |
|
36 | - new AdminNotice($notice); |
|
37 | - } |
|
38 | - } |
|
39 | - if ($this->getThrowExceptions()) { |
|
40 | - throw new DomainException($error_string); |
|
41 | - } |
|
42 | - } |
|
43 | - if ($notices->hasSuccess()) { |
|
44 | - foreach ($notices->getSuccess() as $notice) { |
|
45 | - new AdminNotice($notice); |
|
46 | - } |
|
47 | - } |
|
48 | - if ($notices->hasInformation()) { |
|
49 | - foreach ($notices->getInformation() as $notice) { |
|
50 | - new AdminNotice($notice); |
|
51 | - } |
|
52 | - } |
|
53 | - $this->clearNotices(); |
|
54 | - } |
|
17 | + /** |
|
18 | + * Converts Notice objects into AdminNotice notifications |
|
19 | + * |
|
20 | + * @param NoticesContainerInterface $notices |
|
21 | + * @throws DomainException |
|
22 | + */ |
|
23 | + public function process(NoticesContainerInterface $notices) |
|
24 | + { |
|
25 | + if ($notices->hasAttention()) { |
|
26 | + foreach ($notices->getAttention() as $notice) { |
|
27 | + new AdminNotice($notice); |
|
28 | + } |
|
29 | + } |
|
30 | + if ($notices->hasError()) { |
|
31 | + $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
|
32 | + foreach ($notices->getError() as $notice) { |
|
33 | + if ($this->getThrowExceptions()) { |
|
34 | + $error_string .= '<br />' . $notice->message(); |
|
35 | + } else { |
|
36 | + new AdminNotice($notice); |
|
37 | + } |
|
38 | + } |
|
39 | + if ($this->getThrowExceptions()) { |
|
40 | + throw new DomainException($error_string); |
|
41 | + } |
|
42 | + } |
|
43 | + if ($notices->hasSuccess()) { |
|
44 | + foreach ($notices->getSuccess() as $notice) { |
|
45 | + new AdminNotice($notice); |
|
46 | + } |
|
47 | + } |
|
48 | + if ($notices->hasInformation()) { |
|
49 | + foreach ($notices->getInformation() as $notice) { |
|
50 | + new AdminNotice($notice); |
|
51 | + } |
|
52 | + } |
|
53 | + $this->clearNotices(); |
|
54 | + } |
|
55 | 55 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | /** |
276 | 276 | * @access public |
277 | - * @return string |
|
277 | + * @return boolean |
|
278 | 278 | */ |
279 | 279 | public static function is_iframe() |
280 | 280 | { |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | * display_description |
893 | 893 | * |
894 | 894 | * @access public |
895 | - * @param $value |
|
895 | + * @param integer $value |
|
896 | 896 | * @return bool |
897 | 897 | */ |
898 | 898 | public static function display_description($value) |
@@ -16,1094 +16,1094 @@ discard block |
||
16 | 16 | class EED_Events_Archive extends EED_Module |
17 | 17 | { |
18 | 18 | |
19 | - const EVENT_DETAILS_PRIORITY = 100; |
|
20 | - |
|
21 | - const EVENT_DATETIMES_PRIORITY = 110; |
|
22 | - |
|
23 | - const EVENT_TICKETS_PRIORITY = 120; |
|
24 | - |
|
25 | - const EVENT_VENUES_PRIORITY = 130; |
|
26 | - |
|
27 | - |
|
28 | - public static $espresso_event_list_ID = 0; |
|
29 | - |
|
30 | - public static $espresso_grid_event_lists = array(); |
|
31 | - |
|
32 | - /** |
|
33 | - * @type bool $using_get_the_excerpt |
|
34 | - */ |
|
35 | - protected static $using_get_the_excerpt = false; |
|
36 | - |
|
37 | - /** |
|
38 | - * Used to flag when the event list is being called from an external iframe. |
|
39 | - * |
|
40 | - * @var bool $iframe |
|
41 | - */ |
|
42 | - protected static $iframe = false; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var \EventEspresso\core\libraries\iframe_display\EventListIframeEmbedButton $_iframe_embed_button |
|
46 | - */ |
|
47 | - private static $_iframe_embed_button; |
|
48 | - |
|
49 | - /** |
|
50 | - * @type EE_Template_Part_Manager $template_parts |
|
51 | - */ |
|
52 | - protected $template_parts; |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * @return EED_Events_Archive |
|
57 | - */ |
|
58 | - public static function instance() |
|
59 | - { |
|
60 | - return parent::get_instance(__CLASS__); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
66 | - * |
|
67 | - * @return void |
|
68 | - * @throws InvalidArgumentException |
|
69 | - * @throws InvalidDataTypeException |
|
70 | - * @throws InvalidInterfaceException |
|
71 | - */ |
|
72 | - public static function set_hooks() |
|
73 | - { |
|
74 | - /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
75 | - $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
76 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
77 | - ); |
|
78 | - $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
79 | - EE_Config::register_route( |
|
80 | - $custom_post_types['espresso_events']['plural_slug'], |
|
81 | - 'Events_Archive', |
|
82 | - 'run' |
|
83 | - ); |
|
84 | - EE_Config::register_route( |
|
85 | - 'event_list', |
|
86 | - 'Events_Archive', |
|
87 | - 'event_list' |
|
88 | - ); |
|
89 | - EE_Config::register_route( |
|
90 | - 'iframe', |
|
91 | - 'Events_Archive', |
|
92 | - 'event_list_iframe', |
|
93 | - 'event_list' |
|
94 | - ); |
|
95 | - add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
101 | - * |
|
102 | - * @access public |
|
103 | - * @return void |
|
104 | - */ |
|
105 | - public static function set_hooks_admin() |
|
106 | - { |
|
107 | - add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
108 | - // hook into the end of the \EE_Admin_Page::_load_page_dependencies() |
|
109 | - // to load assets for "espresso_events" page on the "default" route (action) |
|
110 | - add_action( |
|
111 | - 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__default', |
|
112 | - array('EED_Events_Archive', 'event_list_iframe_embed_button'), |
|
113 | - 10 |
|
114 | - ); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * set_definitions |
|
120 | - * |
|
121 | - * @access public |
|
122 | - * @return void |
|
123 | - */ |
|
124 | - public static function set_definitions() |
|
125 | - { |
|
126 | - define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
127 | - define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * set up EE_Events_Archive_Config |
|
133 | - */ |
|
134 | - protected function set_config() |
|
135 | - { |
|
136 | - $this->set_config_section('template_settings'); |
|
137 | - $this->set_config_class('EE_Events_Archive_Config'); |
|
138 | - $this->set_config_name('EED_Events_Archive'); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * @return EventListIframeEmbedButton |
|
144 | - */ |
|
145 | - public static function get_iframe_embed_button() |
|
146 | - { |
|
147 | - if (! self::$_iframe_embed_button instanceof EventListIframeEmbedButton) { |
|
148 | - self::$_iframe_embed_button = new EventListIframeEmbedButton(); |
|
149 | - } |
|
150 | - return self::$_iframe_embed_button; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - /** |
|
155 | - * event_list_iframe_embed_button |
|
156 | - * |
|
157 | - * @return void |
|
158 | - * @throws \EE_Error |
|
159 | - */ |
|
160 | - public static function event_list_iframe_embed_button() |
|
161 | - { |
|
162 | - $iframe_embed_button = \EED_Events_Archive::get_iframe_embed_button(); |
|
163 | - $iframe_embed_button->addEmbedButton(); |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - /** |
|
168 | - * initialize_template_parts |
|
169 | - * |
|
170 | - * @access public |
|
171 | - * @param \EE_Events_Archive_Config $config |
|
172 | - * @return \EE_Template_Part_Manager |
|
173 | - */ |
|
174 | - public function initialize_template_parts(EE_Events_Archive_Config $config = null) |
|
175 | - { |
|
176 | - $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
|
177 | - EEH_Autoloader::instance()->register_template_part_autoloaders(); |
|
178 | - $template_parts = new EE_Template_Part_Manager(); |
|
179 | - $template_parts->add_template_part( |
|
180 | - 'tickets', |
|
181 | - __('Ticket Selector', 'event_espresso'), |
|
182 | - 'content-espresso_events-tickets.php', |
|
183 | - $config->display_order_tickets |
|
184 | - ); |
|
185 | - $template_parts->add_template_part( |
|
186 | - 'datetimes', |
|
187 | - __('Dates and Times', 'event_espresso'), |
|
188 | - 'content-espresso_events-datetimes.php', |
|
189 | - $config->display_order_datetimes |
|
190 | - ); |
|
191 | - $template_parts->add_template_part( |
|
192 | - 'event', |
|
193 | - __('Event Description', 'event_espresso'), |
|
194 | - 'content-espresso_events-details.php', |
|
195 | - $config->display_order_event |
|
196 | - ); |
|
197 | - $template_parts->add_template_part( |
|
198 | - 'venue', |
|
199 | - __('Venue Information', 'event_espresso'), |
|
200 | - 'content-espresso_events-venues.php', |
|
201 | - $config->display_order_venue |
|
202 | - ); |
|
203 | - do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
204 | - return $template_parts; |
|
205 | - } |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * run - initial module setup - this gets called by the EE_Front_Controller if the module route is found in the |
|
210 | - * incoming request |
|
211 | - * |
|
212 | - * @access public |
|
213 | - * @param WP $WP |
|
214 | - * @return void |
|
215 | - */ |
|
216 | - public function run($WP) |
|
217 | - { |
|
218 | - do_action('AHEE__EED_Events_Archive__before_run'); |
|
219 | - // ensure valid EE_Events_Archive_Config() object exists |
|
220 | - $this->set_config(); |
|
221 | - /** @type EE_Events_Archive_Config $config */ |
|
222 | - $config = $this->config(); |
|
223 | - // load other required components |
|
224 | - $this->load_event_list_assets(); |
|
225 | - // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
|
226 | - // add query filters |
|
227 | - EEH_Event_Query::add_query_filters(); |
|
228 | - // set params that will get used by the filters |
|
229 | - EEH_Event_Query::set_query_params( |
|
230 | - '', // month |
|
231 | - '', // category |
|
232 | - $config->display_expired_events, // show_expired |
|
233 | - 'start_date', // orderby |
|
234 | - 'ASC' // sort |
|
235 | - ); |
|
236 | - // check what template is loaded |
|
237 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
238 | - } |
|
239 | - |
|
240 | - |
|
241 | - /** |
|
242 | - * most likely called by the ESPRESSO_EVENTS shortcode which uses this module to do some of it's lifting |
|
243 | - * |
|
244 | - * @return void |
|
245 | - */ |
|
246 | - public function event_list() |
|
247 | - { |
|
248 | - // ensure valid EE_Events_Archive_Config() object exists |
|
249 | - $this->set_config(); |
|
250 | - // load other required components |
|
251 | - $this->load_event_list_assets(); |
|
252 | - } |
|
253 | - |
|
254 | - |
|
255 | - /** |
|
256 | - * @access public |
|
257 | - * @return void |
|
258 | - * @throws \EE_Error |
|
259 | - * @throws \DomainException |
|
260 | - */ |
|
261 | - public function event_list_iframe() |
|
262 | - { |
|
263 | - \EED_Events_Archive::$iframe = true; |
|
264 | - $event_list_iframe = new EventsArchiveIframe($this); |
|
265 | - $event_list_iframe->display(); |
|
266 | - } |
|
267 | - |
|
268 | - |
|
269 | - /** |
|
270 | - * @access public |
|
271 | - * @return string |
|
272 | - */ |
|
273 | - public static function is_iframe() |
|
274 | - { |
|
275 | - return \EED_Events_Archive::$iframe; |
|
276 | - } |
|
277 | - |
|
278 | - |
|
279 | - /** |
|
280 | - * @access public |
|
281 | - * @return string |
|
282 | - */ |
|
283 | - public static function link_target() |
|
284 | - { |
|
285 | - return \EED_Events_Archive::$iframe ? ' target="_blank"' : ''; |
|
286 | - } |
|
287 | - |
|
288 | - |
|
289 | - /** |
|
290 | - * template_include |
|
291 | - * |
|
292 | - * @access public |
|
293 | - * @param string $template |
|
294 | - * @return string |
|
295 | - */ |
|
296 | - public function template_include($template = '') |
|
297 | - { |
|
298 | - // don't add content filter for dedicated EE child themes or private posts |
|
299 | - if (! EEH_Template::is_espresso_theme()) { |
|
300 | - /** @type EE_Events_Archive_Config $config */ |
|
301 | - $config = $this->config(); |
|
302 | - // add status banner ? |
|
303 | - if ($config->display_status_banner) { |
|
304 | - add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
305 | - } |
|
306 | - // if NOT a custom template |
|
307 | - if (apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false) |
|
308 | - || EE_Registry::instance() |
|
309 | - ->load_core('Front_Controller') |
|
310 | - ->get_selected_template() !== 'archive-espresso_events.php' |
|
311 | - ) { |
|
312 | - // don't display entry meta because the existing theme will take care of that |
|
313 | - add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
314 | - // load functions.php file for the theme (loaded by WP if using child theme) |
|
315 | - EEH_Template::load_espresso_theme_functions(); |
|
316 | - // because we don't know if the theme is using the_excerpt() |
|
317 | - add_filter( |
|
318 | - 'the_excerpt', |
|
319 | - array('EED_Events_Archive', 'event_details'), |
|
320 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
321 | - ); |
|
322 | - // or the_content |
|
323 | - add_filter( |
|
324 | - 'the_content', |
|
325 | - array('EED_Events_Archive', 'event_details'), |
|
326 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
327 | - ); |
|
328 | - // and just in case they are running get_the_excerpt() which DESTROYS things |
|
329 | - add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
330 | - // don't display entry meta because the existing theme will take care of that |
|
331 | - add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
332 | - } |
|
333 | - } |
|
334 | - return $template; |
|
335 | - } |
|
336 | - |
|
337 | - |
|
338 | - /** |
|
339 | - * get_the_excerpt - kinda hacky, but if a theme is using get_the_excerpt(), then we need to remove our filters |
|
340 | - * on the_content() |
|
341 | - * |
|
342 | - * @access public |
|
343 | - * @param string $excerpt |
|
344 | - * @return string |
|
345 | - */ |
|
346 | - public static function get_the_excerpt($excerpt = '') |
|
347 | - { |
|
348 | - if (post_password_required()) { |
|
349 | - return $excerpt; |
|
350 | - } |
|
351 | - if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
352 | - remove_filter( |
|
353 | - 'the_excerpt', |
|
354 | - array('EED_Events_Archive', 'event_details'), |
|
355 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
356 | - ); |
|
357 | - remove_filter( |
|
358 | - 'the_content', |
|
359 | - array('EED_Events_Archive', 'event_details'), |
|
360 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
361 | - ); |
|
362 | - $excerpt = EED_Events_Archive::event_details($excerpt); |
|
363 | - } else { |
|
364 | - EED_Events_Archive::$using_get_the_excerpt = true; |
|
365 | - add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
366 | - } |
|
367 | - return $excerpt; |
|
368 | - } |
|
369 | - |
|
370 | - |
|
371 | - /** |
|
372 | - * end_get_the_excerpt |
|
373 | - * |
|
374 | - * @access public |
|
375 | - * @param string $text |
|
376 | - * @return string |
|
377 | - */ |
|
378 | - public static function end_get_the_excerpt($text = '') |
|
379 | - { |
|
380 | - EED_Events_Archive::$using_get_the_excerpt = false; |
|
381 | - return $text; |
|
382 | - } |
|
383 | - |
|
384 | - |
|
385 | - /** |
|
386 | - * the_title |
|
387 | - * |
|
388 | - * @access public |
|
389 | - * @param string $title |
|
390 | - * @param string $id |
|
391 | - * @return string |
|
392 | - */ |
|
393 | - public static function the_title($title = '', $id = '') |
|
394 | - { |
|
395 | - global $post; |
|
396 | - if ($post instanceof WP_Post) { |
|
397 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID) . $title : $title; |
|
398 | - } |
|
399 | - return $title; |
|
400 | - } |
|
401 | - |
|
402 | - |
|
403 | - /** |
|
404 | - * event_details |
|
405 | - * |
|
406 | - * @access public |
|
407 | - * @param string $content |
|
408 | - * @return string |
|
409 | - */ |
|
410 | - public static function event_details($content) |
|
411 | - { |
|
412 | - global $post; |
|
413 | - static $current_post_ID = 0; |
|
414 | - if ($current_post_ID !== $post->ID |
|
415 | - && $post->post_type === 'espresso_events' |
|
416 | - && ! EED_Events_Archive::$using_get_the_excerpt |
|
417 | - && ! post_password_required() |
|
418 | - && ( |
|
419 | - apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
420 | - || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
421 | - ) |
|
422 | - ) { |
|
423 | - // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
|
424 | - // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early |
|
425 | - // BEFORE headers are sent in order to examine the post content and generate content for the HTML header. |
|
426 | - // We want to allow those plugins to still do their thing and have access to our content, but depending on |
|
427 | - // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
|
428 | - // so the following allows this filter to be applied multiple times, but only once for real |
|
429 | - $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
430 | - if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
431 | - $content = \EED_Events_Archive::use_sortable_display_order(); |
|
432 | - } else { |
|
433 | - $content = \EED_Events_Archive::use_filterable_display_order(); |
|
434 | - } |
|
435 | - } |
|
436 | - return $content; |
|
437 | - } |
|
438 | - |
|
439 | - |
|
440 | - /** |
|
441 | - * use_sortable_display_order |
|
442 | - * |
|
443 | - * @access protected |
|
444 | - * @return string |
|
445 | - */ |
|
446 | - protected static function use_sortable_display_order() |
|
447 | - { |
|
448 | - // no further password checks required atm |
|
449 | - add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
450 | - // we need to first remove this callback from being applied to the_content() or the_excerpt() |
|
451 | - // (otherwise it will recurse and blow up the interweb) |
|
452 | - remove_filter( |
|
453 | - 'the_excerpt', |
|
454 | - array('EED_Events_Archive', 'event_details'), |
|
455 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
456 | - ); |
|
457 | - remove_filter( |
|
458 | - 'the_content', |
|
459 | - array('EED_Events_Archive', 'event_details'), |
|
460 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
461 | - ); |
|
462 | - remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
463 | - // now add additional content depending on whether event is using the_excerpt() or the_content() |
|
464 | - EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
|
465 | - $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
466 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
467 | - // re-add our main filters (or else the next event won't have them) |
|
468 | - add_filter( |
|
469 | - 'the_excerpt', |
|
470 | - array('EED_Events_Archive', 'event_details'), |
|
471 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
472 | - ); |
|
473 | - add_filter( |
|
474 | - 'the_content', |
|
475 | - array('EED_Events_Archive', 'event_details'), |
|
476 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
477 | - ); |
|
478 | - add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
479 | - remove_filter( |
|
480 | - 'FHEE__EED_Events_Archive__event_details__no_post_password_required', |
|
481 | - '__return_true' |
|
482 | - ); |
|
483 | - return $content; |
|
484 | - } |
|
485 | - |
|
486 | - |
|
487 | - /** |
|
488 | - * use_filterable_display_order |
|
489 | - * |
|
490 | - * @access protected |
|
491 | - * @return string |
|
492 | - */ |
|
493 | - protected static function use_filterable_display_order() |
|
494 | - { |
|
495 | - // we need to first remove this callback from being applied to the_content() |
|
496 | - // (otherwise it will recurse and blow up the interweb) |
|
497 | - remove_filter( |
|
498 | - 'the_excerpt', |
|
499 | - array('EED_Events_Archive', 'event_details'), |
|
500 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
501 | - ); |
|
502 | - remove_filter( |
|
503 | - 'the_content', |
|
504 | - array('EED_Events_Archive', 'event_details'), |
|
505 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
506 | - ); |
|
507 | - remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
508 | - // now add additional content depending on whether event is using the_excerpt() or the_content() |
|
509 | - EED_Events_Archive::_add_additional_excerpt_filters(); |
|
510 | - EED_Events_Archive::_add_additional_content_filters(); |
|
511 | - do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
512 | - // now load our template |
|
513 | - $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
514 | - // re-add our main filters (or else the next event won't have them) |
|
515 | - add_filter( |
|
516 | - 'the_excerpt', |
|
517 | - array('EED_Events_Archive', 'event_details'), |
|
518 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
519 | - ); |
|
520 | - add_filter( |
|
521 | - 'the_content', |
|
522 | - array('EED_Events_Archive', 'event_details'), |
|
523 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
524 | - ); |
|
525 | - add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
526 | - // but remove the other filters so that they don't get applied to the next post |
|
527 | - EED_Events_Archive::_remove_additional_events_archive_filters(); |
|
528 | - do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
529 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
530 | - // return ! empty( $template ) ? $template : $content; |
|
531 | - return $content; |
|
532 | - } |
|
533 | - |
|
534 | - |
|
535 | - /** |
|
536 | - * event_datetimes - adds datetimes ABOVE content |
|
537 | - * |
|
538 | - * @access public |
|
539 | - * @param string $content |
|
540 | - * @return string |
|
541 | - */ |
|
542 | - public static function event_datetimes($content) |
|
543 | - { |
|
544 | - if (post_password_required()) { |
|
545 | - return $content; |
|
546 | - } |
|
547 | - return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
548 | - } |
|
549 | - |
|
550 | - |
|
551 | - /** |
|
552 | - * event_tickets - adds tickets ABOVE content (which includes datetimes) |
|
553 | - * |
|
554 | - * @access public |
|
555 | - * @param string $content |
|
556 | - * @return string |
|
557 | - */ |
|
558 | - public static function event_tickets($content) |
|
559 | - { |
|
560 | - if (post_password_required()) { |
|
561 | - return $content; |
|
562 | - } |
|
563 | - return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
564 | - } |
|
565 | - |
|
566 | - |
|
567 | - /** |
|
568 | - * event_venues - adds venues BELOW content |
|
569 | - * |
|
570 | - * @access public |
|
571 | - * @param string $content |
|
572 | - * @return string |
|
573 | - */ |
|
574 | - public static function event_venue($content) |
|
575 | - { |
|
576 | - return EED_Events_Archive::event_venues($content); |
|
577 | - } |
|
578 | - |
|
579 | - |
|
580 | - /** |
|
581 | - * event_venues - adds venues BELOW content |
|
582 | - * |
|
583 | - * @access public |
|
584 | - * @param string $content |
|
585 | - * @return string |
|
586 | - */ |
|
587 | - public static function event_venues($content) |
|
588 | - { |
|
589 | - if (post_password_required()) { |
|
590 | - return $content; |
|
591 | - } |
|
592 | - return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
593 | - } |
|
594 | - |
|
595 | - |
|
596 | - /** |
|
597 | - * _add_additional_content_filters |
|
598 | - * |
|
599 | - * @access private |
|
600 | - * @return void |
|
601 | - */ |
|
602 | - private static function _add_additional_excerpt_filters() |
|
603 | - { |
|
604 | - add_filter( |
|
605 | - 'the_excerpt', |
|
606 | - array('EED_Events_Archive', 'event_datetimes'), |
|
607 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
608 | - ); |
|
609 | - add_filter( |
|
610 | - 'the_excerpt', |
|
611 | - array('EED_Events_Archive', 'event_tickets'), |
|
612 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
613 | - ); |
|
614 | - add_filter( |
|
615 | - 'the_excerpt', |
|
616 | - array('EED_Events_Archive', 'event_venues'), |
|
617 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
618 | - ); |
|
619 | - } |
|
620 | - |
|
621 | - |
|
622 | - /** |
|
623 | - * _add_additional_content_filters |
|
624 | - * |
|
625 | - * @access private |
|
626 | - * @return void |
|
627 | - */ |
|
628 | - private static function _add_additional_content_filters() |
|
629 | - { |
|
630 | - add_filter( |
|
631 | - 'the_content', |
|
632 | - array('EED_Events_Archive', 'event_datetimes'), |
|
633 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
634 | - ); |
|
635 | - add_filter( |
|
636 | - 'the_content', |
|
637 | - array('EED_Events_Archive', 'event_tickets'), |
|
638 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
639 | - ); |
|
640 | - add_filter( |
|
641 | - 'the_content', |
|
642 | - array('EED_Events_Archive', 'event_venues'), |
|
643 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
644 | - ); |
|
645 | - } |
|
646 | - |
|
647 | - |
|
648 | - /** |
|
649 | - * _remove_additional_events_archive_filters |
|
650 | - * |
|
651 | - * @access private |
|
652 | - * @return void |
|
653 | - */ |
|
654 | - private static function _remove_additional_events_archive_filters() |
|
655 | - { |
|
656 | - remove_filter( |
|
657 | - 'the_excerpt', |
|
658 | - array('EED_Events_Archive', 'event_datetimes'), |
|
659 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
660 | - ); |
|
661 | - remove_filter( |
|
662 | - 'the_excerpt', |
|
663 | - array('EED_Events_Archive', 'event_tickets'), |
|
664 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
665 | - ); |
|
666 | - remove_filter( |
|
667 | - 'the_excerpt', |
|
668 | - array('EED_Events_Archive', 'event_venues'), |
|
669 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
670 | - ); |
|
671 | - remove_filter( |
|
672 | - 'the_content', |
|
673 | - array('EED_Events_Archive', 'event_datetimes'), |
|
674 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
675 | - ); |
|
676 | - remove_filter( |
|
677 | - 'the_content', |
|
678 | - array('EED_Events_Archive', 'event_tickets'), |
|
679 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
680 | - ); |
|
681 | - remove_filter( |
|
682 | - 'the_content', |
|
683 | - array('EED_Events_Archive', 'event_venues'), |
|
684 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
685 | - ); |
|
686 | - } |
|
687 | - |
|
688 | - |
|
689 | - /** |
|
690 | - * remove_all_events_archive_filters |
|
691 | - * |
|
692 | - * @access public |
|
693 | - * @return void |
|
694 | - */ |
|
695 | - public static function remove_all_events_archive_filters() |
|
696 | - { |
|
697 | - // remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
698 | - remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 1); |
|
699 | - remove_filter( |
|
700 | - 'the_excerpt', |
|
701 | - array('EED_Events_Archive', 'event_details'), |
|
702 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
703 | - ); |
|
704 | - remove_filter( |
|
705 | - 'the_excerpt', |
|
706 | - array('EED_Events_Archive', 'event_datetimes'), |
|
707 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
708 | - ); |
|
709 | - remove_filter( |
|
710 | - 'the_excerpt', |
|
711 | - array('EED_Events_Archive', 'event_tickets'), |
|
712 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
713 | - ); |
|
714 | - remove_filter( |
|
715 | - 'the_excerpt', |
|
716 | - array('EED_Events_Archive', 'event_venues'), |
|
717 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
718 | - ); |
|
719 | - remove_filter( |
|
720 | - 'the_content', |
|
721 | - array('EED_Events_Archive', 'event_details'), |
|
722 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
723 | - ); |
|
724 | - remove_filter( |
|
725 | - 'the_content', |
|
726 | - array('EED_Events_Archive', 'event_datetimes'), |
|
727 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
728 | - ); |
|
729 | - remove_filter( |
|
730 | - 'the_content', |
|
731 | - array('EED_Events_Archive', 'event_tickets'), |
|
732 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
733 | - ); |
|
734 | - remove_filter( |
|
735 | - 'the_content', |
|
736 | - array('EED_Events_Archive', 'event_venues'), |
|
737 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
738 | - ); |
|
739 | - // don't display entry meta because the existing theme will take care of that |
|
740 | - remove_filter( |
|
741 | - 'FHEE__content_espresso_events_details_template__display_entry_meta', |
|
742 | - '__return_false' |
|
743 | - ); |
|
744 | - } |
|
745 | - |
|
746 | - |
|
747 | - /** |
|
748 | - * load_event_list_assets |
|
749 | - * |
|
750 | - * @access public |
|
751 | - * @return void |
|
752 | - */ |
|
753 | - public function load_event_list_assets() |
|
754 | - { |
|
755 | - do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
756 | - add_filter('FHEE_load_EE_Session', '__return_true'); |
|
757 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
758 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
759 | - if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
760 | - add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
761 | - } |
|
762 | - } |
|
763 | - |
|
764 | - |
|
765 | - /** |
|
766 | - * wp_enqueue_scripts |
|
767 | - * |
|
768 | - * @access public |
|
769 | - * @return void |
|
770 | - */ |
|
771 | - public function wp_enqueue_scripts() |
|
772 | - { |
|
773 | - // get some style |
|
774 | - if (apply_filters('FHEE_enable_default_espresso_css', false)) { |
|
775 | - // first check uploads folder |
|
776 | - if (EEH_File::is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
777 | - wp_register_style( |
|
778 | - $this->theme, |
|
779 | - get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
780 | - array('dashicons', 'espresso_default') |
|
781 | - ); |
|
782 | - } else { |
|
783 | - } |
|
784 | - wp_enqueue_style($this->theme); |
|
785 | - } |
|
786 | - } |
|
787 | - |
|
788 | - |
|
789 | - /** |
|
790 | - * template_settings_form |
|
791 | - * |
|
792 | - * @access public |
|
793 | - * @static |
|
794 | - * @return string |
|
795 | - */ |
|
796 | - public static function template_settings_form() |
|
797 | - { |
|
798 | - $template_settings = EE_Registry::instance()->CFG->template_settings; |
|
799 | - $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) |
|
800 | - ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
801 | - $template_settings->EED_Events_Archive = apply_filters( |
|
802 | - 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', |
|
803 | - $template_settings->EED_Events_Archive |
|
804 | - ); |
|
805 | - $events_archive_settings = array( |
|
806 | - 'display_status_banner' => 0, |
|
807 | - 'display_description' => 1, |
|
808 | - 'display_ticket_selector' => 0, |
|
809 | - 'display_datetimes' => 1, |
|
810 | - 'display_venue' => 0, |
|
811 | - 'display_expired_events' => 0, |
|
812 | - ); |
|
813 | - $events_archive_settings = array_merge( |
|
814 | - $events_archive_settings, |
|
815 | - (array) $template_settings->EED_Events_Archive |
|
816 | - ); |
|
817 | - EEH_Template::display_template( |
|
818 | - EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
819 | - $events_archive_settings |
|
820 | - ); |
|
821 | - } |
|
822 | - |
|
823 | - |
|
824 | - /** |
|
825 | - * update_template_settings |
|
826 | - * |
|
827 | - * @access public |
|
828 | - * @param EE_Template_Config $CFG |
|
829 | - * @param EE_Request_Handler $REQ |
|
830 | - * @return EE_Template_Config |
|
831 | - */ |
|
832 | - public static function update_template_settings($CFG, $REQ) |
|
833 | - { |
|
834 | - $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
|
835 | - // unless we are resetting the config... |
|
836 | - if (! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
837 | - || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1 |
|
838 | - ) { |
|
839 | - $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) |
|
840 | - ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
841 | - $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) |
|
842 | - ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
843 | - $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) |
|
844 | - ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
845 | - $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint( |
|
846 | - $REQ['EED_Events_Archive_display_datetimes'] |
|
847 | - ) : 1; |
|
848 | - $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint( |
|
849 | - $REQ['EED_Events_Archive_display_venue'] |
|
850 | - ) : 0; |
|
851 | - $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) |
|
852 | - ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; |
|
853 | - } |
|
854 | - return $CFG; |
|
855 | - } |
|
856 | - |
|
857 | - |
|
858 | - /** |
|
859 | - * event_list_css |
|
860 | - * |
|
861 | - * @access public |
|
862 | - * @param string $extra_class |
|
863 | - * @return string |
|
864 | - */ |
|
865 | - public static function event_list_css($extra_class = '') |
|
866 | - { |
|
867 | - $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
868 | - $event_list_css[] = 'espresso-event-list-event'; |
|
869 | - return implode(' ', $event_list_css); |
|
870 | - } |
|
871 | - |
|
872 | - |
|
873 | - /** |
|
874 | - * event_categories |
|
875 | - * |
|
876 | - * @access public |
|
877 | - * @return array |
|
878 | - */ |
|
879 | - public static function event_categories() |
|
880 | - { |
|
881 | - return EE_Registry::instance()->load_model('Term')->get_all_ee_categories(); |
|
882 | - } |
|
883 | - |
|
884 | - |
|
885 | - /** |
|
886 | - * display_description |
|
887 | - * |
|
888 | - * @access public |
|
889 | - * @param $value |
|
890 | - * @return bool |
|
891 | - */ |
|
892 | - public static function display_description($value) |
|
893 | - { |
|
894 | - $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
|
895 | - $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
896 | - return $display_description === $value ? true : false; |
|
897 | - } |
|
898 | - |
|
899 | - |
|
900 | - /** |
|
901 | - * display_ticket_selector |
|
902 | - * |
|
903 | - * @access public |
|
904 | - * @return bool |
|
905 | - */ |
|
906 | - public static function display_ticket_selector() |
|
907 | - { |
|
908 | - $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
|
909 | - return isset($config->display_ticket_selector) && $config->display_ticket_selector ? true : false; |
|
910 | - } |
|
911 | - |
|
912 | - |
|
913 | - /** |
|
914 | - * display_venue |
|
915 | - * |
|
916 | - * @access public |
|
917 | - * @return bool |
|
918 | - */ |
|
919 | - public static function display_venue() |
|
920 | - { |
|
921 | - $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
|
922 | - return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? true : false; |
|
923 | - } |
|
924 | - |
|
925 | - |
|
926 | - /** |
|
927 | - * display_datetimes |
|
928 | - * |
|
929 | - * @access public |
|
930 | - * @return bool |
|
931 | - */ |
|
932 | - public static function display_datetimes() |
|
933 | - { |
|
934 | - $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
|
935 | - return isset($config->display_datetimes) && $config->display_datetimes ? true : false; |
|
936 | - } |
|
937 | - |
|
938 | - |
|
939 | - /** |
|
940 | - * event_list_title |
|
941 | - * |
|
942 | - * @access public |
|
943 | - * @return string |
|
944 | - */ |
|
945 | - public static function event_list_title() |
|
946 | - { |
|
947 | - return apply_filters( |
|
948 | - 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
949 | - __('Upcoming Events', 'event_espresso') |
|
950 | - ); |
|
951 | - } |
|
952 | - |
|
953 | - |
|
954 | - // GRAVEYARD |
|
955 | - |
|
956 | - |
|
957 | - /** |
|
958 | - * @since 4.4.0 |
|
959 | - */ |
|
960 | - public static function _doing_it_wrong_notice($function = '') |
|
961 | - { |
|
962 | - EE_Error::doing_it_wrong( |
|
963 | - __FUNCTION__, |
|
964 | - sprintf( |
|
965 | - __( |
|
966 | - 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', |
|
967 | - 'event_espresso' |
|
968 | - ), |
|
969 | - $function, |
|
970 | - '<br />', |
|
971 | - '4.6.0' |
|
972 | - ), |
|
973 | - '4.4.0' |
|
974 | - ); |
|
975 | - } |
|
976 | - |
|
977 | - |
|
978 | - /** |
|
979 | - * @deprecated |
|
980 | - * @since 4.4.0 |
|
981 | - */ |
|
982 | - public function get_post_data() |
|
983 | - { |
|
984 | - EEH_Event_Query::set_query_params(); |
|
985 | - } |
|
986 | - |
|
987 | - |
|
988 | - /** |
|
989 | - * @deprecated |
|
990 | - * @since 4.4.0 |
|
991 | - */ |
|
992 | - public function posts_fields($SQL, WP_Query $wp_query) |
|
993 | - { |
|
994 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
995 | - return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
996 | - } |
|
997 | - |
|
998 | - |
|
999 | - /** |
|
1000 | - * @deprecated |
|
1001 | - * @since 4.4.0 |
|
1002 | - */ |
|
1003 | - public static function posts_fields_sql_for_orderby($orderby_params = array()) |
|
1004 | - { |
|
1005 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1006 | - return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
1007 | - } |
|
1008 | - |
|
1009 | - |
|
1010 | - /** |
|
1011 | - * @deprecated |
|
1012 | - * @since 4.4.0 |
|
1013 | - */ |
|
1014 | - public function posts_join($SQL, WP_Query $wp_query) |
|
1015 | - { |
|
1016 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1017 | - return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
1018 | - } |
|
1019 | - |
|
1020 | - |
|
1021 | - /** |
|
1022 | - * @deprecated |
|
1023 | - * @since 4.4.0 |
|
1024 | - */ |
|
1025 | - public static function posts_join_sql_for_terms($join_terms = null) |
|
1026 | - { |
|
1027 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1028 | - return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
1029 | - } |
|
1030 | - |
|
1031 | - |
|
1032 | - /** |
|
1033 | - * @deprecated |
|
1034 | - * @since 4.4.0 |
|
1035 | - */ |
|
1036 | - public static function posts_join_for_orderby($orderby_params = array()) |
|
1037 | - { |
|
1038 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1039 | - return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
1040 | - } |
|
1041 | - |
|
1042 | - |
|
1043 | - /** |
|
1044 | - * @deprecated |
|
1045 | - * @since 4.4.0 |
|
1046 | - */ |
|
1047 | - public function posts_where($SQL, WP_Query $wp_query) |
|
1048 | - { |
|
1049 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1050 | - return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
1051 | - } |
|
1052 | - |
|
1053 | - |
|
1054 | - /** |
|
1055 | - * @deprecated |
|
1056 | - * @since 4.4.0 |
|
1057 | - */ |
|
1058 | - public static function posts_where_sql_for_show_expired($show_expired = false) |
|
1059 | - { |
|
1060 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1061 | - return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
1062 | - } |
|
1063 | - |
|
1064 | - |
|
1065 | - /** |
|
1066 | - * @deprecated |
|
1067 | - * @since 4.4.0 |
|
1068 | - */ |
|
1069 | - public static function posts_where_sql_for_event_category_slug($event_category_slug = null) |
|
1070 | - { |
|
1071 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1072 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
1073 | - } |
|
1074 | - |
|
1075 | - |
|
1076 | - /** |
|
1077 | - * @deprecated |
|
1078 | - * @since 4.4.0 |
|
1079 | - */ |
|
1080 | - public static function posts_where_sql_for_event_list_month($month = null) |
|
1081 | - { |
|
1082 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1083 | - return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
1084 | - } |
|
1085 | - |
|
1086 | - |
|
1087 | - /** |
|
1088 | - * @deprecated |
|
1089 | - * @since 4.4.0 |
|
1090 | - */ |
|
1091 | - public function posts_orderby($SQL, WP_Query $wp_query) |
|
1092 | - { |
|
1093 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1094 | - return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
1095 | - } |
|
1096 | - |
|
1097 | - |
|
1098 | - /** |
|
1099 | - * @deprecated |
|
1100 | - * @since 4.4.0 |
|
1101 | - */ |
|
1102 | - public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') |
|
1103 | - { |
|
1104 | - EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1105 | - return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
1106 | - } |
|
19 | + const EVENT_DETAILS_PRIORITY = 100; |
|
20 | + |
|
21 | + const EVENT_DATETIMES_PRIORITY = 110; |
|
22 | + |
|
23 | + const EVENT_TICKETS_PRIORITY = 120; |
|
24 | + |
|
25 | + const EVENT_VENUES_PRIORITY = 130; |
|
26 | + |
|
27 | + |
|
28 | + public static $espresso_event_list_ID = 0; |
|
29 | + |
|
30 | + public static $espresso_grid_event_lists = array(); |
|
31 | + |
|
32 | + /** |
|
33 | + * @type bool $using_get_the_excerpt |
|
34 | + */ |
|
35 | + protected static $using_get_the_excerpt = false; |
|
36 | + |
|
37 | + /** |
|
38 | + * Used to flag when the event list is being called from an external iframe. |
|
39 | + * |
|
40 | + * @var bool $iframe |
|
41 | + */ |
|
42 | + protected static $iframe = false; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var \EventEspresso\core\libraries\iframe_display\EventListIframeEmbedButton $_iframe_embed_button |
|
46 | + */ |
|
47 | + private static $_iframe_embed_button; |
|
48 | + |
|
49 | + /** |
|
50 | + * @type EE_Template_Part_Manager $template_parts |
|
51 | + */ |
|
52 | + protected $template_parts; |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * @return EED_Events_Archive |
|
57 | + */ |
|
58 | + public static function instance() |
|
59 | + { |
|
60 | + return parent::get_instance(__CLASS__); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
66 | + * |
|
67 | + * @return void |
|
68 | + * @throws InvalidArgumentException |
|
69 | + * @throws InvalidDataTypeException |
|
70 | + * @throws InvalidInterfaceException |
|
71 | + */ |
|
72 | + public static function set_hooks() |
|
73 | + { |
|
74 | + /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
75 | + $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
76 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
77 | + ); |
|
78 | + $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
79 | + EE_Config::register_route( |
|
80 | + $custom_post_types['espresso_events']['plural_slug'], |
|
81 | + 'Events_Archive', |
|
82 | + 'run' |
|
83 | + ); |
|
84 | + EE_Config::register_route( |
|
85 | + 'event_list', |
|
86 | + 'Events_Archive', |
|
87 | + 'event_list' |
|
88 | + ); |
|
89 | + EE_Config::register_route( |
|
90 | + 'iframe', |
|
91 | + 'Events_Archive', |
|
92 | + 'event_list_iframe', |
|
93 | + 'event_list' |
|
94 | + ); |
|
95 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
101 | + * |
|
102 | + * @access public |
|
103 | + * @return void |
|
104 | + */ |
|
105 | + public static function set_hooks_admin() |
|
106 | + { |
|
107 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
108 | + // hook into the end of the \EE_Admin_Page::_load_page_dependencies() |
|
109 | + // to load assets for "espresso_events" page on the "default" route (action) |
|
110 | + add_action( |
|
111 | + 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__default', |
|
112 | + array('EED_Events_Archive', 'event_list_iframe_embed_button'), |
|
113 | + 10 |
|
114 | + ); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * set_definitions |
|
120 | + * |
|
121 | + * @access public |
|
122 | + * @return void |
|
123 | + */ |
|
124 | + public static function set_definitions() |
|
125 | + { |
|
126 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
127 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * set up EE_Events_Archive_Config |
|
133 | + */ |
|
134 | + protected function set_config() |
|
135 | + { |
|
136 | + $this->set_config_section('template_settings'); |
|
137 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
138 | + $this->set_config_name('EED_Events_Archive'); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * @return EventListIframeEmbedButton |
|
144 | + */ |
|
145 | + public static function get_iframe_embed_button() |
|
146 | + { |
|
147 | + if (! self::$_iframe_embed_button instanceof EventListIframeEmbedButton) { |
|
148 | + self::$_iframe_embed_button = new EventListIframeEmbedButton(); |
|
149 | + } |
|
150 | + return self::$_iframe_embed_button; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + /** |
|
155 | + * event_list_iframe_embed_button |
|
156 | + * |
|
157 | + * @return void |
|
158 | + * @throws \EE_Error |
|
159 | + */ |
|
160 | + public static function event_list_iframe_embed_button() |
|
161 | + { |
|
162 | + $iframe_embed_button = \EED_Events_Archive::get_iframe_embed_button(); |
|
163 | + $iframe_embed_button->addEmbedButton(); |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + /** |
|
168 | + * initialize_template_parts |
|
169 | + * |
|
170 | + * @access public |
|
171 | + * @param \EE_Events_Archive_Config $config |
|
172 | + * @return \EE_Template_Part_Manager |
|
173 | + */ |
|
174 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) |
|
175 | + { |
|
176 | + $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
|
177 | + EEH_Autoloader::instance()->register_template_part_autoloaders(); |
|
178 | + $template_parts = new EE_Template_Part_Manager(); |
|
179 | + $template_parts->add_template_part( |
|
180 | + 'tickets', |
|
181 | + __('Ticket Selector', 'event_espresso'), |
|
182 | + 'content-espresso_events-tickets.php', |
|
183 | + $config->display_order_tickets |
|
184 | + ); |
|
185 | + $template_parts->add_template_part( |
|
186 | + 'datetimes', |
|
187 | + __('Dates and Times', 'event_espresso'), |
|
188 | + 'content-espresso_events-datetimes.php', |
|
189 | + $config->display_order_datetimes |
|
190 | + ); |
|
191 | + $template_parts->add_template_part( |
|
192 | + 'event', |
|
193 | + __('Event Description', 'event_espresso'), |
|
194 | + 'content-espresso_events-details.php', |
|
195 | + $config->display_order_event |
|
196 | + ); |
|
197 | + $template_parts->add_template_part( |
|
198 | + 'venue', |
|
199 | + __('Venue Information', 'event_espresso'), |
|
200 | + 'content-espresso_events-venues.php', |
|
201 | + $config->display_order_venue |
|
202 | + ); |
|
203 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
204 | + return $template_parts; |
|
205 | + } |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * run - initial module setup - this gets called by the EE_Front_Controller if the module route is found in the |
|
210 | + * incoming request |
|
211 | + * |
|
212 | + * @access public |
|
213 | + * @param WP $WP |
|
214 | + * @return void |
|
215 | + */ |
|
216 | + public function run($WP) |
|
217 | + { |
|
218 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
219 | + // ensure valid EE_Events_Archive_Config() object exists |
|
220 | + $this->set_config(); |
|
221 | + /** @type EE_Events_Archive_Config $config */ |
|
222 | + $config = $this->config(); |
|
223 | + // load other required components |
|
224 | + $this->load_event_list_assets(); |
|
225 | + // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
|
226 | + // add query filters |
|
227 | + EEH_Event_Query::add_query_filters(); |
|
228 | + // set params that will get used by the filters |
|
229 | + EEH_Event_Query::set_query_params( |
|
230 | + '', // month |
|
231 | + '', // category |
|
232 | + $config->display_expired_events, // show_expired |
|
233 | + 'start_date', // orderby |
|
234 | + 'ASC' // sort |
|
235 | + ); |
|
236 | + // check what template is loaded |
|
237 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
238 | + } |
|
239 | + |
|
240 | + |
|
241 | + /** |
|
242 | + * most likely called by the ESPRESSO_EVENTS shortcode which uses this module to do some of it's lifting |
|
243 | + * |
|
244 | + * @return void |
|
245 | + */ |
|
246 | + public function event_list() |
|
247 | + { |
|
248 | + // ensure valid EE_Events_Archive_Config() object exists |
|
249 | + $this->set_config(); |
|
250 | + // load other required components |
|
251 | + $this->load_event_list_assets(); |
|
252 | + } |
|
253 | + |
|
254 | + |
|
255 | + /** |
|
256 | + * @access public |
|
257 | + * @return void |
|
258 | + * @throws \EE_Error |
|
259 | + * @throws \DomainException |
|
260 | + */ |
|
261 | + public function event_list_iframe() |
|
262 | + { |
|
263 | + \EED_Events_Archive::$iframe = true; |
|
264 | + $event_list_iframe = new EventsArchiveIframe($this); |
|
265 | + $event_list_iframe->display(); |
|
266 | + } |
|
267 | + |
|
268 | + |
|
269 | + /** |
|
270 | + * @access public |
|
271 | + * @return string |
|
272 | + */ |
|
273 | + public static function is_iframe() |
|
274 | + { |
|
275 | + return \EED_Events_Archive::$iframe; |
|
276 | + } |
|
277 | + |
|
278 | + |
|
279 | + /** |
|
280 | + * @access public |
|
281 | + * @return string |
|
282 | + */ |
|
283 | + public static function link_target() |
|
284 | + { |
|
285 | + return \EED_Events_Archive::$iframe ? ' target="_blank"' : ''; |
|
286 | + } |
|
287 | + |
|
288 | + |
|
289 | + /** |
|
290 | + * template_include |
|
291 | + * |
|
292 | + * @access public |
|
293 | + * @param string $template |
|
294 | + * @return string |
|
295 | + */ |
|
296 | + public function template_include($template = '') |
|
297 | + { |
|
298 | + // don't add content filter for dedicated EE child themes or private posts |
|
299 | + if (! EEH_Template::is_espresso_theme()) { |
|
300 | + /** @type EE_Events_Archive_Config $config */ |
|
301 | + $config = $this->config(); |
|
302 | + // add status banner ? |
|
303 | + if ($config->display_status_banner) { |
|
304 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
305 | + } |
|
306 | + // if NOT a custom template |
|
307 | + if (apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false) |
|
308 | + || EE_Registry::instance() |
|
309 | + ->load_core('Front_Controller') |
|
310 | + ->get_selected_template() !== 'archive-espresso_events.php' |
|
311 | + ) { |
|
312 | + // don't display entry meta because the existing theme will take care of that |
|
313 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
314 | + // load functions.php file for the theme (loaded by WP if using child theme) |
|
315 | + EEH_Template::load_espresso_theme_functions(); |
|
316 | + // because we don't know if the theme is using the_excerpt() |
|
317 | + add_filter( |
|
318 | + 'the_excerpt', |
|
319 | + array('EED_Events_Archive', 'event_details'), |
|
320 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
321 | + ); |
|
322 | + // or the_content |
|
323 | + add_filter( |
|
324 | + 'the_content', |
|
325 | + array('EED_Events_Archive', 'event_details'), |
|
326 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
327 | + ); |
|
328 | + // and just in case they are running get_the_excerpt() which DESTROYS things |
|
329 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
330 | + // don't display entry meta because the existing theme will take care of that |
|
331 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
332 | + } |
|
333 | + } |
|
334 | + return $template; |
|
335 | + } |
|
336 | + |
|
337 | + |
|
338 | + /** |
|
339 | + * get_the_excerpt - kinda hacky, but if a theme is using get_the_excerpt(), then we need to remove our filters |
|
340 | + * on the_content() |
|
341 | + * |
|
342 | + * @access public |
|
343 | + * @param string $excerpt |
|
344 | + * @return string |
|
345 | + */ |
|
346 | + public static function get_the_excerpt($excerpt = '') |
|
347 | + { |
|
348 | + if (post_password_required()) { |
|
349 | + return $excerpt; |
|
350 | + } |
|
351 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
352 | + remove_filter( |
|
353 | + 'the_excerpt', |
|
354 | + array('EED_Events_Archive', 'event_details'), |
|
355 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
356 | + ); |
|
357 | + remove_filter( |
|
358 | + 'the_content', |
|
359 | + array('EED_Events_Archive', 'event_details'), |
|
360 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
361 | + ); |
|
362 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
363 | + } else { |
|
364 | + EED_Events_Archive::$using_get_the_excerpt = true; |
|
365 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
366 | + } |
|
367 | + return $excerpt; |
|
368 | + } |
|
369 | + |
|
370 | + |
|
371 | + /** |
|
372 | + * end_get_the_excerpt |
|
373 | + * |
|
374 | + * @access public |
|
375 | + * @param string $text |
|
376 | + * @return string |
|
377 | + */ |
|
378 | + public static function end_get_the_excerpt($text = '') |
|
379 | + { |
|
380 | + EED_Events_Archive::$using_get_the_excerpt = false; |
|
381 | + return $text; |
|
382 | + } |
|
383 | + |
|
384 | + |
|
385 | + /** |
|
386 | + * the_title |
|
387 | + * |
|
388 | + * @access public |
|
389 | + * @param string $title |
|
390 | + * @param string $id |
|
391 | + * @return string |
|
392 | + */ |
|
393 | + public static function the_title($title = '', $id = '') |
|
394 | + { |
|
395 | + global $post; |
|
396 | + if ($post instanceof WP_Post) { |
|
397 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID) . $title : $title; |
|
398 | + } |
|
399 | + return $title; |
|
400 | + } |
|
401 | + |
|
402 | + |
|
403 | + /** |
|
404 | + * event_details |
|
405 | + * |
|
406 | + * @access public |
|
407 | + * @param string $content |
|
408 | + * @return string |
|
409 | + */ |
|
410 | + public static function event_details($content) |
|
411 | + { |
|
412 | + global $post; |
|
413 | + static $current_post_ID = 0; |
|
414 | + if ($current_post_ID !== $post->ID |
|
415 | + && $post->post_type === 'espresso_events' |
|
416 | + && ! EED_Events_Archive::$using_get_the_excerpt |
|
417 | + && ! post_password_required() |
|
418 | + && ( |
|
419 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
420 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
421 | + ) |
|
422 | + ) { |
|
423 | + // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
|
424 | + // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early |
|
425 | + // BEFORE headers are sent in order to examine the post content and generate content for the HTML header. |
|
426 | + // We want to allow those plugins to still do their thing and have access to our content, but depending on |
|
427 | + // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
|
428 | + // so the following allows this filter to be applied multiple times, but only once for real |
|
429 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
430 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
431 | + $content = \EED_Events_Archive::use_sortable_display_order(); |
|
432 | + } else { |
|
433 | + $content = \EED_Events_Archive::use_filterable_display_order(); |
|
434 | + } |
|
435 | + } |
|
436 | + return $content; |
|
437 | + } |
|
438 | + |
|
439 | + |
|
440 | + /** |
|
441 | + * use_sortable_display_order |
|
442 | + * |
|
443 | + * @access protected |
|
444 | + * @return string |
|
445 | + */ |
|
446 | + protected static function use_sortable_display_order() |
|
447 | + { |
|
448 | + // no further password checks required atm |
|
449 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
450 | + // we need to first remove this callback from being applied to the_content() or the_excerpt() |
|
451 | + // (otherwise it will recurse and blow up the interweb) |
|
452 | + remove_filter( |
|
453 | + 'the_excerpt', |
|
454 | + array('EED_Events_Archive', 'event_details'), |
|
455 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
456 | + ); |
|
457 | + remove_filter( |
|
458 | + 'the_content', |
|
459 | + array('EED_Events_Archive', 'event_details'), |
|
460 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
461 | + ); |
|
462 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
463 | + // now add additional content depending on whether event is using the_excerpt() or the_content() |
|
464 | + EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
|
465 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
466 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
467 | + // re-add our main filters (or else the next event won't have them) |
|
468 | + add_filter( |
|
469 | + 'the_excerpt', |
|
470 | + array('EED_Events_Archive', 'event_details'), |
|
471 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
472 | + ); |
|
473 | + add_filter( |
|
474 | + 'the_content', |
|
475 | + array('EED_Events_Archive', 'event_details'), |
|
476 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
477 | + ); |
|
478 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
479 | + remove_filter( |
|
480 | + 'FHEE__EED_Events_Archive__event_details__no_post_password_required', |
|
481 | + '__return_true' |
|
482 | + ); |
|
483 | + return $content; |
|
484 | + } |
|
485 | + |
|
486 | + |
|
487 | + /** |
|
488 | + * use_filterable_display_order |
|
489 | + * |
|
490 | + * @access protected |
|
491 | + * @return string |
|
492 | + */ |
|
493 | + protected static function use_filterable_display_order() |
|
494 | + { |
|
495 | + // we need to first remove this callback from being applied to the_content() |
|
496 | + // (otherwise it will recurse and blow up the interweb) |
|
497 | + remove_filter( |
|
498 | + 'the_excerpt', |
|
499 | + array('EED_Events_Archive', 'event_details'), |
|
500 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
501 | + ); |
|
502 | + remove_filter( |
|
503 | + 'the_content', |
|
504 | + array('EED_Events_Archive', 'event_details'), |
|
505 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
506 | + ); |
|
507 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
508 | + // now add additional content depending on whether event is using the_excerpt() or the_content() |
|
509 | + EED_Events_Archive::_add_additional_excerpt_filters(); |
|
510 | + EED_Events_Archive::_add_additional_content_filters(); |
|
511 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
512 | + // now load our template |
|
513 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
514 | + // re-add our main filters (or else the next event won't have them) |
|
515 | + add_filter( |
|
516 | + 'the_excerpt', |
|
517 | + array('EED_Events_Archive', 'event_details'), |
|
518 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
519 | + ); |
|
520 | + add_filter( |
|
521 | + 'the_content', |
|
522 | + array('EED_Events_Archive', 'event_details'), |
|
523 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
524 | + ); |
|
525 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
526 | + // but remove the other filters so that they don't get applied to the next post |
|
527 | + EED_Events_Archive::_remove_additional_events_archive_filters(); |
|
528 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
529 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
530 | + // return ! empty( $template ) ? $template : $content; |
|
531 | + return $content; |
|
532 | + } |
|
533 | + |
|
534 | + |
|
535 | + /** |
|
536 | + * event_datetimes - adds datetimes ABOVE content |
|
537 | + * |
|
538 | + * @access public |
|
539 | + * @param string $content |
|
540 | + * @return string |
|
541 | + */ |
|
542 | + public static function event_datetimes($content) |
|
543 | + { |
|
544 | + if (post_password_required()) { |
|
545 | + return $content; |
|
546 | + } |
|
547 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
548 | + } |
|
549 | + |
|
550 | + |
|
551 | + /** |
|
552 | + * event_tickets - adds tickets ABOVE content (which includes datetimes) |
|
553 | + * |
|
554 | + * @access public |
|
555 | + * @param string $content |
|
556 | + * @return string |
|
557 | + */ |
|
558 | + public static function event_tickets($content) |
|
559 | + { |
|
560 | + if (post_password_required()) { |
|
561 | + return $content; |
|
562 | + } |
|
563 | + return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
564 | + } |
|
565 | + |
|
566 | + |
|
567 | + /** |
|
568 | + * event_venues - adds venues BELOW content |
|
569 | + * |
|
570 | + * @access public |
|
571 | + * @param string $content |
|
572 | + * @return string |
|
573 | + */ |
|
574 | + public static function event_venue($content) |
|
575 | + { |
|
576 | + return EED_Events_Archive::event_venues($content); |
|
577 | + } |
|
578 | + |
|
579 | + |
|
580 | + /** |
|
581 | + * event_venues - adds venues BELOW content |
|
582 | + * |
|
583 | + * @access public |
|
584 | + * @param string $content |
|
585 | + * @return string |
|
586 | + */ |
|
587 | + public static function event_venues($content) |
|
588 | + { |
|
589 | + if (post_password_required()) { |
|
590 | + return $content; |
|
591 | + } |
|
592 | + return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
593 | + } |
|
594 | + |
|
595 | + |
|
596 | + /** |
|
597 | + * _add_additional_content_filters |
|
598 | + * |
|
599 | + * @access private |
|
600 | + * @return void |
|
601 | + */ |
|
602 | + private static function _add_additional_excerpt_filters() |
|
603 | + { |
|
604 | + add_filter( |
|
605 | + 'the_excerpt', |
|
606 | + array('EED_Events_Archive', 'event_datetimes'), |
|
607 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
608 | + ); |
|
609 | + add_filter( |
|
610 | + 'the_excerpt', |
|
611 | + array('EED_Events_Archive', 'event_tickets'), |
|
612 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
613 | + ); |
|
614 | + add_filter( |
|
615 | + 'the_excerpt', |
|
616 | + array('EED_Events_Archive', 'event_venues'), |
|
617 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
618 | + ); |
|
619 | + } |
|
620 | + |
|
621 | + |
|
622 | + /** |
|
623 | + * _add_additional_content_filters |
|
624 | + * |
|
625 | + * @access private |
|
626 | + * @return void |
|
627 | + */ |
|
628 | + private static function _add_additional_content_filters() |
|
629 | + { |
|
630 | + add_filter( |
|
631 | + 'the_content', |
|
632 | + array('EED_Events_Archive', 'event_datetimes'), |
|
633 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
634 | + ); |
|
635 | + add_filter( |
|
636 | + 'the_content', |
|
637 | + array('EED_Events_Archive', 'event_tickets'), |
|
638 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
639 | + ); |
|
640 | + add_filter( |
|
641 | + 'the_content', |
|
642 | + array('EED_Events_Archive', 'event_venues'), |
|
643 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
644 | + ); |
|
645 | + } |
|
646 | + |
|
647 | + |
|
648 | + /** |
|
649 | + * _remove_additional_events_archive_filters |
|
650 | + * |
|
651 | + * @access private |
|
652 | + * @return void |
|
653 | + */ |
|
654 | + private static function _remove_additional_events_archive_filters() |
|
655 | + { |
|
656 | + remove_filter( |
|
657 | + 'the_excerpt', |
|
658 | + array('EED_Events_Archive', 'event_datetimes'), |
|
659 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
660 | + ); |
|
661 | + remove_filter( |
|
662 | + 'the_excerpt', |
|
663 | + array('EED_Events_Archive', 'event_tickets'), |
|
664 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
665 | + ); |
|
666 | + remove_filter( |
|
667 | + 'the_excerpt', |
|
668 | + array('EED_Events_Archive', 'event_venues'), |
|
669 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
670 | + ); |
|
671 | + remove_filter( |
|
672 | + 'the_content', |
|
673 | + array('EED_Events_Archive', 'event_datetimes'), |
|
674 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
675 | + ); |
|
676 | + remove_filter( |
|
677 | + 'the_content', |
|
678 | + array('EED_Events_Archive', 'event_tickets'), |
|
679 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
680 | + ); |
|
681 | + remove_filter( |
|
682 | + 'the_content', |
|
683 | + array('EED_Events_Archive', 'event_venues'), |
|
684 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
685 | + ); |
|
686 | + } |
|
687 | + |
|
688 | + |
|
689 | + /** |
|
690 | + * remove_all_events_archive_filters |
|
691 | + * |
|
692 | + * @access public |
|
693 | + * @return void |
|
694 | + */ |
|
695 | + public static function remove_all_events_archive_filters() |
|
696 | + { |
|
697 | + // remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
698 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 1); |
|
699 | + remove_filter( |
|
700 | + 'the_excerpt', |
|
701 | + array('EED_Events_Archive', 'event_details'), |
|
702 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
703 | + ); |
|
704 | + remove_filter( |
|
705 | + 'the_excerpt', |
|
706 | + array('EED_Events_Archive', 'event_datetimes'), |
|
707 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
708 | + ); |
|
709 | + remove_filter( |
|
710 | + 'the_excerpt', |
|
711 | + array('EED_Events_Archive', 'event_tickets'), |
|
712 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
713 | + ); |
|
714 | + remove_filter( |
|
715 | + 'the_excerpt', |
|
716 | + array('EED_Events_Archive', 'event_venues'), |
|
717 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
718 | + ); |
|
719 | + remove_filter( |
|
720 | + 'the_content', |
|
721 | + array('EED_Events_Archive', 'event_details'), |
|
722 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
723 | + ); |
|
724 | + remove_filter( |
|
725 | + 'the_content', |
|
726 | + array('EED_Events_Archive', 'event_datetimes'), |
|
727 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
728 | + ); |
|
729 | + remove_filter( |
|
730 | + 'the_content', |
|
731 | + array('EED_Events_Archive', 'event_tickets'), |
|
732 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
733 | + ); |
|
734 | + remove_filter( |
|
735 | + 'the_content', |
|
736 | + array('EED_Events_Archive', 'event_venues'), |
|
737 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
738 | + ); |
|
739 | + // don't display entry meta because the existing theme will take care of that |
|
740 | + remove_filter( |
|
741 | + 'FHEE__content_espresso_events_details_template__display_entry_meta', |
|
742 | + '__return_false' |
|
743 | + ); |
|
744 | + } |
|
745 | + |
|
746 | + |
|
747 | + /** |
|
748 | + * load_event_list_assets |
|
749 | + * |
|
750 | + * @access public |
|
751 | + * @return void |
|
752 | + */ |
|
753 | + public function load_event_list_assets() |
|
754 | + { |
|
755 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
756 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
757 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
758 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
759 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
760 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
761 | + } |
|
762 | + } |
|
763 | + |
|
764 | + |
|
765 | + /** |
|
766 | + * wp_enqueue_scripts |
|
767 | + * |
|
768 | + * @access public |
|
769 | + * @return void |
|
770 | + */ |
|
771 | + public function wp_enqueue_scripts() |
|
772 | + { |
|
773 | + // get some style |
|
774 | + if (apply_filters('FHEE_enable_default_espresso_css', false)) { |
|
775 | + // first check uploads folder |
|
776 | + if (EEH_File::is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
777 | + wp_register_style( |
|
778 | + $this->theme, |
|
779 | + get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
780 | + array('dashicons', 'espresso_default') |
|
781 | + ); |
|
782 | + } else { |
|
783 | + } |
|
784 | + wp_enqueue_style($this->theme); |
|
785 | + } |
|
786 | + } |
|
787 | + |
|
788 | + |
|
789 | + /** |
|
790 | + * template_settings_form |
|
791 | + * |
|
792 | + * @access public |
|
793 | + * @static |
|
794 | + * @return string |
|
795 | + */ |
|
796 | + public static function template_settings_form() |
|
797 | + { |
|
798 | + $template_settings = EE_Registry::instance()->CFG->template_settings; |
|
799 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) |
|
800 | + ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
801 | + $template_settings->EED_Events_Archive = apply_filters( |
|
802 | + 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', |
|
803 | + $template_settings->EED_Events_Archive |
|
804 | + ); |
|
805 | + $events_archive_settings = array( |
|
806 | + 'display_status_banner' => 0, |
|
807 | + 'display_description' => 1, |
|
808 | + 'display_ticket_selector' => 0, |
|
809 | + 'display_datetimes' => 1, |
|
810 | + 'display_venue' => 0, |
|
811 | + 'display_expired_events' => 0, |
|
812 | + ); |
|
813 | + $events_archive_settings = array_merge( |
|
814 | + $events_archive_settings, |
|
815 | + (array) $template_settings->EED_Events_Archive |
|
816 | + ); |
|
817 | + EEH_Template::display_template( |
|
818 | + EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
819 | + $events_archive_settings |
|
820 | + ); |
|
821 | + } |
|
822 | + |
|
823 | + |
|
824 | + /** |
|
825 | + * update_template_settings |
|
826 | + * |
|
827 | + * @access public |
|
828 | + * @param EE_Template_Config $CFG |
|
829 | + * @param EE_Request_Handler $REQ |
|
830 | + * @return EE_Template_Config |
|
831 | + */ |
|
832 | + public static function update_template_settings($CFG, $REQ) |
|
833 | + { |
|
834 | + $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
|
835 | + // unless we are resetting the config... |
|
836 | + if (! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
837 | + || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1 |
|
838 | + ) { |
|
839 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) |
|
840 | + ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
841 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) |
|
842 | + ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
843 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) |
|
844 | + ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
845 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint( |
|
846 | + $REQ['EED_Events_Archive_display_datetimes'] |
|
847 | + ) : 1; |
|
848 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint( |
|
849 | + $REQ['EED_Events_Archive_display_venue'] |
|
850 | + ) : 0; |
|
851 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) |
|
852 | + ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; |
|
853 | + } |
|
854 | + return $CFG; |
|
855 | + } |
|
856 | + |
|
857 | + |
|
858 | + /** |
|
859 | + * event_list_css |
|
860 | + * |
|
861 | + * @access public |
|
862 | + * @param string $extra_class |
|
863 | + * @return string |
|
864 | + */ |
|
865 | + public static function event_list_css($extra_class = '') |
|
866 | + { |
|
867 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
868 | + $event_list_css[] = 'espresso-event-list-event'; |
|
869 | + return implode(' ', $event_list_css); |
|
870 | + } |
|
871 | + |
|
872 | + |
|
873 | + /** |
|
874 | + * event_categories |
|
875 | + * |
|
876 | + * @access public |
|
877 | + * @return array |
|
878 | + */ |
|
879 | + public static function event_categories() |
|
880 | + { |
|
881 | + return EE_Registry::instance()->load_model('Term')->get_all_ee_categories(); |
|
882 | + } |
|
883 | + |
|
884 | + |
|
885 | + /** |
|
886 | + * display_description |
|
887 | + * |
|
888 | + * @access public |
|
889 | + * @param $value |
|
890 | + * @return bool |
|
891 | + */ |
|
892 | + public static function display_description($value) |
|
893 | + { |
|
894 | + $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
|
895 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
896 | + return $display_description === $value ? true : false; |
|
897 | + } |
|
898 | + |
|
899 | + |
|
900 | + /** |
|
901 | + * display_ticket_selector |
|
902 | + * |
|
903 | + * @access public |
|
904 | + * @return bool |
|
905 | + */ |
|
906 | + public static function display_ticket_selector() |
|
907 | + { |
|
908 | + $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
|
909 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? true : false; |
|
910 | + } |
|
911 | + |
|
912 | + |
|
913 | + /** |
|
914 | + * display_venue |
|
915 | + * |
|
916 | + * @access public |
|
917 | + * @return bool |
|
918 | + */ |
|
919 | + public static function display_venue() |
|
920 | + { |
|
921 | + $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
|
922 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? true : false; |
|
923 | + } |
|
924 | + |
|
925 | + |
|
926 | + /** |
|
927 | + * display_datetimes |
|
928 | + * |
|
929 | + * @access public |
|
930 | + * @return bool |
|
931 | + */ |
|
932 | + public static function display_datetimes() |
|
933 | + { |
|
934 | + $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
|
935 | + return isset($config->display_datetimes) && $config->display_datetimes ? true : false; |
|
936 | + } |
|
937 | + |
|
938 | + |
|
939 | + /** |
|
940 | + * event_list_title |
|
941 | + * |
|
942 | + * @access public |
|
943 | + * @return string |
|
944 | + */ |
|
945 | + public static function event_list_title() |
|
946 | + { |
|
947 | + return apply_filters( |
|
948 | + 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
949 | + __('Upcoming Events', 'event_espresso') |
|
950 | + ); |
|
951 | + } |
|
952 | + |
|
953 | + |
|
954 | + // GRAVEYARD |
|
955 | + |
|
956 | + |
|
957 | + /** |
|
958 | + * @since 4.4.0 |
|
959 | + */ |
|
960 | + public static function _doing_it_wrong_notice($function = '') |
|
961 | + { |
|
962 | + EE_Error::doing_it_wrong( |
|
963 | + __FUNCTION__, |
|
964 | + sprintf( |
|
965 | + __( |
|
966 | + 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', |
|
967 | + 'event_espresso' |
|
968 | + ), |
|
969 | + $function, |
|
970 | + '<br />', |
|
971 | + '4.6.0' |
|
972 | + ), |
|
973 | + '4.4.0' |
|
974 | + ); |
|
975 | + } |
|
976 | + |
|
977 | + |
|
978 | + /** |
|
979 | + * @deprecated |
|
980 | + * @since 4.4.0 |
|
981 | + */ |
|
982 | + public function get_post_data() |
|
983 | + { |
|
984 | + EEH_Event_Query::set_query_params(); |
|
985 | + } |
|
986 | + |
|
987 | + |
|
988 | + /** |
|
989 | + * @deprecated |
|
990 | + * @since 4.4.0 |
|
991 | + */ |
|
992 | + public function posts_fields($SQL, WP_Query $wp_query) |
|
993 | + { |
|
994 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
995 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
996 | + } |
|
997 | + |
|
998 | + |
|
999 | + /** |
|
1000 | + * @deprecated |
|
1001 | + * @since 4.4.0 |
|
1002 | + */ |
|
1003 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) |
|
1004 | + { |
|
1005 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1006 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
1007 | + } |
|
1008 | + |
|
1009 | + |
|
1010 | + /** |
|
1011 | + * @deprecated |
|
1012 | + * @since 4.4.0 |
|
1013 | + */ |
|
1014 | + public function posts_join($SQL, WP_Query $wp_query) |
|
1015 | + { |
|
1016 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1017 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
1018 | + } |
|
1019 | + |
|
1020 | + |
|
1021 | + /** |
|
1022 | + * @deprecated |
|
1023 | + * @since 4.4.0 |
|
1024 | + */ |
|
1025 | + public static function posts_join_sql_for_terms($join_terms = null) |
|
1026 | + { |
|
1027 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1028 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
1029 | + } |
|
1030 | + |
|
1031 | + |
|
1032 | + /** |
|
1033 | + * @deprecated |
|
1034 | + * @since 4.4.0 |
|
1035 | + */ |
|
1036 | + public static function posts_join_for_orderby($orderby_params = array()) |
|
1037 | + { |
|
1038 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1039 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
1040 | + } |
|
1041 | + |
|
1042 | + |
|
1043 | + /** |
|
1044 | + * @deprecated |
|
1045 | + * @since 4.4.0 |
|
1046 | + */ |
|
1047 | + public function posts_where($SQL, WP_Query $wp_query) |
|
1048 | + { |
|
1049 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1050 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
1051 | + } |
|
1052 | + |
|
1053 | + |
|
1054 | + /** |
|
1055 | + * @deprecated |
|
1056 | + * @since 4.4.0 |
|
1057 | + */ |
|
1058 | + public static function posts_where_sql_for_show_expired($show_expired = false) |
|
1059 | + { |
|
1060 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1061 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
1062 | + } |
|
1063 | + |
|
1064 | + |
|
1065 | + /** |
|
1066 | + * @deprecated |
|
1067 | + * @since 4.4.0 |
|
1068 | + */ |
|
1069 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = null) |
|
1070 | + { |
|
1071 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1072 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
1073 | + } |
|
1074 | + |
|
1075 | + |
|
1076 | + /** |
|
1077 | + * @deprecated |
|
1078 | + * @since 4.4.0 |
|
1079 | + */ |
|
1080 | + public static function posts_where_sql_for_event_list_month($month = null) |
|
1081 | + { |
|
1082 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1083 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
1084 | + } |
|
1085 | + |
|
1086 | + |
|
1087 | + /** |
|
1088 | + * @deprecated |
|
1089 | + * @since 4.4.0 |
|
1090 | + */ |
|
1091 | + public function posts_orderby($SQL, WP_Query $wp_query) |
|
1092 | + { |
|
1093 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1094 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
1095 | + } |
|
1096 | + |
|
1097 | + |
|
1098 | + /** |
|
1099 | + * @deprecated |
|
1100 | + * @since 4.4.0 |
|
1101 | + */ |
|
1102 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') |
|
1103 | + { |
|
1104 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1105 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
1106 | + } |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | |
@@ -1112,9 +1112,9 @@ discard block |
||
1112 | 1112 | */ |
1113 | 1113 | function espresso_get_event_list_ID() |
1114 | 1114 | { |
1115 | - EED_Events_Archive::$espresso_event_list_ID++; |
|
1116 | - EED_Events_Archive::$espresso_grid_event_lists[] = EED_Events_Archive::$espresso_event_list_ID; |
|
1117 | - return EED_Events_Archive::$espresso_event_list_ID; |
|
1115 | + EED_Events_Archive::$espresso_event_list_ID++; |
|
1116 | + EED_Events_Archive::$espresso_grid_event_lists[] = EED_Events_Archive::$espresso_event_list_ID; |
|
1117 | + return EED_Events_Archive::$espresso_event_list_ID; |
|
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | /** |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | */ |
1123 | 1123 | function espresso_event_list_title() |
1124 | 1124 | { |
1125 | - return EED_Events_Archive::event_list_title(); |
|
1125 | + return EED_Events_Archive::event_list_title(); |
|
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | /** |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | */ |
1132 | 1132 | function espresso_event_list_css($extra_class = '') |
1133 | 1133 | { |
1134 | - return EED_Events_Archive::event_list_css($extra_class); |
|
1134 | + return EED_Events_Archive::event_list_css($extra_class); |
|
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | /** |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | */ |
1140 | 1140 | function espresso_get_event_categories() |
1141 | 1141 | { |
1142 | - return EED_Events_Archive::event_categories(); |
|
1142 | + return EED_Events_Archive::event_categories(); |
|
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | /** |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | */ |
1148 | 1148 | function espresso_display_full_description_in_event_list() |
1149 | 1149 | { |
1150 | - return EED_Events_Archive::display_description(2); |
|
1150 | + return EED_Events_Archive::display_description(2); |
|
1151 | 1151 | } |
1152 | 1152 | |
1153 | 1153 | /** |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | */ |
1156 | 1156 | function espresso_display_excerpt_in_event_list() |
1157 | 1157 | { |
1158 | - return EED_Events_Archive::display_description(1); |
|
1158 | + return EED_Events_Archive::display_description(1); |
|
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | /** |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | */ |
1164 | 1164 | function espresso_display_ticket_selector_in_event_list() |
1165 | 1165 | { |
1166 | - return EED_Events_Archive::display_ticket_selector(); |
|
1166 | + return EED_Events_Archive::display_ticket_selector(); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | /** |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | */ |
1172 | 1172 | function espresso_display_venue_in_event_list() |
1173 | 1173 | { |
1174 | - return EED_Events_Archive::display_venue(); |
|
1174 | + return EED_Events_Archive::display_venue(); |
|
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | /** |
@@ -1179,5 +1179,5 @@ discard block |
||
1179 | 1179 | */ |
1180 | 1180 | function espresso_display_datetimes_in_event_list() |
1181 | 1181 | { |
1182 | - return EED_Events_Archive::display_datetimes(); |
|
1182 | + return EED_Events_Archive::display_datetimes(); |
|
1183 | 1183 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public static function set_definitions() |
125 | 125 | { |
126 | - define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
127 | - define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
126 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
127 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public static function get_iframe_embed_button() |
146 | 146 | { |
147 | - if (! self::$_iframe_embed_button instanceof EventListIframeEmbedButton) { |
|
147 | + if ( ! self::$_iframe_embed_button instanceof EventListIframeEmbedButton) { |
|
148 | 148 | self::$_iframe_embed_button = new EventListIframeEmbedButton(); |
149 | 149 | } |
150 | 150 | return self::$_iframe_embed_button; |
@@ -227,10 +227,10 @@ discard block |
||
227 | 227 | EEH_Event_Query::add_query_filters(); |
228 | 228 | // set params that will get used by the filters |
229 | 229 | EEH_Event_Query::set_query_params( |
230 | - '', // month |
|
231 | - '', // category |
|
232 | - $config->display_expired_events, // show_expired |
|
233 | - 'start_date', // orderby |
|
230 | + '', // month |
|
231 | + '', // category |
|
232 | + $config->display_expired_events, // show_expired |
|
233 | + 'start_date', // orderby |
|
234 | 234 | 'ASC' // sort |
235 | 235 | ); |
236 | 236 | // check what template is loaded |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | public function template_include($template = '') |
297 | 297 | { |
298 | 298 | // don't add content filter for dedicated EE child themes or private posts |
299 | - if (! EEH_Template::is_espresso_theme()) { |
|
299 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
300 | 300 | /** @type EE_Events_Archive_Config $config */ |
301 | 301 | $config = $this->config(); |
302 | 302 | // add status banner ? |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | { |
395 | 395 | global $post; |
396 | 396 | if ($post instanceof WP_Post) { |
397 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID) . $title : $title; |
|
397 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
398 | 398 | } |
399 | 399 | return $title; |
400 | 400 | } |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | if (post_password_required()) { |
545 | 545 | return $content; |
546 | 546 | } |
547 | - return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
547 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | if (post_password_required()) { |
561 | 561 | return $content; |
562 | 562 | } |
563 | - return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
563 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | if (post_password_required()) { |
590 | 590 | return $content; |
591 | 591 | } |
592 | - return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
592 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | |
@@ -773,10 +773,10 @@ discard block |
||
773 | 773 | // get some style |
774 | 774 | if (apply_filters('FHEE_enable_default_espresso_css', false)) { |
775 | 775 | // first check uploads folder |
776 | - if (EEH_File::is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
776 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
777 | 777 | wp_register_style( |
778 | 778 | $this->theme, |
779 | - get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
779 | + get_stylesheet_directory_uri().$this->theme.DS.'style.css', |
|
780 | 780 | array('dashicons', 'espresso_default') |
781 | 781 | ); |
782 | 782 | } else { |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | (array) $template_settings->EED_Events_Archive |
816 | 816 | ); |
817 | 817 | EEH_Template::display_template( |
818 | - EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
818 | + EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', |
|
819 | 819 | $events_archive_settings |
820 | 820 | ); |
821 | 821 | } |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | { |
834 | 834 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
835 | 835 | // unless we are resetting the config... |
836 | - if (! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
836 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
837 | 837 | || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1 |
838 | 838 | ) { |
839 | 839 | $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) |
@@ -12,32 +12,32 @@ |
||
12 | 12 | class EE_Button_Display_Strategy extends EE_Display_Strategy_Base |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @return string of html to display the input |
|
17 | - */ |
|
18 | - public function display() |
|
19 | - { |
|
20 | - $default_value = $this->_input->get_default(); |
|
21 | - if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) { |
|
22 | - $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value); |
|
23 | - } |
|
24 | - $html = $this->_opening_tag('button'); |
|
25 | - $html .= $this->_attributes_string( |
|
26 | - array_merge( |
|
27 | - $this->_standard_attributes_array(), |
|
28 | - array( |
|
29 | - 'value' => $default_value, |
|
30 | - ) |
|
31 | - ) |
|
32 | - ); |
|
33 | - if ($this->_input instanceof EE_Button_Input) { |
|
34 | - $button_content = $this->_input->button_content(); |
|
35 | - } else { |
|
36 | - $button_content = $this->_input->get_default(); |
|
37 | - } |
|
38 | - $html .= '>'; |
|
39 | - $html .= $button_content; |
|
40 | - $html .= $this->_closing_tag(); |
|
41 | - return $html; |
|
42 | - } |
|
15 | + /** |
|
16 | + * @return string of html to display the input |
|
17 | + */ |
|
18 | + public function display() |
|
19 | + { |
|
20 | + $default_value = $this->_input->get_default(); |
|
21 | + if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) { |
|
22 | + $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value); |
|
23 | + } |
|
24 | + $html = $this->_opening_tag('button'); |
|
25 | + $html .= $this->_attributes_string( |
|
26 | + array_merge( |
|
27 | + $this->_standard_attributes_array(), |
|
28 | + array( |
|
29 | + 'value' => $default_value, |
|
30 | + ) |
|
31 | + ) |
|
32 | + ); |
|
33 | + if ($this->_input instanceof EE_Button_Input) { |
|
34 | + $button_content = $this->_input->button_content(); |
|
35 | + } else { |
|
36 | + $button_content = $this->_input->get_default(); |
|
37 | + } |
|
38 | + $html .= '>'; |
|
39 | + $html .= $button_content; |
|
40 | + $html .= $this->_closing_tag(); |
|
41 | + return $html; |
|
42 | + } |
|
43 | 43 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments) |
42 | 42 | { |
43 | - if (! isset($arguments[0], $arguments[1])) { |
|
43 | + if ( ! isset($arguments[0], $arguments[1])) { |
|
44 | 44 | throw new InvalidArgumentException( |
45 | 45 | esc_html__( |
46 | 46 | 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | ); |
50 | 50 | } |
51 | 51 | $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments); |
52 | - if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
52 | + if ( ! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
53 | 53 | throw new DomainException( |
54 | 54 | sprintf( |
55 | 55 | esc_html__( |
@@ -28,63 +28,63 @@ |
||
28 | 28 | class DomainFactory |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * @param FullyQualifiedName $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
33 | - * @param array $arguments [required] array of arguments to be passed to the Domain class |
|
34 | - * constructor. Must at least include the following two value objects: |
|
35 | - * array( |
|
36 | - * EventEspresso\core\domain\values\FilePath $plugin_file |
|
37 | - * EventEspresso\core\domain\values\Version $version |
|
38 | - * ) |
|
39 | - * @return mixed |
|
40 | - * @throws DomainException |
|
41 | - * @throws InvalidArgumentException |
|
42 | - * @throws InvalidDataTypeException |
|
43 | - * @throws InvalidInterfaceException |
|
44 | - */ |
|
45 | - public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments) |
|
46 | - { |
|
47 | - if (! isset($arguments[0], $arguments[1])) { |
|
48 | - throw new InvalidArgumentException( |
|
49 | - esc_html__( |
|
50 | - 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
51 | - 'event_espresso' |
|
52 | - ) |
|
53 | - ); |
|
54 | - } |
|
55 | - $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments); |
|
56 | - if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
57 | - throw new DomainException( |
|
58 | - sprintf( |
|
59 | - esc_html__( |
|
60 | - 'The requested Domain class "%1$s" could not be loaded.', |
|
61 | - 'event_espresso' |
|
62 | - ), |
|
63 | - $domain_fqcn |
|
64 | - ) |
|
65 | - ); |
|
66 | - } |
|
67 | - return $domain; |
|
68 | - } |
|
31 | + /** |
|
32 | + * @param FullyQualifiedName $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
33 | + * @param array $arguments [required] array of arguments to be passed to the Domain class |
|
34 | + * constructor. Must at least include the following two value objects: |
|
35 | + * array( |
|
36 | + * EventEspresso\core\domain\values\FilePath $plugin_file |
|
37 | + * EventEspresso\core\domain\values\Version $version |
|
38 | + * ) |
|
39 | + * @return mixed |
|
40 | + * @throws DomainException |
|
41 | + * @throws InvalidArgumentException |
|
42 | + * @throws InvalidDataTypeException |
|
43 | + * @throws InvalidInterfaceException |
|
44 | + */ |
|
45 | + public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments) |
|
46 | + { |
|
47 | + if (! isset($arguments[0], $arguments[1])) { |
|
48 | + throw new InvalidArgumentException( |
|
49 | + esc_html__( |
|
50 | + 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
51 | + 'event_espresso' |
|
52 | + ) |
|
53 | + ); |
|
54 | + } |
|
55 | + $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments); |
|
56 | + if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
57 | + throw new DomainException( |
|
58 | + sprintf( |
|
59 | + esc_html__( |
|
60 | + 'The requested Domain class "%1$s" could not be loaded.', |
|
61 | + 'event_espresso' |
|
62 | + ), |
|
63 | + $domain_fqcn |
|
64 | + ) |
|
65 | + ); |
|
66 | + } |
|
67 | + return $domain; |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * @return Domain |
|
73 | - * @throws DomainException |
|
74 | - * @throws InvalidArgumentException |
|
75 | - * @throws InvalidDataTypeException |
|
76 | - * @throws InvalidFilePathException |
|
77 | - * @throws InvalidInterfaceException |
|
78 | - */ |
|
79 | - public static function getEventEspressoCoreDomain() |
|
80 | - { |
|
81 | - $domain = new Domain( |
|
82 | - new FilePath(EVENT_ESPRESSO_MAIN_FILE), |
|
83 | - Version::fromString(espresso_version()) |
|
84 | - ); |
|
85 | - LoaderFactory::getLoader()->share('EventEspresso\core\domain\Domain', $domain); |
|
86 | - return $domain; |
|
87 | - } |
|
71 | + /** |
|
72 | + * @return Domain |
|
73 | + * @throws DomainException |
|
74 | + * @throws InvalidArgumentException |
|
75 | + * @throws InvalidDataTypeException |
|
76 | + * @throws InvalidFilePathException |
|
77 | + * @throws InvalidInterfaceException |
|
78 | + */ |
|
79 | + public static function getEventEspressoCoreDomain() |
|
80 | + { |
|
81 | + $domain = new Domain( |
|
82 | + new FilePath(EVENT_ESPRESSO_MAIN_FILE), |
|
83 | + Version::fromString(espresso_version()) |
|
84 | + ); |
|
85 | + LoaderFactory::getLoader()->share('EventEspresso\core\domain\Domain', $domain); |
|
86 | + return $domain; |
|
87 | + } |
|
88 | 88 | } |
89 | 89 | |
90 | 90 |
@@ -20,42 +20,42 @@ |
||
20 | 20 | class FilePath |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var string file_path |
|
25 | - */ |
|
26 | - private $file_path; |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * FilePath constructor. |
|
31 | - * |
|
32 | - * @param string $file_path |
|
33 | - * @throws InvalidDataTypeException |
|
34 | - * @throws InvalidFilePathException |
|
35 | - */ |
|
36 | - public function __construct($file_path) |
|
37 | - { |
|
38 | - if (! is_string($file_path)) { |
|
39 | - throw new InvalidDataTypeException( |
|
40 | - '$file_path', |
|
41 | - $file_path, |
|
42 | - 'string' |
|
43 | - ); |
|
44 | - } |
|
45 | - if (! is_readable($file_path)) { |
|
46 | - throw new InvalidFilePathException($file_path); |
|
47 | - } |
|
48 | - $this->file_path = $file_path; |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - public function __toString() |
|
56 | - { |
|
57 | - return $this->file_path; |
|
58 | - } |
|
23 | + /** |
|
24 | + * @var string file_path |
|
25 | + */ |
|
26 | + private $file_path; |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * FilePath constructor. |
|
31 | + * |
|
32 | + * @param string $file_path |
|
33 | + * @throws InvalidDataTypeException |
|
34 | + * @throws InvalidFilePathException |
|
35 | + */ |
|
36 | + public function __construct($file_path) |
|
37 | + { |
|
38 | + if (! is_string($file_path)) { |
|
39 | + throw new InvalidDataTypeException( |
|
40 | + '$file_path', |
|
41 | + $file_path, |
|
42 | + 'string' |
|
43 | + ); |
|
44 | + } |
|
45 | + if (! is_readable($file_path)) { |
|
46 | + throw new InvalidFilePathException($file_path); |
|
47 | + } |
|
48 | + $this->file_path = $file_path; |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + public function __toString() |
|
56 | + { |
|
57 | + return $this->file_path; |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | 61 | } |
@@ -35,14 +35,14 @@ |
||
35 | 35 | */ |
36 | 36 | public function __construct($file_path) |
37 | 37 | { |
38 | - if (! is_string($file_path)) { |
|
38 | + if ( ! is_string($file_path)) { |
|
39 | 39 | throw new InvalidDataTypeException( |
40 | 40 | '$file_path', |
41 | 41 | $file_path, |
42 | 42 | 'string' |
43 | 43 | ); |
44 | 44 | } |
45 | - if (! is_readable($file_path)) { |
|
45 | + if ( ! is_readable($file_path)) { |
|
46 | 46 | throw new InvalidFilePathException($file_path); |
47 | 47 | } |
48 | 48 | $this->file_path = $file_path; |
@@ -37,14 +37,14 @@ |
||
37 | 37 | */ |
38 | 38 | public function __construct($fully_qualified_name) |
39 | 39 | { |
40 | - if (! is_string($fully_qualified_name)) { |
|
40 | + if ( ! is_string($fully_qualified_name)) { |
|
41 | 41 | throw new InvalidDataTypeException( |
42 | 42 | '$fully_qualified_name', |
43 | 43 | $fully_qualified_name, |
44 | 44 | 'string' |
45 | 45 | ); |
46 | 46 | } |
47 | - if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
47 | + if ( ! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
48 | 48 | if (strpos($fully_qualified_name, 'Interface') !== false) { |
49 | 49 | throw new InvalidInterfaceException($fully_qualified_name); |
50 | 50 | } |
@@ -21,54 +21,54 @@ |
||
21 | 21 | class FullyQualifiedName |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var string $fully_qualified_name |
|
26 | - */ |
|
27 | - private $fully_qualified_name; |
|
24 | + /** |
|
25 | + * @var string $fully_qualified_name |
|
26 | + */ |
|
27 | + private $fully_qualified_name; |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * FullyQualifiedName constructor. |
|
32 | - * |
|
33 | - * @param string $fully_qualified_name |
|
34 | - * @throws InvalidClassException |
|
35 | - * @throws InvalidInterfaceException |
|
36 | - * @throws InvalidDataTypeException |
|
37 | - */ |
|
38 | - public function __construct($fully_qualified_name) |
|
39 | - { |
|
40 | - if (! is_string($fully_qualified_name)) { |
|
41 | - throw new InvalidDataTypeException( |
|
42 | - '$fully_qualified_name', |
|
43 | - $fully_qualified_name, |
|
44 | - 'string' |
|
45 | - ); |
|
46 | - } |
|
47 | - if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
48 | - if (strpos($fully_qualified_name, 'Interface') !== false) { |
|
49 | - throw new InvalidInterfaceException($fully_qualified_name); |
|
50 | - } |
|
51 | - throw new InvalidClassException($fully_qualified_name); |
|
52 | - } |
|
53 | - $this->fully_qualified_name = $fully_qualified_name; |
|
54 | - } |
|
30 | + /** |
|
31 | + * FullyQualifiedName constructor. |
|
32 | + * |
|
33 | + * @param string $fully_qualified_name |
|
34 | + * @throws InvalidClassException |
|
35 | + * @throws InvalidInterfaceException |
|
36 | + * @throws InvalidDataTypeException |
|
37 | + */ |
|
38 | + public function __construct($fully_qualified_name) |
|
39 | + { |
|
40 | + if (! is_string($fully_qualified_name)) { |
|
41 | + throw new InvalidDataTypeException( |
|
42 | + '$fully_qualified_name', |
|
43 | + $fully_qualified_name, |
|
44 | + 'string' |
|
45 | + ); |
|
46 | + } |
|
47 | + if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
48 | + if (strpos($fully_qualified_name, 'Interface') !== false) { |
|
49 | + throw new InvalidInterfaceException($fully_qualified_name); |
|
50 | + } |
|
51 | + throw new InvalidClassException($fully_qualified_name); |
|
52 | + } |
|
53 | + $this->fully_qualified_name = $fully_qualified_name; |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function string() |
|
61 | - { |
|
62 | - return $this->fully_qualified_name; |
|
63 | - } |
|
57 | + /** |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public function string() |
|
61 | + { |
|
62 | + return $this->fully_qualified_name; |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * @return string |
|
68 | - */ |
|
69 | - public function __toString() |
|
70 | - { |
|
71 | - return $this->fully_qualified_name; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return string |
|
68 | + */ |
|
69 | + public function __toString() |
|
70 | + { |
|
71 | + return $this->fully_qualified_name; |
|
72 | + } |
|
73 | 73 | |
74 | 74 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | public function __construct($slug, $description) |
92 | 92 | { |
93 | 93 | parent::__construct($slug, $description); |
94 | - if (! in_array($this->slug(), $this->validRequestTypes(), true)) { |
|
94 | + if ( ! in_array($this->slug(), $this->validRequestTypes(), true)) { |
|
95 | 95 | throw new InvalidArgumentException( |
96 | 96 | sprintf( |
97 | 97 | esc_html__( |
@@ -16,155 +16,155 @@ |
||
16 | 16 | class RequestTypeContext extends Context |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * indicates that the current request involves some form of activation |
|
21 | - */ |
|
22 | - const ACTIVATION = 'activation-request'; |
|
23 | - |
|
24 | - /** |
|
25 | - * indicates that the current request is for the admin but is not being made via AJAX |
|
26 | - */ |
|
27 | - const ADMIN = 'non-ajax-admin-request'; |
|
28 | - |
|
29 | - /** |
|
30 | - * indicates that the current request is for the admin AND is being made via AJAX |
|
31 | - */ |
|
32 | - const AJAX_ADMIN = 'admin-ajax-request'; |
|
33 | - |
|
34 | - /** |
|
35 | - * indicates that the current request is for the frontend AND is being made via AJAX |
|
36 | - */ |
|
37 | - const AJAX_FRONT = 'frontend-ajax-request'; |
|
38 | - |
|
39 | - /** |
|
40 | - * indicates that the current request is for the WP Heartbeat |
|
41 | - */ |
|
42 | - const AJAX_HEARTBEAT = 'admin-ajax-heartbeat'; |
|
43 | - |
|
44 | - /** |
|
45 | - * indicates that the current request is being made via AJAX, but is NOT for EE |
|
46 | - */ |
|
47 | - const AJAX_OTHER = 'other-ajax-request'; |
|
48 | - |
|
49 | - /** |
|
50 | - * indicates that the current request is for the EE REST API |
|
51 | - */ |
|
52 | - const API = 'rest-api'; |
|
53 | - |
|
54 | - /** |
|
55 | - * indicates that the current request is from the command line |
|
56 | - */ |
|
57 | - const CLI = 'command-line'; |
|
58 | - |
|
59 | - /** |
|
60 | - * indicates that the current request is for a WP_Cron |
|
61 | - */ |
|
62 | - const CRON = 'wp-cron'; |
|
63 | - |
|
64 | - /** |
|
65 | - * indicates that the current request is for a feed (ie: RSS) |
|
66 | - */ |
|
67 | - const FEED = 'feed-request'; |
|
68 | - |
|
69 | - /** |
|
70 | - * indicates that the current request is for the frontend but is not being made via AJAX |
|
71 | - */ |
|
72 | - const FRONTEND = 'non-ajax-frontend-request'; |
|
73 | - |
|
74 | - /** |
|
75 | - * indicates that the current request is for content that is to be displayed within an iframe |
|
76 | - */ |
|
77 | - const IFRAME = 'iframe-request'; |
|
78 | - |
|
79 | - /** |
|
80 | - * indicates that the current request is for the WP REST API |
|
81 | - */ |
|
82 | - const WP_API = 'wp-rest-api'; |
|
83 | - |
|
84 | - /** |
|
85 | - * indicates that the current request is a loopback sent from WP core to test for errors |
|
86 | - */ |
|
87 | - const WP_SCRAPE = 'wordpress-scrape'; |
|
88 | - |
|
89 | - /** |
|
90 | - * @var boolean $is_activation |
|
91 | - */ |
|
92 | - private $is_activation = false; |
|
93 | - |
|
94 | - /** |
|
95 | - * @var array $valid_request_types |
|
96 | - */ |
|
97 | - private $valid_request_types = array(); |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * RequestTypeContext constructor. |
|
102 | - * |
|
103 | - * @param string $slug |
|
104 | - * @param string $description |
|
105 | - * @throws InvalidArgumentException |
|
106 | - */ |
|
107 | - public function __construct($slug, $description) |
|
108 | - { |
|
109 | - parent::__construct($slug, $description); |
|
110 | - if (! in_array($this->slug(), $this->validRequestTypes(), true)) { |
|
111 | - throw new InvalidArgumentException( |
|
112 | - sprintf( |
|
113 | - esc_html__( |
|
114 | - 'The RequestTypeContext slug must be one of the following values: %1$s %2$s', |
|
115 | - 'event_espresso' |
|
116 | - ), |
|
117 | - var_export($this->validRequestTypes(), true) |
|
118 | - ) |
|
119 | - ); |
|
120 | - } |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * @return array |
|
126 | - */ |
|
127 | - public function validRequestTypes() |
|
128 | - { |
|
129 | - if (empty($this->valid_request_types)) { |
|
130 | - $this->valid_request_types = apply_filters( |
|
131 | - 'FHEE__EventEspresso_core_domain_entities_contexts_RequestTypeContext__validRequestTypes', |
|
132 | - array( |
|
133 | - RequestTypeContext::ACTIVATION, |
|
134 | - RequestTypeContext::ADMIN, |
|
135 | - RequestTypeContext::AJAX_ADMIN, |
|
136 | - RequestTypeContext::AJAX_FRONT, |
|
137 | - RequestTypeContext::AJAX_HEARTBEAT, |
|
138 | - RequestTypeContext::AJAX_OTHER, |
|
139 | - RequestTypeContext::API, |
|
140 | - RequestTypeContext::CLI, |
|
141 | - RequestTypeContext::CRON, |
|
142 | - RequestTypeContext::FEED, |
|
143 | - RequestTypeContext::FRONTEND, |
|
144 | - RequestTypeContext::IFRAME, |
|
145 | - RequestTypeContext::WP_API, |
|
146 | - RequestTypeContext::WP_SCRAPE, |
|
147 | - ) |
|
148 | - ); |
|
149 | - } |
|
150 | - return $this->valid_request_types; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - /** |
|
155 | - * @return bool |
|
156 | - */ |
|
157 | - public function isActivation() |
|
158 | - { |
|
159 | - return $this->is_activation; |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - /** |
|
164 | - * @param bool $is_activation |
|
165 | - */ |
|
166 | - public function setIsActivation($is_activation) |
|
167 | - { |
|
168 | - $this->is_activation = filter_var($is_activation, FILTER_VALIDATE_BOOLEAN); |
|
169 | - } |
|
19 | + /** |
|
20 | + * indicates that the current request involves some form of activation |
|
21 | + */ |
|
22 | + const ACTIVATION = 'activation-request'; |
|
23 | + |
|
24 | + /** |
|
25 | + * indicates that the current request is for the admin but is not being made via AJAX |
|
26 | + */ |
|
27 | + const ADMIN = 'non-ajax-admin-request'; |
|
28 | + |
|
29 | + /** |
|
30 | + * indicates that the current request is for the admin AND is being made via AJAX |
|
31 | + */ |
|
32 | + const AJAX_ADMIN = 'admin-ajax-request'; |
|
33 | + |
|
34 | + /** |
|
35 | + * indicates that the current request is for the frontend AND is being made via AJAX |
|
36 | + */ |
|
37 | + const AJAX_FRONT = 'frontend-ajax-request'; |
|
38 | + |
|
39 | + /** |
|
40 | + * indicates that the current request is for the WP Heartbeat |
|
41 | + */ |
|
42 | + const AJAX_HEARTBEAT = 'admin-ajax-heartbeat'; |
|
43 | + |
|
44 | + /** |
|
45 | + * indicates that the current request is being made via AJAX, but is NOT for EE |
|
46 | + */ |
|
47 | + const AJAX_OTHER = 'other-ajax-request'; |
|
48 | + |
|
49 | + /** |
|
50 | + * indicates that the current request is for the EE REST API |
|
51 | + */ |
|
52 | + const API = 'rest-api'; |
|
53 | + |
|
54 | + /** |
|
55 | + * indicates that the current request is from the command line |
|
56 | + */ |
|
57 | + const CLI = 'command-line'; |
|
58 | + |
|
59 | + /** |
|
60 | + * indicates that the current request is for a WP_Cron |
|
61 | + */ |
|
62 | + const CRON = 'wp-cron'; |
|
63 | + |
|
64 | + /** |
|
65 | + * indicates that the current request is for a feed (ie: RSS) |
|
66 | + */ |
|
67 | + const FEED = 'feed-request'; |
|
68 | + |
|
69 | + /** |
|
70 | + * indicates that the current request is for the frontend but is not being made via AJAX |
|
71 | + */ |
|
72 | + const FRONTEND = 'non-ajax-frontend-request'; |
|
73 | + |
|
74 | + /** |
|
75 | + * indicates that the current request is for content that is to be displayed within an iframe |
|
76 | + */ |
|
77 | + const IFRAME = 'iframe-request'; |
|
78 | + |
|
79 | + /** |
|
80 | + * indicates that the current request is for the WP REST API |
|
81 | + */ |
|
82 | + const WP_API = 'wp-rest-api'; |
|
83 | + |
|
84 | + /** |
|
85 | + * indicates that the current request is a loopback sent from WP core to test for errors |
|
86 | + */ |
|
87 | + const WP_SCRAPE = 'wordpress-scrape'; |
|
88 | + |
|
89 | + /** |
|
90 | + * @var boolean $is_activation |
|
91 | + */ |
|
92 | + private $is_activation = false; |
|
93 | + |
|
94 | + /** |
|
95 | + * @var array $valid_request_types |
|
96 | + */ |
|
97 | + private $valid_request_types = array(); |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * RequestTypeContext constructor. |
|
102 | + * |
|
103 | + * @param string $slug |
|
104 | + * @param string $description |
|
105 | + * @throws InvalidArgumentException |
|
106 | + */ |
|
107 | + public function __construct($slug, $description) |
|
108 | + { |
|
109 | + parent::__construct($slug, $description); |
|
110 | + if (! in_array($this->slug(), $this->validRequestTypes(), true)) { |
|
111 | + throw new InvalidArgumentException( |
|
112 | + sprintf( |
|
113 | + esc_html__( |
|
114 | + 'The RequestTypeContext slug must be one of the following values: %1$s %2$s', |
|
115 | + 'event_espresso' |
|
116 | + ), |
|
117 | + var_export($this->validRequestTypes(), true) |
|
118 | + ) |
|
119 | + ); |
|
120 | + } |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * @return array |
|
126 | + */ |
|
127 | + public function validRequestTypes() |
|
128 | + { |
|
129 | + if (empty($this->valid_request_types)) { |
|
130 | + $this->valid_request_types = apply_filters( |
|
131 | + 'FHEE__EventEspresso_core_domain_entities_contexts_RequestTypeContext__validRequestTypes', |
|
132 | + array( |
|
133 | + RequestTypeContext::ACTIVATION, |
|
134 | + RequestTypeContext::ADMIN, |
|
135 | + RequestTypeContext::AJAX_ADMIN, |
|
136 | + RequestTypeContext::AJAX_FRONT, |
|
137 | + RequestTypeContext::AJAX_HEARTBEAT, |
|
138 | + RequestTypeContext::AJAX_OTHER, |
|
139 | + RequestTypeContext::API, |
|
140 | + RequestTypeContext::CLI, |
|
141 | + RequestTypeContext::CRON, |
|
142 | + RequestTypeContext::FEED, |
|
143 | + RequestTypeContext::FRONTEND, |
|
144 | + RequestTypeContext::IFRAME, |
|
145 | + RequestTypeContext::WP_API, |
|
146 | + RequestTypeContext::WP_SCRAPE, |
|
147 | + ) |
|
148 | + ); |
|
149 | + } |
|
150 | + return $this->valid_request_types; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + /** |
|
155 | + * @return bool |
|
156 | + */ |
|
157 | + public function isActivation() |
|
158 | + { |
|
159 | + return $this->is_activation; |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + /** |
|
164 | + * @param bool $is_activation |
|
165 | + */ |
|
166 | + public function setIsActivation($is_activation) |
|
167 | + { |
|
168 | + $this->is_activation = filter_var($is_activation, FILTER_VALIDATE_BOOLEAN); |
|
169 | + } |
|
170 | 170 | } |
@@ -11,14 +11,14 @@ |
||
11 | 11 | |
12 | 12 | |
13 | 13 | |
14 | - /** |
|
15 | - * removes all tags which a WP Post wouldn't allow in its content normally |
|
16 | - * |
|
17 | - * @param string $value |
|
18 | - * @return string |
|
19 | - */ |
|
20 | - public function prepare_for_set($value) |
|
21 | - { |
|
22 | - return parent::prepare_for_set(wp_kses("$value", EEH_HTML::get_simple_tags())); |
|
23 | - } |
|
14 | + /** |
|
15 | + * removes all tags which a WP Post wouldn't allow in its content normally |
|
16 | + * |
|
17 | + * @param string $value |
|
18 | + * @return string |
|
19 | + */ |
|
20 | + public function prepare_for_set($value) |
|
21 | + { |
|
22 | + return parent::prepare_for_set(wp_kses("$value", EEH_HTML::get_simple_tags())); |
|
23 | + } |
|
24 | 24 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function wp_user_obj() |
53 | 53 | { |
54 | - if (! $this->_wp_user_obj) { |
|
54 | + if ( ! $this->_wp_user_obj) { |
|
55 | 55 | $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
56 | 56 | } |
57 | 57 | return $this->_wp_user_obj; |
@@ -11,91 +11,91 @@ |
||
11 | 11 | class EE_WP_User extends EE_Base_Class implements EEI_Admin_Links |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @var WP_User |
|
16 | - */ |
|
17 | - protected $_wp_user_obj; |
|
14 | + /** |
|
15 | + * @var WP_User |
|
16 | + */ |
|
17 | + protected $_wp_user_obj; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @param array $props_n_values |
|
21 | - * @return EE_WP_User|mixed |
|
22 | - */ |
|
23 | - public static function new_instance($props_n_values = array()) |
|
24 | - { |
|
25 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
26 | - return $has_object ? $has_object : new self($props_n_values); |
|
27 | - } |
|
19 | + /** |
|
20 | + * @param array $props_n_values |
|
21 | + * @return EE_WP_User|mixed |
|
22 | + */ |
|
23 | + public static function new_instance($props_n_values = array()) |
|
24 | + { |
|
25 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
26 | + return $has_object ? $has_object : new self($props_n_values); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @param array $props_n_values |
|
32 | - * @return EE_WP_User |
|
33 | - */ |
|
34 | - public static function new_instance_from_db($props_n_values = array()) |
|
35 | - { |
|
36 | - return new self($props_n_values, true); |
|
37 | - } |
|
30 | + /** |
|
31 | + * @param array $props_n_values |
|
32 | + * @return EE_WP_User |
|
33 | + */ |
|
34 | + public static function new_instance_from_db($props_n_values = array()) |
|
35 | + { |
|
36 | + return new self($props_n_values, true); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Return a normal WP_User object (caches the object for future calls) |
|
41 | - * |
|
42 | - * @return WP_User |
|
43 | - */ |
|
44 | - public function wp_user_obj() |
|
45 | - { |
|
46 | - if (! $this->_wp_user_obj) { |
|
47 | - $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
48 | - } |
|
49 | - return $this->_wp_user_obj; |
|
50 | - } |
|
39 | + /** |
|
40 | + * Return a normal WP_User object (caches the object for future calls) |
|
41 | + * |
|
42 | + * @return WP_User |
|
43 | + */ |
|
44 | + public function wp_user_obj() |
|
45 | + { |
|
46 | + if (! $this->_wp_user_obj) { |
|
47 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
48 | + } |
|
49 | + return $this->_wp_user_obj; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Return the link to the admin details for the object. |
|
54 | - * |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - public function get_admin_details_link() |
|
58 | - { |
|
59 | - return $this->get_admin_edit_link(); |
|
60 | - } |
|
52 | + /** |
|
53 | + * Return the link to the admin details for the object. |
|
54 | + * |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + public function get_admin_details_link() |
|
58 | + { |
|
59 | + return $this->get_admin_edit_link(); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
64 | - * |
|
65 | - * @return string |
|
66 | - */ |
|
67 | - public function get_admin_edit_link() |
|
68 | - { |
|
69 | - return esc_url( |
|
70 | - add_query_arg( |
|
71 | - 'wp_http_referer', |
|
72 | - urlencode( |
|
73 | - wp_unslash( |
|
74 | - $_SERVER['REQUEST_URI'] |
|
75 | - ) |
|
76 | - ), |
|
77 | - get_edit_user_link($this->ID()) |
|
78 | - ) |
|
79 | - ); |
|
80 | - } |
|
62 | + /** |
|
63 | + * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
64 | + * |
|
65 | + * @return string |
|
66 | + */ |
|
67 | + public function get_admin_edit_link() |
|
68 | + { |
|
69 | + return esc_url( |
|
70 | + add_query_arg( |
|
71 | + 'wp_http_referer', |
|
72 | + urlencode( |
|
73 | + wp_unslash( |
|
74 | + $_SERVER['REQUEST_URI'] |
|
75 | + ) |
|
76 | + ), |
|
77 | + get_edit_user_link($this->ID()) |
|
78 | + ) |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Returns the link to a settings page for the object. |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function get_admin_settings_link() |
|
88 | - { |
|
89 | - return $this->get_admin_edit_link(); |
|
90 | - } |
|
82 | + /** |
|
83 | + * Returns the link to a settings page for the object. |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function get_admin_settings_link() |
|
88 | + { |
|
89 | + return $this->get_admin_edit_link(); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Returns the link to the "overview" for the object (typically the "list table" view). |
|
94 | - * |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public function get_admin_overview_link() |
|
98 | - { |
|
99 | - return admin_url('users.php'); |
|
100 | - } |
|
92 | + /** |
|
93 | + * Returns the link to the "overview" for the object (typically the "list table" view). |
|
94 | + * |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public function get_admin_overview_link() |
|
98 | + { |
|
99 | + return admin_url('users.php'); |
|
100 | + } |
|
101 | 101 | } |