@@ -26,7 +26,7 @@ |
||
26 | 26 | * just checks the field isn't blank |
27 | 27 | * |
28 | 28 | * @param $normalized_value |
29 | - * @return bool |
|
29 | + * @return boolean|null |
|
30 | 30 | * @throws \EE_Validation_Error |
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
@@ -283,7 +283,7 @@ |
||
283 | 283 | $current_post = basename( $current_post ); |
284 | 284 | // are we on a category page? |
285 | 285 | $term_exists = is_array( term_exists( $current_post, 'category' ) ) |
286 | - || $this->_is_espresso_category( $WP->query_vars ); |
|
286 | + || $this->_is_espresso_category( $WP->query_vars ); |
|
287 | 287 | // make sure shortcodes are set |
288 | 288 | if ( isset( $this->Registry->CFG->core->post_shortcodes )) { |
289 | 289 | if ( ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Event Espresso |
4 | 4 | * |
@@ -75,37 +75,37 @@ discard block |
||
75 | 75 | $this->Request_Handler = $Request_Handler; |
76 | 76 | $this->Module_Request_Router = $Module_Request_Router; |
77 | 77 | // make sure template tags are loaded immediately so that themes don't break |
78 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
78 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
79 | 79 | // determine how to integrate WP_Query with the EE models |
80 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
80 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
81 | 81 | // load other resources and begin to actually run shortcodes and modules |
82 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
82 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
83 | 83 | // analyse the incoming WP request |
84 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
84 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
85 | 85 | // process any content shortcodes |
86 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
86 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
87 | 87 | // process request with module factory |
88 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
88 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
89 | 89 | // before headers sent |
90 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
90 | + add_action('wp', array($this, 'wp'), 5); |
|
91 | 91 | // load css and js |
92 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 ); |
|
92 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1); |
|
93 | 93 | // header |
94 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
95 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
94 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
95 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
96 | 96 | // display errors |
97 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
97 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
98 | 98 | // the content |
99 | 99 | // add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
100 | 100 | //exclude our private cpt comments |
101 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
101 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
102 | 102 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
103 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
103 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
104 | 104 | // action hook EE |
105 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
105 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
106 | 106 | // for checking that browser cookies are enabled |
107 | - if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) { |
|
108 | - setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' ); |
|
107 | + if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) { |
|
108 | + setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/'); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | * @return void |
142 | 142 | */ |
143 | 143 | public function load_espresso_template_tags() { |
144 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
145 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
144 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
145 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
158 | 158 | * @return array array of comment clauses with modifications. |
159 | 159 | */ |
160 | - public function filter_wp_comments( $clauses ) { |
|
160 | + public function filter_wp_comments($clauses) { |
|
161 | 161 | global $wpdb; |
162 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
162 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
163 | 163 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
164 | - foreach ( $cpts as $cpt => $details ) { |
|
165 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
164 | + foreach ($cpts as $cpt => $details) { |
|
165 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | return $clauses; |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * @return void |
180 | 180 | */ |
181 | 181 | public function employ_CPT_Strategy() { |
182 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
183 | - $this->Registry->load_core( 'CPT_Strategy' ); |
|
182 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
183 | + $this->Registry->load_core('CPT_Strategy'); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | * @param string $url incoming url |
193 | 193 | * @return string final assembled url |
194 | 194 | */ |
195 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
196 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
197 | - $url = str_replace( 'http://', 'https://', $url ); |
|
195 | + public function maybe_force_admin_ajax_ssl($url) { |
|
196 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
197 | + $url = str_replace('http://', 'https://', $url); |
|
198 | 198 | } |
199 | 199 | return $url; |
200 | 200 | } |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @param WP $WP |
232 | 232 | * @return void |
233 | 233 | */ |
234 | - public function get_request( WP $WP ) { |
|
235 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
236 | - $this->Request_Handler->parse_request( $WP ); |
|
237 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
234 | + public function get_request(WP $WP) { |
|
235 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
236 | + $this->Request_Handler->parse_request($WP); |
|
237 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -246,24 +246,24 @@ discard block |
||
246 | 246 | * @param WP $WP |
247 | 247 | * @return void |
248 | 248 | */ |
249 | - public function _initialize_shortcodes( WP $WP ) { |
|
250 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
251 | - $this->Request_Handler->set_request_vars( $WP ); |
|
249 | + public function _initialize_shortcodes(WP $WP) { |
|
250 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
251 | + $this->Request_Handler->set_request_vars($WP); |
|
252 | 252 | // grab post_name from request |
253 | 253 | $current_post = apply_filters( |
254 | 254 | 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', |
255 | - $this->Request_Handler->get( 'post_name' ) |
|
255 | + $this->Request_Handler->get('post_name') |
|
256 | 256 | ); |
257 | - $show_on_front = get_option( 'show_on_front' ); |
|
257 | + $show_on_front = get_option('show_on_front'); |
|
258 | 258 | // if it's not set, then check if frontpage is blog |
259 | - if ( empty( $current_post ) ) { |
|
259 | + if (empty($current_post)) { |
|
260 | 260 | // yup.. this is the posts page, prepare to load all shortcode modules |
261 | 261 | $current_post = 'posts'; |
262 | 262 | // unless.. |
263 | - if ( $show_on_front === 'page' ) { |
|
263 | + if ($show_on_front === 'page') { |
|
264 | 264 | // some other page is set as the homepage |
265 | - $page_on_front = get_option( 'page_on_front' ); |
|
266 | - if ( $page_on_front ) { |
|
265 | + $page_on_front = get_option('page_on_front'); |
|
266 | + if ($page_on_front) { |
|
267 | 267 | // k now we need to find the post_name for this page |
268 | 268 | global $wpdb; |
269 | 269 | $page_on_front = $wpdb->get_var( |
@@ -280,17 +280,17 @@ discard block |
||
280 | 280 | // where are posts being displayed ? |
281 | 281 | $page_for_posts = EE_Config::get_page_for_posts(); |
282 | 282 | // in case $current_post is hierarchical like: /parent-page/current-page |
283 | - $current_post = basename( $current_post ); |
|
283 | + $current_post = basename($current_post); |
|
284 | 284 | // are we on a category page? |
285 | - $term_exists = is_array( term_exists( $current_post, 'category' ) ) |
|
286 | - || $this->_is_espresso_category( $WP->query_vars ); |
|
285 | + $term_exists = is_array(term_exists($current_post, 'category')) |
|
286 | + || $this->_is_espresso_category($WP->query_vars); |
|
287 | 287 | // make sure shortcodes are set |
288 | - if ( isset( $this->Registry->CFG->core->post_shortcodes )) { |
|
289 | - if ( ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
290 | - $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
288 | + if (isset($this->Registry->CFG->core->post_shortcodes)) { |
|
289 | + if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) { |
|
290 | + $this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
291 | 291 | } |
292 | 292 | // cycle thru all posts with shortcodes set |
293 | - foreach ( $this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
293 | + foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
294 | 294 | $this->_process_post_shortcodes( |
295 | 295 | $post_shortcodes, |
296 | 296 | $term_exists, |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | ); |
302 | 302 | } |
303 | 303 | } |
304 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
304 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | * @param array $query_vars |
311 | 311 | * @return bool |
312 | 312 | */ |
313 | - protected function _is_espresso_category( $query_vars ) { |
|
313 | + protected function _is_espresso_category($query_vars) { |
|
314 | 314 | $taxonomies = EE_Register_CPTs::get_taxonomies(); |
315 | 315 | // $taxonomies = array_keys( $taxonomies ); |
316 | - foreach ( $query_vars as $query_var => $category ) { |
|
317 | - if ( isset( $taxonomies[ $query_var ] ) ) { |
|
316 | + foreach ($query_vars as $query_var => $category) { |
|
317 | + if (isset($taxonomies[$query_var])) { |
|
318 | 318 | return true; |
319 | 319 | } |
320 | 320 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $page_for_posts, |
340 | 340 | $post_name, |
341 | 341 | $WP |
342 | - ){ |
|
342 | + ) { |
|
343 | 343 | static $processed = array(); |
344 | 344 | // filter shortcodes so |
345 | 345 | $post_shortcodes = (array) apply_filters( |
@@ -347,10 +347,10 @@ discard block |
||
347 | 347 | $post_shortcodes |
348 | 348 | ); |
349 | 349 | // now cycle thru shortcodes |
350 | - foreach ( $post_shortcodes as $shortcode_class => $post_id ) { |
|
350 | + foreach ($post_shortcodes as $shortcode_class => $post_id) { |
|
351 | 351 | if ( |
352 | 352 | // we have already processed this shortcode |
353 | - isset( $processed[ $shortcode_class ] ) |
|
353 | + isset($processed[$shortcode_class]) |
|
354 | 354 | || ( |
355 | 355 | // or we're on a tag or category page |
356 | 356 | $term_exists |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | continue; |
370 | 370 | } |
371 | 371 | // are we on this page, or on the blog page, or an EE CPT category page ? |
372 | - if ( $current_post === $post_name || $term_exists ) { |
|
372 | + if ($current_post === $post_name || $term_exists) { |
|
373 | 373 | // maybe init the shortcode |
374 | 374 | if ( |
375 | 375 | $this->initialize_shortcode_if_active_on_page( |
@@ -381,18 +381,18 @@ discard block |
||
381 | 381 | $WP |
382 | 382 | ) |
383 | 383 | ) { |
384 | - $processed[ $shortcode_class ] = true; |
|
384 | + $processed[$shortcode_class] = true; |
|
385 | 385 | } |
386 | 386 | // if this is NOT the "Posts page" and we have a valid entry |
387 | 387 | // for the "Posts page" in our tracked post_shortcodes array |
388 | 388 | // but the shortcode is not being tracked for this page |
389 | 389 | } else if ( |
390 | 390 | $post_name !== $page_for_posts |
391 | - && isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) |
|
392 | - && ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) |
|
391 | + && isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts]) |
|
392 | + && ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class]) |
|
393 | 393 | ) { |
394 | 394 | // then remove the "fallback" shortcode processor |
395 | - remove_shortcode( $shortcode_class ); |
|
395 | + remove_shortcode($shortcode_class); |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | } |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | $WP |
418 | 418 | ) { |
419 | 419 | // verify shortcode is in list of registered shortcodes |
420 | - if ( ! isset( $this->Registry->shortcodes->{$shortcode_class} ) ) { |
|
421 | - if ( $current_post !== $page_for_posts && current_user_can( 'edit_post', $post_id ) ) { |
|
420 | + if ( ! isset($this->Registry->shortcodes->{$shortcode_class} )) { |
|
421 | + if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
422 | 422 | EE_Error::add_error( |
423 | 423 | sprintf( |
424 | 424 | __( |
@@ -431,24 +431,24 @@ discard block |
||
431 | 431 | __FUNCTION__, |
432 | 432 | __LINE__ |
433 | 433 | ); |
434 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
434 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
435 | 435 | } |
436 | - add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' ) ); |
|
436 | + add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
437 | 437 | return false; |
438 | 438 | } |
439 | 439 | // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ? |
440 | 440 | if ( |
441 | 441 | $term_exists |
442 | 442 | || $current_post === $page_for_posts |
443 | - || isset( $this->Registry->CFG->core->post_shortcodes[ $current_post ] ) |
|
443 | + || isset($this->Registry->CFG->core->post_shortcodes[$current_post]) |
|
444 | 444 | ) { |
445 | 445 | // let's pause to reflect on this... |
446 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class ); |
|
446 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_class); |
|
447 | 447 | // ensure that class is actually a shortcode |
448 | 448 | if ( |
449 | - defined( 'WP_DEBUG' ) |
|
449 | + defined('WP_DEBUG') |
|
450 | 450 | && WP_DEBUG === true |
451 | - && ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) |
|
451 | + && ! $sc_reflector->isSubclassOf('EES_Shortcode') |
|
452 | 452 | ) { |
453 | 453 | EE_Error::add_error( |
454 | 454 | sprintf( |
@@ -462,13 +462,13 @@ discard block |
||
462 | 462 | __FUNCTION__, |
463 | 463 | __LINE__ |
464 | 464 | ); |
465 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
465 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
466 | 466 | return false; |
467 | 467 | } |
468 | 468 | // and pass the request object to the run method |
469 | 469 | $this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
470 | 470 | // fire the shortcode class's run method, so that it can activate resources |
471 | - $this->Registry->shortcodes->{$shortcode_class}->run( $WP ); |
|
471 | + $this->Registry->shortcodes->{$shortcode_class}->run($WP); |
|
472 | 472 | return true; |
473 | 473 | } |
474 | 474 | return false; |
@@ -483,19 +483,19 @@ discard block |
||
483 | 483 | * @param WP_Query $WP_Query |
484 | 484 | * @return void |
485 | 485 | */ |
486 | - public function pre_get_posts( $WP_Query ) { |
|
486 | + public function pre_get_posts($WP_Query) { |
|
487 | 487 | // only load Module_Request_Router if this is the main query |
488 | 488 | if ( |
489 | 489 | $this->Module_Request_Router instanceof EE_Module_Request_Router |
490 | 490 | && $WP_Query->is_main_query() |
491 | 491 | ) { |
492 | 492 | // cycle thru module routes |
493 | - while ( $route = $this->Module_Request_Router->get_route( $WP_Query )) { |
|
493 | + while ($route = $this->Module_Request_Router->get_route($WP_Query)) { |
|
494 | 494 | // determine module and method for route |
495 | - $module = $this->Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
496 | - if( $module instanceof EED_Module ) { |
|
495 | + $module = $this->Module_Request_Router->resolve_route($route[0], $route[1]); |
|
496 | + if ($module instanceof EED_Module) { |
|
497 | 497 | // get registered view for route |
498 | - $this->_template_path = $this->Module_Request_Router->get_view( $route ); |
|
498 | + $this->_template_path = $this->Module_Request_Router->get_view($route); |
|
499 | 499 | // grab module name |
500 | 500 | $module_name = $module->module_name(); |
501 | 501 | // map the module to the module objects |
@@ -537,29 +537,29 @@ discard block |
||
537 | 537 | public function wp_enqueue_scripts() { |
538 | 538 | |
539 | 539 | // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_css', '__return_false' ); |
540 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
540 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
541 | 541 | |
542 | 542 | $this->Registry->CFG->template_settings->enable_default_style = TRUE; |
543 | 543 | //Load the ThemeRoller styles if enabled |
544 | - if ( isset( $this->Registry->CFG->template_settings->enable_default_style ) && $this->Registry->CFG->template_settings->enable_default_style ) { |
|
544 | + if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) { |
|
545 | 545 | |
546 | 546 | //Load custom style sheet if available |
547 | - if ( isset( $this->Registry->CFG->template_settings->custom_style_sheet )) { |
|
548 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
547 | + if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) { |
|
548 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
549 | 549 | wp_enqueue_style('espresso_custom_css'); |
550 | 550 | } |
551 | 551 | |
552 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
553 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
552 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
553 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
554 | 554 | } else { |
555 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
555 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
556 | 556 | } |
557 | 557 | wp_enqueue_style('espresso_default'); |
558 | 558 | |
559 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
560 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
559 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
560 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
561 | 561 | } else { |
562 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
562 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | } |
@@ -567,38 +567,38 @@ discard block |
||
567 | 567 | } |
568 | 568 | |
569 | 569 | // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_js', '__return_false' ); |
570 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
570 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
571 | 571 | |
572 | - wp_enqueue_script( 'jquery' ); |
|
572 | + wp_enqueue_script('jquery'); |
|
573 | 573 | //let's make sure that all required scripts have been setup |
574 | - if ( function_exists( 'wp_script_is' ) && ! wp_script_is( 'jquery' )) { |
|
574 | + if (function_exists('wp_script_is') && ! wp_script_is('jquery')) { |
|
575 | 575 | $msg = sprintf( |
576 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
576 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
577 | 577 | '<em><br />', |
578 | 578 | '</em>' |
579 | 579 | ); |
580 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
580 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
581 | 581 | } |
582 | 582 | // load core js |
583 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
584 | - wp_enqueue_script( 'espresso_core' ); |
|
585 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
583 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
584 | + wp_enqueue_script('espresso_core'); |
|
585 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
586 | 586 | |
587 | 587 | } |
588 | 588 | |
589 | 589 | //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
590 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
590 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
591 | 591 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
592 | 592 | } |
593 | 593 | |
594 | 594 | |
595 | 595 | //accounting.js library |
596 | 596 | // @link http://josscrowcroft.github.io/accounting.js/ |
597 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
598 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
599 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
600 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
601 | - wp_enqueue_script( 'ee-accounting' ); |
|
597 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
598 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
599 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
601 | + wp_enqueue_script('ee-accounting'); |
|
602 | 602 | |
603 | 603 | $currency_config = array( |
604 | 604 | 'currency' => array( |
@@ -621,21 +621,21 @@ discard block |
||
621 | 621 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
622 | 622 | } |
623 | 623 | |
624 | - if ( ! function_exists( 'wp_head' )) { |
|
624 | + if ( ! function_exists('wp_head')) { |
|
625 | 625 | $msg = sprintf( |
626 | - __( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
626 | + __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
627 | 627 | '<em><br />', |
628 | 628 | '</em>' |
629 | 629 | ); |
630 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
630 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
631 | 631 | } |
632 | - if ( ! function_exists( 'wp_footer' )) { |
|
632 | + if ( ! function_exists('wp_footer')) { |
|
633 | 633 | $msg = sprintf( |
634 | - __( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
634 | + __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
635 | 635 | '<em><br />', |
636 | 636 | '</em>' |
637 | 637 | ); |
638 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
638 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | } |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | * @return void |
650 | 650 | */ |
651 | 651 | public function header_meta_tag() { |
652 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
652 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | |
@@ -690,10 +690,10 @@ discard block |
||
690 | 690 | */ |
691 | 691 | public function display_errors() { |
692 | 692 | static $shown_already = FALSE; |
693 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
693 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
694 | 694 | if ( |
695 | 695 | ! $shown_already |
696 | - && apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) |
|
696 | + && apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) |
|
697 | 697 | && is_main_query() |
698 | 698 | && ! is_feed() |
699 | 699 | && in_the_loop() |
@@ -701,9 +701,9 @@ discard block |
||
701 | 701 | ) { |
702 | 702 | echo EE_Error::get_notices(); |
703 | 703 | $shown_already = TRUE; |
704 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
704 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
705 | 705 | } |
706 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
706 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | |
@@ -718,12 +718,12 @@ discard block |
||
718 | 718 | * @param string $template_include_path |
719 | 719 | * @return string |
720 | 720 | */ |
721 | - public function template_include( $template_include_path = NULL ) { |
|
722 | - if ( $this->Request_Handler->is_espresso_page() ) { |
|
723 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
724 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
725 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
726 | - $this->_template = basename( $this->_template_path ); |
|
721 | + public function template_include($template_include_path = NULL) { |
|
722 | + if ($this->Request_Handler->is_espresso_page()) { |
|
723 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
724 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
725 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
726 | + $this->_template = basename($this->_template_path); |
|
727 | 727 | return $this->_template_path; |
728 | 728 | } |
729 | 729 | return $template_include_path; |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * @param bool $with_path |
739 | 739 | * @return string |
740 | 740 | */ |
741 | - public function get_selected_template( $with_path = FALSE ) { |
|
741 | + public function get_selected_template($with_path = FALSE) { |
|
742 | 742 | return $with_path ? $this->_template_path : $this->_template; |
743 | 743 | } |
744 | 744 |