@@ -1,26 +1,26 @@ |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | 2 | /** |
| 3 | - * Event Espresso |
|
| 4 | - * |
|
| 5 | - * Event Registration and Management Plugin for WordPress |
|
| 6 | - * |
|
| 7 | - * @ package Event Espresso |
|
| 8 | - * @ author Event Espresso |
|
| 9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 11 | - * @ link http://www.eventespresso.com |
|
| 12 | - * @ version 4.0 |
|
| 13 | - * |
|
| 14 | - * ------------------------------------------------------------------------ |
|
| 15 | - * |
|
| 16 | - * class EE_Request_Handler |
|
| 17 | - * |
|
| 18 | - * @package Event Espresso |
|
| 19 | - * @subpackage /core/ |
|
| 20 | - * @author Brent Christensen |
|
| 21 | - * |
|
| 22 | - * ------------------------------------------------------------------------ |
|
| 23 | - */ |
|
| 3 | + * Event Espresso |
|
| 4 | + * |
|
| 5 | + * Event Registration and Management Plugin for WordPress |
|
| 6 | + * |
|
| 7 | + * @ package Event Espresso |
|
| 8 | + * @ author Event Espresso |
|
| 9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 11 | + * @ link http://www.eventespresso.com |
|
| 12 | + * @ version 4.0 |
|
| 13 | + * |
|
| 14 | + * ------------------------------------------------------------------------ |
|
| 15 | + * |
|
| 16 | + * class EE_Request_Handler |
|
| 17 | + * |
|
| 18 | + * @package Event Espresso |
|
| 19 | + * @subpackage /core/ |
|
| 20 | + * @author Brent Christensen |
|
| 21 | + * |
|
| 22 | + * ------------------------------------------------------------------------ |
|
| 23 | + */ |
|
| 24 | 24 | final class EE_Request_Handler { |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | * @param WP $wp |
| 66 | 66 | * @return \EE_Request_Handler |
| 67 | 67 | */ |
| 68 | - public function __construct( $wp = null ) { |
|
| 68 | + public function __construct($wp = null) { |
|
| 69 | 69 | // grab request vars |
| 70 | 70 | // NOTE: WHEN MERGING TO 4.9 PLZ FAVOUR THE CHANGES IN 4.9 OVER THE FOLLOWING LINE |
| 71 | - $this->_params = array_merge( $_GET, $_POST ); |
|
| 71 | + $this->_params = array_merge($_GET, $_POST); |
|
| 72 | 72 | // AJAX ??? |
| 73 | - $this->ajax = defined( 'DOING_AJAX' ) ? true : false; |
|
| 74 | - $this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false; |
|
| 75 | - do_action( 'AHEE__EE_Request_Handler__construct__complete' ); |
|
| 73 | + $this->ajax = defined('DOING_AJAX') ? true : false; |
|
| 74 | + $this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false; |
|
| 75 | + do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | * @param WP $wp |
| 85 | 85 | * @return void |
| 86 | 86 | */ |
| 87 | - public function parse_request( $wp = null ) { |
|
| 87 | + public function parse_request($wp = null) { |
|
| 88 | 88 | //if somebody forgot to provide us with WP, that's ok because its global |
| 89 | - if ( ! $wp instanceof WP ) { |
|
| 89 | + if ( ! $wp instanceof WP) { |
|
| 90 | 90 | global $wp; |
| 91 | 91 | } |
| 92 | - $this->set_request_vars( $wp ); |
|
| 92 | + $this->set_request_vars($wp); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | * @param WP $wp |
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | - public function set_request_vars( $wp = null ) { |
|
| 105 | - if ( ! is_admin() ) { |
|
| 104 | + public function set_request_vars($wp = null) { |
|
| 105 | + if ( ! is_admin()) { |
|
| 106 | 106 | // set request post_id |
| 107 | - $this->set( 'post_id', $this->get_post_id_from_request( $wp )); |
|
| 107 | + $this->set('post_id', $this->get_post_id_from_request($wp)); |
|
| 108 | 108 | // set request post name |
| 109 | - $this->set( 'post_name', $this->get_post_name_from_request( $wp )); |
|
| 109 | + $this->set('post_name', $this->get_post_name_from_request($wp)); |
|
| 110 | 110 | // set request post_type |
| 111 | - $this->set( 'post_type', $this->get_post_type_from_request( $wp )); |
|
| 111 | + $this->set('post_type', $this->get_post_type_from_request($wp)); |
|
| 112 | 112 | // true or false ? is this page being used by EE ? |
| 113 | 113 | $this->set_espresso_page(); |
| 114 | 114 | } |
@@ -123,20 +123,20 @@ discard block |
||
| 123 | 123 | * @param WP $wp |
| 124 | 124 | * @return int |
| 125 | 125 | */ |
| 126 | - public function get_post_id_from_request( $wp = null ) { |
|
| 127 | - if ( ! $wp instanceof WP ){ |
|
| 126 | + public function get_post_id_from_request($wp = null) { |
|
| 127 | + if ( ! $wp instanceof WP) { |
|
| 128 | 128 | global $wp; |
| 129 | 129 | } |
| 130 | 130 | $post_id = null; |
| 131 | - if ( isset( $wp->query_vars['p'] )) { |
|
| 131 | + if (isset($wp->query_vars['p'])) { |
|
| 132 | 132 | $post_id = $wp->query_vars['p']; |
| 133 | 133 | } |
| 134 | - if ( ! $post_id && isset( $wp->query_vars['page_id'] )) { |
|
| 134 | + if ( ! $post_id && isset($wp->query_vars['page_id'])) { |
|
| 135 | 135 | $post_id = $wp->query_vars['page_id']; |
| 136 | 136 | } |
| 137 | - if ( ! $post_id && isset( $wp->request )) { |
|
| 138 | - if ( is_numeric( basename( $wp->request ))) { |
|
| 139 | - $post_id = basename( $wp->request ); |
|
| 137 | + if ( ! $post_id && isset($wp->request)) { |
|
| 138 | + if (is_numeric(basename($wp->request))) { |
|
| 139 | + $post_id = basename($wp->request); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | return $post_id; |
@@ -151,35 +151,35 @@ discard block |
||
| 151 | 151 | * @param WP $wp |
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | - public function get_post_name_from_request( $wp = null ) { |
|
| 155 | - if ( ! $wp instanceof WP ){ |
|
| 154 | + public function get_post_name_from_request($wp = null) { |
|
| 155 | + if ( ! $wp instanceof WP) { |
|
| 156 | 156 | global $wp; |
| 157 | 157 | } |
| 158 | 158 | $post_name = null; |
| 159 | - if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) { |
|
| 159 | + if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) { |
|
| 160 | 160 | $post_name = $wp->query_vars['name']; |
| 161 | 161 | } |
| 162 | - if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) { |
|
| 162 | + if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
| 163 | 163 | $post_name = $wp->query_vars['pagename']; |
| 164 | 164 | } |
| 165 | - if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) { |
|
| 166 | - $possible_post_name = basename( $wp->request ); |
|
| 167 | - if ( ! is_numeric( $possible_post_name )) { |
|
| 165 | + if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) { |
|
| 166 | + $possible_post_name = basename($wp->request); |
|
| 167 | + if ( ! is_numeric($possible_post_name)) { |
|
| 168 | 168 | /** @type WPDB $wpdb */ |
| 169 | 169 | global $wpdb; |
| 170 | 170 | $SQL = "SELECT ID from $wpdb->posts WHERE post_status='publish' AND post_name=%s"; |
| 171 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name )); |
|
| 172 | - if ( $possible_post_name ) { |
|
| 171 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name)); |
|
| 172 | + if ($possible_post_name) { |
|
| 173 | 173 | $post_name = $possible_post_name; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | - if ( ! $post_name && $this->get( 'post_id' )) { |
|
| 177 | + if ( ! $post_name && $this->get('post_id')) { |
|
| 178 | 178 | /** @type WPDB $wpdb */ |
| 179 | 179 | global $wpdb; |
| 180 | 180 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_status='publish' AND ID=%d"; |
| 181 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' ))); |
|
| 182 | - if( $possible_post_name ) { |
|
| 181 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id'))); |
|
| 182 | + if ($possible_post_name) { |
|
| 183 | 183 | $post_name = $possible_post_name; |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | * @param WP $wp |
| 196 | 196 | * @return mixed |
| 197 | 197 | */ |
| 198 | - public function get_post_type_from_request( $wp = null ) { |
|
| 199 | - if ( ! $wp instanceof WP ){ |
|
| 198 | + public function get_post_type_from_request($wp = null) { |
|
| 199 | + if ( ! $wp instanceof WP) { |
|
| 200 | 200 | global $wp; |
| 201 | 201 | } |
| 202 | - return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null; |
|
| 202 | + return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | |
@@ -209,18 +209,18 @@ discard block |
||
| 209 | 209 | * @param WP $wp |
| 210 | 210 | * @return bool|string|void |
| 211 | 211 | */ |
| 212 | - public function get_current_page_permalink( $wp = null ) { |
|
| 213 | - $post_id = $this->get_post_id_from_request( $wp ); |
|
| 214 | - if ( $post_id ) { |
|
| 215 | - $current_page_permalink = get_permalink( $post_id ); |
|
| 212 | + public function get_current_page_permalink($wp = null) { |
|
| 213 | + $post_id = $this->get_post_id_from_request($wp); |
|
| 214 | + if ($post_id) { |
|
| 215 | + $current_page_permalink = get_permalink($post_id); |
|
| 216 | 216 | } else { |
| 217 | - if ( ! $wp instanceof WP ) { |
|
| 217 | + if ( ! $wp instanceof WP) { |
|
| 218 | 218 | global $wp; |
| 219 | 219 | } |
| 220 | - if ( $wp->request ) { |
|
| 221 | - $current_page_permalink = site_url( $wp->request ); |
|
| 220 | + if ($wp->request) { |
|
| 221 | + $current_page_permalink = site_url($wp->request); |
|
| 222 | 222 | } else { |
| 223 | - $current_page_permalink = esc_url( site_url( $_SERVER[ 'REQUEST_URI' ] ) ); |
|
| 223 | + $current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI'])); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | return $current_page_permalink; |
@@ -237,41 +237,41 @@ discard block |
||
| 237 | 237 | public function test_for_espresso_page() { |
| 238 | 238 | global $wp; |
| 239 | 239 | /** @type EE_CPT_Strategy $EE_CPT_Strategy */ |
| 240 | - $EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
| 240 | + $EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy'); |
|
| 241 | 241 | $espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies(); |
| 242 | - if ( is_array( $espresso_CPT_taxonomies ) ) { |
|
| 243 | - foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) { |
|
| 244 | - if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) { |
|
| 242 | + if (is_array($espresso_CPT_taxonomies)) { |
|
| 243 | + foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) { |
|
| 244 | + if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) { |
|
| 245 | 245 | return true; |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | // load espresso CPT endpoints |
| 250 | 250 | $espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints(); |
| 251 | - $post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints ); |
|
| 252 | - $post_types = (array)$this->get( 'post_type' ); |
|
| 253 | - foreach ( $post_types as $post_type ) { |
|
| 251 | + $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints); |
|
| 252 | + $post_types = (array) $this->get('post_type'); |
|
| 253 | + foreach ($post_types as $post_type) { |
|
| 254 | 254 | // was a post name passed ? |
| 255 | - if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) { |
|
| 255 | + if (isset($post_type_CPT_endpoints[$post_type])) { |
|
| 256 | 256 | // kk we know this is an espresso page, but is it a specific post ? |
| 257 | - if ( ! $this->get( 'post_name' ) ) { |
|
| 257 | + if ( ! $this->get('post_name')) { |
|
| 258 | 258 | // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events |
| 259 | - $post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null; |
|
| 259 | + $post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null; |
|
| 260 | 260 | // if the post type matches on of our then set the endpoint |
| 261 | - if ( $post_name ) { |
|
| 262 | - $this->set( 'post_name', $post_name ); |
|
| 261 | + if ($post_name) { |
|
| 262 | + $this->set('post_name', $post_name); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | return true; |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | - if ( $this->get( 'post_name' )) { |
|
| 268 | + if ($this->get('post_name')) { |
|
| 269 | 269 | // load all pages using espresso shortcodes |
| 270 | - $post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
| 270 | + $post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
| 271 | 271 | // make sure core pages are included |
| 272 | - $espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes ); |
|
| 272 | + $espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes); |
|
| 273 | 273 | // was a post name passed ? |
| 274 | - if ( isset( $espresso_pages[ $this->get( 'post_name' ) ] )) { |
|
| 274 | + if (isset($espresso_pages[$this->get('post_name')])) { |
|
| 275 | 275 | return true; |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * @param null $value |
| 288 | 288 | * @return mixed |
| 289 | 289 | */ |
| 290 | - public function set_espresso_page( $value = null ) { |
|
| 290 | + public function set_espresso_page($value = null) { |
|
| 291 | 291 | $value = $value ? $value : $this->test_for_espresso_page(); |
| 292 | 292 | $this->_params['is_espresso_page'] = $value; |
| 293 | 293 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @return mixed |
| 302 | 302 | */ |
| 303 | 303 | public function is_espresso_page() { |
| 304 | - return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false; |
|
| 304 | + return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | |
@@ -325,10 +325,10 @@ discard block |
||
| 325 | 325 | * @param bool $override_ee |
| 326 | 326 | * @return void |
| 327 | 327 | */ |
| 328 | - public function set( $key, $value, $override_ee = false ) { |
|
| 328 | + public function set($key, $value, $override_ee = false) { |
|
| 329 | 329 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
| 330 | - if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) { |
|
| 331 | - $this->_params[ $key ] = $value; |
|
| 330 | + if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) { |
|
| 331 | + $this->_params[$key] = $value; |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | * @param null $default |
| 343 | 343 | * @return mixed |
| 344 | 344 | */ |
| 345 | - public function get( $key, $default = null ) { |
|
| 346 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
| 345 | + public function get($key, $default = null) { |
|
| 346 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | * @param $key |
| 356 | 356 | * @return boolean |
| 357 | 357 | */ |
| 358 | - public function is_set( $key ) { |
|
| 359 | - return isset( $this->_params[ $key ] ) ? true : false; |
|
| 358 | + public function is_set($key) { |
|
| 359 | + return isset($this->_params[$key]) ? true : false; |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | |
@@ -368,8 +368,8 @@ discard block |
||
| 368 | 368 | * @param $key |
| 369 | 369 | * @return void |
| 370 | 370 | */ |
| 371 | - public function un_set( $key ) { |
|
| 372 | - unset( $this->_params[ $key ] ); |
|
| 371 | + public function un_set($key) { |
|
| 372 | + unset($this->_params[$key]); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | * @param $value |
| 383 | 383 | * @return void |
| 384 | 384 | */ |
| 385 | - public function set_notice( $key, $value ) { |
|
| 386 | - $this->_notice[ $key ] = $value; |
|
| 385 | + public function set_notice($key, $value) { |
|
| 386 | + $this->_notice[$key] = $value; |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | * @param $key |
| 396 | 396 | * @return mixed |
| 397 | 397 | */ |
| 398 | - public function get_notice( $key ) { |
|
| 399 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null; |
|
| 398 | + public function get_notice($key) { |
|
| 399 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : null; |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | * @param $string |
| 409 | 409 | * @return void |
| 410 | 410 | */ |
| 411 | - public function add_output( $string ) { |
|
| 411 | + public function add_output($string) { |
|
| 412 | 412 | $this->_output .= $string; |
| 413 | 413 | } |
| 414 | 414 | |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | * @param $item |
| 431 | 431 | * @param $key |
| 432 | 432 | */ |
| 433 | - function sanitize_text_field_for_array_walk( &$item, &$key ) { |
|
| 434 | - $item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item ); |
|
| 433 | + function sanitize_text_field_for_array_walk(&$item, &$key) { |
|
| 434 | + $item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | * @param $b |
| 442 | 442 | * @return bool |
| 443 | 443 | */ |
| 444 | - public function __set($a,$b) { return false; } |
|
| 444 | + public function __set($a, $b) { return false; } |
|
| 445 | 445 | |
| 446 | 446 | |
| 447 | 447 | |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function __construct() { |
| 44 | 44 | // construct request stack and run middleware apps as soon as all WP plugins are loaded |
| 45 | - add_action( 'plugins_loaded', array( $this, 'run_request_stack' ), 0 ); |
|
| 45 | + add_action('plugins_loaded', array($this, 'run_request_stack'), 0); |
|
| 46 | 46 | // set framework for the rest of EE to hook into when loading |
| 47 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_espresso_addons' ), 1 ); |
|
| 48 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'detect_activations_or_upgrades' ), 3 ); |
|
| 49 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_core_configuration' ), 5 ); |
|
| 50 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
| 51 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'brew_espresso' ), 9 ); |
|
| 47 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1); |
|
| 48 | + add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3); |
|
| 49 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5); |
|
| 50 | + add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7); |
|
| 51 | + add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | new EE_Load_Espresso_Core() |
| 66 | 66 | ); |
| 67 | 67 | $this->_request_stack->handle_request( |
| 68 | - new EE_Request( $_GET, $_POST, $_COOKIE ), |
|
| 68 | + new EE_Request($_GET, $_POST, $_COOKIE), |
|
| 69 | 69 | new EE_Response() |
| 70 | 70 | ); |
| 71 | 71 | $this->_request_stack->handle_response(); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | protected function load_autoloader() { |
| 80 | 80 | // load interfaces |
| 81 | - espresso_load_required( 'EEH_Autoloader', EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' ); |
|
| 81 | + espresso_load_required('EEH_Autoloader', EE_CORE.'helpers'.DS.'EEH_Autoloader.helper.php'); |
|
| 82 | 82 | EEH_Autoloader::instance(); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected function set_autoloaders_for_required_files() { |
| 91 | 91 | // load interfaces |
| 92 | - espresso_load_required( 'EEI_Interfaces', EE_CORE . 'interfaces' . DS . 'EEI_Interfaces.php' ); |
|
| 92 | + espresso_load_required('EEI_Interfaces', EE_CORE.'interfaces'.DS.'EEI_Interfaces.php'); |
|
| 93 | 93 | // load helpers |
| 94 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_HELPERS ); |
|
| 94 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
| 95 | 95 | // load request stack |
| 96 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'request_stack' . DS ); |
|
| 96 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack'.DS); |
|
| 97 | 97 | // load middleware |
| 98 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'middleware' . DS ); |
|
| 98 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware'.DS); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | ) |
| 119 | 119 | ); |
| 120 | 120 | // load middleware onto stack : FILO (First In Last Out) |
| 121 | - foreach ( (array)$stack_apps as $stack_app ) { |
|
| 121 | + foreach ((array) $stack_apps as $stack_app) { |
|
| 122 | 122 | //$request_stack_builder->push( $stack_app ); |
| 123 | - $request_stack_builder->unshift( $stack_app ); |
|
| 123 | + $request_stack_builder->unshift($stack_app); |
|
| 124 | 124 | } |
| 125 | 125 | return apply_filters( |
| 126 | 126 | 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * no other logic should be performed at this point |
| 138 | 138 | */ |
| 139 | 139 | public static function load_espresso_addons() { |
| 140 | - do_action( 'AHEE__EE_Bootstrap__load_espresso_addons' ); |
|
| 140 | + do_action('AHEE__EE_Bootstrap__load_espresso_addons'); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * we can determine if anything needs activating or upgrading |
| 150 | 150 | */ |
| 151 | 151 | public static function detect_activations_or_upgrades() { |
| 152 | - do_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' ); |
|
| 152 | + do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * we can load and set all of the system configurations |
| 162 | 162 | */ |
| 163 | 163 | public static function load_core_configuration() { |
| 164 | - do_action( 'AHEE__EE_Bootstrap__load_core_configuration' ); |
|
| 164 | + do_action('AHEE__EE_Bootstrap__load_core_configuration'); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * so that they are ready to be used throughout the system |
| 174 | 174 | */ |
| 175 | 175 | public static function register_shortcodes_modules_and_widgets() { |
| 176 | - do_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' ); |
|
| 176 | + do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * so let the fun begin... |
| 186 | 186 | */ |
| 187 | 187 | public static function brew_espresso() { |
| 188 | - do_action( 'AHEE__EE_Bootstrap__brew_espresso' ); |
|
| 188 | + do_action('AHEE__EE_Bootstrap__brew_espresso'); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
@@ -60,15 +60,15 @@ discard block |
||
| 60 | 60 | * @param array $post |
| 61 | 61 | * @param array $cookie |
| 62 | 62 | */ |
| 63 | - public function __construct( $get, $post, $cookie ) { |
|
| 63 | + public function __construct($get, $post, $cookie) { |
|
| 64 | 64 | // grab request vars |
| 65 | 65 | $this->_get = $get; |
| 66 | 66 | $this->_post = $post; |
| 67 | 67 | $this->_cookie = $cookie; |
| 68 | - $this->_params = array_merge( $get, $post ); |
|
| 68 | + $this->_params = array_merge($get, $post); |
|
| 69 | 69 | // AJAX ??? |
| 70 | - $this->ajax = defined( 'DOING_AJAX' ) ? true : false; |
|
| 71 | - $this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false; |
|
| 70 | + $this->ajax = defined('DOING_AJAX') ? true : false; |
|
| 71 | + $this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | * @param bool $override_ee |
| 120 | 120 | * @return void |
| 121 | 121 | */ |
| 122 | - public function set( $key, $value, $override_ee = FALSE ) { |
|
| 122 | + public function set($key, $value, $override_ee = FALSE) { |
|
| 123 | 123 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
| 124 | - if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) { |
|
| 125 | - $this->_params[ $key ] = $value; |
|
| 124 | + if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) { |
|
| 125 | + $this->_params[$key] = $value; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * @param null $default |
| 137 | 137 | * @return mixed |
| 138 | 138 | */ |
| 139 | - public function get( $key, $default = NULL ) { |
|
| 140 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
| 139 | + public function get($key, $default = NULL) { |
|
| 140 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | * @param $key |
| 150 | 150 | * @return boolean |
| 151 | 151 | */ |
| 152 | - public function is_set( $key ) { |
|
| 153 | - return isset( $this->_params[ $key ] ) ? TRUE : FALSE; |
|
| 152 | + public function is_set($key) { |
|
| 153 | + return isset($this->_params[$key]) ? TRUE : FALSE; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | * @param $key |
| 163 | 163 | * @param bool $unset_from_global_too |
| 164 | 164 | */ |
| 165 | - public function un_set( $key, $unset_from_global_too = false ) { |
|
| 166 | - unset( $this->_params[ $key ] ); |
|
| 167 | - if ( $unset_from_global_too ) { |
|
| 168 | - unset( $_REQUEST[ $key ] ); |
|
| 165 | + public function un_set($key, $unset_from_global_too = false) { |
|
| 166 | + unset($this->_params[$key]); |
|
| 167 | + if ($unset_from_global_too) { |
|
| 168 | + unset($_REQUEST[$key]); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |