Completed
Branch fix/block-theme-excerpt (366ffa)
by
unknown
15:55 queued 13:33
created
modules/events_archive/EED_Events_Archive.module.php 1 patch
Indentation   +1104 added lines, -1104 removed lines patch added patch discarded remove patch
@@ -16,1099 +16,1099 @@  discard block
 block discarded – undo
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 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/');
127
-        define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/');
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
-            esc_html__('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
-            esc_html__('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
-            esc_html__('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
-            esc_html__('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 (
308
-                apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false)
309
-                || EE_Registry::instance()
310
-                              ->load_core('Front_Controller')
311
-                              ->get_selected_template() !== 'archive-espresso_events.php'
312
-            ) {
313
-                // don't display entry meta because the existing theme will take care of that
314
-                add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true');
315
-                // load functions.php file for the theme (loaded by WP if using child theme)
316
-                EEH_Template::load_espresso_theme_functions();
317
-                // because we don't know if the theme is using the_excerpt()
318
-                add_filter(
319
-                    'get_the_excerpt',
320
-                    array('EED_Events_Archive', 'event_details'),
321
-                    EED_Events_Archive::EVENT_DETAILS_PRIORITY
322
-                );
323
-                // or the_content
324
-                add_filter(
325
-                    'the_content',
326
-                    array('EED_Events_Archive', 'event_details'),
327
-                    EED_Events_Archive::EVENT_DETAILS_PRIORITY
328
-                );
329
-                // and just in case they are running get_the_excerpt() which DESTROYS things
330
-                add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
331
-                // don't display entry meta because the existing theme will take care of that
332
-                add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
333
-            }
334
-        }
335
-        return $template;
336
-    }
337
-
338
-
339
-    /**
340
-     *    get_the_excerpt - kinda hacky, but if a theme is using get_the_excerpt(), then we need to remove our filters
341
-     *    on the_content()
342
-     *
343
-     * @access    public
344
-     * @param        string $excerpt
345
-     * @return        string
346
-     */
347
-    public static function get_the_excerpt($excerpt = '')
348
-    {
349
-        if (post_password_required()) {
350
-            return $excerpt;
351
-        }
352
-        if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) {
353
-            remove_filter(
354
-                'get_the_excerpt',
355
-                array('EED_Events_Archive', 'event_details'),
356
-                EED_Events_Archive::EVENT_DETAILS_PRIORITY
357
-            );
358
-            remove_filter(
359
-                'the_content',
360
-                array('EED_Events_Archive', 'event_details'),
361
-                EED_Events_Archive::EVENT_DETAILS_PRIORITY
362
-            );
363
-            $excerpt = EED_Events_Archive::event_details($excerpt);
364
-        } else {
365
-            EED_Events_Archive::$using_get_the_excerpt = true;
366
-            add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1);
367
-        }
368
-        return $excerpt;
369
-    }
370
-
371
-
372
-    /**
373
-     * end_get_the_excerpt
374
-     *
375
-     * @access public
376
-     * @param  string $text
377
-     * @return string
378
-     */
379
-    public static function end_get_the_excerpt($text = '')
380
-    {
381
-        EED_Events_Archive::$using_get_the_excerpt = false;
382
-        return $text;
383
-    }
384
-
385
-
386
-    /**
387
-     *    the_title
388
-     *
389
-     * @access        public
390
-     * @param        string $title
391
-     * @param        string $id
392
-     * @return        string
393
-     */
394
-    public static function the_title($title = '', $id = '')
395
-    {
396
-        global $post;
397
-        if ($post instanceof WP_Post) {
398
-            return ((function_exists('wp_is_block_theme') && wp_is_block_theme()) || in_the_loop()) && $post->ID == $id
399
-                ? espresso_event_status_banner($post->ID) . $title
400
-                : $title;
401
-        }
402
-        return $title;
403
-    }
404
-
405
-
406
-    /**
407
-     *    event_details
408
-     *
409
-     * @access    public
410
-     * @param        string $content
411
-     * @return        string
412
-     */
413
-    public static function event_details($content)
414
-    {
415
-        global $post;
416
-        static $current_post_ID = 0;
417
-        if (
418
-            $current_post_ID !== $post->ID
419
-            && $post->post_type === 'espresso_events'
420
-            && ! EED_Events_Archive::$using_get_the_excerpt
421
-            && ! post_password_required()
422
-            && (
423
-                apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false)
424
-                || ! apply_filters('FHEE__content_espresso_events__template_loaded', false)
425
-            )
426
-        ) {
427
-            // Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
428
-            // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early
429
-            // BEFORE headers are sent in order to examine the post content and generate content for the HTML header.
430
-            // We want to allow those plugins to still do their thing and have access to our content, but depending on
431
-            // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
432
-            // so the following allows this filter to be applied multiple times, but only once for real
433
-            $current_post_ID = did_action('loop_start') ? $post->ID : 0;
434
-            if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) {
435
-                $content = EED_Events_Archive::use_sortable_display_order();
436
-            } else {
437
-                $content = EED_Events_Archive::use_filterable_display_order();
438
-            }
439
-        }
440
-        return $content;
441
-    }
442
-
443
-
444
-    /**
445
-     *    use_sortable_display_order
446
-     *
447
-     * @access    protected
448
-     * @return string
449
-     */
450
-    protected static function use_sortable_display_order()
451
-    {
452
-        // no further password checks required atm
453
-        add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true');
454
-        // we need to first remove this callback from being applied to the_content() or the_excerpt()
455
-        // (otherwise it will recurse and blow up the interweb)
456
-        remove_filter(
457
-            'get_the_excerpt',
458
-            array('EED_Events_Archive', 'event_details'),
459
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
460
-        );
461
-        remove_filter(
462
-            'the_content',
463
-            array('EED_Events_Archive', 'event_details'),
464
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
465
-        );
466
-        remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
467
-        // now add additional content depending on whether event is using the_excerpt() or the_content()
468
-        EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts();
469
-        $content = EEH_Template::locate_template('content-espresso_events-details.php');
470
-        $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content);
471
-        // re-add our main filters (or else the next event won't have them)
472
-        add_filter(
473
-            'get_the_excerpt',
474
-            array('EED_Events_Archive', 'event_details'),
475
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
476
-        );
477
-        add_filter(
478
-            'the_content',
479
-            array('EED_Events_Archive', 'event_details'),
480
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
481
-        );
482
-        add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
483
-        remove_filter(
484
-            'FHEE__EED_Events_Archive__event_details__no_post_password_required',
485
-            '__return_true'
486
-        );
487
-        return $content;
488
-    }
489
-
490
-
491
-    /**
492
-     *    use_filterable_display_order
493
-     *
494
-     * @access    protected
495
-     * @return    string
496
-     */
497
-    protected static function use_filterable_display_order()
498
-    {
499
-        // we need to first remove this callback from being applied to the_content()
500
-        // (otherwise it will recurse and blow up the interweb)
501
-        remove_filter(
502
-            'get_the_excerpt',
503
-            array('EED_Events_Archive', 'event_details'),
504
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
505
-        );
506
-        remove_filter(
507
-            'the_content',
508
-            array('EED_Events_Archive', 'event_details'),
509
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
510
-        );
511
-        remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
512
-        // now add additional content depending on whether event is using the_excerpt() or the_content()
513
-        EED_Events_Archive::_add_additional_excerpt_filters();
514
-        EED_Events_Archive::_add_additional_content_filters();
515
-        do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters');
516
-        // now load our template
517
-        $content = EEH_Template::locate_template('content-espresso_events-details.php');
518
-        // re-add our main filters (or else the next event won't have them)
519
-        add_filter(
520
-            'get_the_excerpt',
521
-            array('EED_Events_Archive', 'event_details'),
522
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
523
-        );
524
-        add_filter(
525
-            'the_content',
526
-            array('EED_Events_Archive', 'event_details'),
527
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
528
-        );
529
-        add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
530
-        // but remove the other filters so that they don't get applied to the next post
531
-        EED_Events_Archive::_remove_additional_events_archive_filters();
532
-        do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters');
533
-        // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
534
-        // return ! empty( $template ) ? $template : $content;
535
-        return $content;
536
-    }
537
-
538
-
539
-    /**
540
-     *    event_datetimes - adds datetimes ABOVE content
541
-     *
542
-     * @access    public
543
-     * @param        string $content
544
-     * @return        string
545
-     */
546
-    public static function event_datetimes($content)
547
-    {
548
-        if (post_password_required()) {
549
-            return $content;
550
-        }
551
-        return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content;
552
-    }
553
-
554
-
555
-    /**
556
-     *    event_tickets - adds tickets ABOVE content (which includes datetimes)
557
-     *
558
-     * @access    public
559
-     * @param        string $content
560
-     * @return        string
561
-     */
562
-    public static function event_tickets($content)
563
-    {
564
-        if (post_password_required()) {
565
-            return $content;
566
-        }
567
-        return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content;
568
-    }
569
-
570
-
571
-    /**
572
-     *    event_venues - adds venues BELOW content
573
-     *
574
-     * @access    public
575
-     * @param    string $content
576
-     * @return    string
577
-     */
578
-    public static function event_venue($content)
579
-    {
580
-        return EED_Events_Archive::event_venues($content);
581
-    }
582
-
583
-
584
-    /**
585
-     *    event_venues - adds venues BELOW content
586
-     *
587
-     * @access    public
588
-     * @param        string $content
589
-     * @return        string
590
-     */
591
-    public static function event_venues($content)
592
-    {
593
-        if (post_password_required()) {
594
-            return $content;
595
-        }
596
-        return $content . EEH_Template::locate_template('content-espresso_events-venues.php');
597
-    }
598
-
599
-
600
-    /**
601
-     *    _add_additional_content_filters
602
-     *
603
-     * @access    private
604
-     * @return        void
605
-     */
606
-    private static function _add_additional_excerpt_filters()
607
-    {
608
-        add_filter(
609
-            'get_the_excerpt',
610
-            array('EED_Events_Archive', 'event_datetimes'),
611
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
612
-        );
613
-        add_filter(
614
-            'get_the_excerpt',
615
-            array('EED_Events_Archive', 'event_tickets'),
616
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
617
-        );
618
-        add_filter(
619
-            'get_the_excerpt',
620
-            array('EED_Events_Archive', 'event_venues'),
621
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
622
-        );
623
-    }
624
-
625
-
626
-    /**
627
-     *    _add_additional_content_filters
628
-     *
629
-     * @access    private
630
-     * @return        void
631
-     */
632
-    private static function _add_additional_content_filters()
633
-    {
634
-        add_filter(
635
-            'the_content',
636
-            array('EED_Events_Archive', 'event_datetimes'),
637
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
638
-        );
639
-        add_filter(
640
-            'the_content',
641
-            array('EED_Events_Archive', 'event_tickets'),
642
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
643
-        );
644
-        add_filter(
645
-            'the_content',
646
-            array('EED_Events_Archive', 'event_venues'),
647
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
648
-        );
649
-    }
650
-
651
-
652
-    /**
653
-     *    _remove_additional_events_archive_filters
654
-     *
655
-     * @access    private
656
-     * @return        void
657
-     */
658
-    private static function _remove_additional_events_archive_filters()
659
-    {
660
-        remove_filter(
661
-            'get_the_excerpt',
662
-            array('EED_Events_Archive', 'event_datetimes'),
663
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
664
-        );
665
-        remove_filter(
666
-            'get_the_excerpt',
667
-            array('EED_Events_Archive', 'event_tickets'),
668
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
669
-        );
670
-        remove_filter(
671
-            'get_the_excerpt',
672
-            array('EED_Events_Archive', 'event_venues'),
673
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
674
-        );
675
-        remove_filter(
676
-            'the_content',
677
-            array('EED_Events_Archive', 'event_datetimes'),
678
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
679
-        );
680
-        remove_filter(
681
-            'the_content',
682
-            array('EED_Events_Archive', 'event_tickets'),
683
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
684
-        );
685
-        remove_filter(
686
-            'the_content',
687
-            array('EED_Events_Archive', 'event_venues'),
688
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
689
-        );
690
-    }
691
-
692
-
693
-    /**
694
-     *    remove_all_events_archive_filters
695
-     *
696
-     * @access    public
697
-     * @return        void
698
-     */
699
-    public static function remove_all_events_archive_filters()
700
-    {
701
-        // remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
702
-        remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 1);
703
-        remove_filter(
704
-            'get_the_excerpt',
705
-            array('EED_Events_Archive', 'event_details'),
706
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
707
-        );
708
-        remove_filter(
709
-            'get_the_excerpt',
710
-            array('EED_Events_Archive', 'event_datetimes'),
711
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
712
-        );
713
-        remove_filter(
714
-            'get_the_excerpt',
715
-            array('EED_Events_Archive', 'event_tickets'),
716
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
717
-        );
718
-        remove_filter(
719
-            'get_the_excerpt',
720
-            array('EED_Events_Archive', 'event_venues'),
721
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
722
-        );
723
-        remove_filter(
724
-            'the_content',
725
-            array('EED_Events_Archive', 'event_details'),
726
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
727
-        );
728
-        remove_filter(
729
-            'the_content',
730
-            array('EED_Events_Archive', 'event_datetimes'),
731
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
732
-        );
733
-        remove_filter(
734
-            'the_content',
735
-            array('EED_Events_Archive', 'event_tickets'),
736
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
737
-        );
738
-        remove_filter(
739
-            'the_content',
740
-            array('EED_Events_Archive', 'event_venues'),
741
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
742
-        );
743
-        // don't display entry meta because the existing theme will take care of that
744
-        remove_filter(
745
-            'FHEE__content_espresso_events_details_template__display_entry_meta',
746
-            '__return_false'
747
-        );
748
-    }
749
-
750
-
751
-    /**
752
-     *    load_event_list_assets
753
-     *
754
-     * @access    public
755
-     * @return    void
756
-     */
757
-    public function load_event_list_assets()
758
-    {
759
-        do_action('AHEE__EED_Events_Archive__before_load_assets');
760
-        add_filter('FHEE_load_EE_Session', '__return_true');
761
-        add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
762
-        add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
763
-        if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
764
-            add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
765
-        }
766
-    }
767
-
768
-
769
-    /**
770
-     *    wp_enqueue_scripts
771
-     *
772
-     * @access    public
773
-     * @return    void
774
-     */
775
-    public function wp_enqueue_scripts()
776
-    {
777
-        // get some style
778
-        if (apply_filters('FHEE_enable_default_espresso_css', false)) {
779
-            // first check uploads folder
780
-            if (EEH_File::is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) {
781
-                wp_register_style(
782
-                    $this->theme,
783
-                    get_stylesheet_directory_uri() . $this->theme . '/style.css',
784
-                    array('dashicons', 'espresso_default')
785
-                );
786
-            } else {
787
-            }
788
-            wp_enqueue_style($this->theme);
789
-        }
790
-    }
791
-
792
-
793
-    /**
794
-     *    template_settings_form
795
-     *
796
-     * @access    public
797
-     * @static
798
-     * @return    string
799
-     */
800
-    public static function template_settings_form()
801
-    {
802
-        $template_settings = EE_Registry::instance()->CFG->template_settings;
803
-        $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive)
804
-            ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
805
-        $template_settings->EED_Events_Archive = apply_filters(
806
-            'FHEE__EED_Events_Archive__template_settings_form__event_list_config',
807
-            $template_settings->EED_Events_Archive
808
-        );
809
-        $events_archive_settings = array(
810
-            'display_status_banner' => 0,
811
-            'display_description' => 1,
812
-            'display_ticket_selector' => 0,
813
-            'display_datetimes' => 1,
814
-            'display_venue' => 0,
815
-            'display_expired_events' => 0,
816
-        );
817
-        $events_archive_settings = array_merge(
818
-            $events_archive_settings,
819
-            (array) $template_settings->EED_Events_Archive
820
-        );
821
-        EEH_Template::display_template(
822
-            EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php',
823
-            $events_archive_settings
824
-        );
825
-    }
826
-
827
-
828
-    /**
829
-     *    update_template_settings
830
-     *
831
-     * @access    public
832
-     * @param    EE_Template_Config $CFG
833
-     * @param    array $REQ
834
-     * @return    EE_Template_Config
835
-     */
836
-    public static function update_template_settings($CFG, $REQ)
837
-    {
838
-        $CFG->EED_Events_Archive = new EE_Events_Archive_Config();
839
-        // unless we are resetting the config...
840
-        if (
841
-            ! isset($REQ['EED_Events_Archive_reset_event_list_settings'])
842
-            || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1
843
-        ) {
844
-            $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner'])
845
-                ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
846
-            $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description'])
847
-                ? absint($REQ['EED_Events_Archive_display_description']) : 1;
848
-            $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector'])
849
-                ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
850
-            $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint(
851
-                $REQ['EED_Events_Archive_display_datetimes']
852
-            ) : 1;
853
-            $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint(
854
-                $REQ['EED_Events_Archive_display_venue']
855
-            ) : 0;
856
-            $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events'])
857
-                ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0;
858
-        }
859
-        return $CFG;
860
-    }
861
-
862
-
863
-    /**
864
-     *    event_list_css
865
-     *
866
-     * @access    public
867
-     * @param string $extra_class
868
-     * @return    string
869
-     */
870
-    public static function event_list_css($extra_class = '')
871
-    {
872
-        $event_list_css = ! empty($extra_class) ? array($extra_class) : array();
873
-        $event_list_css[] = 'espresso-event-list-event';
874
-        return implode(' ', $event_list_css);
875
-    }
876
-
877
-
878
-    /**
879
-     *    event_categories
880
-     *
881
-     * @access    public
882
-     * @return    array
883
-     */
884
-    public static function event_categories()
885
-    {
886
-        return EE_Registry::instance()->load_model('Term')->get_all_ee_categories();
887
-    }
888
-
889
-
890
-    /**
891
-     *    display_description
892
-     *
893
-     * @access    public
894
-     * @param $value
895
-     * @return    bool
896
-     */
897
-    public static function display_description($value)
898
-    {
899
-        $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
900
-        $display_description = isset($config->display_description) ? $config->display_description : 1;
901
-        return $display_description === $value ? true : false;
902
-    }
903
-
904
-
905
-    /**
906
-     *    display_ticket_selector
907
-     *
908
-     * @access    public
909
-     * @return    bool
910
-     */
911
-    public static function display_ticket_selector()
912
-    {
913
-        $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
914
-        return isset($config->display_ticket_selector) && $config->display_ticket_selector ? true : false;
915
-    }
916
-
917
-
918
-    /**
919
-     *    display_venue
920
-     *
921
-     * @access    public
922
-     * @return    bool
923
-     */
924
-    public static function display_venue()
925
-    {
926
-        $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
927
-        return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? true : false;
928
-    }
929
-
930
-
931
-    /**
932
-     *    display_datetimes
933
-     *
934
-     * @access    public
935
-     * @return    bool
936
-     */
937
-    public static function display_datetimes()
938
-    {
939
-        $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
940
-        return isset($config->display_datetimes) && $config->display_datetimes ? true : false;
941
-    }
942
-
943
-
944
-    /**
945
-     *    event_list_title
946
-     *
947
-     * @access    public
948
-     * @return    string
949
-     */
950
-    public static function event_list_title()
951
-    {
952
-        return apply_filters(
953
-            'FHEE__archive_espresso_events_template__upcoming_events_h1',
954
-            esc_html__('Upcoming Events', 'event_espresso')
955
-        );
956
-    }
957
-
958
-
959
-    // GRAVEYARD
960
-
961
-
962
-    /**
963
-     * @since 4.4.0
964
-     */
965
-    public static function _doing_it_wrong_notice($function = '')
966
-    {
967
-        EE_Error::doing_it_wrong(
968
-            __FUNCTION__,
969
-            sprintf(
970
-                esc_html__(
971
-                    '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',
972
-                    'event_espresso'
973
-                ),
974
-                $function,
975
-                '<br />',
976
-                '4.6.0'
977
-            ),
978
-            '4.4.0'
979
-        );
980
-    }
981
-
982
-
983
-    /**
984
-     * @deprecated
985
-     * @since 4.4.0
986
-     */
987
-    public function get_post_data()
988
-    {
989
-        EEH_Event_Query::set_query_params();
990
-    }
991
-
992
-
993
-    /**
994
-     * @deprecated
995
-     * @since 4.4.0
996
-     */
997
-    public function posts_fields($SQL, WP_Query $wp_query)
998
-    {
999
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1000
-        return EEH_Event_Query::posts_fields($SQL, $wp_query);
1001
-    }
1002
-
1003
-
1004
-    /**
1005
-     * @deprecated
1006
-     * @since 4.4.0
1007
-     */
1008
-    public static function posts_fields_sql_for_orderby($orderby_params = array())
1009
-    {
1010
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1011
-        return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params);
1012
-    }
1013
-
1014
-
1015
-    /**
1016
-     * @deprecated
1017
-     * @since 4.4.0
1018
-     */
1019
-    public function posts_join($SQL, WP_Query $wp_query)
1020
-    {
1021
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1022
-        return EEH_Event_Query::posts_join($SQL, $wp_query);
1023
-    }
1024
-
1025
-
1026
-    /**
1027
-     * @deprecated
1028
-     * @since 4.4.0
1029
-     */
1030
-    public static function posts_join_sql_for_terms($join_terms = null)
1031
-    {
1032
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1033
-        return EEH_Event_Query::posts_join_sql_for_terms($join_terms);
1034
-    }
1035
-
1036
-
1037
-    /**
1038
-     * @deprecated
1039
-     * @since 4.4.0
1040
-     */
1041
-    public static function posts_join_for_orderby($orderby_params = array())
1042
-    {
1043
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1044
-        return EEH_Event_Query::posts_join_for_orderby($orderby_params);
1045
-    }
1046
-
1047
-
1048
-    /**
1049
-     * @deprecated
1050
-     * @since 4.4.0
1051
-     */
1052
-    public function posts_where($SQL, WP_Query $wp_query)
1053
-    {
1054
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1055
-        return EEH_Event_Query::posts_where($SQL, $wp_query);
1056
-    }
1057
-
1058
-
1059
-    /**
1060
-     * @deprecated
1061
-     * @since 4.4.0
1062
-     */
1063
-    public static function posts_where_sql_for_show_expired($show_expired = false)
1064
-    {
1065
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1066
-        return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired);
1067
-    }
1068
-
1069
-
1070
-    /**
1071
-     * @deprecated
1072
-     * @since 4.4.0
1073
-     */
1074
-    public static function posts_where_sql_for_event_category_slug($event_category_slug = null)
1075
-    {
1076
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1077
-        return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug);
1078
-    }
1079
-
1080
-
1081
-    /**
1082
-     * @deprecated
1083
-     * @since 4.4.0
1084
-     */
1085
-    public static function posts_where_sql_for_event_list_month($month = null)
1086
-    {
1087
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1088
-        return EEH_Event_Query::posts_where_sql_for_event_list_month($month);
1089
-    }
1090
-
1091
-
1092
-    /**
1093
-     * @deprecated
1094
-     * @since 4.4.0
1095
-     */
1096
-    public function posts_orderby($SQL, WP_Query $wp_query)
1097
-    {
1098
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1099
-        return EEH_Event_Query::posts_orderby($SQL, $wp_query);
1100
-    }
1101
-
1102
-
1103
-    /**
1104
-     * @deprecated
1105
-     * @since 4.4.0
1106
-     */
1107
-    public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC')
1108
-    {
1109
-        EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1110
-        return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort);
1111
-    }
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 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/');
127
+		define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/');
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
+			esc_html__('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
+			esc_html__('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
+			esc_html__('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
+			esc_html__('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 (
308
+				apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false)
309
+				|| EE_Registry::instance()
310
+							  ->load_core('Front_Controller')
311
+							  ->get_selected_template() !== 'archive-espresso_events.php'
312
+			) {
313
+				// don't display entry meta because the existing theme will take care of that
314
+				add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true');
315
+				// load functions.php file for the theme (loaded by WP if using child theme)
316
+				EEH_Template::load_espresso_theme_functions();
317
+				// because we don't know if the theme is using the_excerpt()
318
+				add_filter(
319
+					'get_the_excerpt',
320
+					array('EED_Events_Archive', 'event_details'),
321
+					EED_Events_Archive::EVENT_DETAILS_PRIORITY
322
+				);
323
+				// or the_content
324
+				add_filter(
325
+					'the_content',
326
+					array('EED_Events_Archive', 'event_details'),
327
+					EED_Events_Archive::EVENT_DETAILS_PRIORITY
328
+				);
329
+				// and just in case they are running get_the_excerpt() which DESTROYS things
330
+				add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
331
+				// don't display entry meta because the existing theme will take care of that
332
+				add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
333
+			}
334
+		}
335
+		return $template;
336
+	}
337
+
338
+
339
+	/**
340
+	 *    get_the_excerpt - kinda hacky, but if a theme is using get_the_excerpt(), then we need to remove our filters
341
+	 *    on the_content()
342
+	 *
343
+	 * @access    public
344
+	 * @param        string $excerpt
345
+	 * @return        string
346
+	 */
347
+	public static function get_the_excerpt($excerpt = '')
348
+	{
349
+		if (post_password_required()) {
350
+			return $excerpt;
351
+		}
352
+		if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) {
353
+			remove_filter(
354
+				'get_the_excerpt',
355
+				array('EED_Events_Archive', 'event_details'),
356
+				EED_Events_Archive::EVENT_DETAILS_PRIORITY
357
+			);
358
+			remove_filter(
359
+				'the_content',
360
+				array('EED_Events_Archive', 'event_details'),
361
+				EED_Events_Archive::EVENT_DETAILS_PRIORITY
362
+			);
363
+			$excerpt = EED_Events_Archive::event_details($excerpt);
364
+		} else {
365
+			EED_Events_Archive::$using_get_the_excerpt = true;
366
+			add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1);
367
+		}
368
+		return $excerpt;
369
+	}
370
+
371
+
372
+	/**
373
+	 * end_get_the_excerpt
374
+	 *
375
+	 * @access public
376
+	 * @param  string $text
377
+	 * @return string
378
+	 */
379
+	public static function end_get_the_excerpt($text = '')
380
+	{
381
+		EED_Events_Archive::$using_get_the_excerpt = false;
382
+		return $text;
383
+	}
384
+
385
+
386
+	/**
387
+	 *    the_title
388
+	 *
389
+	 * @access        public
390
+	 * @param        string $title
391
+	 * @param        string $id
392
+	 * @return        string
393
+	 */
394
+	public static function the_title($title = '', $id = '')
395
+	{
396
+		global $post;
397
+		if ($post instanceof WP_Post) {
398
+			return ((function_exists('wp_is_block_theme') && wp_is_block_theme()) || in_the_loop()) && $post->ID == $id
399
+				? espresso_event_status_banner($post->ID) . $title
400
+				: $title;
401
+		}
402
+		return $title;
403
+	}
404
+
405
+
406
+	/**
407
+	 *    event_details
408
+	 *
409
+	 * @access    public
410
+	 * @param        string $content
411
+	 * @return        string
412
+	 */
413
+	public static function event_details($content)
414
+	{
415
+		global $post;
416
+		static $current_post_ID = 0;
417
+		if (
418
+			$current_post_ID !== $post->ID
419
+			&& $post->post_type === 'espresso_events'
420
+			&& ! EED_Events_Archive::$using_get_the_excerpt
421
+			&& ! post_password_required()
422
+			&& (
423
+				apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false)
424
+				|| ! apply_filters('FHEE__content_espresso_events__template_loaded', false)
425
+			)
426
+		) {
427
+			// Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
428
+			// Reason being is that some plugins, like Yoast, need to run through a copy of the loop early
429
+			// BEFORE headers are sent in order to examine the post content and generate content for the HTML header.
430
+			// We want to allow those plugins to still do their thing and have access to our content, but depending on
431
+			// how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
432
+			// so the following allows this filter to be applied multiple times, but only once for real
433
+			$current_post_ID = did_action('loop_start') ? $post->ID : 0;
434
+			if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) {
435
+				$content = EED_Events_Archive::use_sortable_display_order();
436
+			} else {
437
+				$content = EED_Events_Archive::use_filterable_display_order();
438
+			}
439
+		}
440
+		return $content;
441
+	}
442
+
443
+
444
+	/**
445
+	 *    use_sortable_display_order
446
+	 *
447
+	 * @access    protected
448
+	 * @return string
449
+	 */
450
+	protected static function use_sortable_display_order()
451
+	{
452
+		// no further password checks required atm
453
+		add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true');
454
+		// we need to first remove this callback from being applied to the_content() or the_excerpt()
455
+		// (otherwise it will recurse and blow up the interweb)
456
+		remove_filter(
457
+			'get_the_excerpt',
458
+			array('EED_Events_Archive', 'event_details'),
459
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
460
+		);
461
+		remove_filter(
462
+			'the_content',
463
+			array('EED_Events_Archive', 'event_details'),
464
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
465
+		);
466
+		remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
467
+		// now add additional content depending on whether event is using the_excerpt() or the_content()
468
+		EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts();
469
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
470
+		$content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content);
471
+		// re-add our main filters (or else the next event won't have them)
472
+		add_filter(
473
+			'get_the_excerpt',
474
+			array('EED_Events_Archive', 'event_details'),
475
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
476
+		);
477
+		add_filter(
478
+			'the_content',
479
+			array('EED_Events_Archive', 'event_details'),
480
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
481
+		);
482
+		add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
483
+		remove_filter(
484
+			'FHEE__EED_Events_Archive__event_details__no_post_password_required',
485
+			'__return_true'
486
+		);
487
+		return $content;
488
+	}
489
+
490
+
491
+	/**
492
+	 *    use_filterable_display_order
493
+	 *
494
+	 * @access    protected
495
+	 * @return    string
496
+	 */
497
+	protected static function use_filterable_display_order()
498
+	{
499
+		// we need to first remove this callback from being applied to the_content()
500
+		// (otherwise it will recurse and blow up the interweb)
501
+		remove_filter(
502
+			'get_the_excerpt',
503
+			array('EED_Events_Archive', 'event_details'),
504
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
505
+		);
506
+		remove_filter(
507
+			'the_content',
508
+			array('EED_Events_Archive', 'event_details'),
509
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
510
+		);
511
+		remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
512
+		// now add additional content depending on whether event is using the_excerpt() or the_content()
513
+		EED_Events_Archive::_add_additional_excerpt_filters();
514
+		EED_Events_Archive::_add_additional_content_filters();
515
+		do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters');
516
+		// now load our template
517
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
518
+		// re-add our main filters (or else the next event won't have them)
519
+		add_filter(
520
+			'get_the_excerpt',
521
+			array('EED_Events_Archive', 'event_details'),
522
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
523
+		);
524
+		add_filter(
525
+			'the_content',
526
+			array('EED_Events_Archive', 'event_details'),
527
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
528
+		);
529
+		add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
530
+		// but remove the other filters so that they don't get applied to the next post
531
+		EED_Events_Archive::_remove_additional_events_archive_filters();
532
+		do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters');
533
+		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
534
+		// return ! empty( $template ) ? $template : $content;
535
+		return $content;
536
+	}
537
+
538
+
539
+	/**
540
+	 *    event_datetimes - adds datetimes ABOVE content
541
+	 *
542
+	 * @access    public
543
+	 * @param        string $content
544
+	 * @return        string
545
+	 */
546
+	public static function event_datetimes($content)
547
+	{
548
+		if (post_password_required()) {
549
+			return $content;
550
+		}
551
+		return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content;
552
+	}
553
+
554
+
555
+	/**
556
+	 *    event_tickets - adds tickets ABOVE content (which includes datetimes)
557
+	 *
558
+	 * @access    public
559
+	 * @param        string $content
560
+	 * @return        string
561
+	 */
562
+	public static function event_tickets($content)
563
+	{
564
+		if (post_password_required()) {
565
+			return $content;
566
+		}
567
+		return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content;
568
+	}
569
+
570
+
571
+	/**
572
+	 *    event_venues - adds venues BELOW content
573
+	 *
574
+	 * @access    public
575
+	 * @param    string $content
576
+	 * @return    string
577
+	 */
578
+	public static function event_venue($content)
579
+	{
580
+		return EED_Events_Archive::event_venues($content);
581
+	}
582
+
583
+
584
+	/**
585
+	 *    event_venues - adds venues BELOW content
586
+	 *
587
+	 * @access    public
588
+	 * @param        string $content
589
+	 * @return        string
590
+	 */
591
+	public static function event_venues($content)
592
+	{
593
+		if (post_password_required()) {
594
+			return $content;
595
+		}
596
+		return $content . EEH_Template::locate_template('content-espresso_events-venues.php');
597
+	}
598
+
599
+
600
+	/**
601
+	 *    _add_additional_content_filters
602
+	 *
603
+	 * @access    private
604
+	 * @return        void
605
+	 */
606
+	private static function _add_additional_excerpt_filters()
607
+	{
608
+		add_filter(
609
+			'get_the_excerpt',
610
+			array('EED_Events_Archive', 'event_datetimes'),
611
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
612
+		);
613
+		add_filter(
614
+			'get_the_excerpt',
615
+			array('EED_Events_Archive', 'event_tickets'),
616
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
617
+		);
618
+		add_filter(
619
+			'get_the_excerpt',
620
+			array('EED_Events_Archive', 'event_venues'),
621
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
622
+		);
623
+	}
624
+
625
+
626
+	/**
627
+	 *    _add_additional_content_filters
628
+	 *
629
+	 * @access    private
630
+	 * @return        void
631
+	 */
632
+	private static function _add_additional_content_filters()
633
+	{
634
+		add_filter(
635
+			'the_content',
636
+			array('EED_Events_Archive', 'event_datetimes'),
637
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
638
+		);
639
+		add_filter(
640
+			'the_content',
641
+			array('EED_Events_Archive', 'event_tickets'),
642
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
643
+		);
644
+		add_filter(
645
+			'the_content',
646
+			array('EED_Events_Archive', 'event_venues'),
647
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
648
+		);
649
+	}
650
+
651
+
652
+	/**
653
+	 *    _remove_additional_events_archive_filters
654
+	 *
655
+	 * @access    private
656
+	 * @return        void
657
+	 */
658
+	private static function _remove_additional_events_archive_filters()
659
+	{
660
+		remove_filter(
661
+			'get_the_excerpt',
662
+			array('EED_Events_Archive', 'event_datetimes'),
663
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
664
+		);
665
+		remove_filter(
666
+			'get_the_excerpt',
667
+			array('EED_Events_Archive', 'event_tickets'),
668
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
669
+		);
670
+		remove_filter(
671
+			'get_the_excerpt',
672
+			array('EED_Events_Archive', 'event_venues'),
673
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
674
+		);
675
+		remove_filter(
676
+			'the_content',
677
+			array('EED_Events_Archive', 'event_datetimes'),
678
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
679
+		);
680
+		remove_filter(
681
+			'the_content',
682
+			array('EED_Events_Archive', 'event_tickets'),
683
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
684
+		);
685
+		remove_filter(
686
+			'the_content',
687
+			array('EED_Events_Archive', 'event_venues'),
688
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
689
+		);
690
+	}
691
+
692
+
693
+	/**
694
+	 *    remove_all_events_archive_filters
695
+	 *
696
+	 * @access    public
697
+	 * @return        void
698
+	 */
699
+	public static function remove_all_events_archive_filters()
700
+	{
701
+		// remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
702
+		remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 1);
703
+		remove_filter(
704
+			'get_the_excerpt',
705
+			array('EED_Events_Archive', 'event_details'),
706
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
707
+		);
708
+		remove_filter(
709
+			'get_the_excerpt',
710
+			array('EED_Events_Archive', 'event_datetimes'),
711
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
712
+		);
713
+		remove_filter(
714
+			'get_the_excerpt',
715
+			array('EED_Events_Archive', 'event_tickets'),
716
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
717
+		);
718
+		remove_filter(
719
+			'get_the_excerpt',
720
+			array('EED_Events_Archive', 'event_venues'),
721
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
722
+		);
723
+		remove_filter(
724
+			'the_content',
725
+			array('EED_Events_Archive', 'event_details'),
726
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
727
+		);
728
+		remove_filter(
729
+			'the_content',
730
+			array('EED_Events_Archive', 'event_datetimes'),
731
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
732
+		);
733
+		remove_filter(
734
+			'the_content',
735
+			array('EED_Events_Archive', 'event_tickets'),
736
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
737
+		);
738
+		remove_filter(
739
+			'the_content',
740
+			array('EED_Events_Archive', 'event_venues'),
741
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
742
+		);
743
+		// don't display entry meta because the existing theme will take care of that
744
+		remove_filter(
745
+			'FHEE__content_espresso_events_details_template__display_entry_meta',
746
+			'__return_false'
747
+		);
748
+	}
749
+
750
+
751
+	/**
752
+	 *    load_event_list_assets
753
+	 *
754
+	 * @access    public
755
+	 * @return    void
756
+	 */
757
+	public function load_event_list_assets()
758
+	{
759
+		do_action('AHEE__EED_Events_Archive__before_load_assets');
760
+		add_filter('FHEE_load_EE_Session', '__return_true');
761
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
762
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
763
+		if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
764
+			add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
765
+		}
766
+	}
767
+
768
+
769
+	/**
770
+	 *    wp_enqueue_scripts
771
+	 *
772
+	 * @access    public
773
+	 * @return    void
774
+	 */
775
+	public function wp_enqueue_scripts()
776
+	{
777
+		// get some style
778
+		if (apply_filters('FHEE_enable_default_espresso_css', false)) {
779
+			// first check uploads folder
780
+			if (EEH_File::is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) {
781
+				wp_register_style(
782
+					$this->theme,
783
+					get_stylesheet_directory_uri() . $this->theme . '/style.css',
784
+					array('dashicons', 'espresso_default')
785
+				);
786
+			} else {
787
+			}
788
+			wp_enqueue_style($this->theme);
789
+		}
790
+	}
791
+
792
+
793
+	/**
794
+	 *    template_settings_form
795
+	 *
796
+	 * @access    public
797
+	 * @static
798
+	 * @return    string
799
+	 */
800
+	public static function template_settings_form()
801
+	{
802
+		$template_settings = EE_Registry::instance()->CFG->template_settings;
803
+		$template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive)
804
+			? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
805
+		$template_settings->EED_Events_Archive = apply_filters(
806
+			'FHEE__EED_Events_Archive__template_settings_form__event_list_config',
807
+			$template_settings->EED_Events_Archive
808
+		);
809
+		$events_archive_settings = array(
810
+			'display_status_banner' => 0,
811
+			'display_description' => 1,
812
+			'display_ticket_selector' => 0,
813
+			'display_datetimes' => 1,
814
+			'display_venue' => 0,
815
+			'display_expired_events' => 0,
816
+		);
817
+		$events_archive_settings = array_merge(
818
+			$events_archive_settings,
819
+			(array) $template_settings->EED_Events_Archive
820
+		);
821
+		EEH_Template::display_template(
822
+			EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php',
823
+			$events_archive_settings
824
+		);
825
+	}
826
+
827
+
828
+	/**
829
+	 *    update_template_settings
830
+	 *
831
+	 * @access    public
832
+	 * @param    EE_Template_Config $CFG
833
+	 * @param    array $REQ
834
+	 * @return    EE_Template_Config
835
+	 */
836
+	public static function update_template_settings($CFG, $REQ)
837
+	{
838
+		$CFG->EED_Events_Archive = new EE_Events_Archive_Config();
839
+		// unless we are resetting the config...
840
+		if (
841
+			! isset($REQ['EED_Events_Archive_reset_event_list_settings'])
842
+			|| absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1
843
+		) {
844
+			$CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner'])
845
+				? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
846
+			$CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description'])
847
+				? absint($REQ['EED_Events_Archive_display_description']) : 1;
848
+			$CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector'])
849
+				? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
850
+			$CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint(
851
+				$REQ['EED_Events_Archive_display_datetimes']
852
+			) : 1;
853
+			$CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint(
854
+				$REQ['EED_Events_Archive_display_venue']
855
+			) : 0;
856
+			$CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events'])
857
+				? absint($REQ['EED_Events_Archive_display_expired_events']) : 0;
858
+		}
859
+		return $CFG;
860
+	}
861
+
862
+
863
+	/**
864
+	 *    event_list_css
865
+	 *
866
+	 * @access    public
867
+	 * @param string $extra_class
868
+	 * @return    string
869
+	 */
870
+	public static function event_list_css($extra_class = '')
871
+	{
872
+		$event_list_css = ! empty($extra_class) ? array($extra_class) : array();
873
+		$event_list_css[] = 'espresso-event-list-event';
874
+		return implode(' ', $event_list_css);
875
+	}
876
+
877
+
878
+	/**
879
+	 *    event_categories
880
+	 *
881
+	 * @access    public
882
+	 * @return    array
883
+	 */
884
+	public static function event_categories()
885
+	{
886
+		return EE_Registry::instance()->load_model('Term')->get_all_ee_categories();
887
+	}
888
+
889
+
890
+	/**
891
+	 *    display_description
892
+	 *
893
+	 * @access    public
894
+	 * @param $value
895
+	 * @return    bool
896
+	 */
897
+	public static function display_description($value)
898
+	{
899
+		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
900
+		$display_description = isset($config->display_description) ? $config->display_description : 1;
901
+		return $display_description === $value ? true : false;
902
+	}
903
+
904
+
905
+	/**
906
+	 *    display_ticket_selector
907
+	 *
908
+	 * @access    public
909
+	 * @return    bool
910
+	 */
911
+	public static function display_ticket_selector()
912
+	{
913
+		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
914
+		return isset($config->display_ticket_selector) && $config->display_ticket_selector ? true : false;
915
+	}
916
+
917
+
918
+	/**
919
+	 *    display_venue
920
+	 *
921
+	 * @access    public
922
+	 * @return    bool
923
+	 */
924
+	public static function display_venue()
925
+	{
926
+		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
927
+		return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? true : false;
928
+	}
929
+
930
+
931
+	/**
932
+	 *    display_datetimes
933
+	 *
934
+	 * @access    public
935
+	 * @return    bool
936
+	 */
937
+	public static function display_datetimes()
938
+	{
939
+		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
940
+		return isset($config->display_datetimes) && $config->display_datetimes ? true : false;
941
+	}
942
+
943
+
944
+	/**
945
+	 *    event_list_title
946
+	 *
947
+	 * @access    public
948
+	 * @return    string
949
+	 */
950
+	public static function event_list_title()
951
+	{
952
+		return apply_filters(
953
+			'FHEE__archive_espresso_events_template__upcoming_events_h1',
954
+			esc_html__('Upcoming Events', 'event_espresso')
955
+		);
956
+	}
957
+
958
+
959
+	// GRAVEYARD
960
+
961
+
962
+	/**
963
+	 * @since 4.4.0
964
+	 */
965
+	public static function _doing_it_wrong_notice($function = '')
966
+	{
967
+		EE_Error::doing_it_wrong(
968
+			__FUNCTION__,
969
+			sprintf(
970
+				esc_html__(
971
+					'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',
972
+					'event_espresso'
973
+				),
974
+				$function,
975
+				'<br />',
976
+				'4.6.0'
977
+			),
978
+			'4.4.0'
979
+		);
980
+	}
981
+
982
+
983
+	/**
984
+	 * @deprecated
985
+	 * @since 4.4.0
986
+	 */
987
+	public function get_post_data()
988
+	{
989
+		EEH_Event_Query::set_query_params();
990
+	}
991
+
992
+
993
+	/**
994
+	 * @deprecated
995
+	 * @since 4.4.0
996
+	 */
997
+	public function posts_fields($SQL, WP_Query $wp_query)
998
+	{
999
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1000
+		return EEH_Event_Query::posts_fields($SQL, $wp_query);
1001
+	}
1002
+
1003
+
1004
+	/**
1005
+	 * @deprecated
1006
+	 * @since 4.4.0
1007
+	 */
1008
+	public static function posts_fields_sql_for_orderby($orderby_params = array())
1009
+	{
1010
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1011
+		return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params);
1012
+	}
1013
+
1014
+
1015
+	/**
1016
+	 * @deprecated
1017
+	 * @since 4.4.0
1018
+	 */
1019
+	public function posts_join($SQL, WP_Query $wp_query)
1020
+	{
1021
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1022
+		return EEH_Event_Query::posts_join($SQL, $wp_query);
1023
+	}
1024
+
1025
+
1026
+	/**
1027
+	 * @deprecated
1028
+	 * @since 4.4.0
1029
+	 */
1030
+	public static function posts_join_sql_for_terms($join_terms = null)
1031
+	{
1032
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1033
+		return EEH_Event_Query::posts_join_sql_for_terms($join_terms);
1034
+	}
1035
+
1036
+
1037
+	/**
1038
+	 * @deprecated
1039
+	 * @since 4.4.0
1040
+	 */
1041
+	public static function posts_join_for_orderby($orderby_params = array())
1042
+	{
1043
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1044
+		return EEH_Event_Query::posts_join_for_orderby($orderby_params);
1045
+	}
1046
+
1047
+
1048
+	/**
1049
+	 * @deprecated
1050
+	 * @since 4.4.0
1051
+	 */
1052
+	public function posts_where($SQL, WP_Query $wp_query)
1053
+	{
1054
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1055
+		return EEH_Event_Query::posts_where($SQL, $wp_query);
1056
+	}
1057
+
1058
+
1059
+	/**
1060
+	 * @deprecated
1061
+	 * @since 4.4.0
1062
+	 */
1063
+	public static function posts_where_sql_for_show_expired($show_expired = false)
1064
+	{
1065
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1066
+		return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired);
1067
+	}
1068
+
1069
+
1070
+	/**
1071
+	 * @deprecated
1072
+	 * @since 4.4.0
1073
+	 */
1074
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = null)
1075
+	{
1076
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1077
+		return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug);
1078
+	}
1079
+
1080
+
1081
+	/**
1082
+	 * @deprecated
1083
+	 * @since 4.4.0
1084
+	 */
1085
+	public static function posts_where_sql_for_event_list_month($month = null)
1086
+	{
1087
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1088
+		return EEH_Event_Query::posts_where_sql_for_event_list_month($month);
1089
+	}
1090
+
1091
+
1092
+	/**
1093
+	 * @deprecated
1094
+	 * @since 4.4.0
1095
+	 */
1096
+	public function posts_orderby($SQL, WP_Query $wp_query)
1097
+	{
1098
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1099
+		return EEH_Event_Query::posts_orderby($SQL, $wp_query);
1100
+	}
1101
+
1102
+
1103
+	/**
1104
+	 * @deprecated
1105
+	 * @since 4.4.0
1106
+	 */
1107
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC')
1108
+	{
1109
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1110
+		return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort);
1111
+	}
1112 1112
 }
1113 1113
 
1114 1114
 
@@ -1117,9 +1117,9 @@  discard block
 block discarded – undo
1117 1117
  */
1118 1118
 function espresso_get_event_list_ID()
1119 1119
 {
1120
-    EED_Events_Archive::$espresso_event_list_ID++;
1121
-    EED_Events_Archive::$espresso_grid_event_lists[] = EED_Events_Archive::$espresso_event_list_ID;
1122
-    return EED_Events_Archive::$espresso_event_list_ID;
1120
+	EED_Events_Archive::$espresso_event_list_ID++;
1121
+	EED_Events_Archive::$espresso_grid_event_lists[] = EED_Events_Archive::$espresso_event_list_ID;
1122
+	return EED_Events_Archive::$espresso_event_list_ID;
1123 1123
 }
1124 1124
 
1125 1125
 /**
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
  */
1128 1128
 function espresso_event_list_title()
1129 1129
 {
1130
-    return EED_Events_Archive::event_list_title();
1130
+	return EED_Events_Archive::event_list_title();
1131 1131
 }
1132 1132
 
1133 1133
 /**
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
  */
1137 1137
 function espresso_event_list_css($extra_class = '')
1138 1138
 {
1139
-    return EED_Events_Archive::event_list_css($extra_class);
1139
+	return EED_Events_Archive::event_list_css($extra_class);
1140 1140
 }
1141 1141
 
1142 1142
 /**
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
  */
1145 1145
 function espresso_get_event_categories()
1146 1146
 {
1147
-    return EED_Events_Archive::event_categories();
1147
+	return EED_Events_Archive::event_categories();
1148 1148
 }
1149 1149
 
1150 1150
 /**
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
  */
1153 1153
 function espresso_display_full_description_in_event_list()
1154 1154
 {
1155
-    return EED_Events_Archive::display_description(2);
1155
+	return EED_Events_Archive::display_description(2);
1156 1156
 }
1157 1157
 
1158 1158
 /**
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
  */
1161 1161
 function espresso_display_excerpt_in_event_list()
1162 1162
 {
1163
-    return EED_Events_Archive::display_description(1);
1163
+	return EED_Events_Archive::display_description(1);
1164 1164
 }
1165 1165
 
1166 1166
 /**
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
  */
1169 1169
 function espresso_display_ticket_selector_in_event_list()
1170 1170
 {
1171
-    return EED_Events_Archive::display_ticket_selector();
1171
+	return EED_Events_Archive::display_ticket_selector();
1172 1172
 }
1173 1173
 
1174 1174
 /**
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
  */
1177 1177
 function espresso_display_venue_in_event_list()
1178 1178
 {
1179
-    return EED_Events_Archive::display_venue();
1179
+	return EED_Events_Archive::display_venue();
1180 1180
 }
1181 1181
 
1182 1182
 /**
@@ -1184,5 +1184,5 @@  discard block
 block discarded – undo
1184 1184
  */
1185 1185
 function espresso_display_datetimes_in_event_list()
1186 1186
 {
1187
-    return EED_Events_Archive::display_datetimes();
1187
+	return EED_Events_Archive::display_datetimes();
1188 1188
 }
Please login to merge, or discard this patch.