Completed
Branch fix/event-status-block-theme (1207b8)
by
unknown
08:42 queued 06:32
created
modules/event_single/EED_Event_Single.module.php 2 patches
Indentation   +469 added lines, -469 removed lines patch added patch discarded remove patch
@@ -14,474 +14,474 @@  discard block
 block discarded – undo
14 14
 class EED_Event_Single extends EED_Module
15 15
 {
16 16
 
17
-    const EVENT_DETAILS_PRIORITY = 100;
18
-    const EVENT_DATETIMES_PRIORITY = 110;
19
-    const EVENT_TICKETS_PRIORITY = 120;
20
-    const EVENT_VENUES_PRIORITY = 130;
21
-
22
-    /**
23
-     * @type bool $using_get_the_excerpt
24
-     */
25
-    protected static $using_get_the_excerpt = false;
26
-
27
-
28
-    /**
29
-     * @type EE_Template_Part_Manager $template_parts
30
-     */
31
-    protected $template_parts;
32
-
33
-
34
-    /**
35
-     * @return EED_Module|EED_Event_Single
36
-     */
37
-    public static function instance()
38
-    {
39
-        return parent::get_instance(__CLASS__);
40
-    }
41
-
42
-
43
-    /**
44
-     * set_hooks - for hooking into EE Core, other modules, etc
45
-     *
46
-     * @return void
47
-     * @throws InvalidArgumentException
48
-     * @throws InvalidDataTypeException
49
-     * @throws InvalidInterfaceException
50
-     */
51
-    public static function set_hooks()
52
-    {
53
-        add_filter('FHEE_run_EE_wp', '__return_true');
54
-        add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
55
-        /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */
56
-        $custom_post_type_definitions = LoaderFactory::getLoader()->getShared(
57
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
58
-        );
59
-        $custom_post_types = $custom_post_type_definitions->getDefinitions();
60
-        EE_Config::register_route(
61
-            $custom_post_types['espresso_events']['singular_slug'],
62
-            'Event_Single',
63
-            'run'
64
-        );
65
-    }
66
-
67
-    /**
68
-     * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
69
-     *
70
-     * @return    void
71
-     */
72
-    public static function set_hooks_admin()
73
-    {
74
-        add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
75
-    }
76
-
77
-
78
-    /**
79
-     * set_definitions
80
-     *
81
-     * @static
82
-     * @return void
83
-     */
84
-    public static function set_definitions()
85
-    {
86
-        define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/');
87
-        define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates/');
88
-    }
89
-
90
-
91
-    /**
92
-     * set_config
93
-     *
94
-     * @void
95
-     */
96
-    protected function set_config()
97
-    {
98
-        $this->set_config_section('template_settings');
99
-        $this->set_config_class('EE_Event_Single_Config');
100
-        $this->set_config_name('EED_Event_Single');
101
-    }
102
-
103
-
104
-    /**
105
-     * initialize_template_parts
106
-     *
107
-     * @param EE_Config_Base|EE_Event_Single_Config $config
108
-     * @return EE_Template_Part_Manager
109
-     */
110
-    public function initialize_template_parts(EE_Event_Single_Config $config = null)
111
-    {
112
-        /** @type EE_Event_Single_Config $config */
113
-        $config = $config instanceof EE_Event_Single_Config ? $config : $this->config();
114
-        EEH_Autoloader::instance()->register_template_part_autoloaders();
115
-        $template_parts = new EE_Template_Part_Manager();
116
-        $template_parts->add_template_part(
117
-            'tickets',
118
-            esc_html__('Ticket Selector', 'event_espresso'),
119
-            'content-espresso_events-tickets.php',
120
-            $config->display_order_tickets
121
-        );
122
-        $template_parts->add_template_part(
123
-            'datetimes',
124
-            esc_html__('Dates and Times', 'event_espresso'),
125
-            'content-espresso_events-datetimes.php',
126
-            $config->display_order_datetimes
127
-        );
128
-        $template_parts->add_template_part(
129
-            'event',
130
-            esc_html__('Event Description', 'event_espresso'),
131
-            'content-espresso_events-details.php',
132
-            $config->display_order_event
133
-        );
134
-        $template_parts->add_template_part(
135
-            'venue',
136
-            esc_html__('Venue Information', 'event_espresso'),
137
-            'content-espresso_events-venues.php',
138
-            $config->display_order_venue
139
-        );
140
-        do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts);
141
-        return $template_parts;
142
-    }
143
-
144
-
145
-    /**
146
-     * run - initial module setup
147
-     *
148
-     * @param WP $WP
149
-     * @return    void
150
-     */
151
-    public function run($WP)
152
-    {
153
-        // ensure valid EE_Events_Single_Config() object exists
154
-        $this->set_config();
155
-        // check what template is loaded
156
-        add_filter('template_include', array($this, 'template_include'), 999, 1);
157
-        add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
158
-        // load css
159
-        add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
160
-    }
161
-
162
-
163
-    /**
164
-     * template_include
165
-     *
166
-     * @param    string $template
167
-     * @return    string
168
-     */
169
-    public function template_include($template)
170
-    {
171
-        global $post;
172
-        /** @type EE_Event_Single_Config $config */
173
-        $config = $this->config();
174
-        if ($config->display_status_banner_single) {
175
-            add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2);
176
-        }
177
-        // not a custom template?
178
-        if (
179
-            ! post_password_required($post)
180
-            && (
181
-                apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false)
182
-                || EE_Registry::instance()
183
-                              ->load_core('Front_Controller')
184
-                              ->get_selected_template() !== 'single-espresso_events.php'
185
-            )
186
-        ) {
187
-            EEH_Template::load_espresso_theme_functions();
188
-            // then add extra event data via hooks
189
-            add_action('loop_start', array('EED_Event_Single', 'loop_start'));
190
-            add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1);
191
-            add_filter(
192
-                'the_content',
193
-                array('EED_Event_Single', 'event_details'),
194
-                EED_Event_Single::EVENT_DETAILS_PRIORITY
195
-            );
196
-            add_action('loop_end', array('EED_Event_Single', 'loop_end'));
197
-            // don't display entry meta because the existing theme will take car of that
198
-            add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
199
-        }
200
-        return $template;
201
-    }
202
-
203
-
204
-    /**
205
-     * loop_start
206
-     *
207
-     * @param    array $wp_query_array an array containing the WP_Query object
208
-     * @return    void
209
-     */
210
-    public static function loop_start($wp_query_array)
211
-    {
212
-        global $post;
213
-        do_action('AHEE_event_details_before_post', $post, $wp_query_array);
214
-    }
215
-
216
-
217
-    /**
218
-     * the_title
219
-     *
220
-     * @param    string $title
221
-     * @param    int    $id
222
-     * @return    string
223
-     */
224
-    public static function the_title($title = '', $id = 0)
225
-    {
226
-        global $post;
227
-        return ((function_exists('wp_is_block_theme') && wp_is_block_theme()) || in_the_loop()) && $post->ID === (int) $id
228
-            ? espresso_event_status_banner($post->ID) . $title
229
-            : $title;
230
-    }
231
-
232
-
233
-    /**
234
-     * get_the_excerpt
235
-     * kinda hacky, but if a theme is using get_the_excerpt(),
236
-     * then we need to remove our filters on the_content()
237
-     *
238
-     * @param        string $excerpt
239
-     * @return        string
240
-     */
241
-    public static function get_the_excerpt($excerpt = '')
242
-    {
243
-        EED_Event_Single::$using_get_the_excerpt = true;
244
-        add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1);
245
-        return $excerpt;
246
-    }
247
-
248
-
249
-    /**
250
-     * end_get_the_excerpt
251
-     *
252
-     * @param  string $text
253
-     * @return string
254
-     */
255
-    public static function end_get_the_excerpt($text = '')
256
-    {
257
-        EED_Event_Single::$using_get_the_excerpt = false;
258
-        return $text;
259
-    }
260
-
261
-
262
-    /**
263
-     * event_details
264
-     *
265
-     * @param    string $content
266
-     * @return    string
267
-     */
268
-    public static function event_details($content)
269
-    {
270
-        global $post;
271
-        static $current_post_ID = 0;
272
-        if (
273
-            $current_post_ID !== $post->ID
274
-            && $post->post_type === 'espresso_events'
275
-            && ! EED_Event_Single::$using_get_the_excerpt
276
-            && ! post_password_required()
277
-        ) {
278
-            // Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
279
-            // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early
280
-            // BEFORE headers are sent in order to examine the post content and generate content for the HTML header.
281
-            // We want to allow those plugins to still do their thing and have access to our content, but depending on
282
-            // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
283
-            // so the following allows this filter to be applied multiple times, but only once for real
284
-            $current_post_ID = did_action('loop_start') ? $post->ID : 0;
285
-            if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) {
286
-                // we need to first remove this callback from being applied to the_content()
287
-                // (otherwise it will recurse and blow up the interweb)
288
-                remove_filter(
289
-                    'the_content',
290
-                    array('EED_Event_Single', 'event_details'),
291
-                    EED_Event_Single::EVENT_DETAILS_PRIORITY
292
-                );
293
-                EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(
294
-                );
295
-                $content = EEH_Template::locate_template('content-espresso_events-details.php');
296
-                $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content);
297
-                add_filter(
298
-                    'the_content',
299
-                    array('EED_Event_Single', 'event_details'),
300
-                    EED_Event_Single::EVENT_DETAILS_PRIORITY
301
-                );
302
-            } else {
303
-                $content = EED_Event_Single::use_filterable_display_order();
304
-            }
305
-        }
306
-        return $content;
307
-    }
308
-
309
-
310
-    /**
311
-     * use_filterable_display_order
312
-     *
313
-     * @return string
314
-     */
315
-    protected static function use_filterable_display_order()
316
-    {
317
-        // since the 'content-espresso_events-details.php' template might be used directly from within a theme,
318
-        // it uses the_content() for displaying the $post->post_content
319
-        // so in order to load a template that uses the_content()
320
-        // from within a callback being used to filter the_content(),
321
-        // we need to first remove this callback from being applied to the_content()
322
-        // (otherwise it will recurse and blow up the interweb)
323
-        remove_filter(
324
-            'the_content',
325
-            array('EED_Event_Single', 'event_details'),
326
-            EED_Event_Single::EVENT_DETAILS_PRIORITY
327
-        );
328
-        // now add additional content
329
-        add_filter(
330
-            'the_content',
331
-            array('EED_Event_Single', 'event_datetimes'),
332
-            EED_Event_Single::EVENT_DATETIMES_PRIORITY,
333
-            1
334
-        );
335
-        add_filter(
336
-            'the_content',
337
-            array('EED_Event_Single', 'event_tickets'),
338
-            EED_Event_Single::EVENT_TICKETS_PRIORITY,
339
-            1
340
-        );
341
-        add_filter(
342
-            'the_content',
343
-            array('EED_Event_Single', 'event_venues'),
344
-            EED_Event_Single::EVENT_VENUES_PRIORITY,
345
-            1
346
-        );
347
-        do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters');
348
-        // now load our template
349
-        $content = EEH_Template::locate_template('content-espresso_events-details.php');
350
-        // now add our filter back in, plus some others
351
-        add_filter(
352
-            'the_content',
353
-            array('EED_Event_Single', 'event_details'),
354
-            EED_Event_Single::EVENT_DETAILS_PRIORITY
355
-        );
356
-        remove_filter(
357
-            'the_content',
358
-            array('EED_Event_Single', 'event_datetimes'),
359
-            EED_Event_Single::EVENT_DATETIMES_PRIORITY
360
-        );
361
-        remove_filter(
362
-            'the_content',
363
-            array('EED_Event_Single', 'event_tickets'),
364
-            EED_Event_Single::EVENT_TICKETS_PRIORITY
365
-        );
366
-        remove_filter(
367
-            'the_content',
368
-            array('EED_Event_Single', 'event_venues'),
369
-            EED_Event_Single::EVENT_VENUES_PRIORITY
370
-        );
371
-        do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters');
372
-        // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
373
-        return $content;
374
-    }
375
-
376
-
377
-    /**
378
-     * event_datetimes - adds datetimes ABOVE content
379
-     *
380
-     * @param        string $content
381
-     * @return        string
382
-     */
383
-    public static function event_datetimes($content)
384
-    {
385
-        return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content;
386
-    }
387
-
388
-
389
-    /**
390
-     * event_tickets - adds tickets ABOVE content (which includes datetimes)
391
-     *
392
-     * @param        string $content
393
-     * @return        string
394
-     */
395
-    public static function event_tickets($content)
396
-    {
397
-        return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content;
398
-    }
399
-
400
-
401
-    /**
402
-     * event_venues
403
-     *
404
-     * @param    string $content
405
-     * @return    string
406
-     */
407
-    public static function event_venue($content)
408
-    {
409
-        return EED_Event_Single::event_venues($content);
410
-    }
411
-
412
-
413
-    /**
414
-     * event_venues - adds venues BELOW content
415
-     *
416
-     * @param        string $content
417
-     * @return        string
418
-     */
419
-    public static function event_venues($content)
420
-    {
421
-        return $content . EEH_Template::locate_template('content-espresso_events-venues.php');
422
-    }
423
-
424
-
425
-    /**
426
-     * loop_end
427
-     *
428
-     * @param        array $wp_query_array an array containing the WP_Query object
429
-     * @return        void
430
-     */
431
-    public static function loop_end($wp_query_array)
432
-    {
433
-        global $post;
434
-        do_action('AHEE_event_details_after_post', $post, $wp_query_array);
435
-    }
436
-
437
-
438
-    /**
439
-     * wp_enqueue_scripts
440
-     *
441
-     * @return    void
442
-     */
443
-    public function wp_enqueue_scripts()
444
-    {
445
-        // get some style
446
-        if (
447
-            apply_filters('FHEE_enable_default_espresso_css', true)
448
-            && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', true)
449
-        ) {
450
-            // first check uploads folder
451
-            if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) {
452
-                wp_register_style(
453
-                    $this->theme,
454
-                    get_stylesheet_directory_uri() . $this->theme . '/style.css',
455
-                    array('dashicons', 'espresso_default')
456
-                );
457
-            } else {
458
-                wp_register_style(
459
-                    $this->theme,
460
-                    EE_TEMPLATES_URL . $this->theme . '/style.css',
461
-                    array('dashicons', 'espresso_default')
462
-                );
463
-            }
464
-            wp_enqueue_script($this->theme);
465
-            if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
466
-                add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
467
-            }
468
-        }
469
-    }
470
-
471
-
472
-    /**
473
-     * display_venue
474
-     *
475
-     * @return    bool
476
-     */
477
-    public static function display_venue()
478
-    {
479
-        /** @type EE_Event_Single_Config $config */
480
-        $config = EED_Event_Single::instance()->config();
481
-        $display_venue = $config->display_venue === null ? true : $config->display_venue;
482
-        $venue_name = EEH_Venue_View::venue_name();
483
-        return $display_venue && ! empty($venue_name);
484
-    }
17
+	const EVENT_DETAILS_PRIORITY = 100;
18
+	const EVENT_DATETIMES_PRIORITY = 110;
19
+	const EVENT_TICKETS_PRIORITY = 120;
20
+	const EVENT_VENUES_PRIORITY = 130;
21
+
22
+	/**
23
+	 * @type bool $using_get_the_excerpt
24
+	 */
25
+	protected static $using_get_the_excerpt = false;
26
+
27
+
28
+	/**
29
+	 * @type EE_Template_Part_Manager $template_parts
30
+	 */
31
+	protected $template_parts;
32
+
33
+
34
+	/**
35
+	 * @return EED_Module|EED_Event_Single
36
+	 */
37
+	public static function instance()
38
+	{
39
+		return parent::get_instance(__CLASS__);
40
+	}
41
+
42
+
43
+	/**
44
+	 * set_hooks - for hooking into EE Core, other modules, etc
45
+	 *
46
+	 * @return void
47
+	 * @throws InvalidArgumentException
48
+	 * @throws InvalidDataTypeException
49
+	 * @throws InvalidInterfaceException
50
+	 */
51
+	public static function set_hooks()
52
+	{
53
+		add_filter('FHEE_run_EE_wp', '__return_true');
54
+		add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
55
+		/** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */
56
+		$custom_post_type_definitions = LoaderFactory::getLoader()->getShared(
57
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
58
+		);
59
+		$custom_post_types = $custom_post_type_definitions->getDefinitions();
60
+		EE_Config::register_route(
61
+			$custom_post_types['espresso_events']['singular_slug'],
62
+			'Event_Single',
63
+			'run'
64
+		);
65
+	}
66
+
67
+	/**
68
+	 * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
69
+	 *
70
+	 * @return    void
71
+	 */
72
+	public static function set_hooks_admin()
73
+	{
74
+		add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
75
+	}
76
+
77
+
78
+	/**
79
+	 * set_definitions
80
+	 *
81
+	 * @static
82
+	 * @return void
83
+	 */
84
+	public static function set_definitions()
85
+	{
86
+		define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/');
87
+		define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates/');
88
+	}
89
+
90
+
91
+	/**
92
+	 * set_config
93
+	 *
94
+	 * @void
95
+	 */
96
+	protected function set_config()
97
+	{
98
+		$this->set_config_section('template_settings');
99
+		$this->set_config_class('EE_Event_Single_Config');
100
+		$this->set_config_name('EED_Event_Single');
101
+	}
102
+
103
+
104
+	/**
105
+	 * initialize_template_parts
106
+	 *
107
+	 * @param EE_Config_Base|EE_Event_Single_Config $config
108
+	 * @return EE_Template_Part_Manager
109
+	 */
110
+	public function initialize_template_parts(EE_Event_Single_Config $config = null)
111
+	{
112
+		/** @type EE_Event_Single_Config $config */
113
+		$config = $config instanceof EE_Event_Single_Config ? $config : $this->config();
114
+		EEH_Autoloader::instance()->register_template_part_autoloaders();
115
+		$template_parts = new EE_Template_Part_Manager();
116
+		$template_parts->add_template_part(
117
+			'tickets',
118
+			esc_html__('Ticket Selector', 'event_espresso'),
119
+			'content-espresso_events-tickets.php',
120
+			$config->display_order_tickets
121
+		);
122
+		$template_parts->add_template_part(
123
+			'datetimes',
124
+			esc_html__('Dates and Times', 'event_espresso'),
125
+			'content-espresso_events-datetimes.php',
126
+			$config->display_order_datetimes
127
+		);
128
+		$template_parts->add_template_part(
129
+			'event',
130
+			esc_html__('Event Description', 'event_espresso'),
131
+			'content-espresso_events-details.php',
132
+			$config->display_order_event
133
+		);
134
+		$template_parts->add_template_part(
135
+			'venue',
136
+			esc_html__('Venue Information', 'event_espresso'),
137
+			'content-espresso_events-venues.php',
138
+			$config->display_order_venue
139
+		);
140
+		do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts);
141
+		return $template_parts;
142
+	}
143
+
144
+
145
+	/**
146
+	 * run - initial module setup
147
+	 *
148
+	 * @param WP $WP
149
+	 * @return    void
150
+	 */
151
+	public function run($WP)
152
+	{
153
+		// ensure valid EE_Events_Single_Config() object exists
154
+		$this->set_config();
155
+		// check what template is loaded
156
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
157
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
158
+		// load css
159
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
160
+	}
161
+
162
+
163
+	/**
164
+	 * template_include
165
+	 *
166
+	 * @param    string $template
167
+	 * @return    string
168
+	 */
169
+	public function template_include($template)
170
+	{
171
+		global $post;
172
+		/** @type EE_Event_Single_Config $config */
173
+		$config = $this->config();
174
+		if ($config->display_status_banner_single) {
175
+			add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2);
176
+		}
177
+		// not a custom template?
178
+		if (
179
+			! post_password_required($post)
180
+			&& (
181
+				apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false)
182
+				|| EE_Registry::instance()
183
+							  ->load_core('Front_Controller')
184
+							  ->get_selected_template() !== 'single-espresso_events.php'
185
+			)
186
+		) {
187
+			EEH_Template::load_espresso_theme_functions();
188
+			// then add extra event data via hooks
189
+			add_action('loop_start', array('EED_Event_Single', 'loop_start'));
190
+			add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1);
191
+			add_filter(
192
+				'the_content',
193
+				array('EED_Event_Single', 'event_details'),
194
+				EED_Event_Single::EVENT_DETAILS_PRIORITY
195
+			);
196
+			add_action('loop_end', array('EED_Event_Single', 'loop_end'));
197
+			// don't display entry meta because the existing theme will take car of that
198
+			add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
199
+		}
200
+		return $template;
201
+	}
202
+
203
+
204
+	/**
205
+	 * loop_start
206
+	 *
207
+	 * @param    array $wp_query_array an array containing the WP_Query object
208
+	 * @return    void
209
+	 */
210
+	public static function loop_start($wp_query_array)
211
+	{
212
+		global $post;
213
+		do_action('AHEE_event_details_before_post', $post, $wp_query_array);
214
+	}
215
+
216
+
217
+	/**
218
+	 * the_title
219
+	 *
220
+	 * @param    string $title
221
+	 * @param    int    $id
222
+	 * @return    string
223
+	 */
224
+	public static function the_title($title = '', $id = 0)
225
+	{
226
+		global $post;
227
+		return ((function_exists('wp_is_block_theme') && wp_is_block_theme()) || in_the_loop()) && $post->ID === (int) $id
228
+			? espresso_event_status_banner($post->ID) . $title
229
+			: $title;
230
+	}
231
+
232
+
233
+	/**
234
+	 * get_the_excerpt
235
+	 * kinda hacky, but if a theme is using get_the_excerpt(),
236
+	 * then we need to remove our filters on the_content()
237
+	 *
238
+	 * @param        string $excerpt
239
+	 * @return        string
240
+	 */
241
+	public static function get_the_excerpt($excerpt = '')
242
+	{
243
+		EED_Event_Single::$using_get_the_excerpt = true;
244
+		add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1);
245
+		return $excerpt;
246
+	}
247
+
248
+
249
+	/**
250
+	 * end_get_the_excerpt
251
+	 *
252
+	 * @param  string $text
253
+	 * @return string
254
+	 */
255
+	public static function end_get_the_excerpt($text = '')
256
+	{
257
+		EED_Event_Single::$using_get_the_excerpt = false;
258
+		return $text;
259
+	}
260
+
261
+
262
+	/**
263
+	 * event_details
264
+	 *
265
+	 * @param    string $content
266
+	 * @return    string
267
+	 */
268
+	public static function event_details($content)
269
+	{
270
+		global $post;
271
+		static $current_post_ID = 0;
272
+		if (
273
+			$current_post_ID !== $post->ID
274
+			&& $post->post_type === 'espresso_events'
275
+			&& ! EED_Event_Single::$using_get_the_excerpt
276
+			&& ! post_password_required()
277
+		) {
278
+			// Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
279
+			// Reason being is that some plugins, like Yoast, need to run through a copy of the loop early
280
+			// BEFORE headers are sent in order to examine the post content and generate content for the HTML header.
281
+			// We want to allow those plugins to still do their thing and have access to our content, but depending on
282
+			// how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
283
+			// so the following allows this filter to be applied multiple times, but only once for real
284
+			$current_post_ID = did_action('loop_start') ? $post->ID : 0;
285
+			if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) {
286
+				// we need to first remove this callback from being applied to the_content()
287
+				// (otherwise it will recurse and blow up the interweb)
288
+				remove_filter(
289
+					'the_content',
290
+					array('EED_Event_Single', 'event_details'),
291
+					EED_Event_Single::EVENT_DETAILS_PRIORITY
292
+				);
293
+				EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(
294
+				);
295
+				$content = EEH_Template::locate_template('content-espresso_events-details.php');
296
+				$content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content);
297
+				add_filter(
298
+					'the_content',
299
+					array('EED_Event_Single', 'event_details'),
300
+					EED_Event_Single::EVENT_DETAILS_PRIORITY
301
+				);
302
+			} else {
303
+				$content = EED_Event_Single::use_filterable_display_order();
304
+			}
305
+		}
306
+		return $content;
307
+	}
308
+
309
+
310
+	/**
311
+	 * use_filterable_display_order
312
+	 *
313
+	 * @return string
314
+	 */
315
+	protected static function use_filterable_display_order()
316
+	{
317
+		// since the 'content-espresso_events-details.php' template might be used directly from within a theme,
318
+		// it uses the_content() for displaying the $post->post_content
319
+		// so in order to load a template that uses the_content()
320
+		// from within a callback being used to filter the_content(),
321
+		// we need to first remove this callback from being applied to the_content()
322
+		// (otherwise it will recurse and blow up the interweb)
323
+		remove_filter(
324
+			'the_content',
325
+			array('EED_Event_Single', 'event_details'),
326
+			EED_Event_Single::EVENT_DETAILS_PRIORITY
327
+		);
328
+		// now add additional content
329
+		add_filter(
330
+			'the_content',
331
+			array('EED_Event_Single', 'event_datetimes'),
332
+			EED_Event_Single::EVENT_DATETIMES_PRIORITY,
333
+			1
334
+		);
335
+		add_filter(
336
+			'the_content',
337
+			array('EED_Event_Single', 'event_tickets'),
338
+			EED_Event_Single::EVENT_TICKETS_PRIORITY,
339
+			1
340
+		);
341
+		add_filter(
342
+			'the_content',
343
+			array('EED_Event_Single', 'event_venues'),
344
+			EED_Event_Single::EVENT_VENUES_PRIORITY,
345
+			1
346
+		);
347
+		do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters');
348
+		// now load our template
349
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
350
+		// now add our filter back in, plus some others
351
+		add_filter(
352
+			'the_content',
353
+			array('EED_Event_Single', 'event_details'),
354
+			EED_Event_Single::EVENT_DETAILS_PRIORITY
355
+		);
356
+		remove_filter(
357
+			'the_content',
358
+			array('EED_Event_Single', 'event_datetimes'),
359
+			EED_Event_Single::EVENT_DATETIMES_PRIORITY
360
+		);
361
+		remove_filter(
362
+			'the_content',
363
+			array('EED_Event_Single', 'event_tickets'),
364
+			EED_Event_Single::EVENT_TICKETS_PRIORITY
365
+		);
366
+		remove_filter(
367
+			'the_content',
368
+			array('EED_Event_Single', 'event_venues'),
369
+			EED_Event_Single::EVENT_VENUES_PRIORITY
370
+		);
371
+		do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters');
372
+		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
373
+		return $content;
374
+	}
375
+
376
+
377
+	/**
378
+	 * event_datetimes - adds datetimes ABOVE content
379
+	 *
380
+	 * @param        string $content
381
+	 * @return        string
382
+	 */
383
+	public static function event_datetimes($content)
384
+	{
385
+		return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content;
386
+	}
387
+
388
+
389
+	/**
390
+	 * event_tickets - adds tickets ABOVE content (which includes datetimes)
391
+	 *
392
+	 * @param        string $content
393
+	 * @return        string
394
+	 */
395
+	public static function event_tickets($content)
396
+	{
397
+		return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content;
398
+	}
399
+
400
+
401
+	/**
402
+	 * event_venues
403
+	 *
404
+	 * @param    string $content
405
+	 * @return    string
406
+	 */
407
+	public static function event_venue($content)
408
+	{
409
+		return EED_Event_Single::event_venues($content);
410
+	}
411
+
412
+
413
+	/**
414
+	 * event_venues - adds venues BELOW content
415
+	 *
416
+	 * @param        string $content
417
+	 * @return        string
418
+	 */
419
+	public static function event_venues($content)
420
+	{
421
+		return $content . EEH_Template::locate_template('content-espresso_events-venues.php');
422
+	}
423
+
424
+
425
+	/**
426
+	 * loop_end
427
+	 *
428
+	 * @param        array $wp_query_array an array containing the WP_Query object
429
+	 * @return        void
430
+	 */
431
+	public static function loop_end($wp_query_array)
432
+	{
433
+		global $post;
434
+		do_action('AHEE_event_details_after_post', $post, $wp_query_array);
435
+	}
436
+
437
+
438
+	/**
439
+	 * wp_enqueue_scripts
440
+	 *
441
+	 * @return    void
442
+	 */
443
+	public function wp_enqueue_scripts()
444
+	{
445
+		// get some style
446
+		if (
447
+			apply_filters('FHEE_enable_default_espresso_css', true)
448
+			&& apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', true)
449
+		) {
450
+			// first check uploads folder
451
+			if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) {
452
+				wp_register_style(
453
+					$this->theme,
454
+					get_stylesheet_directory_uri() . $this->theme . '/style.css',
455
+					array('dashicons', 'espresso_default')
456
+				);
457
+			} else {
458
+				wp_register_style(
459
+					$this->theme,
460
+					EE_TEMPLATES_URL . $this->theme . '/style.css',
461
+					array('dashicons', 'espresso_default')
462
+				);
463
+			}
464
+			wp_enqueue_script($this->theme);
465
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
466
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
467
+			}
468
+		}
469
+	}
470
+
471
+
472
+	/**
473
+	 * display_venue
474
+	 *
475
+	 * @return    bool
476
+	 */
477
+	public static function display_venue()
478
+	{
479
+		/** @type EE_Event_Single_Config $config */
480
+		$config = EED_Event_Single::instance()->config();
481
+		$display_venue = $config->display_venue === null ? true : $config->display_venue;
482
+		$venue_name = EEH_Venue_View::venue_name();
483
+		return $display_venue && ! empty($venue_name);
484
+	}
485 485
 }
486 486
 
487 487
 
@@ -493,5 +493,5 @@  discard block
 block discarded – undo
493 493
  */
494 494
 function espresso_display_venue_in_event_details()
495 495
 {
496
-    return EED_Event_Single::display_venue();
496
+	return EED_Event_Single::display_venue();
497 497
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public static function set_definitions()
85 85
     {
86
-        define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/');
87
-        define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates/');
86
+        define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets/');
87
+        define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates/');
88 88
     }
89 89
 
90 90
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     {
226 226
         global $post;
227 227
         return ((function_exists('wp_is_block_theme') && wp_is_block_theme()) || in_the_loop()) && $post->ID === (int) $id
228
-            ? espresso_event_status_banner($post->ID) . $title
228
+            ? espresso_event_status_banner($post->ID).$title
229 229
             : $title;
230 230
     }
231 231
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
      */
383 383
     public static function event_datetimes($content)
384 384
     {
385
-        return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content;
385
+        return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content;
386 386
     }
387 387
 
388 388
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
      */
395 395
     public static function event_tickets($content)
396 396
     {
397
-        return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content;
397
+        return EEH_Template::locate_template('content-espresso_events-tickets.php').$content;
398 398
     }
399 399
 
400 400
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
      */
419 419
     public static function event_venues($content)
420 420
     {
421
-        return $content . EEH_Template::locate_template('content-espresso_events-venues.php');
421
+        return $content.EEH_Template::locate_template('content-espresso_events-venues.php');
422 422
     }
423 423
 
424 424
 
@@ -448,16 +448,16 @@  discard block
 block discarded – undo
448 448
             && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', true)
449 449
         ) {
450 450
             // first check uploads folder
451
-            if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) {
451
+            if (is_readable(get_stylesheet_directory().$this->theme.'/style.css')) {
452 452
                 wp_register_style(
453 453
                     $this->theme,
454
-                    get_stylesheet_directory_uri() . $this->theme . '/style.css',
454
+                    get_stylesheet_directory_uri().$this->theme.'/style.css',
455 455
                     array('dashicons', 'espresso_default')
456 456
                 );
457 457
             } else {
458 458
                 wp_register_style(
459 459
                     $this->theme,
460
-                    EE_TEMPLATES_URL . $this->theme . '/style.css',
460
+                    EE_TEMPLATES_URL.$this->theme.'/style.css',
461 461
                     array('dashicons', 'espresso_default')
462 462
                 );
463 463
             }
Please login to merge, or discard this patch.
modules/events_archive/EED_Events_Archive.module.php 2 patches
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
-                    '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
-                '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
-            '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
-            '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
-            '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
-            '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
-            'the_excerpt',
610
-            array('EED_Events_Archive', 'event_datetimes'),
611
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
612
-        );
613
-        add_filter(
614
-            'the_excerpt',
615
-            array('EED_Events_Archive', 'event_tickets'),
616
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
617
-        );
618
-        add_filter(
619
-            '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
-            'the_excerpt',
662
-            array('EED_Events_Archive', 'event_datetimes'),
663
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
664
-        );
665
-        remove_filter(
666
-            'the_excerpt',
667
-            array('EED_Events_Archive', 'event_tickets'),
668
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
669
-        );
670
-        remove_filter(
671
-            '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
-            'the_excerpt',
705
-            array('EED_Events_Archive', 'event_details'),
706
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
707
-        );
708
-        remove_filter(
709
-            'the_excerpt',
710
-            array('EED_Events_Archive', 'event_datetimes'),
711
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
712
-        );
713
-        remove_filter(
714
-            'the_excerpt',
715
-            array('EED_Events_Archive', 'event_tickets'),
716
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
717
-        );
718
-        remove_filter(
719
-            '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
+					'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
+				'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
+			'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
+			'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
+			'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
+			'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
+			'the_excerpt',
610
+			array('EED_Events_Archive', 'event_datetimes'),
611
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
612
+		);
613
+		add_filter(
614
+			'the_excerpt',
615
+			array('EED_Events_Archive', 'event_tickets'),
616
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
617
+		);
618
+		add_filter(
619
+			'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
+			'the_excerpt',
662
+			array('EED_Events_Archive', 'event_datetimes'),
663
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
664
+		);
665
+		remove_filter(
666
+			'the_excerpt',
667
+			array('EED_Events_Archive', 'event_tickets'),
668
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
669
+		);
670
+		remove_filter(
671
+			'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
+			'the_excerpt',
705
+			array('EED_Events_Archive', 'event_details'),
706
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
707
+		);
708
+		remove_filter(
709
+			'the_excerpt',
710
+			array('EED_Events_Archive', 'event_datetimes'),
711
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
712
+		);
713
+		remove_filter(
714
+			'the_excerpt',
715
+			array('EED_Events_Archive', 'event_tickets'),
716
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
717
+		);
718
+		remove_filter(
719
+			'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.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public static function set_definitions()
125 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/');
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 128
     }
129 129
 
130 130
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 ?
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
         global $post;
397 397
         if ($post instanceof WP_Post) {
398 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
399
+                ? espresso_event_status_banner($post->ID).$title
400 400
                 : $title;
401 401
         }
402 402
         return $title;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         if (post_password_required()) {
549 549
             return $content;
550 550
         }
551
-        return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content;
551
+        return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content;
552 552
     }
553 553
 
554 554
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
         if (post_password_required()) {
565 565
             return $content;
566 566
         }
567
-        return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content;
567
+        return EEH_Template::locate_template('content-espresso_events-tickets.php').$content;
568 568
     }
569 569
 
570 570
 
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         if (post_password_required()) {
594 594
             return $content;
595 595
         }
596
-        return $content . EEH_Template::locate_template('content-espresso_events-venues.php');
596
+        return $content.EEH_Template::locate_template('content-espresso_events-venues.php');
597 597
     }
598 598
 
599 599
 
@@ -777,10 +777,10 @@  discard block
 block discarded – undo
777 777
         // get some style
778 778
         if (apply_filters('FHEE_enable_default_espresso_css', false)) {
779 779
             // first check uploads folder
780
-            if (EEH_File::is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) {
780
+            if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.'/style.css')) {
781 781
                 wp_register_style(
782 782
                     $this->theme,
783
-                    get_stylesheet_directory_uri() . $this->theme . '/style.css',
783
+                    get_stylesheet_directory_uri().$this->theme.'/style.css',
784 784
                     array('dashicons', 'espresso_default')
785 785
                 );
786 786
             } else {
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
             (array) $template_settings->EED_Events_Archive
820 820
         );
821 821
         EEH_Template::display_template(
822
-            EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php',
822
+            EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php',
823 823
             $events_archive_settings
824 824
         );
825 825
     }
Please login to merge, or discard this patch.