@@ -37,8 +37,8 @@ |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - $post_type = get_post_type_object('espresso_venues'); |
|
41 | - EE_Config::register_route(strtolower($post_type->labels->name), 'Venues_Archive', 'run' ); |
|
40 | + $post_type = get_post_type_object('espresso_venues'); |
|
41 | + EE_Config::register_route(strtolower($post_type->labels->name), 'Venues_Archive', 'run' ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venues_Archive |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | 40 | $post_type = get_post_type_object('espresso_venues'); |
41 | - EE_Config::register_route(strtolower($post_type->labels->name), 'Venues_Archive', 'run' ); |
|
41 | + EE_Config::register_route(strtolower($post_type->labels->name), 'Venues_Archive', 'run'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | 82 | // don't know if theme uses the_excerpt |
83 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
83 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
84 | 84 | // or the_content |
85 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
85 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
86 | 86 | // don't display entry meta because the existing theme will take care of that |
87 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
87 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
88 | 88 | } |
89 | 89 | return $template; |
90 | 90 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $title |
99 | 99 | * @return string |
100 | 100 | */ |
101 | - public function the_title( $title = '' ) { |
|
101 | + public function the_title($title = '') { |
|
102 | 102 | return $title; |
103 | 103 | } |
104 | 104 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param string $content |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - public function venue_details( $content ) { |
|
113 | + public function venue_details($content) { |
|
114 | 114 | global $post; |
115 | 115 | if ( |
116 | 116 | $post->post_type == 'espresso_venues' |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | // it uses the_content() for displaying the $post->post_content |
121 | 121 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
122 | 122 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
123 | - remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
124 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
123 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
124 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
125 | 125 | // add filters we want |
126 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
127 | - add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
126 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
128 | 128 | // now load our template |
129 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
129 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
130 | 130 | //now add our filter back in, plus some others |
131 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
132 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
131 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
132 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
133 | 133 | // remove other filters we added so they won't get applied to the next post |
134 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
135 | - remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
134 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
135 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
136 | 136 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
137 | 137 | } |
138 | - return ! empty( $template ) ? $template : $content; |
|
138 | + return ! empty($template) ? $template : $content; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $content |
148 | 148 | * @return string |
149 | 149 | */ |
150 | - public function venue_location( $content ) { |
|
151 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
150 | + public function venue_location($content) { |
|
151 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function wp_enqueue_scripts() { |
164 | 164 | // get some style |
165 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
|
165 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) { |
|
166 | 166 | // first check theme folder |
167 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
168 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
169 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
170 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
167 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
168 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
169 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
170 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
171 | 171 | } |
172 | - wp_enqueue_style( $this->theme ); |
|
172 | + wp_enqueue_style($this->theme); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 |
@@ -13,463 +13,463 @@ discard block |
||
13 | 13 | class EED_Event_Single extends EED_Module |
14 | 14 | { |
15 | 15 | |
16 | - const EVENT_DETAILS_PRIORITY = 100; |
|
17 | - const EVENT_DATETIMES_PRIORITY = 110; |
|
18 | - const EVENT_TICKETS_PRIORITY = 120; |
|
19 | - const EVENT_VENUES_PRIORITY = 130; |
|
20 | - |
|
21 | - /** |
|
22 | - * @type bool $using_get_the_excerpt |
|
23 | - */ |
|
24 | - protected static $using_get_the_excerpt = false; |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * @type EE_Template_Part_Manager $template_parts |
|
29 | - */ |
|
30 | - protected $template_parts; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @return EED_Module|EED_Event_Single |
|
35 | - */ |
|
36 | - public static function instance() |
|
37 | - { |
|
38 | - return parent::get_instance(__CLASS__); |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
44 | - * |
|
45 | - * @return void |
|
46 | - */ |
|
47 | - public static function set_hooks() |
|
48 | - { |
|
49 | - add_filter('FHEE_run_EE_wp', '__return_true'); |
|
50 | - add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
51 | - $post_type = get_post_type_object('espresso_events'); |
|
52 | - EE_Config::register_route(strtolower($post_type->labels->singular_name), 'Event_Single', 'run'); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
57 | - * |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - public static function set_hooks_admin() |
|
61 | - { |
|
62 | - add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * set_definitions |
|
68 | - * |
|
69 | - * @static |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - public static function set_definitions() |
|
73 | - { |
|
74 | - define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
75 | - define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * set_config |
|
81 | - * |
|
82 | - * @void |
|
83 | - */ |
|
84 | - protected function set_config() |
|
85 | - { |
|
86 | - $this->set_config_section('template_settings'); |
|
87 | - $this->set_config_class('EE_Event_Single_Config'); |
|
88 | - $this->set_config_name('EED_Event_Single'); |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * initialize_template_parts |
|
94 | - * |
|
95 | - * @param EE_Config_Base|EE_Event_Single_Config $config |
|
96 | - * @return EE_Template_Part_Manager |
|
97 | - */ |
|
98 | - public function initialize_template_parts(EE_Event_Single_Config $config = null) |
|
99 | - { |
|
100 | - /** @type EE_Event_Single_Config $config */ |
|
101 | - $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
|
102 | - EEH_Autoloader::instance()->register_template_part_autoloaders(); |
|
103 | - $template_parts = new EE_Template_Part_Manager(); |
|
104 | - $template_parts->add_template_part( |
|
105 | - 'tickets', |
|
106 | - __('Ticket Selector', 'event_espresso'), |
|
107 | - 'content-espresso_events-tickets.php', |
|
108 | - $config->display_order_tickets |
|
109 | - ); |
|
110 | - $template_parts->add_template_part( |
|
111 | - 'datetimes', |
|
112 | - __('Dates and Times', 'event_espresso'), |
|
113 | - 'content-espresso_events-datetimes.php', |
|
114 | - $config->display_order_datetimes |
|
115 | - ); |
|
116 | - $template_parts->add_template_part( |
|
117 | - 'event', |
|
118 | - __('Event Description', 'event_espresso'), |
|
119 | - 'content-espresso_events-details.php', |
|
120 | - $config->display_order_event |
|
121 | - ); |
|
122 | - $template_parts->add_template_part( |
|
123 | - 'venue', |
|
124 | - __('Venue Information', 'event_espresso'), |
|
125 | - 'content-espresso_events-venues.php', |
|
126 | - $config->display_order_venue |
|
127 | - ); |
|
128 | - do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
129 | - return $template_parts; |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * run - initial module setup |
|
135 | - * |
|
136 | - * @param WP $WP |
|
137 | - * @return void |
|
138 | - */ |
|
139 | - public function run($WP) |
|
140 | - { |
|
141 | - // ensure valid EE_Events_Single_Config() object exists |
|
142 | - $this->set_config(); |
|
143 | - // check what template is loaded |
|
144 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
145 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
146 | - // load css |
|
147 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * template_include |
|
153 | - * |
|
154 | - * @param string $template |
|
155 | - * @return string |
|
156 | - */ |
|
157 | - public function template_include($template) |
|
158 | - { |
|
159 | - global $post; |
|
160 | - /** @type EE_Event_Single_Config $config */ |
|
161 | - $config = $this->config(); |
|
162 | - if ($config->display_status_banner_single) { |
|
163 | - add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
164 | - } |
|
165 | - // not a custom template? |
|
166 | - if ( |
|
167 | - !post_password_required($post) |
|
168 | - && ( |
|
169 | - apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false) |
|
170 | - || EE_Registry::instance() |
|
171 | - ->load_core('Front_Controller') |
|
172 | - ->get_selected_template() !== 'single-espresso_events.php' |
|
173 | - ) |
|
174 | - |
|
175 | - ) { |
|
176 | - EEH_Template::load_espresso_theme_functions(); |
|
177 | - // then add extra event data via hooks |
|
178 | - add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
179 | - add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
180 | - add_filter( |
|
181 | - 'the_content', |
|
182 | - array('EED_Event_Single', 'event_details'), |
|
183 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
184 | - ); |
|
185 | - add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
186 | - // don't display entry meta because the existing theme will take car of that |
|
187 | - add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
188 | - } |
|
189 | - return $template; |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * loop_start |
|
195 | - * |
|
196 | - * @param array $wp_query_array an array containing the WP_Query object |
|
197 | - * @return void |
|
198 | - */ |
|
199 | - public static function loop_start($wp_query_array) |
|
200 | - { |
|
201 | - global $post; |
|
202 | - do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
203 | - } |
|
204 | - |
|
205 | - |
|
206 | - /** |
|
207 | - * the_title |
|
208 | - * |
|
209 | - * @param string $title |
|
210 | - * @param int $id |
|
211 | - * @return string |
|
212 | - */ |
|
213 | - public static function the_title($title = '', $id = 0) |
|
214 | - { |
|
215 | - global $post; |
|
216 | - return in_the_loop() && $post->ID === (int)$id |
|
217 | - ? espresso_event_status_banner($post->ID) . $title |
|
218 | - : $title; |
|
219 | - } |
|
220 | - |
|
221 | - |
|
222 | - /** |
|
223 | - * get_the_excerpt |
|
224 | - * kinda hacky, but if a theme is using get_the_excerpt(), |
|
225 | - * then we need to remove our filters on the_content() |
|
226 | - * |
|
227 | - * @param string $excerpt |
|
228 | - * @return string |
|
229 | - */ |
|
230 | - public static function get_the_excerpt($excerpt = '') |
|
231 | - { |
|
232 | - EED_Event_Single::$using_get_the_excerpt = true; |
|
233 | - add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
234 | - return $excerpt; |
|
235 | - } |
|
236 | - |
|
237 | - |
|
238 | - /** |
|
239 | - * end_get_the_excerpt |
|
240 | - * |
|
241 | - * @param string $text |
|
242 | - * @return string |
|
243 | - */ |
|
244 | - public static function end_get_the_excerpt($text = '') |
|
245 | - { |
|
246 | - EED_Event_Single::$using_get_the_excerpt = false; |
|
247 | - return $text; |
|
248 | - } |
|
249 | - |
|
250 | - |
|
251 | - /** |
|
252 | - * event_details |
|
253 | - * |
|
254 | - * @param string $content |
|
255 | - * @return string |
|
256 | - */ |
|
257 | - public static function event_details($content) |
|
258 | - { |
|
259 | - global $post; |
|
260 | - static $current_post_ID = 0; |
|
261 | - if ( |
|
262 | - $current_post_ID !== $post->ID |
|
263 | - && $post->post_type === 'espresso_events' |
|
264 | - && !EED_Event_Single::$using_get_the_excerpt |
|
265 | - && !post_password_required() |
|
266 | - ) { |
|
267 | - // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
|
268 | - // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early |
|
269 | - // BEFORE headers are sent in order to examine the post content and generate content for the HTML header. |
|
270 | - // We want to allow those plugins to still do their thing and have access to our content, but depending on |
|
271 | - // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
|
272 | - // so the following allows this filter to be applied multiple times, but only once for real |
|
273 | - $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
274 | - if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
275 | - // we need to first remove this callback from being applied to the_content() |
|
276 | - // (otherwise it will recurse and blow up the interweb) |
|
277 | - remove_filter( |
|
278 | - 'the_content', |
|
279 | - array('EED_Event_Single', 'event_details'), |
|
280 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
281 | - ); |
|
282 | - EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
|
283 | - $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
284 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
285 | - add_filter( |
|
286 | - 'the_content', |
|
287 | - array('EED_Event_Single', 'event_details'), |
|
288 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
289 | - ); |
|
290 | - } else { |
|
291 | - $content = EED_Event_Single::use_filterable_display_order(); |
|
292 | - } |
|
293 | - } |
|
294 | - return $content; |
|
295 | - } |
|
296 | - |
|
297 | - |
|
298 | - /** |
|
299 | - * use_filterable_display_order |
|
300 | - * |
|
301 | - * @return string |
|
302 | - */ |
|
303 | - protected static function use_filterable_display_order() |
|
304 | - { |
|
305 | - // since the 'content-espresso_events-details.php' template might be used directly from within a theme, |
|
306 | - // it uses the_content() for displaying the $post->post_content |
|
307 | - // so in order to load a template that uses the_content() |
|
308 | - // from within a callback being used to filter the_content(), |
|
309 | - // we need to first remove this callback from being applied to the_content() |
|
310 | - // (otherwise it will recurse and blow up the interweb) |
|
311 | - remove_filter( |
|
312 | - 'the_content', |
|
313 | - array('EED_Event_Single', 'event_details'), |
|
314 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
315 | - ); |
|
316 | - //now add additional content |
|
317 | - add_filter( |
|
318 | - 'the_content', |
|
319 | - array('EED_Event_Single', 'event_datetimes'), |
|
320 | - EED_Event_Single::EVENT_DATETIMES_PRIORITY, |
|
321 | - 1 |
|
322 | - ); |
|
323 | - add_filter( |
|
324 | - 'the_content', |
|
325 | - array('EED_Event_Single', 'event_tickets'), |
|
326 | - EED_Event_Single::EVENT_TICKETS_PRIORITY, |
|
327 | - 1 |
|
328 | - ); |
|
329 | - add_filter( |
|
330 | - 'the_content', |
|
331 | - array('EED_Event_Single', 'event_venues'), |
|
332 | - EED_Event_Single::EVENT_VENUES_PRIORITY, |
|
333 | - 1 |
|
334 | - ); |
|
335 | - do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
336 | - // now load our template |
|
337 | - $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
338 | - //now add our filter back in, plus some others |
|
339 | - add_filter( |
|
340 | - 'the_content', |
|
341 | - array('EED_Event_Single', 'event_details'), |
|
342 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
343 | - ); |
|
344 | - remove_filter( |
|
345 | - 'the_content', |
|
346 | - array('EED_Event_Single', 'event_datetimes'), |
|
347 | - EED_Event_Single::EVENT_DATETIMES_PRIORITY |
|
348 | - ); |
|
349 | - remove_filter( |
|
350 | - 'the_content', |
|
351 | - array('EED_Event_Single', 'event_tickets'), |
|
352 | - EED_Event_Single::EVENT_TICKETS_PRIORITY |
|
353 | - ); |
|
354 | - remove_filter( |
|
355 | - 'the_content', |
|
356 | - array('EED_Event_Single', 'event_venues'), |
|
357 | - EED_Event_Single::EVENT_VENUES_PRIORITY |
|
358 | - ); |
|
359 | - do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters'); |
|
360 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
361 | - return $content; |
|
362 | - } |
|
363 | - |
|
364 | - |
|
365 | - /** |
|
366 | - * event_datetimes - adds datetimes ABOVE content |
|
367 | - * |
|
368 | - * @param string $content |
|
369 | - * @return string |
|
370 | - */ |
|
371 | - public static function event_datetimes($content) |
|
372 | - { |
|
373 | - return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
374 | - } |
|
375 | - |
|
376 | - |
|
377 | - /** |
|
378 | - * event_tickets - adds tickets ABOVE content (which includes datetimes) |
|
379 | - * |
|
380 | - * @param string $content |
|
381 | - * @return string |
|
382 | - */ |
|
383 | - public static function event_tickets($content) |
|
384 | - { |
|
385 | - return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
386 | - } |
|
387 | - |
|
388 | - |
|
389 | - /** |
|
390 | - * event_venues |
|
391 | - * |
|
392 | - * @param string $content |
|
393 | - * @return string |
|
394 | - */ |
|
395 | - public static function event_venue($content) |
|
396 | - { |
|
397 | - return EED_Event_Single::event_venues($content); |
|
398 | - } |
|
399 | - |
|
400 | - |
|
401 | - /** |
|
402 | - * event_venues - adds venues BELOW content |
|
403 | - * |
|
404 | - * @param string $content |
|
405 | - * @return string |
|
406 | - */ |
|
407 | - public static function event_venues($content) |
|
408 | - { |
|
409 | - return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
410 | - } |
|
411 | - |
|
412 | - |
|
413 | - /** |
|
414 | - * loop_end |
|
415 | - * |
|
416 | - * @param array $wp_query_array an array containing the WP_Query object |
|
417 | - * @return void |
|
418 | - */ |
|
419 | - public static function loop_end($wp_query_array) |
|
420 | - { |
|
421 | - global $post; |
|
422 | - do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
423 | - } |
|
424 | - |
|
425 | - |
|
426 | - /** |
|
427 | - * wp_enqueue_scripts |
|
428 | - * |
|
429 | - * @return void |
|
430 | - */ |
|
431 | - public function wp_enqueue_scripts() |
|
432 | - { |
|
433 | - // get some style |
|
434 | - if ( |
|
435 | - apply_filters('FHEE_enable_default_espresso_css', TRUE) |
|
436 | - && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE) |
|
437 | - ) { |
|
438 | - // first check uploads folder |
|
439 | - if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
440 | - wp_register_style( |
|
441 | - $this->theme, |
|
442 | - get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
443 | - array('dashicons', 'espresso_default') |
|
444 | - ); |
|
445 | - } else { |
|
446 | - wp_register_style( |
|
447 | - $this->theme, |
|
448 | - EE_TEMPLATES_URL . $this->theme . DS . 'style.css', |
|
449 | - array('dashicons', 'espresso_default') |
|
450 | - ); |
|
451 | - } |
|
452 | - wp_enqueue_script($this->theme); |
|
453 | - if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
454 | - add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
455 | - } |
|
456 | - } |
|
457 | - } |
|
458 | - |
|
459 | - |
|
460 | - /** |
|
461 | - * display_venue |
|
462 | - * |
|
463 | - * @return bool |
|
464 | - */ |
|
465 | - public static function display_venue() |
|
466 | - { |
|
467 | - /** @type EE_Event_Single_Config $config */ |
|
468 | - $config = EED_Event_Single::instance()->config(); |
|
469 | - $display_venue = $config->display_venue === null ? true : $config->display_venue; |
|
470 | - $venue_name = EEH_Venue_View::venue_name(); |
|
471 | - return $display_venue && !empty($venue_name); |
|
472 | - } |
|
16 | + const EVENT_DETAILS_PRIORITY = 100; |
|
17 | + const EVENT_DATETIMES_PRIORITY = 110; |
|
18 | + const EVENT_TICKETS_PRIORITY = 120; |
|
19 | + const EVENT_VENUES_PRIORITY = 130; |
|
20 | + |
|
21 | + /** |
|
22 | + * @type bool $using_get_the_excerpt |
|
23 | + */ |
|
24 | + protected static $using_get_the_excerpt = false; |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * @type EE_Template_Part_Manager $template_parts |
|
29 | + */ |
|
30 | + protected $template_parts; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @return EED_Module|EED_Event_Single |
|
35 | + */ |
|
36 | + public static function instance() |
|
37 | + { |
|
38 | + return parent::get_instance(__CLASS__); |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
44 | + * |
|
45 | + * @return void |
|
46 | + */ |
|
47 | + public static function set_hooks() |
|
48 | + { |
|
49 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
50 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
51 | + $post_type = get_post_type_object('espresso_events'); |
|
52 | + EE_Config::register_route(strtolower($post_type->labels->singular_name), 'Event_Single', 'run'); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
57 | + * |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + public static function set_hooks_admin() |
|
61 | + { |
|
62 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * set_definitions |
|
68 | + * |
|
69 | + * @static |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + public static function set_definitions() |
|
73 | + { |
|
74 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
75 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * set_config |
|
81 | + * |
|
82 | + * @void |
|
83 | + */ |
|
84 | + protected function set_config() |
|
85 | + { |
|
86 | + $this->set_config_section('template_settings'); |
|
87 | + $this->set_config_class('EE_Event_Single_Config'); |
|
88 | + $this->set_config_name('EED_Event_Single'); |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * initialize_template_parts |
|
94 | + * |
|
95 | + * @param EE_Config_Base|EE_Event_Single_Config $config |
|
96 | + * @return EE_Template_Part_Manager |
|
97 | + */ |
|
98 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) |
|
99 | + { |
|
100 | + /** @type EE_Event_Single_Config $config */ |
|
101 | + $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
|
102 | + EEH_Autoloader::instance()->register_template_part_autoloaders(); |
|
103 | + $template_parts = new EE_Template_Part_Manager(); |
|
104 | + $template_parts->add_template_part( |
|
105 | + 'tickets', |
|
106 | + __('Ticket Selector', 'event_espresso'), |
|
107 | + 'content-espresso_events-tickets.php', |
|
108 | + $config->display_order_tickets |
|
109 | + ); |
|
110 | + $template_parts->add_template_part( |
|
111 | + 'datetimes', |
|
112 | + __('Dates and Times', 'event_espresso'), |
|
113 | + 'content-espresso_events-datetimes.php', |
|
114 | + $config->display_order_datetimes |
|
115 | + ); |
|
116 | + $template_parts->add_template_part( |
|
117 | + 'event', |
|
118 | + __('Event Description', 'event_espresso'), |
|
119 | + 'content-espresso_events-details.php', |
|
120 | + $config->display_order_event |
|
121 | + ); |
|
122 | + $template_parts->add_template_part( |
|
123 | + 'venue', |
|
124 | + __('Venue Information', 'event_espresso'), |
|
125 | + 'content-espresso_events-venues.php', |
|
126 | + $config->display_order_venue |
|
127 | + ); |
|
128 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
129 | + return $template_parts; |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * run - initial module setup |
|
135 | + * |
|
136 | + * @param WP $WP |
|
137 | + * @return void |
|
138 | + */ |
|
139 | + public function run($WP) |
|
140 | + { |
|
141 | + // ensure valid EE_Events_Single_Config() object exists |
|
142 | + $this->set_config(); |
|
143 | + // check what template is loaded |
|
144 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
145 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
146 | + // load css |
|
147 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * template_include |
|
153 | + * |
|
154 | + * @param string $template |
|
155 | + * @return string |
|
156 | + */ |
|
157 | + public function template_include($template) |
|
158 | + { |
|
159 | + global $post; |
|
160 | + /** @type EE_Event_Single_Config $config */ |
|
161 | + $config = $this->config(); |
|
162 | + if ($config->display_status_banner_single) { |
|
163 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
164 | + } |
|
165 | + // not a custom template? |
|
166 | + if ( |
|
167 | + !post_password_required($post) |
|
168 | + && ( |
|
169 | + apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false) |
|
170 | + || EE_Registry::instance() |
|
171 | + ->load_core('Front_Controller') |
|
172 | + ->get_selected_template() !== 'single-espresso_events.php' |
|
173 | + ) |
|
174 | + |
|
175 | + ) { |
|
176 | + EEH_Template::load_espresso_theme_functions(); |
|
177 | + // then add extra event data via hooks |
|
178 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
179 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
180 | + add_filter( |
|
181 | + 'the_content', |
|
182 | + array('EED_Event_Single', 'event_details'), |
|
183 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
184 | + ); |
|
185 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
186 | + // don't display entry meta because the existing theme will take car of that |
|
187 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
188 | + } |
|
189 | + return $template; |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * loop_start |
|
195 | + * |
|
196 | + * @param array $wp_query_array an array containing the WP_Query object |
|
197 | + * @return void |
|
198 | + */ |
|
199 | + public static function loop_start($wp_query_array) |
|
200 | + { |
|
201 | + global $post; |
|
202 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
203 | + } |
|
204 | + |
|
205 | + |
|
206 | + /** |
|
207 | + * the_title |
|
208 | + * |
|
209 | + * @param string $title |
|
210 | + * @param int $id |
|
211 | + * @return string |
|
212 | + */ |
|
213 | + public static function the_title($title = '', $id = 0) |
|
214 | + { |
|
215 | + global $post; |
|
216 | + return in_the_loop() && $post->ID === (int)$id |
|
217 | + ? espresso_event_status_banner($post->ID) . $title |
|
218 | + : $title; |
|
219 | + } |
|
220 | + |
|
221 | + |
|
222 | + /** |
|
223 | + * get_the_excerpt |
|
224 | + * kinda hacky, but if a theme is using get_the_excerpt(), |
|
225 | + * then we need to remove our filters on the_content() |
|
226 | + * |
|
227 | + * @param string $excerpt |
|
228 | + * @return string |
|
229 | + */ |
|
230 | + public static function get_the_excerpt($excerpt = '') |
|
231 | + { |
|
232 | + EED_Event_Single::$using_get_the_excerpt = true; |
|
233 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
234 | + return $excerpt; |
|
235 | + } |
|
236 | + |
|
237 | + |
|
238 | + /** |
|
239 | + * end_get_the_excerpt |
|
240 | + * |
|
241 | + * @param string $text |
|
242 | + * @return string |
|
243 | + */ |
|
244 | + public static function end_get_the_excerpt($text = '') |
|
245 | + { |
|
246 | + EED_Event_Single::$using_get_the_excerpt = false; |
|
247 | + return $text; |
|
248 | + } |
|
249 | + |
|
250 | + |
|
251 | + /** |
|
252 | + * event_details |
|
253 | + * |
|
254 | + * @param string $content |
|
255 | + * @return string |
|
256 | + */ |
|
257 | + public static function event_details($content) |
|
258 | + { |
|
259 | + global $post; |
|
260 | + static $current_post_ID = 0; |
|
261 | + if ( |
|
262 | + $current_post_ID !== $post->ID |
|
263 | + && $post->post_type === 'espresso_events' |
|
264 | + && !EED_Event_Single::$using_get_the_excerpt |
|
265 | + && !post_password_required() |
|
266 | + ) { |
|
267 | + // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
|
268 | + // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early |
|
269 | + // BEFORE headers are sent in order to examine the post content and generate content for the HTML header. |
|
270 | + // We want to allow those plugins to still do their thing and have access to our content, but depending on |
|
271 | + // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
|
272 | + // so the following allows this filter to be applied multiple times, but only once for real |
|
273 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
274 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
275 | + // we need to first remove this callback from being applied to the_content() |
|
276 | + // (otherwise it will recurse and blow up the interweb) |
|
277 | + remove_filter( |
|
278 | + 'the_content', |
|
279 | + array('EED_Event_Single', 'event_details'), |
|
280 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
281 | + ); |
|
282 | + EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
|
283 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
284 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
285 | + add_filter( |
|
286 | + 'the_content', |
|
287 | + array('EED_Event_Single', 'event_details'), |
|
288 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
289 | + ); |
|
290 | + } else { |
|
291 | + $content = EED_Event_Single::use_filterable_display_order(); |
|
292 | + } |
|
293 | + } |
|
294 | + return $content; |
|
295 | + } |
|
296 | + |
|
297 | + |
|
298 | + /** |
|
299 | + * use_filterable_display_order |
|
300 | + * |
|
301 | + * @return string |
|
302 | + */ |
|
303 | + protected static function use_filterable_display_order() |
|
304 | + { |
|
305 | + // since the 'content-espresso_events-details.php' template might be used directly from within a theme, |
|
306 | + // it uses the_content() for displaying the $post->post_content |
|
307 | + // so in order to load a template that uses the_content() |
|
308 | + // from within a callback being used to filter the_content(), |
|
309 | + // we need to first remove this callback from being applied to the_content() |
|
310 | + // (otherwise it will recurse and blow up the interweb) |
|
311 | + remove_filter( |
|
312 | + 'the_content', |
|
313 | + array('EED_Event_Single', 'event_details'), |
|
314 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
315 | + ); |
|
316 | + //now add additional content |
|
317 | + add_filter( |
|
318 | + 'the_content', |
|
319 | + array('EED_Event_Single', 'event_datetimes'), |
|
320 | + EED_Event_Single::EVENT_DATETIMES_PRIORITY, |
|
321 | + 1 |
|
322 | + ); |
|
323 | + add_filter( |
|
324 | + 'the_content', |
|
325 | + array('EED_Event_Single', 'event_tickets'), |
|
326 | + EED_Event_Single::EVENT_TICKETS_PRIORITY, |
|
327 | + 1 |
|
328 | + ); |
|
329 | + add_filter( |
|
330 | + 'the_content', |
|
331 | + array('EED_Event_Single', 'event_venues'), |
|
332 | + EED_Event_Single::EVENT_VENUES_PRIORITY, |
|
333 | + 1 |
|
334 | + ); |
|
335 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
336 | + // now load our template |
|
337 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
338 | + //now add our filter back in, plus some others |
|
339 | + add_filter( |
|
340 | + 'the_content', |
|
341 | + array('EED_Event_Single', 'event_details'), |
|
342 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
343 | + ); |
|
344 | + remove_filter( |
|
345 | + 'the_content', |
|
346 | + array('EED_Event_Single', 'event_datetimes'), |
|
347 | + EED_Event_Single::EVENT_DATETIMES_PRIORITY |
|
348 | + ); |
|
349 | + remove_filter( |
|
350 | + 'the_content', |
|
351 | + array('EED_Event_Single', 'event_tickets'), |
|
352 | + EED_Event_Single::EVENT_TICKETS_PRIORITY |
|
353 | + ); |
|
354 | + remove_filter( |
|
355 | + 'the_content', |
|
356 | + array('EED_Event_Single', 'event_venues'), |
|
357 | + EED_Event_Single::EVENT_VENUES_PRIORITY |
|
358 | + ); |
|
359 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters'); |
|
360 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
361 | + return $content; |
|
362 | + } |
|
363 | + |
|
364 | + |
|
365 | + /** |
|
366 | + * event_datetimes - adds datetimes ABOVE content |
|
367 | + * |
|
368 | + * @param string $content |
|
369 | + * @return string |
|
370 | + */ |
|
371 | + public static function event_datetimes($content) |
|
372 | + { |
|
373 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
374 | + } |
|
375 | + |
|
376 | + |
|
377 | + /** |
|
378 | + * event_tickets - adds tickets ABOVE content (which includes datetimes) |
|
379 | + * |
|
380 | + * @param string $content |
|
381 | + * @return string |
|
382 | + */ |
|
383 | + public static function event_tickets($content) |
|
384 | + { |
|
385 | + return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
386 | + } |
|
387 | + |
|
388 | + |
|
389 | + /** |
|
390 | + * event_venues |
|
391 | + * |
|
392 | + * @param string $content |
|
393 | + * @return string |
|
394 | + */ |
|
395 | + public static function event_venue($content) |
|
396 | + { |
|
397 | + return EED_Event_Single::event_venues($content); |
|
398 | + } |
|
399 | + |
|
400 | + |
|
401 | + /** |
|
402 | + * event_venues - adds venues BELOW content |
|
403 | + * |
|
404 | + * @param string $content |
|
405 | + * @return string |
|
406 | + */ |
|
407 | + public static function event_venues($content) |
|
408 | + { |
|
409 | + return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
410 | + } |
|
411 | + |
|
412 | + |
|
413 | + /** |
|
414 | + * loop_end |
|
415 | + * |
|
416 | + * @param array $wp_query_array an array containing the WP_Query object |
|
417 | + * @return void |
|
418 | + */ |
|
419 | + public static function loop_end($wp_query_array) |
|
420 | + { |
|
421 | + global $post; |
|
422 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
423 | + } |
|
424 | + |
|
425 | + |
|
426 | + /** |
|
427 | + * wp_enqueue_scripts |
|
428 | + * |
|
429 | + * @return void |
|
430 | + */ |
|
431 | + public function wp_enqueue_scripts() |
|
432 | + { |
|
433 | + // get some style |
|
434 | + if ( |
|
435 | + apply_filters('FHEE_enable_default_espresso_css', TRUE) |
|
436 | + && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE) |
|
437 | + ) { |
|
438 | + // first check uploads folder |
|
439 | + if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
440 | + wp_register_style( |
|
441 | + $this->theme, |
|
442 | + get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
443 | + array('dashicons', 'espresso_default') |
|
444 | + ); |
|
445 | + } else { |
|
446 | + wp_register_style( |
|
447 | + $this->theme, |
|
448 | + EE_TEMPLATES_URL . $this->theme . DS . 'style.css', |
|
449 | + array('dashicons', 'espresso_default') |
|
450 | + ); |
|
451 | + } |
|
452 | + wp_enqueue_script($this->theme); |
|
453 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
454 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
455 | + } |
|
456 | + } |
|
457 | + } |
|
458 | + |
|
459 | + |
|
460 | + /** |
|
461 | + * display_venue |
|
462 | + * |
|
463 | + * @return bool |
|
464 | + */ |
|
465 | + public static function display_venue() |
|
466 | + { |
|
467 | + /** @type EE_Event_Single_Config $config */ |
|
468 | + $config = EED_Event_Single::instance()->config(); |
|
469 | + $display_venue = $config->display_venue === null ? true : $config->display_venue; |
|
470 | + $venue_name = EEH_Venue_View::venue_name(); |
|
471 | + return $display_venue && !empty($venue_name); |
|
472 | + } |
|
473 | 473 | |
474 | 474 | |
475 | 475 | } |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | */ |
484 | 484 | function espresso_display_venue_in_event_details() |
485 | 485 | { |
486 | - return EED_Event_Single::display_venue(); |
|
486 | + return EED_Event_Single::display_venue(); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 |
@@ -37,8 +37,8 @@ |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - $post_type = get_post_type_object('espresso_venues'); |
|
41 | - EE_Config::register_route(strtolower($post_type->labels->singular_name), 'Venue_Single', 'run' ); |
|
40 | + $post_type = get_post_type_object('espresso_venues'); |
|
41 | + EE_Config::register_route(strtolower($post_type->labels->singular_name), 'Venue_Single', 'run' ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venue_Single |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | 40 | $post_type = get_post_type_object('espresso_venues'); |
41 | - EE_Config::register_route(strtolower($post_type->labels->singular_name), 'Venue_Single', 'run' ); |
|
41 | + EE_Config::register_route(strtolower($post_type->labels->singular_name), 'Venue_Single', 'run'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
82 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
83 | 83 | // don't display entry meta because the existing theme will take car of that |
84 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
84 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
85 | 85 | } |
86 | 86 | return $template; |
87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $title |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function the_title( $title = '' ) { |
|
98 | + public function the_title($title = '') { |
|
99 | 99 | return $title; |
100 | 100 | } |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $content |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function venue_details( $content ) { |
|
110 | + public function venue_details($content) { |
|
111 | 111 | global $post; |
112 | 112 | if ( |
113 | 113 | $post->post_type == 'espresso_venues' |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | // it uses the_content() for displaying the $post->post_content |
118 | 118 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
119 | 119 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
120 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
120 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
121 | 121 | // add filters we want |
122 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
122 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
123 | 123 | // now load our template |
124 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
124 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
125 | 125 | // remove other filters we added so they won't get applied to the next post |
126 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
126 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | 127 | } |
128 | 128 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
129 | - return ! empty( $template ) ? $template : $content; |
|
129 | + return ! empty($template) ? $template : $content; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param string $content |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function venue_location( $content ) { |
|
142 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
141 | + public function venue_location($content) { |
|
142 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function wp_enqueue_scripts() { |
154 | 154 | // get some style |
155 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) { |
|
155 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) { |
|
156 | 156 | // first check theme folder |
157 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
158 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
159 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
160 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
157 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
158 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
159 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
160 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
161 | 161 | } |
162 | - wp_enqueue_style( $this->theme ); |
|
163 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
164 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
162 | + wp_enqueue_style($this->theme); |
|
163 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
164 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class EED_Events_Archive extends EED_Module { |
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; |
|
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 | 21 | |
22 | 22 | |
23 | - public static $espresso_event_list_ID = 0; |
|
23 | + public static $espresso_event_list_ID = 0; |
|
24 | 24 | public static $espresso_grid_event_lists = array(); |
25 | 25 | |
26 | 26 | /** |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | */ |
29 | 29 | protected static $using_get_the_excerpt = false; |
30 | 30 | |
31 | - /** |
|
32 | - * Used to flag when the event list is being called from an external iframe. |
|
33 | - * |
|
34 | - * @var bool $iframe |
|
35 | - */ |
|
36 | - protected static $iframe = false; |
|
31 | + /** |
|
32 | + * Used to flag when the event list is being called from an external iframe. |
|
33 | + * |
|
34 | + * @var bool $iframe |
|
35 | + */ |
|
36 | + protected static $iframe = false; |
|
37 | 37 | |
38 | - /** |
|
38 | + /** |
|
39 | 39 | * @var \EventEspresso\core\libraries\iframe_display\EventListIframeEmbedButton $_iframe_embed_button |
40 | 40 | */ |
41 | 41 | private static $_iframe_embed_button; |
42 | 42 | |
43 | - /** |
|
43 | + /** |
|
44 | 44 | * @type EE_Template_Part_Manager $template_parts |
45 | 45 | */ |
46 | 46 | protected $template_parts; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | public static function set_hooks() { |
66 | - $post_type = get_post_type_object('espresso_events'); |
|
67 | - EE_Config::register_route(strtolower($post_type->labels->name), 'Events_Archive', 'run' ); |
|
66 | + $post_type = get_post_type_object('espresso_events'); |
|
67 | + EE_Config::register_route(strtolower($post_type->labels->name), 'Events_Archive', 'run' ); |
|
68 | 68 | EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
69 | 69 | EE_Config::register_route( 'iframe', 'Events_Archive', 'event_list_iframe', 'event_list' ); |
70 | 70 | add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | |
212 | 212 | |
213 | 213 | /** |
214 | - * most likely called by the ESPRESSO_EVENTS shortcode which uses this module to do some of it's lifting |
|
215 | - * |
|
216 | - * @return void |
|
214 | + * most likely called by the ESPRESSO_EVENTS shortcode which uses this module to do some of it's lifting |
|
215 | + * |
|
216 | + * @return void |
|
217 | 217 | */ |
218 | 218 | public function event_list() { |
219 | 219 | // ensure valid EE_Events_Archive_Config() object exists |
@@ -224,36 +224,36 @@ discard block |
||
224 | 224 | |
225 | 225 | |
226 | 226 | |
227 | - /** |
|
228 | - * @access public |
|
229 | - * @return void |
|
230 | - * @throws \EE_Error |
|
231 | - * @throws \DomainException |
|
232 | - */ |
|
227 | + /** |
|
228 | + * @access public |
|
229 | + * @return void |
|
230 | + * @throws \EE_Error |
|
231 | + * @throws \DomainException |
|
232 | + */ |
|
233 | 233 | public function event_list_iframe() { |
234 | - \EED_Events_Archive::$iframe = true; |
|
234 | + \EED_Events_Archive::$iframe = true; |
|
235 | 235 | $event_list_iframe = new EventsArchiveIframe( $this ); |
236 | 236 | $event_list_iframe->display(); |
237 | 237 | } |
238 | 238 | |
239 | 239 | |
240 | 240 | |
241 | - /** |
|
242 | - * @access public |
|
243 | - * @return string |
|
244 | - */ |
|
241 | + /** |
|
242 | + * @access public |
|
243 | + * @return string |
|
244 | + */ |
|
245 | 245 | public static function is_iframe() { |
246 | - return \EED_Events_Archive::$iframe; |
|
246 | + return \EED_Events_Archive::$iframe; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | |
250 | 250 | |
251 | - /** |
|
252 | - * @access public |
|
253 | - * @return string |
|
254 | - */ |
|
251 | + /** |
|
252 | + * @access public |
|
253 | + * @return string |
|
254 | + */ |
|
255 | 255 | public static function link_target() { |
256 | - return \EED_Events_Archive::$iframe ? ' target="_blank"' : ''; |
|
256 | + return \EED_Events_Archive::$iframe ? ' target="_blank"' : ''; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
@@ -281,10 +281,10 @@ discard block |
||
281 | 281 | } |
282 | 282 | // if NOT a custom template |
283 | 283 | if ( |
284 | - apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false) |
|
284 | + apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false) |
|
285 | 285 | || EE_Registry::instance() |
286 | - ->load_core( 'Front_Controller' ) |
|
287 | - ->get_selected_template() !== 'archive-espresso_events.php' |
|
286 | + ->load_core( 'Front_Controller' ) |
|
287 | + ->get_selected_template() !== 'archive-espresso_events.php' |
|
288 | 288 | ) { |
289 | 289 | // don't display entry meta because the existing theme will take care of that |
290 | 290 | add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
@@ -292,16 +292,16 @@ discard block |
||
292 | 292 | EEH_Template::load_espresso_theme_functions(); |
293 | 293 | // because we don't know if the theme is using the_excerpt() |
294 | 294 | add_filter( |
295 | - 'the_excerpt', |
|
296 | - array( 'EED_Events_Archive', 'event_details' ), |
|
297 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
298 | - ); |
|
295 | + 'the_excerpt', |
|
296 | + array( 'EED_Events_Archive', 'event_details' ), |
|
297 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
298 | + ); |
|
299 | 299 | // or the_content |
300 | 300 | add_filter( |
301 | - 'the_content', |
|
302 | - array( 'EED_Events_Archive', 'event_details' ), |
|
303 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
304 | - ); |
|
301 | + 'the_content', |
|
302 | + array( 'EED_Events_Archive', 'event_details' ), |
|
303 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
304 | + ); |
|
305 | 305 | // and just in case they are running get_the_excerpt() which DESTROYS things |
306 | 306 | add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
307 | 307 | // don't display entry meta because the existing theme will take care of that |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | } |
327 | 327 | if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
328 | 328 | remove_filter( |
329 | - 'the_excerpt', |
|
330 | - array( 'EED_Events_Archive', 'event_details' ), |
|
331 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
332 | - ); |
|
329 | + 'the_excerpt', |
|
330 | + array( 'EED_Events_Archive', 'event_details' ), |
|
331 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
332 | + ); |
|
333 | 333 | remove_filter( |
334 | - 'the_content', |
|
335 | - array( 'EED_Events_Archive', 'event_details' ), |
|
336 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
337 | - ); |
|
334 | + 'the_content', |
|
335 | + array( 'EED_Events_Archive', 'event_details' ), |
|
336 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
337 | + ); |
|
338 | 338 | $excerpt = EED_Events_Archive::event_details( $excerpt ); |
339 | 339 | } else { |
340 | 340 | EED_Events_Archive::$using_get_the_excerpt = true; |
@@ -425,17 +425,17 @@ discard block |
||
425 | 425 | // no further password checks required atm |
426 | 426 | add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
427 | 427 | // we need to first remove this callback from being applied to the_content() or the_excerpt() |
428 | - // (otherwise it will recurse and blow up the interweb) |
|
428 | + // (otherwise it will recurse and blow up the interweb) |
|
429 | 429 | remove_filter( |
430 | - 'the_excerpt', |
|
431 | - array( 'EED_Events_Archive', 'event_details' ), |
|
432 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
433 | - ); |
|
430 | + 'the_excerpt', |
|
431 | + array( 'EED_Events_Archive', 'event_details' ), |
|
432 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
433 | + ); |
|
434 | 434 | remove_filter( |
435 | - 'the_content', |
|
436 | - array( 'EED_Events_Archive', 'event_details' ), |
|
437 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
438 | - ); |
|
435 | + 'the_content', |
|
436 | + array( 'EED_Events_Archive', 'event_details' ), |
|
437 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
438 | + ); |
|
439 | 439 | remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
440 | 440 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
441 | 441 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
@@ -443,20 +443,20 @@ discard block |
||
443 | 443 | $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
444 | 444 | // re-add our main filters (or else the next event won't have them) |
445 | 445 | add_filter( |
446 | - 'the_excerpt', |
|
447 | - array( 'EED_Events_Archive', 'event_details' ), |
|
448 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
449 | - ); |
|
446 | + 'the_excerpt', |
|
447 | + array( 'EED_Events_Archive', 'event_details' ), |
|
448 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
449 | + ); |
|
450 | 450 | add_filter( |
451 | - 'the_content', |
|
452 | - array( 'EED_Events_Archive', 'event_details' ), |
|
453 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
454 | - ); |
|
451 | + 'the_content', |
|
452 | + array( 'EED_Events_Archive', 'event_details' ), |
|
453 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
454 | + ); |
|
455 | 455 | add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
456 | 456 | remove_filter( |
457 | - 'FHEE__EED_Events_Archive__event_details__no_post_password_required', |
|
458 | - '__return_true' |
|
459 | - ); |
|
457 | + 'FHEE__EED_Events_Archive__event_details__no_post_password_required', |
|
458 | + '__return_true' |
|
459 | + ); |
|
460 | 460 | return $content; |
461 | 461 | } |
462 | 462 | |
@@ -472,15 +472,15 @@ discard block |
||
472 | 472 | // we need to first remove this callback from being applied to the_content() |
473 | 473 | // (otherwise it will recurse and blow up the interweb) |
474 | 474 | remove_filter( |
475 | - 'the_excerpt', |
|
476 | - array( 'EED_Events_Archive', 'event_details' ), |
|
477 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
478 | - ); |
|
475 | + 'the_excerpt', |
|
476 | + array( 'EED_Events_Archive', 'event_details' ), |
|
477 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
478 | + ); |
|
479 | 479 | remove_filter( |
480 | - 'the_content', |
|
481 | - array( 'EED_Events_Archive', 'event_details' ), |
|
482 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
483 | - ); |
|
480 | + 'the_content', |
|
481 | + array( 'EED_Events_Archive', 'event_details' ), |
|
482 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
483 | + ); |
|
484 | 484 | remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
485 | 485 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
486 | 486 | EED_Events_Archive::_add_additional_excerpt_filters(); |
@@ -490,15 +490,15 @@ discard block |
||
490 | 490 | $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
491 | 491 | // re-add our main filters (or else the next event won't have them) |
492 | 492 | add_filter( |
493 | - 'the_excerpt', |
|
494 | - array( 'EED_Events_Archive', 'event_details' ), |
|
495 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
496 | - ); |
|
493 | + 'the_excerpt', |
|
494 | + array( 'EED_Events_Archive', 'event_details' ), |
|
495 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
496 | + ); |
|
497 | 497 | add_filter( |
498 | - 'the_content', |
|
499 | - array( 'EED_Events_Archive', 'event_details' ), |
|
500 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
501 | - ); |
|
498 | + 'the_content', |
|
499 | + array( 'EED_Events_Archive', 'event_details' ), |
|
500 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
501 | + ); |
|
502 | 502 | add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
503 | 503 | // but remove the other filters so that they don't get applied to the next post |
504 | 504 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
@@ -575,20 +575,20 @@ discard block |
||
575 | 575 | */ |
576 | 576 | private static function _add_additional_excerpt_filters() { |
577 | 577 | add_filter( |
578 | - 'the_excerpt', |
|
579 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
580 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
581 | - ); |
|
578 | + 'the_excerpt', |
|
579 | + array( 'EED_Events_Archive', 'event_datetimes' ), |
|
580 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
581 | + ); |
|
582 | 582 | add_filter( |
583 | - 'the_excerpt', |
|
584 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
585 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
586 | - ); |
|
583 | + 'the_excerpt', |
|
584 | + array( 'EED_Events_Archive', 'event_tickets' ), |
|
585 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
586 | + ); |
|
587 | 587 | add_filter( |
588 | - 'the_excerpt', |
|
589 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
590 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
591 | - ); |
|
588 | + 'the_excerpt', |
|
589 | + array( 'EED_Events_Archive', 'event_venues' ), |
|
590 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
591 | + ); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | |
@@ -601,20 +601,20 @@ discard block |
||
601 | 601 | */ |
602 | 602 | private static function _add_additional_content_filters() { |
603 | 603 | add_filter( |
604 | - 'the_content', |
|
605 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
606 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
607 | - ); |
|
604 | + 'the_content', |
|
605 | + array( 'EED_Events_Archive', 'event_datetimes' ), |
|
606 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
607 | + ); |
|
608 | 608 | add_filter( |
609 | - 'the_content', |
|
610 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
611 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
612 | - ); |
|
609 | + 'the_content', |
|
610 | + array( 'EED_Events_Archive', 'event_tickets' ), |
|
611 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
612 | + ); |
|
613 | 613 | add_filter( |
614 | - 'the_content', |
|
615 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
616 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
617 | - ); |
|
614 | + 'the_content', |
|
615 | + array( 'EED_Events_Archive', 'event_venues' ), |
|
616 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
617 | + ); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | |
@@ -627,35 +627,35 @@ discard block |
||
627 | 627 | */ |
628 | 628 | private static function _remove_additional_events_archive_filters() { |
629 | 629 | remove_filter( |
630 | - 'the_excerpt', |
|
631 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
632 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
633 | - ); |
|
630 | + 'the_excerpt', |
|
631 | + array( 'EED_Events_Archive', 'event_datetimes' ), |
|
632 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
633 | + ); |
|
634 | 634 | remove_filter( |
635 | - 'the_excerpt', |
|
636 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
637 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
638 | - ); |
|
635 | + 'the_excerpt', |
|
636 | + array( 'EED_Events_Archive', 'event_tickets' ), |
|
637 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
638 | + ); |
|
639 | 639 | remove_filter( |
640 | - 'the_excerpt', |
|
641 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
642 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
643 | - ); |
|
640 | + 'the_excerpt', |
|
641 | + array( 'EED_Events_Archive', 'event_venues' ), |
|
642 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
643 | + ); |
|
644 | 644 | remove_filter( |
645 | - 'the_content', |
|
646 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
647 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
648 | - ); |
|
645 | + 'the_content', |
|
646 | + array( 'EED_Events_Archive', 'event_datetimes' ), |
|
647 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
648 | + ); |
|
649 | 649 | remove_filter( |
650 | - 'the_content', |
|
651 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
652 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
653 | - ); |
|
650 | + 'the_content', |
|
651 | + array( 'EED_Events_Archive', 'event_tickets' ), |
|
652 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
653 | + ); |
|
654 | 654 | remove_filter( |
655 | - 'the_content', |
|
656 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
657 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
658 | - ); |
|
655 | + 'the_content', |
|
656 | + array( 'EED_Events_Archive', 'event_venues' ), |
|
657 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
658 | + ); |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | |
@@ -670,50 +670,50 @@ discard block |
||
670 | 670 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
671 | 671 | remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 1 ); |
672 | 672 | remove_filter( |
673 | - 'the_excerpt', |
|
674 | - array( 'EED_Events_Archive', 'event_details' ), |
|
675 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
676 | - ); |
|
673 | + 'the_excerpt', |
|
674 | + array( 'EED_Events_Archive', 'event_details' ), |
|
675 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
676 | + ); |
|
677 | 677 | remove_filter( |
678 | - 'the_excerpt', |
|
679 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
680 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
681 | - ); |
|
678 | + 'the_excerpt', |
|
679 | + array( 'EED_Events_Archive', 'event_datetimes' ), |
|
680 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
681 | + ); |
|
682 | 682 | remove_filter( |
683 | - 'the_excerpt', |
|
684 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
685 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
686 | - ); |
|
683 | + 'the_excerpt', |
|
684 | + array( 'EED_Events_Archive', 'event_tickets' ), |
|
685 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
686 | + ); |
|
687 | 687 | remove_filter( |
688 | - 'the_excerpt', |
|
689 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
690 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
691 | - ); |
|
688 | + 'the_excerpt', |
|
689 | + array( 'EED_Events_Archive', 'event_venues' ), |
|
690 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
691 | + ); |
|
692 | 692 | remove_filter( |
693 | - 'the_content', |
|
694 | - array( 'EED_Events_Archive', 'event_details' ), |
|
695 | - EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
696 | - ); |
|
693 | + 'the_content', |
|
694 | + array( 'EED_Events_Archive', 'event_details' ), |
|
695 | + EED_Events_Archive::EVENT_DETAILS_PRIORITY |
|
696 | + ); |
|
697 | 697 | remove_filter( |
698 | - 'the_content', |
|
699 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
700 | - EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
701 | - ); |
|
698 | + 'the_content', |
|
699 | + array( 'EED_Events_Archive', 'event_datetimes' ), |
|
700 | + EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
|
701 | + ); |
|
702 | 702 | remove_filter( |
703 | - 'the_content', |
|
704 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
705 | - EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
706 | - ); |
|
703 | + 'the_content', |
|
704 | + array( 'EED_Events_Archive', 'event_tickets' ), |
|
705 | + EED_Events_Archive::EVENT_TICKETS_PRIORITY |
|
706 | + ); |
|
707 | 707 | remove_filter( |
708 | - 'the_content', |
|
709 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
710 | - EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
711 | - ); |
|
708 | + 'the_content', |
|
709 | + array( 'EED_Events_Archive', 'event_venues' ), |
|
710 | + EED_Events_Archive::EVENT_VENUES_PRIORITY |
|
711 | + ); |
|
712 | 712 | // don't display entry meta because the existing theme will take care of that |
713 | 713 | remove_filter( |
714 | - 'FHEE__content_espresso_events_details_template__display_entry_meta', |
|
715 | - '__return_false' |
|
716 | - ); |
|
714 | + 'FHEE__content_espresso_events_details_template__display_entry_meta', |
|
715 | + '__return_false' |
|
716 | + ); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | * @return void |
729 | 729 | */ |
730 | 730 | public function load_event_list_assets() { |
731 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
731 | + do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
732 | 732 | add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
733 | 733 | add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
734 | 734 | add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use EventEspresso\core\libraries\iframe_display\EventListIframeEmbedButton; |
4 | 4 | use EventEspresso\modules\events_archive\EventsArchiveIframe; |
5 | 5 | |
6 | -defined( 'EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed'); |
|
6 | +defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed'); |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Event List |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return EED_Events_Archive |
52 | 52 | */ |
53 | 53 | public static function instance() { |
54 | - return parent::get_instance( __CLASS__ ); |
|
54 | + return parent::get_instance(__CLASS__); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function set_hooks() { |
66 | 66 | $post_type = get_post_type_object('espresso_events'); |
67 | - EE_Config::register_route(strtolower($post_type->labels->name), 'Events_Archive', 'run' ); |
|
68 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
69 | - EE_Config::register_route( 'iframe', 'Events_Archive', 'event_list_iframe', 'event_list' ); |
|
70 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
67 | + EE_Config::register_route(strtolower($post_type->labels->name), 'Events_Archive', 'run'); |
|
68 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
69 | + EE_Config::register_route('iframe', 'Events_Archive', 'event_list_iframe', 'event_list'); |
|
70 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | * @return void |
78 | 78 | */ |
79 | 79 | public static function set_hooks_admin() { |
80 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
80 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
81 | 81 | // hook into the end of the \EE_Admin_Page::_load_page_dependencies() |
82 | 82 | // to load assets for "espresso_events" page on the "default" route (action) |
83 | 83 | add_action( |
84 | 84 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__default', |
85 | - array( 'EED_Events_Archive', 'event_list_iframe_embed_button' ), |
|
85 | + array('EED_Events_Archive', 'event_list_iframe_embed_button'), |
|
86 | 86 | 10 |
87 | 87 | ); |
88 | 88 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @return void |
98 | 98 | */ |
99 | 99 | public static function set_definitions() { |
100 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
101 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
100 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
101 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * set up EE_Events_Archive_Config |
108 | 108 | */ |
109 | - protected function set_config(){ |
|
110 | - $this->set_config_section( 'template_settings' ); |
|
111 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
112 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
109 | + protected function set_config() { |
|
110 | + $this->set_config_section('template_settings'); |
|
111 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
112 | + $this->set_config_name('EED_Events_Archive'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return EventListIframeEmbedButton |
119 | 119 | */ |
120 | 120 | public static function get_iframe_embed_button() { |
121 | - if ( ! self::$_iframe_embed_button instanceof EventListIframeEmbedButton ) { |
|
121 | + if ( ! self::$_iframe_embed_button instanceof EventListIframeEmbedButton) { |
|
122 | 122 | self::$_iframe_embed_button = new EventListIframeEmbedButton(); |
123 | 123 | } |
124 | 124 | return self::$_iframe_embed_button; |
@@ -144,35 +144,35 @@ discard block |
||
144 | 144 | * @param \EE_Events_Archive_Config $config |
145 | 145 | * @return \EE_Template_Part_Manager |
146 | 146 | */ |
147 | - public function initialize_template_parts( EE_Events_Archive_Config $config = null ) { |
|
147 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) { |
|
148 | 148 | $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
149 | 149 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
150 | 150 | $template_parts = new EE_Template_Part_Manager(); |
151 | 151 | $template_parts->add_template_part( |
152 | 152 | 'tickets', |
153 | - __( 'Ticket Selector', 'event_espresso' ), |
|
153 | + __('Ticket Selector', 'event_espresso'), |
|
154 | 154 | 'content-espresso_events-tickets.php', |
155 | 155 | $config->display_order_tickets |
156 | 156 | ); |
157 | 157 | $template_parts->add_template_part( |
158 | 158 | 'datetimes', |
159 | - __( 'Dates and Times', 'event_espresso' ), |
|
159 | + __('Dates and Times', 'event_espresso'), |
|
160 | 160 | 'content-espresso_events-datetimes.php', |
161 | 161 | $config->display_order_datetimes |
162 | 162 | ); |
163 | 163 | $template_parts->add_template_part( |
164 | 164 | 'event', |
165 | - __( 'Event Description', 'event_espresso' ), |
|
165 | + __('Event Description', 'event_espresso'), |
|
166 | 166 | 'content-espresso_events-details.php', |
167 | 167 | $config->display_order_event |
168 | 168 | ); |
169 | 169 | $template_parts->add_template_part( |
170 | 170 | 'venue', |
171 | - __( 'Venue Information', 'event_espresso' ), |
|
171 | + __('Venue Information', 'event_espresso'), |
|
172 | 172 | 'content-espresso_events-venues.php', |
173 | 173 | $config->display_order_venue |
174 | 174 | ); |
175 | - do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts ); |
|
175 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
176 | 176 | return $template_parts; |
177 | 177 | } |
178 | 178 | |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | * @param WP $WP |
186 | 186 | * @return void |
187 | 187 | */ |
188 | - public function run( $WP ) { |
|
189 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
188 | + public function run($WP) { |
|
189 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
190 | 190 | // ensure valid EE_Events_Archive_Config() object exists |
191 | 191 | $this->set_config(); |
192 | 192 | /** @type EE_Events_Archive_Config $config */ |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | EEH_Event_Query::add_query_filters(); |
199 | 199 | // set params that will get used by the filters |
200 | 200 | EEH_Event_Query::set_query_params( |
201 | - '', // month |
|
202 | - '', // category |
|
203 | - $config->display_expired_events, // show_expired |
|
204 | - 'start_date', // orderby |
|
201 | + '', // month |
|
202 | + '', // category |
|
203 | + $config->display_expired_events, // show_expired |
|
204 | + 'start_date', // orderby |
|
205 | 205 | 'ASC' // sort |
206 | 206 | ); |
207 | 207 | // check what template is loaded |
208 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
208 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function event_list_iframe() { |
234 | 234 | \EED_Events_Archive::$iframe = true; |
235 | - $event_list_iframe = new EventsArchiveIframe( $this ); |
|
235 | + $event_list_iframe = new EventsArchiveIframe($this); |
|
236 | 236 | $event_list_iframe->display(); |
237 | 237 | } |
238 | 238 | |
@@ -270,42 +270,42 @@ discard block |
||
270 | 270 | * @param string $template |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - public function template_include( $template = '' ) { |
|
273 | + public function template_include($template = '') { |
|
274 | 274 | // don't add content filter for dedicated EE child themes or private posts |
275 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
275 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
276 | 276 | /** @type EE_Events_Archive_Config $config */ |
277 | 277 | $config = $this->config(); |
278 | 278 | // add status banner ? |
279 | - if ( $config->display_status_banner ) { |
|
280 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
279 | + if ($config->display_status_banner) { |
|
280 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
281 | 281 | } |
282 | 282 | // if NOT a custom template |
283 | 283 | if ( |
284 | 284 | apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false) |
285 | 285 | || EE_Registry::instance() |
286 | - ->load_core( 'Front_Controller' ) |
|
286 | + ->load_core('Front_Controller') |
|
287 | 287 | ->get_selected_template() !== 'archive-espresso_events.php' |
288 | 288 | ) { |
289 | 289 | // don't display entry meta because the existing theme will take care of that |
290 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
290 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
291 | 291 | // load functions.php file for the theme (loaded by WP if using child theme) |
292 | 292 | EEH_Template::load_espresso_theme_functions(); |
293 | 293 | // because we don't know if the theme is using the_excerpt() |
294 | 294 | add_filter( |
295 | 295 | 'the_excerpt', |
296 | - array( 'EED_Events_Archive', 'event_details' ), |
|
296 | + array('EED_Events_Archive', 'event_details'), |
|
297 | 297 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
298 | 298 | ); |
299 | 299 | // or the_content |
300 | 300 | add_filter( |
301 | 301 | 'the_content', |
302 | - array( 'EED_Events_Archive', 'event_details' ), |
|
302 | + array('EED_Events_Archive', 'event_details'), |
|
303 | 303 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
304 | 304 | ); |
305 | 305 | // and just in case they are running get_the_excerpt() which DESTROYS things |
306 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
306 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
307 | 307 | // don't display entry meta because the existing theme will take care of that |
308 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
308 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | return $template; |
@@ -320,25 +320,25 @@ discard block |
||
320 | 320 | * @param string $excerpt |
321 | 321 | * @return string |
322 | 322 | */ |
323 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
324 | - if ( post_password_required() ) { |
|
323 | + public static function get_the_excerpt($excerpt = '') { |
|
324 | + if (post_password_required()) { |
|
325 | 325 | return $excerpt; |
326 | 326 | } |
327 | - if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
|
327 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
328 | 328 | remove_filter( |
329 | 329 | 'the_excerpt', |
330 | - array( 'EED_Events_Archive', 'event_details' ), |
|
330 | + array('EED_Events_Archive', 'event_details'), |
|
331 | 331 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
332 | 332 | ); |
333 | 333 | remove_filter( |
334 | 334 | 'the_content', |
335 | - array( 'EED_Events_Archive', 'event_details' ), |
|
335 | + array('EED_Events_Archive', 'event_details'), |
|
336 | 336 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
337 | 337 | ); |
338 | - $excerpt = EED_Events_Archive::event_details( $excerpt ); |
|
338 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
339 | 339 | } else { |
340 | 340 | EED_Events_Archive::$using_get_the_excerpt = true; |
341 | - add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 ); |
|
341 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
342 | 342 | } |
343 | 343 | return $excerpt; |
344 | 344 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * @param string $text |
353 | 353 | * @return string |
354 | 354 | */ |
355 | - public static function end_get_the_excerpt( $text = '' ) { |
|
355 | + public static function end_get_the_excerpt($text = '') { |
|
356 | 356 | EED_Events_Archive::$using_get_the_excerpt = false; |
357 | 357 | return $text; |
358 | 358 | } |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | * @param string $id |
368 | 368 | * @return string |
369 | 369 | */ |
370 | - public static function the_title( $title = '', $id = '' ) { |
|
370 | + public static function the_title($title = '', $id = '') { |
|
371 | 371 | global $post; |
372 | - if ( $post instanceof WP_Post ) { |
|
373 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
372 | + if ($post instanceof WP_Post) { |
|
373 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
374 | 374 | } |
375 | 375 | return $title; |
376 | 376 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * @param string $content |
385 | 385 | * @return string |
386 | 386 | */ |
387 | - public static function event_details( $content ) { |
|
387 | + public static function event_details($content) { |
|
388 | 388 | global $post; |
389 | 389 | static $current_post_ID = 0; |
390 | 390 | if ( |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | && ! EED_Events_Archive::$using_get_the_excerpt |
394 | 394 | && ! post_password_required() |
395 | 395 | && ( |
396 | - apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false ) |
|
397 | - || ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false ) |
|
396 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
397 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
398 | 398 | ) |
399 | 399 | ) { |
400 | 400 | // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
404 | 404 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
405 | 405 | // so the following allows this filter to be applied multiple times, but only once for real |
406 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
407 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) { |
|
406 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
407 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
408 | 408 | $content = \EED_Events_Archive::use_sortable_display_order(); |
409 | 409 | } else { |
410 | 410 | $content = \EED_Events_Archive::use_filterable_display_order(); |
@@ -423,36 +423,36 @@ discard block |
||
423 | 423 | */ |
424 | 424 | protected static function use_sortable_display_order() { |
425 | 425 | // no further password checks required atm |
426 | - add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
426 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
427 | 427 | // we need to first remove this callback from being applied to the_content() or the_excerpt() |
428 | 428 | // (otherwise it will recurse and blow up the interweb) |
429 | 429 | remove_filter( |
430 | 430 | 'the_excerpt', |
431 | - array( 'EED_Events_Archive', 'event_details' ), |
|
431 | + array('EED_Events_Archive', 'event_details'), |
|
432 | 432 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
433 | 433 | ); |
434 | 434 | remove_filter( |
435 | 435 | 'the_content', |
436 | - array( 'EED_Events_Archive', 'event_details' ), |
|
436 | + array('EED_Events_Archive', 'event_details'), |
|
437 | 437 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
438 | 438 | ); |
439 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
439 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
440 | 440 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
441 | 441 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
442 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
443 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
|
442 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
443 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
444 | 444 | // re-add our main filters (or else the next event won't have them) |
445 | 445 | add_filter( |
446 | 446 | 'the_excerpt', |
447 | - array( 'EED_Events_Archive', 'event_details' ), |
|
447 | + array('EED_Events_Archive', 'event_details'), |
|
448 | 448 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
449 | 449 | ); |
450 | 450 | add_filter( |
451 | 451 | 'the_content', |
452 | - array( 'EED_Events_Archive', 'event_details' ), |
|
452 | + array('EED_Events_Archive', 'event_details'), |
|
453 | 453 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
454 | 454 | ); |
455 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
455 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
456 | 456 | remove_filter( |
457 | 457 | 'FHEE__EED_Events_Archive__event_details__no_post_password_required', |
458 | 458 | '__return_true' |
@@ -473,36 +473,36 @@ discard block |
||
473 | 473 | // (otherwise it will recurse and blow up the interweb) |
474 | 474 | remove_filter( |
475 | 475 | 'the_excerpt', |
476 | - array( 'EED_Events_Archive', 'event_details' ), |
|
476 | + array('EED_Events_Archive', 'event_details'), |
|
477 | 477 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
478 | 478 | ); |
479 | 479 | remove_filter( |
480 | 480 | 'the_content', |
481 | - array( 'EED_Events_Archive', 'event_details' ), |
|
481 | + array('EED_Events_Archive', 'event_details'), |
|
482 | 482 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
483 | 483 | ); |
484 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
484 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
485 | 485 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
486 | 486 | EED_Events_Archive::_add_additional_excerpt_filters(); |
487 | 487 | EED_Events_Archive::_add_additional_content_filters(); |
488 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' ); |
|
488 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
489 | 489 | // now load our template |
490 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
490 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
491 | 491 | // re-add our main filters (or else the next event won't have them) |
492 | 492 | add_filter( |
493 | 493 | 'the_excerpt', |
494 | - array( 'EED_Events_Archive', 'event_details' ), |
|
494 | + array('EED_Events_Archive', 'event_details'), |
|
495 | 495 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
496 | 496 | ); |
497 | 497 | add_filter( |
498 | 498 | 'the_content', |
499 | - array( 'EED_Events_Archive', 'event_details' ), |
|
499 | + array('EED_Events_Archive', 'event_details'), |
|
500 | 500 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
501 | 501 | ); |
502 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
502 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
503 | 503 | // but remove the other filters so that they don't get applied to the next post |
504 | 504 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
505 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' ); |
|
505 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
506 | 506 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
507 | 507 | //return ! empty( $template ) ? $template : $content; |
508 | 508 | return $content; |
@@ -517,11 +517,11 @@ discard block |
||
517 | 517 | * @param string $content |
518 | 518 | * @return string |
519 | 519 | */ |
520 | - public static function event_datetimes( $content ) { |
|
521 | - if ( post_password_required() ) { |
|
520 | + public static function event_datetimes($content) { |
|
521 | + if (post_password_required()) { |
|
522 | 522 | return $content; |
523 | 523 | } |
524 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
524 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
@@ -531,11 +531,11 @@ discard block |
||
531 | 531 | * @param string $content |
532 | 532 | * @return string |
533 | 533 | */ |
534 | - public static function event_tickets( $content ) { |
|
535 | - if ( post_password_required() ) { |
|
534 | + public static function event_tickets($content) { |
|
535 | + if (post_password_required()) { |
|
536 | 536 | return $content; |
537 | 537 | } |
538 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
538 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | * @param string $content |
548 | 548 | * @return string |
549 | 549 | */ |
550 | - public static function event_venue( $content ) { |
|
551 | - return EED_Events_Archive::event_venues( $content ); |
|
550 | + public static function event_venue($content) { |
|
551 | + return EED_Events_Archive::event_venues($content); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | * @param string $content |
559 | 559 | * @return string |
560 | 560 | */ |
561 | - public static function event_venues( $content ) { |
|
562 | - if ( post_password_required() ) { |
|
561 | + public static function event_venues($content) { |
|
562 | + if (post_password_required()) { |
|
563 | 563 | return $content; |
564 | 564 | } |
565 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
565 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | |
@@ -576,17 +576,17 @@ discard block |
||
576 | 576 | private static function _add_additional_excerpt_filters() { |
577 | 577 | add_filter( |
578 | 578 | 'the_excerpt', |
579 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
579 | + array('EED_Events_Archive', 'event_datetimes'), |
|
580 | 580 | EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
581 | 581 | ); |
582 | 582 | add_filter( |
583 | 583 | 'the_excerpt', |
584 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
584 | + array('EED_Events_Archive', 'event_tickets'), |
|
585 | 585 | EED_Events_Archive::EVENT_TICKETS_PRIORITY |
586 | 586 | ); |
587 | 587 | add_filter( |
588 | 588 | 'the_excerpt', |
589 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
589 | + array('EED_Events_Archive', 'event_venues'), |
|
590 | 590 | EED_Events_Archive::EVENT_VENUES_PRIORITY |
591 | 591 | ); |
592 | 592 | } |
@@ -602,17 +602,17 @@ discard block |
||
602 | 602 | private static function _add_additional_content_filters() { |
603 | 603 | add_filter( |
604 | 604 | 'the_content', |
605 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
605 | + array('EED_Events_Archive', 'event_datetimes'), |
|
606 | 606 | EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
607 | 607 | ); |
608 | 608 | add_filter( |
609 | 609 | 'the_content', |
610 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
610 | + array('EED_Events_Archive', 'event_tickets'), |
|
611 | 611 | EED_Events_Archive::EVENT_TICKETS_PRIORITY |
612 | 612 | ); |
613 | 613 | add_filter( |
614 | 614 | 'the_content', |
615 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
615 | + array('EED_Events_Archive', 'event_venues'), |
|
616 | 616 | EED_Events_Archive::EVENT_VENUES_PRIORITY |
617 | 617 | ); |
618 | 618 | } |
@@ -628,32 +628,32 @@ discard block |
||
628 | 628 | private static function _remove_additional_events_archive_filters() { |
629 | 629 | remove_filter( |
630 | 630 | 'the_excerpt', |
631 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
631 | + array('EED_Events_Archive', 'event_datetimes'), |
|
632 | 632 | EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
633 | 633 | ); |
634 | 634 | remove_filter( |
635 | 635 | 'the_excerpt', |
636 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
636 | + array('EED_Events_Archive', 'event_tickets'), |
|
637 | 637 | EED_Events_Archive::EVENT_TICKETS_PRIORITY |
638 | 638 | ); |
639 | 639 | remove_filter( |
640 | 640 | 'the_excerpt', |
641 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
641 | + array('EED_Events_Archive', 'event_venues'), |
|
642 | 642 | EED_Events_Archive::EVENT_VENUES_PRIORITY |
643 | 643 | ); |
644 | 644 | remove_filter( |
645 | 645 | 'the_content', |
646 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
646 | + array('EED_Events_Archive', 'event_datetimes'), |
|
647 | 647 | EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
648 | 648 | ); |
649 | 649 | remove_filter( |
650 | 650 | 'the_content', |
651 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
651 | + array('EED_Events_Archive', 'event_tickets'), |
|
652 | 652 | EED_Events_Archive::EVENT_TICKETS_PRIORITY |
653 | 653 | ); |
654 | 654 | remove_filter( |
655 | 655 | 'the_content', |
656 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
656 | + array('EED_Events_Archive', 'event_venues'), |
|
657 | 657 | EED_Events_Archive::EVENT_VENUES_PRIORITY |
658 | 658 | ); |
659 | 659 | } |
@@ -668,45 +668,45 @@ discard block |
||
668 | 668 | */ |
669 | 669 | public static function remove_all_events_archive_filters() { |
670 | 670 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
671 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 1 ); |
|
671 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 1); |
|
672 | 672 | remove_filter( |
673 | 673 | 'the_excerpt', |
674 | - array( 'EED_Events_Archive', 'event_details' ), |
|
674 | + array('EED_Events_Archive', 'event_details'), |
|
675 | 675 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
676 | 676 | ); |
677 | 677 | remove_filter( |
678 | 678 | 'the_excerpt', |
679 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
679 | + array('EED_Events_Archive', 'event_datetimes'), |
|
680 | 680 | EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
681 | 681 | ); |
682 | 682 | remove_filter( |
683 | 683 | 'the_excerpt', |
684 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
684 | + array('EED_Events_Archive', 'event_tickets'), |
|
685 | 685 | EED_Events_Archive::EVENT_TICKETS_PRIORITY |
686 | 686 | ); |
687 | 687 | remove_filter( |
688 | 688 | 'the_excerpt', |
689 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
689 | + array('EED_Events_Archive', 'event_venues'), |
|
690 | 690 | EED_Events_Archive::EVENT_VENUES_PRIORITY |
691 | 691 | ); |
692 | 692 | remove_filter( |
693 | 693 | 'the_content', |
694 | - array( 'EED_Events_Archive', 'event_details' ), |
|
694 | + array('EED_Events_Archive', 'event_details'), |
|
695 | 695 | EED_Events_Archive::EVENT_DETAILS_PRIORITY |
696 | 696 | ); |
697 | 697 | remove_filter( |
698 | 698 | 'the_content', |
699 | - array( 'EED_Events_Archive', 'event_datetimes' ), |
|
699 | + array('EED_Events_Archive', 'event_datetimes'), |
|
700 | 700 | EED_Events_Archive::EVENT_DATETIMES_PRIORITY |
701 | 701 | ); |
702 | 702 | remove_filter( |
703 | 703 | 'the_content', |
704 | - array( 'EED_Events_Archive', 'event_tickets' ), |
|
704 | + array('EED_Events_Archive', 'event_tickets'), |
|
705 | 705 | EED_Events_Archive::EVENT_TICKETS_PRIORITY |
706 | 706 | ); |
707 | 707 | remove_filter( |
708 | 708 | 'the_content', |
709 | - array( 'EED_Events_Archive', 'event_venues' ), |
|
709 | + array('EED_Events_Archive', 'event_venues'), |
|
710 | 710 | EED_Events_Archive::EVENT_VENUES_PRIORITY |
711 | 711 | ); |
712 | 712 | // don't display entry meta because the existing theme will take care of that |
@@ -728,12 +728,12 @@ discard block |
||
728 | 728 | * @return void |
729 | 729 | */ |
730 | 730 | public function load_event_list_assets() { |
731 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
732 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
733 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
734 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
735 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
736 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
731 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
732 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
733 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
734 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
735 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
736 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | |
@@ -750,13 +750,13 @@ discard block |
||
750 | 750 | */ |
751 | 751 | public function wp_enqueue_scripts() { |
752 | 752 | // get some style |
753 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
753 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
754 | 754 | // first check uploads folder |
755 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
756 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
755 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
756 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
757 | 757 | } else { |
758 | 758 | } |
759 | - wp_enqueue_style( $this->theme ); |
|
759 | + wp_enqueue_style($this->theme); |
|
760 | 760 | |
761 | 761 | } |
762 | 762 | } |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | */ |
775 | 775 | public static function template_settings_form() { |
776 | 776 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
777 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
778 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
777 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
778 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
779 | 779 | $events_archive_settings = array( |
780 | 780 | 'display_status_banner' => 0, |
781 | 781 | 'display_description' => 1, |
@@ -784,8 +784,8 @@ discard block |
||
784 | 784 | 'display_venue' => 0, |
785 | 785 | 'display_expired_events' => 0 |
786 | 786 | ); |
787 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
788 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
787 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
788 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | |
@@ -801,16 +801,16 @@ discard block |
||
801 | 801 | * @param EE_Request_Handler $REQ |
802 | 802 | * @return EE_Template_Config |
803 | 803 | */ |
804 | - public static function update_template_settings( $CFG, $REQ ) { |
|
804 | + public static function update_template_settings($CFG, $REQ) { |
|
805 | 805 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
806 | 806 | // unless we are resetting the config... |
807 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
808 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
809 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
810 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
811 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
812 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
813 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
807 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
808 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
809 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
810 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
811 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
812 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
813 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
814 | 814 | return $CFG; |
815 | 815 | } |
816 | 816 | |
@@ -823,10 +823,10 @@ discard block |
||
823 | 823 | * @param string $extra_class |
824 | 824 | * @return string |
825 | 825 | */ |
826 | - public static function event_list_css( $extra_class = '' ) { |
|
827 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
826 | + public static function event_list_css($extra_class = '') { |
|
827 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
828 | 828 | $event_list_css[] = 'espresso-event-list-event'; |
829 | - return implode( ' ', $event_list_css ); |
|
829 | + return implode(' ', $event_list_css); |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | |
@@ -853,9 +853,9 @@ discard block |
||
853 | 853 | * @param $value |
854 | 854 | * @return bool |
855 | 855 | */ |
856 | - public static function display_description( $value ) { |
|
856 | + public static function display_description($value) { |
|
857 | 857 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
858 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
858 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
859 | 859 | return $display_description === $value ? TRUE : FALSE; |
860 | 860 | } |
861 | 861 | |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | */ |
869 | 869 | public static function display_ticket_selector() { |
870 | 870 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
871 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
871 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | */ |
882 | 882 | public static function display_venue() { |
883 | 883 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
884 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
884 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | */ |
894 | 894 | public static function display_datetimes() { |
895 | 895 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
896 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
896 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
897 | 897 | } |
898 | 898 | |
899 | 899 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | * @return string |
909 | 909 | */ |
910 | 910 | public static function event_list_title() { |
911 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
911 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | |
@@ -917,11 +917,11 @@ discard block |
||
917 | 917 | /** |
918 | 918 | * @since 4.4.0 |
919 | 919 | */ |
920 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
920 | + public static function _doing_it_wrong_notice($function = '') { |
|
921 | 921 | EE_Error::doing_it_wrong( |
922 | 922 | __FUNCTION__, |
923 | 923 | sprintf( |
924 | - __( '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', 'event_espresso' ), |
|
924 | + __('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', 'event_espresso'), |
|
925 | 925 | $function, |
926 | 926 | '<br />', |
927 | 927 | '4.6.0' |
@@ -943,89 +943,89 @@ discard block |
||
943 | 943 | * @deprecated |
944 | 944 | * @since 4.4.0 |
945 | 945 | */ |
946 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
947 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
948 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
946 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
947 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
948 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
949 | 949 | } |
950 | 950 | /** |
951 | 951 | * @deprecated |
952 | 952 | * @since 4.4.0 |
953 | 953 | */ |
954 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
955 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
956 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
954 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
955 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
956 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
957 | 957 | } |
958 | 958 | /** |
959 | 959 | * @deprecated |
960 | 960 | * @since 4.4.0 |
961 | 961 | */ |
962 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
963 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
964 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
962 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
963 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
964 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
965 | 965 | } |
966 | 966 | /** |
967 | 967 | * @deprecated |
968 | 968 | * @since 4.4.0 |
969 | 969 | */ |
970 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
971 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
972 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
970 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
971 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
972 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
973 | 973 | } |
974 | 974 | /** |
975 | 975 | * @deprecated |
976 | 976 | * @since 4.4.0 |
977 | 977 | */ |
978 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
979 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
980 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
978 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
979 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
980 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
981 | 981 | } |
982 | 982 | /** |
983 | 983 | * @deprecated |
984 | 984 | * @since 4.4.0 |
985 | 985 | */ |
986 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
987 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
988 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
986 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
987 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
988 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
989 | 989 | } |
990 | 990 | /** |
991 | 991 | * @deprecated |
992 | 992 | * @since 4.4.0 |
993 | 993 | */ |
994 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
995 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
996 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
994 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
995 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
996 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
997 | 997 | } |
998 | 998 | /** |
999 | 999 | * @deprecated |
1000 | 1000 | * @since 4.4.0 |
1001 | 1001 | */ |
1002 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
1003 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
1004 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
1002 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
1003 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1004 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
1005 | 1005 | } |
1006 | 1006 | /** |
1007 | 1007 | * @deprecated |
1008 | 1008 | * @since 4.4.0 |
1009 | 1009 | */ |
1010 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
1011 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
1012 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
1010 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
1011 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1012 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
1013 | 1013 | } |
1014 | 1014 | /** |
1015 | 1015 | * @deprecated |
1016 | 1016 | * @since 4.4.0 |
1017 | 1017 | */ |
1018 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
1019 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
1020 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
1018 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
1019 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1020 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
1021 | 1021 | } |
1022 | 1022 | /** |
1023 | 1023 | * @deprecated |
1024 | 1024 | * @since 4.4.0 |
1025 | 1025 | */ |
1026 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
1027 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
1028 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
1026 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
1027 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
1028 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | |
@@ -1056,8 +1056,8 @@ discard block |
||
1056 | 1056 | * @param string $extra_class |
1057 | 1057 | * @return string |
1058 | 1058 | */ |
1059 | -function espresso_event_list_css( $extra_class = '' ) { |
|
1060 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
1059 | +function espresso_event_list_css($extra_class = '') { |
|
1060 | + return EED_Events_Archive::event_list_css($extra_class); |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | /** |
@@ -1071,14 +1071,14 @@ discard block |
||
1071 | 1071 | * @return bool |
1072 | 1072 | */ |
1073 | 1073 | function espresso_display_full_description_in_event_list() { |
1074 | - return EED_Events_Archive::display_description( 2 ); |
|
1074 | + return EED_Events_Archive::display_description(2); |
|
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | /** |
1078 | 1078 | * @return bool |
1079 | 1079 | */ |
1080 | 1080 | function espresso_display_excerpt_in_event_list() { |
1081 | - return EED_Events_Archive::display_description( 1 ); |
|
1081 | + return EED_Events_Archive::display_description(1); |
|
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | /** |