@@ -137,11 +137,11 @@ |
||
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
140 | - * private constructor to prevent direct creation |
|
141 | - * @Constructor |
|
142 | - * @access private |
|
143 | - * @return EE_Session |
|
144 | - */ |
|
140 | + * private constructor to prevent direct creation |
|
141 | + * @Constructor |
|
142 | + * @access private |
|
143 | + * @return EE_Session |
|
144 | + */ |
|
145 | 145 | private function __construct() { |
146 | 146 | |
147 | 147 | // session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -do_action( 'AHEE_log', __FILE__, ' FILE LOADED', '' ); |
|
2 | +do_action('AHEE_log', __FILE__, ' FILE LOADED', ''); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Event Espresso |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * array for defining default session vars |
97 | 97 | * @var array |
98 | 98 | */ |
99 | - private $_default_session_vars = array ( |
|
99 | + private $_default_session_vars = array( |
|
100 | 100 | 'id' => NULL, |
101 | 101 | 'user_id' => NULL, |
102 | 102 | 'ip_address' => NULL, |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | * @access public |
119 | 119 | * @return EE_Session |
120 | 120 | */ |
121 | - public static function instance ( ) { |
|
121 | + public static function instance( ) { |
|
122 | 122 | // check if class object is instantiated |
123 | - if ( ! self::$_instance instanceof EE_Session ) { |
|
123 | + if ( ! self::$_instance instanceof EE_Session) { |
|
124 | 124 | self::$_instance = new self(); |
125 | 125 | } |
126 | 126 | return self::$_instance; |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | private function __construct() { |
138 | 138 | |
139 | 139 | // session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' ); |
140 | - if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) { |
|
140 | + if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) { |
|
141 | 141 | return NULL; |
142 | 142 | } |
143 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'instantiated' ); |
|
144 | - define( 'ESPRESSO_SESSION', TRUE ); |
|
143 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, 'instantiated'); |
|
144 | + define('ESPRESSO_SESSION', TRUE); |
|
145 | 145 | // default session lifespan in seconds |
146 | 146 | $this->_lifespan = apply_filters( |
147 | 147 | 'FHEE__EE_Session__construct___lifespan', |
@@ -154,35 +154,35 @@ discard block |
||
154 | 154 | * } |
155 | 155 | */ |
156 | 156 | // retrieve session options from db |
157 | - $session_settings = get_option( 'ee_session_settings' ); |
|
158 | - if ( $session_settings !== FALSE ) { |
|
157 | + $session_settings = get_option('ee_session_settings'); |
|
158 | + if ($session_settings !== FALSE) { |
|
159 | 159 | // cycle though existing session options |
160 | - foreach ( $session_settings as $var_name => $session_setting ) { |
|
160 | + foreach ($session_settings as $var_name => $session_setting) { |
|
161 | 161 | // set values for class properties |
162 | 162 | $this->_{$var_name} = $session_setting; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | // are we using encryption? |
166 | - if ( $this->_use_encryption ) { |
|
166 | + if ($this->_use_encryption) { |
|
167 | 167 | // instantiate the class object making all properties and methods accessible via $this->encryption ex: $this->encryption->encrypt(); |
168 | - $this->encryption = EE_Registry::instance()->load_core( 'Encryption' ); |
|
168 | + $this->encryption = EE_Registry::instance()->load_core('Encryption'); |
|
169 | 169 | } |
170 | 170 | // filter hook allows outside functions/classes/plugins to change default empty cart |
171 | - $extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() ); |
|
172 | - array_merge( $this->_default_session_vars, $extra_default_session_vars ); |
|
171 | + $extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array()); |
|
172 | + array_merge($this->_default_session_vars, $extra_default_session_vars); |
|
173 | 173 | // apply default session vars |
174 | 174 | $this->_set_defaults(); |
175 | 175 | // check for existing session and retrieve it from db |
176 | - if ( ! $this->_espresso_session() ) { |
|
176 | + if ( ! $this->_espresso_session()) { |
|
177 | 177 | // or just start a new one |
178 | 178 | $this->_create_espresso_session(); |
179 | 179 | } |
180 | 180 | |
181 | 181 | // check request for 'clear_session' param |
182 | - add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' )); |
|
182 | + add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded')); |
|
183 | 183 | // once everything is all said and done, |
184 | - add_action( 'shutdown', array( $this, 'update' ), 100 ); |
|
185 | - add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 ); |
|
184 | + add_action('shutdown', array($this, 'update'), 100); |
|
185 | + add_action('shutdown', array($this, 'garbage_collection'), 999); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function _set_defaults() { |
216 | 216 | // set some defaults |
217 | - foreach ( $this->_default_session_vars as $key => $default_var ) { |
|
218 | - if ( is_array( $default_var )) { |
|
219 | - $this->_session_data[ $key ] = array(); |
|
217 | + foreach ($this->_default_session_vars as $key => $default_var) { |
|
218 | + if (is_array($default_var)) { |
|
219 | + $this->_session_data[$key] = array(); |
|
220 | 220 | } else { |
221 | - $this->_session_data[ $key ] = ''; |
|
221 | + $this->_session_data[$key] = ''; |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @param \EE_Cart $cart |
241 | 241 | * @return bool |
242 | 242 | */ |
243 | - public function set_cart( EE_Cart $cart ) { |
|
243 | + public function set_cart(EE_Cart $cart) { |
|
244 | 244 | $this->_session_data['cart'] = $cart; |
245 | 245 | return TRUE; |
246 | 246 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return \EE_Cart |
261 | 261 | */ |
262 | 262 | public function cart() { |
263 | - return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL; |
|
263 | + return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param \EE_Checkout $checkout |
270 | 270 | * @return bool |
271 | 271 | */ |
272 | - public function set_checkout( EE_Checkout $checkout ) { |
|
272 | + public function set_checkout(EE_Checkout $checkout) { |
|
273 | 273 | $this->_session_data['checkout'] = $checkout; |
274 | 274 | return TRUE; |
275 | 275 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @return \EE_Checkout |
290 | 290 | */ |
291 | 291 | public function checkout() { |
292 | - return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL; |
|
292 | + return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | * @param \EE_Transaction $transaction |
299 | 299 | * @return bool |
300 | 300 | */ |
301 | - public function set_transaction( EE_Transaction $transaction ) { |
|
301 | + public function set_transaction(EE_Transaction $transaction) { |
|
302 | 302 | // first remove the session from the transaction before we save the transaction in the session |
303 | - $transaction->set_txn_session_data( NULL ); |
|
303 | + $transaction->set_txn_session_data(NULL); |
|
304 | 304 | $this->_session_data['transaction'] = $transaction; |
305 | 305 | return TRUE; |
306 | 306 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @return \EE_Transaction |
321 | 321 | */ |
322 | 322 | public function transaction() { |
323 | - return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL; |
|
323 | + return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | |
@@ -332,15 +332,15 @@ discard block |
||
332 | 332 | * @param bool $reset_cache |
333 | 333 | * @return array |
334 | 334 | */ |
335 | - public function get_session_data( $key = NULL, $reset_cache = FALSE ) { |
|
336 | - if ( $reset_cache ) { |
|
335 | + public function get_session_data($key = NULL, $reset_cache = FALSE) { |
|
336 | + if ($reset_cache) { |
|
337 | 337 | $this->reset_cart(); |
338 | 338 | $this->reset_checkout(); |
339 | 339 | $this->reset_transaction(); |
340 | 340 | } |
341 | - if ( ! empty( $key )) { |
|
342 | - return isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL; |
|
343 | - } else { |
|
341 | + if ( ! empty($key)) { |
|
342 | + return isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL; |
|
343 | + } else { |
|
344 | 344 | return $this->_session_data; |
345 | 345 | } |
346 | 346 | } |
@@ -353,20 +353,20 @@ discard block |
||
353 | 353 | * @param array $data |
354 | 354 | * @return TRUE on success, FALSE on fail |
355 | 355 | */ |
356 | - public function set_session_data( $data ) { |
|
356 | + public function set_session_data($data) { |
|
357 | 357 | |
358 | 358 | // nothing ??? bad data ??? go home! |
359 | - if ( empty( $data ) || ! is_array( $data )) { |
|
360 | - EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
359 | + if (empty($data) || ! is_array($data)) { |
|
360 | + EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
361 | 361 | return FALSE; |
362 | 362 | } |
363 | 363 | |
364 | - foreach ( $data as $key =>$value ) { |
|
365 | - if ( isset( $this->_default_session_vars[ $key ] )) { |
|
366 | - EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ ); |
|
364 | + foreach ($data as $key =>$value) { |
|
365 | + if (isset($this->_default_session_vars[$key])) { |
|
366 | + EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__); |
|
367 | 367 | return FALSE; |
368 | 368 | } else { |
369 | - $this->_session_data[ $key ] = $value; |
|
369 | + $this->_session_data[$key] = $value; |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
@@ -386,46 +386,46 @@ discard block |
||
386 | 386 | private function _espresso_session() { |
387 | 387 | |
388 | 388 | // is the SID being passed explicitly ? |
389 | - if ( isset( $_REQUEST['EESID'] )) { |
|
390 | - session_id( sanitize_text_field( $_REQUEST['EESID'] )); |
|
389 | + if (isset($_REQUEST['EESID'])) { |
|
390 | + session_id(sanitize_text_field($_REQUEST['EESID'])); |
|
391 | 391 | } |
392 | 392 | // check that session has started |
393 | - if ( session_id() === '' ) { |
|
393 | + if (session_id() === '') { |
|
394 | 394 | //starts a new session if one doesn't already exist, or re-initiates an existing one |
395 | 395 | session_start(); |
396 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'Session Start' ); |
|
396 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, 'Session Start'); |
|
397 | 397 | } |
398 | 398 | // grab the session ID |
399 | 399 | $this->_sid = session_id(); |
400 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'SID='. $this->_sid ); |
|
400 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, 'SID='.$this->_sid); |
|
401 | 401 | // and the visitors IP |
402 | 402 | $this->_ip_address = $this->_visitor_ip(); |
403 | 403 | // set the "user agent" |
404 | - $this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE; |
|
404 | + $this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE; |
|
405 | 405 | // now let's retrieve what's in the db |
406 | 406 | // we're using WP's Transient API to store session data using the PHP session ID as the option name |
407 | - $session_data = get_transient( 'ee_ssn_' . $this->_sid ); |
|
408 | - if ( $session_data ) { |
|
407 | + $session_data = get_transient('ee_ssn_'.$this->_sid); |
|
408 | + if ($session_data) { |
|
409 | 409 | // un-encrypt the data |
410 | - $session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data; |
|
410 | + $session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data; |
|
411 | 411 | // unserialize |
412 | - $session_data = maybe_unserialize( $session_data ); |
|
412 | + $session_data = maybe_unserialize($session_data); |
|
413 | 413 | // just a check to make sure the session array is indeed an array |
414 | - if ( ! is_array( $session_data ) ) { |
|
414 | + if ( ! is_array($session_data)) { |
|
415 | 415 | // no?!?! then something is wrong |
416 | 416 | return FALSE; |
417 | 417 | } |
418 | 418 | // get the current time in UTC |
419 | - $this->_time = isset( $this->_time ) ? $this->_time : time(); |
|
419 | + $this->_time = isset($this->_time) ? $this->_time : time(); |
|
420 | 420 | // and reset the session expiration |
421 | - $this->_expiration = isset( $session_data['expiration'] ) ? |
|
421 | + $this->_expiration = isset($session_data['expiration']) ? |
|
422 | 422 | $session_data['expiration'] : $this->_time + $this->_lifespan; |
423 | 423 | |
424 | 424 | } else { |
425 | 425 | // set initial site access time and the session expiration |
426 | 426 | $this->_set_init_access_and_expiration(); |
427 | 427 | // set referer |
428 | - $this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : ''; |
|
428 | + $this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : ''; |
|
429 | 429 | // no previous session = go back and create one (on top of the data above) |
430 | 430 | return FALSE; |
431 | 431 | } |
@@ -433,22 +433,22 @@ discard block |
||
433 | 433 | // have we met before??? |
434 | 434 | // let's compare our stored session details with the current visitor |
435 | 435 | // first the ip address |
436 | - if ( $session_data['ip_address'] != $this->_ip_address ) { |
|
436 | + if ($session_data['ip_address'] != $this->_ip_address) { |
|
437 | 437 | return FALSE; |
438 | 438 | } |
439 | 439 | // now the user agent |
440 | - if ( $session_data['user_agent'] != $this->_user_agent ) { |
|
440 | + if ($session_data['user_agent'] != $this->_user_agent) { |
|
441 | 441 | return FALSE; |
442 | 442 | } |
443 | 443 | // wait a minute... how old are you? |
444 | - if ( $this->_time > $this->_expiration ) { |
|
445 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'Session Expired' ); |
|
444 | + if ($this->_time > $this->_expiration) { |
|
445 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, 'Session Expired'); |
|
446 | 446 | // yer too old fer me! |
447 | 447 | // wipe out everything that isn't a default session datum |
448 | - $this->clear_session( __CLASS__, __FUNCTION__ ); |
|
448 | + $this->clear_session(__CLASS__, __FUNCTION__); |
|
449 | 449 | } |
450 | 450 | // make event espresso session data available to plugin |
451 | - $this->_session_data = array_merge( $this->_session_data, $session_data ); |
|
451 | + $this->_session_data = array_merge($this->_session_data, $session_data); |
|
452 | 452 | return TRUE; |
453 | 453 | |
454 | 454 | } |
@@ -476,20 +476,20 @@ discard block |
||
476 | 476 | * @param bool $new_session |
477 | 477 | * @return TRUE on success, FALSE on fail |
478 | 478 | */ |
479 | - public function update( $new_session = FALSE ) { |
|
479 | + public function update($new_session = FALSE) { |
|
480 | 480 | |
481 | - $this->_session_data = isset( $this->_session_data ) |
|
482 | - && is_array( $this->_session_data ) |
|
483 | - && isset( $this->_session_data['id']) |
|
481 | + $this->_session_data = isset($this->_session_data) |
|
482 | + && is_array($this->_session_data) |
|
483 | + && isset($this->_session_data['id']) |
|
484 | 484 | ? $this->_session_data |
485 | 485 | : NULL; |
486 | - if ( empty( $this->_session_data )) { |
|
486 | + if (empty($this->_session_data)) { |
|
487 | 487 | $this->_set_defaults(); |
488 | 488 | } |
489 | 489 | $session_data = array(); |
490 | - foreach ( $this->_session_data as $key => $value ) { |
|
490 | + foreach ($this->_session_data as $key => $value) { |
|
491 | 491 | |
492 | - switch( $key ) { |
|
492 | + switch ($key) { |
|
493 | 493 | |
494 | 494 | case 'id' : |
495 | 495 | // session ID |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | break; |
508 | 508 | |
509 | 509 | case 'init_access' : |
510 | - $session_data['init_access'] = absint( $value ); |
|
510 | + $session_data['init_access'] = absint($value); |
|
511 | 511 | break; |
512 | 512 | |
513 | 513 | case 'last_access' : |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | |
518 | 518 | case 'expiration' : |
519 | 519 | // when the session expires |
520 | - $session_data['expiration'] = ! empty( $this->_expiration ) |
|
520 | + $session_data['expiration'] = ! empty($this->_expiration) |
|
521 | 521 | ? $this->_expiration |
522 | 522 | : $session_data['init_access'] + $this->_lifespan; |
523 | 523 | break; |
@@ -529,11 +529,11 @@ discard block |
||
529 | 529 | |
530 | 530 | case 'pages_visited' : |
531 | 531 | $page_visit = $this->_get_page_visit(); |
532 | - if ( $page_visit ) { |
|
532 | + if ($page_visit) { |
|
533 | 533 | // set pages visited where the first will be the http referrer |
534 | - $this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit; |
|
534 | + $this->_session_data['pages_visited'][$this->_time] = $page_visit; |
|
535 | 535 | // we'll only save the last 10 page visits. |
536 | - $session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 ); |
|
536 | + $session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10); |
|
537 | 537 | } |
538 | 538 | break; |
539 | 539 | |
@@ -549,10 +549,10 @@ discard block |
||
549 | 549 | $this->_session_data = $session_data; |
550 | 550 | |
551 | 551 | // creating a new session does not require saving to the db just yet |
552 | - if ( ! $new_session ) { |
|
553 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'Session Updated' ); |
|
552 | + if ( ! $new_session) { |
|
553 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, 'Session Updated'); |
|
554 | 554 | // ready? let's save |
555 | - if ( $this->_save_session_to_db() ) { |
|
555 | + if ($this->_save_session_to_db()) { |
|
556 | 556 | return TRUE; |
557 | 557 | } else { |
558 | 558 | return FALSE; |
@@ -573,9 +573,9 @@ discard block |
||
573 | 573 | * @return bool |
574 | 574 | */ |
575 | 575 | private function _create_espresso_session( ) { |
576 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'Create New Session' ); |
|
576 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, 'Create New Session'); |
|
577 | 577 | // use the update function for now with $new_session arg set to TRUE |
578 | - return $this->update( TRUE ) ? TRUE : FALSE; |
|
578 | + return $this->update(TRUE) ? TRUE : FALSE; |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | return FALSE; |
599 | 599 | } |
600 | 600 | // first serialize all of our session data |
601 | - $session_data = serialize( $this->_session_data ); |
|
601 | + $session_data = serialize($this->_session_data); |
|
602 | 602 | // encrypt it if we are using encryption |
603 | - $session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data; |
|
603 | + $session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data; |
|
604 | 604 | // we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient( transient ID, data, expiry ) |
605 | - return set_transient( 'ee_ssn_' . $this->_sid, $session_data, $this->_lifespan ) ? TRUE : FALSE; |
|
605 | + return set_transient('ee_ssn_'.$this->_sid, $session_data, $this->_lifespan) ? TRUE : FALSE; |
|
606 | 606 | |
607 | 607 | } |
608 | 608 | |
@@ -627,10 +627,10 @@ discard block |
||
627 | 627 | 'HTTP_FORWARDED', |
628 | 628 | 'REMOTE_ADDR' |
629 | 629 | ); |
630 | - foreach ( $server_keys as $key ){ |
|
631 | - if ( isset( $_SERVER[ $key ] )) { |
|
632 | - foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) { |
|
633 | - if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) { |
|
630 | + foreach ($server_keys as $key) { |
|
631 | + if (isset($_SERVER[$key])) { |
|
632 | + foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { |
|
633 | + if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) { |
|
634 | 634 | $visitor_ip = $ip; |
635 | 635 | } |
636 | 636 | } |
@@ -650,45 +650,45 @@ discard block |
||
650 | 650 | */ |
651 | 651 | public function _get_page_visit() { |
652 | 652 | |
653 | - $page_visit = home_url('/') . 'wp-admin/admin-ajax.php'; |
|
653 | + $page_visit = home_url('/').'wp-admin/admin-ajax.php'; |
|
654 | 654 | |
655 | 655 | // check for request url |
656 | - if ( isset( $_SERVER['REQUEST_URI'] )) { |
|
656 | + if (isset($_SERVER['REQUEST_URI'])) { |
|
657 | 657 | |
658 | - $request_uri = esc_url( $_SERVER['REQUEST_URI'] ); |
|
658 | + $request_uri = esc_url($_SERVER['REQUEST_URI']); |
|
659 | 659 | |
660 | - $ru_bits = explode( '?', $request_uri ); |
|
660 | + $ru_bits = explode('?', $request_uri); |
|
661 | 661 | $request_uri = $ru_bits[0]; |
662 | 662 | //echo '<h1>$request_uri ' . $request_uri . '</h1>'; |
663 | 663 | |
664 | 664 | // check for and grab host as well |
665 | - if ( isset( $_SERVER['HTTP_HOST'] )) { |
|
666 | - $http_host = esc_url( $_SERVER['HTTP_HOST'] ); |
|
665 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
666 | + $http_host = esc_url($_SERVER['HTTP_HOST']); |
|
667 | 667 | } else { |
668 | 668 | $http_host = ''; |
669 | 669 | } |
670 | 670 | //echo '<h1>$http_host ' . $http_host . '</h1>'; |
671 | 671 | |
672 | 672 | // check for page_id in SERVER REQUEST |
673 | - if ( isset( $_REQUEST['page_id'] )) { |
|
673 | + if (isset($_REQUEST['page_id'])) { |
|
674 | 674 | // rebuild $e_reg without any of the extra parameters |
675 | - $page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&'; |
|
675 | + $page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&'; |
|
676 | 676 | } else { |
677 | 677 | $page_id = '?'; |
678 | 678 | } |
679 | 679 | // check for $e_reg in SERVER REQUEST |
680 | - if ( isset( $_REQUEST['ee'] )) { |
|
680 | + if (isset($_REQUEST['ee'])) { |
|
681 | 681 | // rebuild $e_reg without any of the extra parameters |
682 | - $e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] ); |
|
682 | + $e_reg = 'ee='.esc_attr($_REQUEST['ee']); |
|
683 | 683 | } else { |
684 | 684 | $e_reg = ''; |
685 | 685 | } |
686 | 686 | |
687 | - $page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' ); |
|
687 | + $page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?'); |
|
688 | 688 | |
689 | 689 | } |
690 | 690 | |
691 | - return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : ''; |
|
691 | + return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : ''; |
|
692 | 692 | |
693 | 693 | } |
694 | 694 | |
@@ -717,13 +717,13 @@ discard block |
||
717 | 717 | * @param string $function |
718 | 718 | * @return void |
719 | 719 | */ |
720 | - public function clear_session( $class = '', $function = '' ) { |
|
721 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' . $function . '()' ); |
|
720 | + public function clear_session($class = '', $function = '') { |
|
721 | + do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()'); |
|
722 | 722 | $this->reset_cart(); |
723 | 723 | $this->reset_checkout(); |
724 | 724 | $this->reset_transaction(); |
725 | 725 | // wipe out everything that isn't a default session datum |
726 | - $this->reset_data( array_keys( $this->_session_data )); |
|
726 | + $this->reset_data(array_keys($this->_session_data)); |
|
727 | 727 | // reset initial site access time and the session expiration |
728 | 728 | $this->_set_init_access_and_expiration(); |
729 | 729 | } |
@@ -737,42 +737,42 @@ discard block |
||
737 | 737 | * @param bool $show_all_notices |
738 | 738 | * @return TRUE on success, FALSE on fail |
739 | 739 | */ |
740 | - public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) { |
|
740 | + public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) { |
|
741 | 741 | // if $data_to_reset is not in an array, then put it in one |
742 | - if ( ! is_array( $data_to_reset ) ) { |
|
743 | - $data_to_reset = array ( $data_to_reset ); |
|
742 | + if ( ! is_array($data_to_reset)) { |
|
743 | + $data_to_reset = array($data_to_reset); |
|
744 | 744 | } |
745 | 745 | // nothing ??? go home! |
746 | - if ( empty( $data_to_reset )) { |
|
747 | - EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
746 | + if (empty($data_to_reset)) { |
|
747 | + EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
748 | 748 | return FALSE; |
749 | 749 | } |
750 | 750 | $return_value = TRUE; |
751 | 751 | // since $data_to_reset is an array, cycle through the values |
752 | - foreach ( $data_to_reset as $reset ) { |
|
752 | + foreach ($data_to_reset as $reset) { |
|
753 | 753 | |
754 | 754 | // first check to make sure it is a valid session var |
755 | - if ( isset( $this->_session_data[ $reset ] )) { |
|
755 | + if (isset($this->_session_data[$reset])) { |
|
756 | 756 | // then check to make sure it is not a default var |
757 | - if ( ! array_key_exists( $reset, $this->_default_session_vars )) { |
|
757 | + if ( ! array_key_exists($reset, $this->_default_session_vars)) { |
|
758 | 758 | // remove session var |
759 | - unset( $this->_session_data[ $reset ] ); |
|
760 | - if ( $show_all_notices ) { |
|
761 | - EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
759 | + unset($this->_session_data[$reset]); |
|
760 | + if ($show_all_notices) { |
|
761 | + EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
762 | 762 | } |
763 | - $return_value = !isset($return_value) ? TRUE : $return_value; |
|
763 | + $return_value = ! isset($return_value) ? TRUE : $return_value; |
|
764 | 764 | |
765 | 765 | } else { |
766 | 766 | // yeeeeeeeeerrrrrrrrrrr OUT !!!! |
767 | - if ( $show_all_notices ) { |
|
768 | - EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
767 | + if ($show_all_notices) { |
|
768 | + EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
769 | 769 | } |
770 | 770 | $return_value = FALSE; |
771 | 771 | } |
772 | 772 | |
773 | - } else if ( $show_all_notices ) { |
|
773 | + } else if ($show_all_notices) { |
|
774 | 774 | // oops! that session var does not exist! |
775 | - EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
775 | + EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
776 | 776 | $return_value = FALSE; |
777 | 777 | } |
778 | 778 | |
@@ -793,8 +793,8 @@ discard block |
||
793 | 793 | * @return string |
794 | 794 | */ |
795 | 795 | public function wp_loaded() { |
796 | - if ( isset( EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) { |
|
797 | - $this->clear_session( __CLASS__, __FUNCTION__ ); |
|
796 | + if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) { |
|
797 | + $this->clear_session(__CLASS__, __FUNCTION__); |
|
798 | 798 | } |
799 | 799 | } |
800 | 800 | |
@@ -819,16 +819,16 @@ discard block |
||
819 | 819 | */ |
820 | 820 | public function garbage_collection() { |
821 | 821 | // only perform during regular requests |
822 | - if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) { |
|
822 | + if ( ! defined('DOING_AJAX') || ! DOING_AJAX) { |
|
823 | 823 | /** @type WPDB $wpdb */ |
824 | 824 | global $wpdb; |
825 | 825 | // since transient expiration timestamps are set in the future, we can compare against NOW |
826 | 826 | $expiration = time(); |
827 | - $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 ); |
|
827 | + $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2); |
|
828 | 828 | // filter the query limit. Set to 0 to turn off garbage collection |
829 | - $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 )); |
|
829 | + $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50)); |
|
830 | 830 | // non-zero LIMIT means take out the trash |
831 | - if ( $expired_session_transient_delete_query_limit ) { |
|
831 | + if ($expired_session_transient_delete_query_limit) { |
|
832 | 832 | $SQL = " |
833 | 833 | SELECT option_name |
834 | 834 | FROM {$wpdb->options} |
@@ -838,29 +838,29 @@ discard block |
||
838 | 838 | OR option_value > {$too_far_in_the_the_future} ) |
839 | 839 | LIMIT {$expired_session_transient_delete_query_limit} |
840 | 840 | "; |
841 | - $expired_sessions = $wpdb->get_col( $SQL ); |
|
841 | + $expired_sessions = $wpdb->get_col($SQL); |
|
842 | 842 | // valid results? |
843 | - if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions )) { |
|
843 | + if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) { |
|
844 | 844 | // format array of results into something usable within the actual DELETE query's IN clause |
845 | 845 | $expired = array(); |
846 | - foreach( $expired_sessions as $expired_session ) { |
|
847 | - $expired[] = "'" . $expired_session . "'"; |
|
848 | - $expired[] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'"; |
|
846 | + foreach ($expired_sessions as $expired_session) { |
|
847 | + $expired[] = "'".$expired_session."'"; |
|
848 | + $expired[] = "'".str_replace('timeout_', '', $expired_session)."'"; |
|
849 | 849 | } |
850 | - $expired = implode( ', ', $expired ); |
|
850 | + $expired = implode(', ', $expired); |
|
851 | 851 | $SQL = " |
852 | 852 | DELETE FROM {$wpdb->options} |
853 | 853 | WHERE option_name |
854 | 854 | IN ( $expired ); |
855 | 855 | "; |
856 | - $results = $wpdb->query( $SQL ); |
|
856 | + $results = $wpdb->query($SQL); |
|
857 | 857 | // if something went wrong, then notify the admin |
858 | - if ( $results instanceof WP_Error && is_admin() ) { |
|
859 | - EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
858 | + if ($results instanceof WP_Error && is_admin()) { |
|
859 | + EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
860 | 860 | } |
861 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $results . ' expired sessions deleted' ); |
|
861 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $results.' expired sessions deleted'); |
|
862 | 862 | } |
863 | - do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit ); |
|
863 | + do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit); |
|
864 | 864 | } |
865 | 865 | } |
866 | 866 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | do_action( 'AHEE_log', __FILE__, ' FILE LOADED', '' ); |
3 | 5 | /** |
4 | 6 | * |
@@ -340,7 +342,7 @@ discard block |
||
340 | 342 | } |
341 | 343 | if ( ! empty( $key )) { |
342 | 344 | return isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL; |
343 | - } else { |
|
345 | + } else { |
|
344 | 346 | return $this->_session_data; |
345 | 347 | } |
346 | 348 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | /** |
329 | 329 | * retrieve session data |
330 | 330 | * @access public |
331 | - * @param null $key |
|
331 | + * @param string|null $key |
|
332 | 332 | * @param bool $reset_cache |
333 | 333 | * @return array |
334 | 334 | */ |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * set session data |
352 | 352 | * @access public |
353 | 353 | * @param array $data |
354 | - * @return TRUE on success, FALSE on fail |
|
354 | + * @return boolean on success, FALSE on fail |
|
355 | 355 | */ |
356 | 356 | public function set_session_data( $data ) { |
357 | 357 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | /** |
382 | 382 | * @initiate session |
383 | 383 | * @access private |
384 | - * @return TRUE on success, FALSE on fail |
|
384 | + * @return boolean on success, FALSE on fail |
|
385 | 385 | */ |
386 | 386 | private function _espresso_session() { |
387 | 387 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @update session data prior to saving to the db |
475 | 475 | * @access public |
476 | 476 | * @param bool $new_session |
477 | - * @return TRUE on success, FALSE on fail |
|
477 | + * @return boolean on success, FALSE on fail |
|
478 | 478 | */ |
479 | 479 | public function update( $new_session = FALSE ) { |
480 | 480 | |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | /** |
586 | 586 | * @attempt to get IP address of current visitor from server |
587 | 587 | * @access public |
588 | - * @return string |
|
588 | + * @return boolean |
|
589 | 589 | */ |
590 | 590 | private function _save_session_to_db() { |
591 | 591 | if ( |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | * @access public |
736 | 736 | * @param array $data_to_reset |
737 | 737 | * @param bool $show_all_notices |
738 | - * @return TRUE on success, FALSE on fail |
|
738 | + * @return boolean on success, FALSE on fail |
|
739 | 739 | */ |
740 | 740 | public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) { |
741 | 741 | // if $data_to_reset is not in an array, then put it in one |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -578,7 +580,7 @@ discard block |
||
578 | 580 | $espresso_db_update = array( $espresso_db_update=>array() ); |
579 | 581 | update_option( 'espresso_db_update', $espresso_db_update ); |
580 | 582 | } |
581 | - }else{ |
|
583 | + } else{ |
|
582 | 584 | $corrected_db_update = array(); |
583 | 585 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
584 | 586 | foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
@@ -588,7 +590,7 @@ discard block |
||
588 | 590 | //fix it! |
589 | 591 | $version_string = $should_be_array; |
590 | 592 | $corrected_db_update[$version_string] = array('unknown-date'); |
591 | - }else{ |
|
593 | + } else{ |
|
592 | 594 | //ok it checks out |
593 | 595 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
594 | 596 | } |
@@ -633,7 +635,7 @@ discard block |
||
633 | 635 | $addon->initialize_db_if_no_migrations_required(); |
634 | 636 | } |
635 | 637 | } |
636 | - }else{ |
|
638 | + } else{ |
|
637 | 639 | EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
638 | 640 | } |
639 | 641 | if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
@@ -703,7 +705,7 @@ discard block |
||
703 | 705 | //it a version we haven't seen before |
704 | 706 | if( $version_is_higher === 1 ){ |
705 | 707 | $req_type = EE_System::req_type_upgrade; |
706 | - }else{ |
|
708 | + } else{ |
|
707 | 709 | $req_type = EE_System::req_type_downgrade; |
708 | 710 | } |
709 | 711 | delete_option( $activation_indicator_option_name ); |
@@ -712,10 +714,10 @@ discard block |
||
712 | 714 | if( get_option( $activation_indicator_option_name, FALSE ) ){ |
713 | 715 | if ( $version_is_higher === -1 ){ |
714 | 716 | $req_type = EE_System::req_type_downgrade; |
715 | - }elseif( $version_is_higher === 0 ){ |
|
717 | + } elseif( $version_is_higher === 0 ){ |
|
716 | 718 | //we've seen this version before, but it's an activation. must be a reactivation |
717 | 719 | $req_type = EE_System::req_type_reactivation; |
718 | - }else{//$version_is_higher === 1 |
|
720 | + } else{//$version_is_higher === 1 |
|
719 | 721 | $req_type = EE_System::req_type_upgrade; |
720 | 722 | } |
721 | 723 | delete_option( $activation_indicator_option_name ); |
@@ -723,10 +725,10 @@ discard block |
||
723 | 725 | //we've seen this version before and the activation indicate doesn't show it was just activated |
724 | 726 | if ( $version_is_higher === -1 ){ |
725 | 727 | $req_type = EE_System::req_type_downgrade; |
726 | - }elseif( $version_is_higher === 0 ){ |
|
728 | + } elseif( $version_is_higher === 0 ){ |
|
727 | 729 | //we've seen this version before and it's not an activation. its normal request |
728 | 730 | $req_type = EE_System::req_type_normal; |
729 | - }else{//$version_is_higher === 1 |
|
731 | + } else{//$version_is_higher === 1 |
|
730 | 732 | $req_type = EE_System::req_type_upgrade; |
731 | 733 | } |
732 | 734 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public static function instance() { |
91 | 91 | // check if class object is instantiated, and instantiated properly |
92 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_System )) { |
|
92 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_System)) { |
|
93 | 93 | self::$_instance = new self(); |
94 | 94 | } |
95 | 95 | return self::$_instance; |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * resets the instance and returns it |
99 | 99 | * @return EE_System |
100 | 100 | */ |
101 | - public static function reset(){ |
|
101 | + public static function reset() { |
|
102 | 102 | self::$_instance->_req_type = NULL; |
103 | 103 | //we need to reset the migration manager in order for it to detect DMSs properly |
104 | 104 | EE_Data_Migration_Manager::reset(); |
105 | 105 | //make sure none of the old hooks are left hanging around |
106 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
106 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
107 | 107 | self::instance()->detect_activations_or_upgrades(); |
108 | 108 | self::instance()->perform_activations_upgrades_and_migrations(); |
109 | 109 | return self::instance(); |
@@ -124,25 +124,25 @@ discard block |
||
124 | 124 | * @return \EE_System |
125 | 125 | */ |
126 | 126 | private function __construct() { |
127 | - do_action( 'AHEE__EE_System__construct__begin',$this ); |
|
127 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
128 | 128 | // check required WP version |
129 | - if ( ! $this->_minimum_wp_version_required() ) { |
|
130 | - unset( $_GET['activate'] ); |
|
131 | - add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 ); |
|
129 | + if ( ! $this->_minimum_wp_version_required()) { |
|
130 | + unset($_GET['activate']); |
|
131 | + add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | // check required PHP version |
135 | - if ( ! $this->_minimum_php_version_required() ) { |
|
136 | - unset( $_GET['activate'] ); |
|
137 | - add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 ); |
|
135 | + if ( ! $this->_minimum_php_version_required()) { |
|
136 | + unset($_GET['activate']); |
|
137 | + add_action('admin_notices', array($this, 'minimum_php_version_error'), 1); |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | // check recommended WP version |
141 | - if ( ! $this->_minimum_wp_version_recommended() ) { |
|
141 | + if ( ! $this->_minimum_wp_version_recommended()) { |
|
142 | 142 | $this->_display_minimum_recommended_wp_version_notice(); |
143 | 143 | } |
144 | 144 | // check recommended PHP version |
145 | - if ( ! $this->_minimum_php_version_recommended() ) { |
|
145 | + if ( ! $this->_minimum_php_version_recommended()) { |
|
146 | 146 | $this->_display_minimum_recommended_php_version_notice(); |
147 | 147 | } |
148 | 148 | $this->display_alpha_banner_warning(); |
@@ -151,40 +151,40 @@ discard block |
||
151 | 151 | // workarounds for PHP < 5.3 |
152 | 152 | $this->_load_class_tools(); |
153 | 153 | // load a few helper files |
154 | - EE_Registry::instance()->load_helper( 'File' ); |
|
155 | - EE_Registry::instance()->load_helper( 'Autoloader', array(), FALSE ); |
|
154 | + EE_Registry::instance()->load_helper('File'); |
|
155 | + EE_Registry::instance()->load_helper('Autoloader', array(), FALSE); |
|
156 | 156 | // enable logging? |
157 | - if ( WP_DEBUG ) { |
|
158 | - EE_Registry::instance()->load_core( 'Log' ); |
|
159 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'WP_DEBUG Logging Initiated' ); |
|
157 | + if (WP_DEBUG) { |
|
158 | + EE_Registry::instance()->load_core('Log'); |
|
159 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, 'WP_DEBUG Logging Initiated'); |
|
160 | 160 | } |
161 | - require_once EE_CORE . 'EE_Deprecated.core.php'; |
|
161 | + require_once EE_CORE.'EE_Deprecated.core.php'; |
|
162 | 162 | // load interfaces |
163 | - require_once EE_CORE . 'EEI_Interfaces.php'; |
|
164 | - require_once EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php'; |
|
163 | + require_once EE_CORE.'EEI_Interfaces.php'; |
|
164 | + require_once EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'; |
|
165 | 165 | // WP cron jobs |
166 | - EE_Registry::instance()->load_core( 'Cron_Tasks' ); |
|
166 | + EE_Registry::instance()->load_core('Cron_Tasks'); |
|
167 | 167 | |
168 | 168 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
169 | - add_action( 'plugins_loaded', array( $this, 'load_espresso_addons' ), 1 ); |
|
169 | + add_action('plugins_loaded', array($this, 'load_espresso_addons'), 1); |
|
170 | 170 | // when an ee addon is activated, we want to call the core hook(s) again |
171 | 171 | // because the newly-activated addon didn't get a chance to run at all |
172 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
172 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
173 | 173 | // detect whether install or upgrade |
174 | - add_action( 'plugins_loaded', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
174 | + add_action('plugins_loaded', array($this, 'detect_activations_or_upgrades'), 3); |
|
175 | 175 | // load EE_Config, EE_Textdomain, etc |
176 | - add_action( 'plugins_loaded', array( $this, 'load_core_configuration' ), 5 ); |
|
176 | + add_action('plugins_loaded', array($this, 'load_core_configuration'), 5); |
|
177 | 177 | // load EE_Config, EE_Textdomain, etc |
178 | - add_action( 'plugins_loaded', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
178 | + add_action('plugins_loaded', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
179 | 179 | // you wanna get going? I wanna get going... let's get going! |
180 | - add_action( 'plugins_loaded', array( $this, 'brew_espresso' ), 9 ); |
|
180 | + add_action('plugins_loaded', array($this, 'brew_espresso'), 9); |
|
181 | 181 | |
182 | 182 | //other housekeeping |
183 | 183 | //exclude EE critical pages from wp_list_pages |
184 | - add_filter('wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages'), 10 ); |
|
184 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
185 | 185 | // ALL EE Addons should use the following hook point to attach their initial setup too |
186 | 186 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
187 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
187 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
@@ -199,22 +199,22 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function display_alpha_banner_warning() { |
201 | 201 | // skip AJAX requests |
202 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
202 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
203 | 203 | return; |
204 | 204 | } |
205 | 205 | // skip stable releases |
206 | - if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) { |
|
206 | + if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) { |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | // post release candidate warning |
210 | - if ( is_admin() ) { |
|
211 | - add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 ); |
|
210 | + if (is_admin()) { |
|
211 | + add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999); |
|
212 | 212 | } else { |
213 | 213 | // site admin has authorized use of non-stable release candidate for production |
214 | - if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) { |
|
214 | + if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | - add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 ); |
|
217 | + add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | public function alpha_banner_admin_notice() { |
231 | 231 | EE_Error::add_attention( |
232 | 232 | sprintf( |
233 | - __( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ), |
|
233 | + __('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'), |
|
234 | 234 | '<strong>', |
235 | 235 | '</strong>' |
236 | 236 | ), |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function alpha_banner_warning_notice() { |
251 | 251 | global $pagenow; |
252 | - if ( in_array( $pagenow, array( 'wp-login.php', 'wp-register.php' ) ) ) { |
|
252 | + if (in_array($pagenow, array('wp-login.php', 'wp-register.php'))) { |
|
253 | 253 | return; |
254 | 254 | } |
255 | 255 | printf( |
256 | - __( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ), |
|
256 | + __('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'), |
|
257 | 257 | '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>', |
258 | 258 | '<strong>', |
259 | 259 | '</strong>', |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * @param string $min_version |
271 | 271 | * @return boolean |
272 | 272 | */ |
273 | - private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) { |
|
273 | + private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) { |
|
274 | 274 | global $wp_version; |
275 | - return version_compare( $wp_version, $min_version, '>=' ) ? TRUE : FALSE; |
|
275 | + return version_compare($wp_version, $min_version, '>=') ? TRUE : FALSE; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @return boolean |
283 | 283 | */ |
284 | 284 | private function _minimum_wp_version_required() { |
285 | - return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED ); |
|
285 | + return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @return boolean |
293 | 293 | */ |
294 | 294 | private function _minimum_wp_version_recommended() { |
295 | - return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED ); |
|
295 | + return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | * @param string $min_version |
305 | 305 | * @return boolean |
306 | 306 | */ |
307 | - private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) { |
|
308 | - return version_compare( PHP_VERSION, $min_version, '>=' ) ? TRUE : FALSE; |
|
307 | + private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) { |
|
308 | + return version_compare(PHP_VERSION, $min_version, '>=') ? TRUE : FALSE; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @return boolean |
316 | 316 | */ |
317 | 317 | private function _minimum_php_version_required() { |
318 | - return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED ); |
|
318 | + return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @return boolean |
326 | 326 | */ |
327 | 327 | private function _minimum_php_version_recommended() { |
328 | - return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED ); |
|
328 | + return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | <p> |
343 | 343 | <?php |
344 | 344 | printf( |
345 | - __( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
345 | + __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
346 | 346 | EE_MIN_WP_VER_REQUIRED, |
347 | 347 | $wp_version, |
348 | 348 | '<br/>', |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | </p> |
353 | 353 | </div> |
354 | 354 | <?php |
355 | - EE_System::deactivate_plugin( EE_PLUGIN_BASENAME ); |
|
355 | + EE_System::deactivate_plugin(EE_PLUGIN_BASENAME); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | <p> |
369 | 369 | <?php |
370 | 370 | printf( |
371 | - __( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
371 | + __('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
372 | 372 | EE_MIN_PHP_VER_REQUIRED, |
373 | 373 | PHP_VERSION, |
374 | 374 | '<br/>', |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | </p> |
379 | 379 | </div> |
380 | 380 | <?php |
381 | - deactivate_plugins( EE_PLUGIN_BASENAME ); |
|
381 | + deactivate_plugins(EE_PLUGIN_BASENAME); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | private function _display_minimum_recommended_wp_version_notice() { |
393 | 393 | global $wp_version; |
394 | 394 | EE_Error::add_persistent_admin_notice( |
395 | - 'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended', |
|
395 | + 'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended', |
|
396 | 396 | sprintf( |
397 | - __( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
397 | + __('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
398 | 398 | EE_MIN_WP_VER_RECOMMENDED, |
399 | 399 | $wp_version, |
400 | 400 | '<br/>', |
@@ -413,9 +413,9 @@ discard block |
||
413 | 413 | */ |
414 | 414 | private function _display_minimum_recommended_php_version_notice() { |
415 | 415 | EE_Error::add_persistent_admin_notice( |
416 | - 'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended', |
|
416 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
417 | 417 | sprintf( |
418 | - __( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
418 | + __('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
419 | 419 | EE_MIN_PHP_VER_RECOMMENDED, |
420 | 420 | PHP_VERSION, |
421 | 421 | '<br/>', |
@@ -433,12 +433,12 @@ discard block |
||
433 | 433 | * @return void |
434 | 434 | */ |
435 | 435 | private function _load_registry() { |
436 | - if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) { |
|
437 | - require_once( EE_CORE . 'EE_Registry.core.php' ); |
|
436 | + if (is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
437 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
438 | 438 | } else { |
439 | - $msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' ); |
|
440 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
441 | - wp_die( EE_Error::get_notices() ); |
|
439 | + $msg = __('The EE_Registry core class could not be loaded.', 'event_espresso'); |
|
440 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
441 | + wp_die(EE_Error::get_notices()); |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | * @return void |
451 | 451 | */ |
452 | 452 | private function _load_class_tools() { |
453 | - if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) { |
|
454 | - require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' ); |
|
453 | + if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
454 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
455 | 455 | } else { |
456 | - $msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ); |
|
457 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
456 | + $msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'); |
|
457 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | * @return void |
470 | 470 | */ |
471 | 471 | public function load_espresso_addons() { |
472 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
472 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
473 | 473 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
474 | 474 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
475 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
475 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
476 | 476 | //load and setup EE_Capabilities |
477 | - EE_Registry::instance()->load_core( 'Capabilities' ); |
|
478 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
477 | + EE_Registry::instance()->load_core('Capabilities'); |
|
478 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
@@ -483,11 +483,11 @@ discard block |
||
483 | 483 | * Checks for activation or upgrade of core first; then also checks if any registered |
484 | 484 | * addons have been activated or upgraded |
485 | 485 | */ |
486 | - public function detect_activations_or_upgrades(){ |
|
487 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
486 | + public function detect_activations_or_upgrades() { |
|
487 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
488 | 488 | //first off: let's make sure to handle core |
489 | 489 | $this->detect_if_activation_or_upgrade(); |
490 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
490 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
491 | 491 | //detect teh request type for that addon |
492 | 492 | $addon->detect_activation_or_upgrade(); |
493 | 493 | } |
@@ -502,48 +502,48 @@ discard block |
||
502 | 502 | * @return void |
503 | 503 | */ |
504 | 504 | public function detect_if_activation_or_upgrade() { |
505 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
505 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
506 | 506 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
507 | 507 | |
508 | 508 | // load M-Mode class |
509 | - EE_Registry::instance()->load_core( 'Maintenance_Mode' ); |
|
509 | + EE_Registry::instance()->load_core('Maintenance_Mode'); |
|
510 | 510 | // check if db has been updated, or if its a brand-new installation |
511 | 511 | |
512 | 512 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
513 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
513 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
514 | 514 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
515 | - if( $request_type != EE_System::req_type_normal){ |
|
515 | + if ($request_type != EE_System::req_type_normal) { |
|
516 | 516 | EE_Registry::instance()->load_helper('Activation'); |
517 | 517 | } |
518 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $request_type, '$request_type' ); |
|
519 | - switch($request_type){ |
|
518 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $request_type, '$request_type'); |
|
519 | + switch ($request_type) { |
|
520 | 520 | case EE_System::req_type_new_activation: |
521 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
522 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
521 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
522 | + $this->_handle_core_version_change($espresso_db_update); |
|
523 | 523 | break; |
524 | 524 | case EE_System::req_type_reactivation: |
525 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
526 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
525 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
526 | + $this->_handle_core_version_change($espresso_db_update); |
|
527 | 527 | break; |
528 | 528 | case EE_System::req_type_upgrade: |
529 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
529 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
530 | 530 | //migrations may be required now that we've upgraded |
531 | 531 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
532 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
532 | + $this->_handle_core_version_change($espresso_db_update); |
|
533 | 533 | // echo "done upgrade";die; |
534 | 534 | break; |
535 | 535 | case EE_System::req_type_downgrade: |
536 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
536 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
537 | 537 | //its possible migrations are no longer required |
538 | 538 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
539 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
539 | + $this->_handle_core_version_change($espresso_db_update); |
|
540 | 540 | break; |
541 | 541 | case EE_System::req_type_normal: |
542 | 542 | default: |
543 | 543 | // $this->_maybe_redirect_to_ee_about(); |
544 | 544 | break; |
545 | 545 | } |
546 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
546 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -551,11 +551,11 @@ discard block |
||
551 | 551 | * initializing the database later during the request |
552 | 552 | * @param array $espresso_db_update |
553 | 553 | */ |
554 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
555 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
556 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
554 | + protected function _handle_core_version_change($espresso_db_update) { |
|
555 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
556 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
557 | 557 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
558 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
558 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | |
@@ -570,45 +570,45 @@ discard block |
||
570 | 570 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
571 | 571 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
572 | 572 | */ |
573 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
574 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
575 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
576 | - if( ! $espresso_db_update){ |
|
577 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
573 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
574 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
575 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
576 | + if ( ! $espresso_db_update) { |
|
577 | + $espresso_db_update = get_option('espresso_db_update'); |
|
578 | 578 | } |
579 | 579 | // check that option is an array |
580 | - if( ! is_array( $espresso_db_update )) { |
|
580 | + if ( ! is_array($espresso_db_update)) { |
|
581 | 581 | // if option is FALSE, then it never existed |
582 | - if ( $espresso_db_update === FALSE ) { |
|
582 | + if ($espresso_db_update === FALSE) { |
|
583 | 583 | // make $espresso_db_update an array and save option with autoload OFF |
584 | - $espresso_db_update = array(); |
|
585 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
584 | + $espresso_db_update = array(); |
|
585 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
586 | 586 | } else { |
587 | 587 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
588 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
589 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
588 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
589 | + update_option('espresso_db_update', $espresso_db_update); |
|
590 | 590 | } |
591 | - }else{ |
|
591 | + } else { |
|
592 | 592 | $corrected_db_update = array(); |
593 | 593 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
594 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
595 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
594 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
595 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
596 | 596 | //the key is an int, and the value IS NOT an array |
597 | 597 | //so it must be numerically-indexed, where values are versions installed... |
598 | 598 | //fix it! |
599 | 599 | $version_string = $should_be_array; |
600 | 600 | $corrected_db_update[$version_string] = array('unknown-date'); |
601 | - }else{ |
|
601 | + } else { |
|
602 | 602 | //ok it checks out |
603 | 603 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
604 | 604 | } |
605 | 605 | } |
606 | 606 | $espresso_db_update = $corrected_db_update; |
607 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
607 | + update_option('espresso_db_update', $espresso_db_update); |
|
608 | 608 | |
609 | 609 | } |
610 | 610 | |
611 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
611 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
612 | 612 | return $espresso_db_update; |
613 | 613 | } |
614 | 614 | |
@@ -625,26 +625,26 @@ discard block |
||
625 | 625 | * however, |
626 | 626 | * @return void |
627 | 627 | */ |
628 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE ){ |
|
629 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, EE_Maintenance_Mode::instance()->level(), 'EE_Maintenance_Mode::instance()->level()' ); |
|
628 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE) { |
|
629 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, EE_Maintenance_Mode::instance()->level(), 'EE_Maintenance_Mode::instance()->level()'); |
|
630 | 630 | $request_type = $this->detect_req_type(); |
631 | 631 | //only initialize system if we're not in maintenance mode. |
632 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
633 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
632 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
633 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
634 | 634 | EEH_Activation::system_initialization(); |
635 | 635 | EEH_Activation::initialize_db_and_folders(); |
636 | 636 | EEH_Activation::initialize_db_content(); |
637 | - if( $initialize_addons_too ) { |
|
637 | + if ($initialize_addons_too) { |
|
638 | 638 | //foreach registered addon, make sure its db is up-to-date too |
639 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
639 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
640 | 640 | $addon->initialize_db_if_no_migrations_required(); |
641 | 641 | } |
642 | 642 | } |
643 | - }else{ |
|
644 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
643 | + } else { |
|
644 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
645 | 645 | } |
646 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
647 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
646 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
647 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | |
@@ -656,17 +656,17 @@ discard block |
||
656 | 656 | * @param string $current_version_to_add version to be added to the version history |
657 | 657 | * @return boolean success as to whether or not this option was changed |
658 | 658 | */ |
659 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
660 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
661 | - if( ! $version_history ) { |
|
659 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
660 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
661 | + if ( ! $version_history) { |
|
662 | 662 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
663 | 663 | } |
664 | - if( $current_version_to_add == NULL){ |
|
664 | + if ($current_version_to_add == NULL) { |
|
665 | 665 | $current_version_to_add = espresso_version(); |
666 | 666 | } |
667 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
667 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
668 | 668 | // re-save |
669 | - return update_option( 'espresso_db_update', $version_history ); |
|
669 | + return update_option('espresso_db_update', $version_history); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | |
@@ -683,11 +683,11 @@ discard block |
||
683 | 683 | * but still know if this is a new install or not |
684 | 684 | * @return int one of the constants on EE_System::req_type_ |
685 | 685 | */ |
686 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
687 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
688 | - if ( $this->_req_type === NULL ){ |
|
689 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
690 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
686 | + public function detect_req_type($espresso_db_update = NULL) { |
|
687 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
688 | + if ($this->_req_type === NULL) { |
|
689 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
690 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
691 | 691 | } |
692 | 692 | return $this->_req_type; |
693 | 693 | } |
@@ -703,41 +703,41 @@ discard block |
||
703 | 703 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
704 | 704 | * @return int one of the constants on EE_System::req_type_* |
705 | 705 | */ |
706 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
707 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $activation_indicator_option_name, '$activation_indicator_option_name' ); |
|
708 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $version_to_upgrade_to, '$version_to_upgrade_to' ); |
|
709 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
710 | - if( $activation_history_for_addon ){ |
|
706 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
707 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $activation_indicator_option_name, '$activation_indicator_option_name'); |
|
708 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $version_to_upgrade_to, '$version_to_upgrade_to'); |
|
709 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
710 | + if ($activation_history_for_addon) { |
|
711 | 711 | //it exists, so this isn't a completely new install |
712 | 712 | //check if this version already in that list of previously installed versions |
713 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
713 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
714 | 714 | //it a version we haven't seen before |
715 | - if( $version_is_higher === 1 ){ |
|
715 | + if ($version_is_higher === 1) { |
|
716 | 716 | $req_type = EE_System::req_type_upgrade; |
717 | - }else{ |
|
717 | + } else { |
|
718 | 718 | $req_type = EE_System::req_type_downgrade; |
719 | 719 | } |
720 | - delete_option( $activation_indicator_option_name ); |
|
720 | + delete_option($activation_indicator_option_name); |
|
721 | 721 | } else { |
722 | 722 | // its not an update. maybe a reactivation? |
723 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
724 | - if ( $version_is_higher === -1 ){ |
|
723 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
724 | + if ($version_is_higher === -1) { |
|
725 | 725 | $req_type = EE_System::req_type_downgrade; |
726 | - }elseif( $version_is_higher === 0 ){ |
|
726 | + }elseif ($version_is_higher === 0) { |
|
727 | 727 | //we've seen this version before, but it's an activation. must be a reactivation |
728 | 728 | $req_type = EE_System::req_type_reactivation; |
729 | - }else{//$version_is_higher === 1 |
|
729 | + } else {//$version_is_higher === 1 |
|
730 | 730 | $req_type = EE_System::req_type_upgrade; |
731 | 731 | } |
732 | - delete_option( $activation_indicator_option_name ); |
|
732 | + delete_option($activation_indicator_option_name); |
|
733 | 733 | } else { |
734 | 734 | //we've seen this version before and the activation indicate doesn't show it was just activated |
735 | - if ( $version_is_higher === -1 ){ |
|
735 | + if ($version_is_higher === -1) { |
|
736 | 736 | $req_type = EE_System::req_type_downgrade; |
737 | - }elseif( $version_is_higher === 0 ){ |
|
737 | + }elseif ($version_is_higher === 0) { |
|
738 | 738 | //we've seen this version before and it's not an activation. its normal request |
739 | 739 | $req_type = EE_System::req_type_normal; |
740 | - }else{//$version_is_higher === 1 |
|
740 | + } else {//$version_is_higher === 1 |
|
741 | 741 | $req_type = EE_System::req_type_upgrade; |
742 | 742 | } |
743 | 743 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | } else { |
746 | 746 | //brand new install |
747 | 747 | $req_type = EE_System::req_type_new_activation; |
748 | - delete_option( $activation_indicator_option_name ); |
|
748 | + delete_option($activation_indicator_option_name); |
|
749 | 749 | } |
750 | 750 | return $req_type; |
751 | 751 | } |
@@ -763,31 +763,31 @@ discard block |
||
763 | 763 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
764 | 764 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
765 | 765 | */ |
766 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
767 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
766 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
767 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
768 | 768 | //find the most recently-activated version |
769 | 769 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
770 | 770 | $most_recently_active_version = '0.0.0.dev.000'; |
771 | - if( is_array( $activation_history_for_addon ) ){ |
|
772 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
771 | + if (is_array($activation_history_for_addon)) { |
|
772 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
773 | 773 | //check there is a record of when this version was activated. Otherwise, |
774 | 774 | //mark it as unknown |
775 | - if( ! $times_activated ){ |
|
776 | - $times_activated = array( 'unknown-date'); |
|
775 | + if ( ! $times_activated) { |
|
776 | + $times_activated = array('unknown-date'); |
|
777 | 777 | } |
778 | - if( is_string( $times_activated ) ){ |
|
779 | - $times_activated = array( $times_activated ); |
|
778 | + if (is_string($times_activated)) { |
|
779 | + $times_activated = array($times_activated); |
|
780 | 780 | } |
781 | - foreach( $times_activated as $an_activation ){ |
|
782 | - if( $an_activation != 'unknown-date' && |
|
783 | - $an_activation > $most_recently_active_version_activation ){ |
|
781 | + foreach ($times_activated as $an_activation) { |
|
782 | + if ($an_activation != 'unknown-date' && |
|
783 | + $an_activation > $most_recently_active_version_activation) { |
|
784 | 784 | $most_recently_active_version = $version; |
785 | 785 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
786 | 786 | } |
787 | 787 | } |
788 | 788 | } |
789 | 789 | } |
790 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
790 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | |
@@ -797,21 +797,21 @@ discard block |
||
797 | 797 | * @return void |
798 | 798 | */ |
799 | 799 | public function redirect_to_about_ee() { |
800 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
801 | - $notices = EE_Error::get_notices( FALSE ); |
|
800 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
801 | + $notices = EE_Error::get_notices(FALSE); |
|
802 | 802 | //if current user is an admin and it's not an ajax request |
803 | - if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) && ! isset( $notices[ 'errors' ] ) ){ |
|
804 | - $query_params = array( 'page' => 'espresso_about' ); |
|
803 | + if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) { |
|
804 | + $query_params = array('page' => 'espresso_about'); |
|
805 | 805 | |
806 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
806 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
807 | 807 | $query_params['new_activation'] = TRUE; |
808 | 808 | } |
809 | 809 | |
810 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
810 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
811 | 811 | $query_params['reactivation'] = TRUE; |
812 | 812 | } |
813 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
814 | - wp_safe_redirect( $url ); |
|
813 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
814 | + wp_safe_redirect($url); |
|
815 | 815 | exit(); |
816 | 816 | } |
817 | 817 | } |
@@ -822,33 +822,33 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @return void |
824 | 824 | */ |
825 | - public function load_core_configuration(){ |
|
826 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
827 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
825 | + public function load_core_configuration() { |
|
826 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
827 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
828 | 828 | // load and setup EE_Config and EE_Network_Config |
829 | - EE_Registry::instance()->load_core( 'Config' ); |
|
830 | - EE_Registry::instance()->load_core( 'Network_Config' ); |
|
829 | + EE_Registry::instance()->load_core('Config'); |
|
830 | + EE_Registry::instance()->load_core('Network_Config'); |
|
831 | 831 | // setup autoloaders |
832 | - EE_Registry::instance()->load_core( 'EE_Load_Textdomain' ); |
|
832 | + EE_Registry::instance()->load_core('EE_Load_Textdomain'); |
|
833 | 833 | //load textdomain |
834 | 834 | EE_Load_Textdomain::load_textdomain(); |
835 | 835 | // enable logging? |
836 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
837 | - EE_Registry::instance()->load_core( 'Log' ); |
|
836 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
837 | + EE_Registry::instance()->load_core('Log'); |
|
838 | 838 | } |
839 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
839 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
840 | 840 | // check for activation errors |
841 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
842 | - if ( $activation_errors ) { |
|
843 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
844 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
841 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
842 | + if ($activation_errors) { |
|
843 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
844 | + update_option('ee_plugin_activation_errors', FALSE); |
|
845 | 845 | } |
846 | 846 | // get model names |
847 | 847 | $this->_parse_model_names(); |
848 | 848 | |
849 | 849 | //load caf stuff a chance to play during the activation process too. |
850 | 850 | $this->_maybe_brew_regular(); |
851 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
851 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | |
@@ -857,24 +857,24 @@ discard block |
||
857 | 857 | * |
858 | 858 | * @return void |
859 | 859 | */ |
860 | - private function _parse_model_names(){ |
|
861 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
860 | + private function _parse_model_names() { |
|
861 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
862 | 862 | //get all the files in the EE_MODELS folder that end in .model.php |
863 | - $models = glob( EE_MODELS.'*.model.php'); |
|
863 | + $models = glob(EE_MODELS.'*.model.php'); |
|
864 | 864 | $model_names = array(); |
865 | 865 | $non_abstract_db_models = array(); |
866 | - foreach( $models as $model ){ |
|
866 | + foreach ($models as $model) { |
|
867 | 867 | // get model classname |
868 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
869 | - $shortname = str_replace( 'EEM_', '', $classname ); |
|
868 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
869 | + $shortname = str_replace('EEM_', '', $classname); |
|
870 | 870 | $reflectionClass = new ReflectionClass($classname); |
871 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
871 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
872 | 872 | $non_abstract_db_models[$shortname] = $classname; |
873 | 873 | } |
874 | - $model_names[ $shortname ] = $classname; |
|
874 | + $model_names[$shortname] = $classname; |
|
875 | 875 | } |
876 | - EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
877 | - EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
876 | + EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
877 | + EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | |
@@ -884,9 +884,9 @@ discard block |
||
884 | 884 | * @return void |
885 | 885 | */ |
886 | 886 | private function _maybe_brew_regular() { |
887 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
888 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, 'coffee\'s on' ); |
|
889 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
887 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
888 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, 'coffee\'s on'); |
|
889 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
890 | 890 | } |
891 | 891 | } |
892 | 892 | |
@@ -901,10 +901,10 @@ discard block |
||
901 | 901 | * @return void |
902 | 902 | */ |
903 | 903 | public function register_shortcodes_modules_and_widgets() { |
904 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
905 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
904 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
905 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
906 | 906 | // check for addons using old hookpoint |
907 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
907 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
908 | 908 | $this->_incompatible_addon_error(); |
909 | 909 | } |
910 | 910 | } |
@@ -917,21 +917,21 @@ discard block |
||
917 | 917 | * @return void |
918 | 918 | */ |
919 | 919 | private function _incompatible_addon_error() { |
920 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
920 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
921 | 921 | // get array of classes hooking into here |
922 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
923 | - if ( ! empty( $class_names )) { |
|
924 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
922 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
923 | + if ( ! empty($class_names)) { |
|
924 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
925 | 925 | $msg .= '<ul>'; |
926 | - foreach ( $class_names as $class_name ) { |
|
927 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
926 | + foreach ($class_names as $class_name) { |
|
927 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
928 | 928 | } |
929 | 929 | $msg .= '</ul>'; |
930 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
930 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
931 | 931 | // save list of incompatible addons to wp-options for later use |
932 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
933 | - if ( is_admin() ) { |
|
934 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
932 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
933 | + if (is_admin()) { |
|
934 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
935 | 935 | } |
936 | 936 | } |
937 | 937 | } |
@@ -947,26 +947,26 @@ discard block |
||
947 | 947 | * |
948 | 948 | * @return void |
949 | 949 | */ |
950 | - public function brew_espresso(){ |
|
951 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
952 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
950 | + public function brew_espresso() { |
|
951 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
952 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
953 | 953 | // load some final core systems |
954 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
955 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
956 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
957 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
958 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
959 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
960 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
961 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
962 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
963 | - |
|
964 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
954 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
955 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
956 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
957 | + add_action('init', array($this, 'load_controllers'), 7); |
|
958 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
959 | + add_action('init', array($this, 'initialize'), 10); |
|
960 | + add_action('init', array($this, 'initialize_last'), 100); |
|
961 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
962 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
963 | + |
|
964 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
965 | 965 | // pew pew pew |
966 | - EE_Registry::instance()->load_core( 'PUE' ); |
|
967 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
966 | + EE_Registry::instance()->load_core('PUE'); |
|
967 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
968 | 968 | } |
969 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
969 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | |
@@ -979,9 +979,9 @@ discard block |
||
979 | 979 | * @return void |
980 | 980 | */ |
981 | 981 | public function set_hooks_for_core() { |
982 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
982 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
983 | 983 | $this->_deactivate_incompatible_addons(); |
984 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
984 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | |
@@ -990,16 +990,16 @@ discard block |
||
990 | 990 | * Using the information gathered in EE_System::_incompatible_addon_error, |
991 | 991 | * deactivates any addons considered incompatible with the current version of EE |
992 | 992 | */ |
993 | - private function _deactivate_incompatible_addons(){ |
|
994 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
995 | - if ( ! empty( $incompatible_addons )) { |
|
996 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $incompatible_addons, '$incompatible_addons' ); |
|
997 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
998 | - foreach ( $active_plugins as $active_plugin ) { |
|
999 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
1000 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
1001 | - unset( $_GET['activate'] ); |
|
1002 | - EE_System::deactivate_plugin( $active_plugin ); |
|
993 | + private function _deactivate_incompatible_addons() { |
|
994 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
995 | + if ( ! empty($incompatible_addons)) { |
|
996 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $incompatible_addons, '$incompatible_addons'); |
|
997 | + $active_plugins = get_option('active_plugins', array()); |
|
998 | + foreach ($active_plugins as $active_plugin) { |
|
999 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
1000 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
1001 | + unset($_GET['activate']); |
|
1002 | + EE_System::deactivate_plugin($active_plugin); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | } |
@@ -1016,12 +1016,12 @@ discard block |
||
1016 | 1016 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
1017 | 1017 | * @return void |
1018 | 1018 | */ |
1019 | - public static function deactivate_plugin( $plugin_basename = '' ) { |
|
1020 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $plugin_basename, '$plugin_basename' ); |
|
1021 | - if ( ! function_exists( 'deactivate_plugins' )) { |
|
1022 | - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
1019 | + public static function deactivate_plugin($plugin_basename = '') { |
|
1020 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $plugin_basename, '$plugin_basename'); |
|
1021 | + if ( ! function_exists('deactivate_plugins')) { |
|
1022 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
1023 | 1023 | } |
1024 | - deactivate_plugins( $plugin_basename ); |
|
1024 | + deactivate_plugins($plugin_basename); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
@@ -1033,8 +1033,8 @@ discard block |
||
1033 | 1033 | * @return void |
1034 | 1034 | */ |
1035 | 1035 | public function perform_activations_upgrades_and_migrations() { |
1036 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
1037 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
1036 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
1037 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | |
@@ -1046,12 +1046,12 @@ discard block |
||
1046 | 1046 | * @return void |
1047 | 1047 | */ |
1048 | 1048 | public function load_CPTs_and_session() { |
1049 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
1050 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
1049 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
1050 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
1051 | 1051 | // register Custom Post Types |
1052 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
1052 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
1053 | 1053 | // EE_Registry::instance()->load_core( 'Session' ); |
1054 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
1054 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1066,17 +1066,17 @@ discard block |
||
1066 | 1066 | * @return void |
1067 | 1067 | */ |
1068 | 1068 | public function load_controllers() { |
1069 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
1070 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
1069 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
1070 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
1071 | 1071 | // let's get it started |
1072 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
1073 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
1074 | - EE_Registry::instance()->load_core( 'Front_Controller' ); |
|
1075 | - } else if ( ! EE_FRONT_AJAX ) { |
|
1076 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
1077 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
1072 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
1073 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
1074 | + EE_Registry::instance()->load_core('Front_Controller'); |
|
1075 | + } else if ( ! EE_FRONT_AJAX) { |
|
1076 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
1077 | + EE_Registry::instance()->load_core('Admin'); |
|
1078 | 1078 | } |
1079 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
1079 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | |
@@ -1090,11 +1090,11 @@ discard block |
||
1090 | 1090 | * @return void |
1091 | 1091 | */ |
1092 | 1092 | public function core_loaded_and_ready() { |
1093 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
1094 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
1095 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
1093 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
1094 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
1095 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
1096 | 1096 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
1097 | - EE_Registry::instance()->load_core( 'Session' ); |
|
1097 | + EE_Registry::instance()->load_core('Session'); |
|
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | |
@@ -1108,8 +1108,8 @@ discard block |
||
1108 | 1108 | * @return void |
1109 | 1109 | */ |
1110 | 1110 | public function initialize() { |
1111 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
1112 | - do_action( 'AHEE__EE_System__initialize' ); |
|
1111 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
1112 | + do_action('AHEE__EE_System__initialize'); |
|
1113 | 1113 | // EE_Cron_Tasks::check_for_abandoned_transactions( 802 ); |
1114 | 1114 | } |
1115 | 1115 | |
@@ -1124,8 +1124,8 @@ discard block |
||
1124 | 1124 | * @return void |
1125 | 1125 | */ |
1126 | 1126 | public function initialize_last() { |
1127 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
1128 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
1127 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
1128 | + do_action('AHEE__EE_System__initialize_last'); |
|
1129 | 1129 | } |
1130 | 1130 | |
1131 | 1131 | |
@@ -1157,21 +1157,21 @@ discard block |
||
1157 | 1157 | */ |
1158 | 1158 | public static function do_not_cache() { |
1159 | 1159 | // set no cache constants |
1160 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
1161 | - define( 'DONOTCACHEPAGE', true ); |
|
1160 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
1161 | + define('DONOTCACHEPAGE', true); |
|
1162 | 1162 | } |
1163 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
1164 | - define( 'DONOTCACHCEOBJECT', true ); |
|
1163 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
1164 | + define('DONOTCACHCEOBJECT', true); |
|
1165 | 1165 | } |
1166 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
1167 | - define( 'DONOTCACHEDB', true ); |
|
1166 | + if ( ! defined('DONOTCACHEDB')) { |
|
1167 | + define('DONOTCACHEDB', true); |
|
1168 | 1168 | } |
1169 | 1169 | // add no cache headers |
1170 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
1170 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
1171 | 1171 | // plus a little extra for nginx |
1172 | - add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 ); |
|
1172 | + add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1); |
|
1173 | 1173 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
1174 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
1174 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | * @param $headers |
1184 | 1184 | * @return array |
1185 | 1185 | */ |
1186 | - public static function nocache_headers_nginx ( $headers ) { |
|
1186 | + public static function nocache_headers_nginx($headers) { |
|
1187 | 1187 | $headers['X-Accel-Expires'] = 0; |
1188 | 1188 | return $headers; |
1189 | 1189 | } |
@@ -1209,13 +1209,13 @@ discard block |
||
1209 | 1209 | * @param $admin_bar |
1210 | 1210 | * @return void |
1211 | 1211 | */ |
1212 | - public function espresso_toolbar_items( $admin_bar ) { |
|
1212 | + public function espresso_toolbar_items($admin_bar) { |
|
1213 | 1213 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
1214 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
1214 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
1215 | 1215 | return; |
1216 | 1216 | } |
1217 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
1218 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
1217 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
1218 | + EE_Registry::instance()->load_helper('URL'); |
|
1219 | 1219 | $menu_class = 'espresso_menu_item_class'; |
1220 | 1220 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
1221 | 1221 | //because they're only defined in each of their respective constructors |
@@ -1226,20 +1226,20 @@ discard block |
||
1226 | 1226 | //Top Level |
1227 | 1227 | $admin_bar->add_menu(array( |
1228 | 1228 | 'id' => 'espresso-toolbar', |
1229 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
1229 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
1230 | 1230 | 'href' => $events_admin_url, |
1231 | 1231 | 'meta' => array( |
1232 | 1232 | 'title' => __('Event Espresso', 'event_espresso'), |
1233 | - 'class' => $menu_class . 'first' |
|
1233 | + 'class' => $menu_class.'first' |
|
1234 | 1234 | ), |
1235 | 1235 | )); |
1236 | 1236 | |
1237 | 1237 | //Events |
1238 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
1238 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
1239 | 1239 | $admin_bar->add_menu(array( |
1240 | 1240 | 'id' => 'espresso-toolbar-events', |
1241 | 1241 | 'parent' => 'espresso-toolbar', |
1242 | - 'title' => __( 'Events', 'event_espresso' ), |
|
1242 | + 'title' => __('Events', 'event_espresso'), |
|
1243 | 1243 | 'href' => $events_admin_url, |
1244 | 1244 | 'meta' => array( |
1245 | 1245 | 'title' => __('Events', 'event_espresso'), |
@@ -1250,13 +1250,13 @@ discard block |
||
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | |
1253 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
1253 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
1254 | 1254 | //Events Add New |
1255 | 1255 | $admin_bar->add_menu(array( |
1256 | 1256 | 'id' => 'espresso-toolbar-events-new', |
1257 | 1257 | 'parent' => 'espresso-toolbar-events', |
1258 | 1258 | 'title' => __('Add New', 'event_espresso'), |
1259 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
1259 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
1260 | 1260 | 'meta' => array( |
1261 | 1261 | 'title' => __('Add New', 'event_espresso'), |
1262 | 1262 | 'target' => '', |
@@ -1266,11 +1266,11 @@ discard block |
||
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | //Events View |
1269 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
1269 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
1270 | 1270 | $admin_bar->add_menu(array( |
1271 | 1271 | 'id' => 'espresso-toolbar-events-view', |
1272 | 1272 | 'parent' => 'espresso-toolbar-events', |
1273 | - 'title' => __( 'View', 'event_espresso' ), |
|
1273 | + 'title' => __('View', 'event_espresso'), |
|
1274 | 1274 | 'href' => $events_admin_url, |
1275 | 1275 | 'meta' => array( |
1276 | 1276 | 'title' => __('View', 'event_espresso'), |
@@ -1280,12 +1280,12 @@ discard block |
||
1280 | 1280 | )); |
1281 | 1281 | } |
1282 | 1282 | |
1283 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1283 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1284 | 1284 | //Events View All |
1285 | 1285 | $admin_bar->add_menu(array( |
1286 | 1286 | 'id' => 'espresso-toolbar-events-all', |
1287 | 1287 | 'parent' => 'espresso-toolbar-events-view', |
1288 | - 'title' => __( 'All', 'event_espresso' ), |
|
1288 | + 'title' => __('All', 'event_espresso'), |
|
1289 | 1289 | 'href' => $events_admin_url, |
1290 | 1290 | 'meta' => array( |
1291 | 1291 | 'title' => __('All', 'event_espresso'), |
@@ -1296,13 +1296,13 @@ discard block |
||
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | |
1299 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1299 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1300 | 1300 | //Events View Today |
1301 | 1301 | $admin_bar->add_menu(array( |
1302 | 1302 | 'id' => 'espresso-toolbar-events-today', |
1303 | 1303 | 'parent' => 'espresso-toolbar-events-view', |
1304 | 1304 | 'title' => __('Today', 'event_espresso'), |
1305 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1305 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1306 | 1306 | 'meta' => array( |
1307 | 1307 | 'title' => __('Today', 'event_espresso'), |
1308 | 1308 | 'target' => '', |
@@ -1312,13 +1312,13 @@ discard block |
||
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | |
1315 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1315 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1316 | 1316 | //Events View This Month |
1317 | 1317 | $admin_bar->add_menu(array( |
1318 | 1318 | 'id' => 'espresso-toolbar-events-month', |
1319 | 1319 | 'parent' => 'espresso-toolbar-events-view', |
1320 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1321 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1320 | + 'title' => __('This Month', 'event_espresso'), |
|
1321 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1322 | 1322 | 'meta' => array( |
1323 | 1323 | 'title' => __('This Month', 'event_espresso'), |
1324 | 1324 | 'target' => '', |
@@ -1328,11 +1328,11 @@ discard block |
||
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | //Registration Overview |
1331 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1331 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1332 | 1332 | $admin_bar->add_menu(array( |
1333 | 1333 | 'id' => 'espresso-toolbar-registrations', |
1334 | 1334 | 'parent' => 'espresso-toolbar', |
1335 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1335 | + 'title' => __('Registrations', 'event_espresso'), |
|
1336 | 1336 | 'href' => $reg_admin_url, |
1337 | 1337 | 'meta' => array( |
1338 | 1338 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1343,12 +1343,12 @@ discard block |
||
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | //Registration Overview Today |
1346 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1346 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1347 | 1347 | $admin_bar->add_menu(array( |
1348 | 1348 | 'id' => 'espresso-toolbar-registrations-today', |
1349 | 1349 | 'parent' => 'espresso-toolbar-registrations', |
1350 | - 'title' => __( 'Today', 'event_espresso'), |
|
1351 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1350 | + 'title' => __('Today', 'event_espresso'), |
|
1351 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1352 | 1352 | 'meta' => array( |
1353 | 1353 | 'title' => __('Today', 'event_espresso'), |
1354 | 1354 | 'target' => '', |
@@ -1358,14 +1358,14 @@ discard block |
||
1358 | 1358 | } |
1359 | 1359 | |
1360 | 1360 | //Registration Overview Today Completed |
1361 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1361 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1362 | 1362 | $admin_bar->add_menu(array( |
1363 | 1363 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1364 | 1364 | 'parent' => 'espresso-toolbar-registrations-today', |
1365 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1366 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1365 | + 'title' => __('Approved', 'event_espresso'), |
|
1366 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1367 | 1367 | 'meta' => array( |
1368 | - 'title' => __('Approved', 'event_espresso' ), |
|
1368 | + 'title' => __('Approved', 'event_espresso'), |
|
1369 | 1369 | 'target' => '', |
1370 | 1370 | 'class' => $menu_class |
1371 | 1371 | ), |
@@ -1373,14 +1373,14 @@ discard block |
||
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | //Registration Overview Today Pending\ |
1376 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1376 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1377 | 1377 | $admin_bar->add_menu(array( |
1378 | 1378 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1379 | 1379 | 'parent' => 'espresso-toolbar-registrations-today', |
1380 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1381 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1380 | + 'title' => __('Pending', 'event_espresso'), |
|
1381 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1382 | 1382 | 'meta' => array( |
1383 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1383 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1384 | 1384 | 'target' => '', |
1385 | 1385 | 'class' => $menu_class |
1386 | 1386 | ), |
@@ -1388,14 +1388,14 @@ discard block |
||
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | //Registration Overview Today Incomplete |
1391 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1391 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1392 | 1392 | $admin_bar->add_menu(array( |
1393 | 1393 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1394 | 1394 | 'parent' => 'espresso-toolbar-registrations-today', |
1395 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1396 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1395 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1396 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1397 | 1397 | 'meta' => array( |
1398 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1398 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1399 | 1399 | 'target' => '', |
1400 | 1400 | 'class' => $menu_class |
1401 | 1401 | ), |
@@ -1403,12 +1403,12 @@ discard block |
||
1403 | 1403 | } |
1404 | 1404 | |
1405 | 1405 | //Registration Overview Today Incomplete |
1406 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1406 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1407 | 1407 | $admin_bar->add_menu(array( |
1408 | 1408 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1409 | 1409 | 'parent' => 'espresso-toolbar-registrations-today', |
1410 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1411 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1410 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1411 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1412 | 1412 | 'meta' => array( |
1413 | 1413 | 'title' => __('Cancelled', 'event_espresso'), |
1414 | 1414 | 'target' => '', |
@@ -1418,12 +1418,12 @@ discard block |
||
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | //Registration Overview This Month |
1421 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1421 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1422 | 1422 | $admin_bar->add_menu(array( |
1423 | 1423 | 'id' => 'espresso-toolbar-registrations-month', |
1424 | 1424 | 'parent' => 'espresso-toolbar-registrations', |
1425 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1426 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1425 | + 'title' => __('This Month', 'event_espresso'), |
|
1426 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1427 | 1427 | 'meta' => array( |
1428 | 1428 | 'title' => __('This Month', 'event_espresso'), |
1429 | 1429 | 'target' => '', |
@@ -1433,12 +1433,12 @@ discard block |
||
1433 | 1433 | } |
1434 | 1434 | |
1435 | 1435 | //Registration Overview This Month Approved |
1436 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1436 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1437 | 1437 | $admin_bar->add_menu(array( |
1438 | 1438 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1439 | 1439 | 'parent' => 'espresso-toolbar-registrations-month', |
1440 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1441 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1440 | + 'title' => __('Approved', 'event_espresso'), |
|
1441 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1442 | 1442 | 'meta' => array( |
1443 | 1443 | 'title' => __('Approved', 'event_espresso'), |
1444 | 1444 | 'target' => '', |
@@ -1448,12 +1448,12 @@ discard block |
||
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | //Registration Overview This Month Pending |
1451 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1451 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1452 | 1452 | $admin_bar->add_menu(array( |
1453 | 1453 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1454 | 1454 | 'parent' => 'espresso-toolbar-registrations-month', |
1455 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1456 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1455 | + 'title' => __('Pending', 'event_espresso'), |
|
1456 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1457 | 1457 | 'meta' => array( |
1458 | 1458 | 'title' => __('Pending', 'event_espresso'), |
1459 | 1459 | 'target' => '', |
@@ -1463,14 +1463,14 @@ discard block |
||
1463 | 1463 | } |
1464 | 1464 | |
1465 | 1465 | //Registration Overview This Month Not Approved |
1466 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1466 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1467 | 1467 | $admin_bar->add_menu(array( |
1468 | 1468 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1469 | 1469 | 'parent' => 'espresso-toolbar-registrations-month', |
1470 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1471 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1470 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1471 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1472 | 1472 | 'meta' => array( |
1473 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1473 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1474 | 1474 | 'target' => '', |
1475 | 1475 | 'class' => $menu_class |
1476 | 1476 | ), |
@@ -1479,12 +1479,12 @@ discard block |
||
1479 | 1479 | |
1480 | 1480 | |
1481 | 1481 | //Registration Overview This Month Cancelled |
1482 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1482 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1483 | 1483 | $admin_bar->add_menu(array( |
1484 | 1484 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1485 | 1485 | 'parent' => 'espresso-toolbar-registrations-month', |
1486 | 1486 | 'title' => __('Cancelled', 'event_espresso'), |
1487 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1487 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1488 | 1488 | 'meta' => array( |
1489 | 1489 | 'title' => __('Cancelled', 'event_espresso'), |
1490 | 1490 | 'target' => '', |
@@ -1505,8 +1505,8 @@ discard block |
||
1505 | 1505 | * @param array $exclude_array any existing pages being excluded are in this array. |
1506 | 1506 | * @return array |
1507 | 1507 | */ |
1508 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1509 | - return array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() ); |
|
1508 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1509 | + return array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array()); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | |
@@ -1526,11 +1526,11 @@ discard block |
||
1526 | 1526 | */ |
1527 | 1527 | public function wp_enqueue_scripts() { |
1528 | 1528 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1529 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1529 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1530 | 1530 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1531 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1531 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1532 | 1532 | // register jQuery Validate |
1533 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE ); |
|
1533 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
1534 | 1534 | } |
1535 | 1535 | } |
1536 | 1536 | } |
@@ -461,13 +461,13 @@ discard block |
||
461 | 461 | |
462 | 462 | |
463 | 463 | /** |
464 | - * load_espresso_addons |
|
465 | - * |
|
466 | - * allow addons to load first so that they can set hooks for running DMS's, etc |
|
467 | - * |
|
468 | - * @access public |
|
469 | - * @return void |
|
470 | - */ |
|
464 | + * load_espresso_addons |
|
465 | + * |
|
466 | + * allow addons to load first so that they can set hooks for running DMS's, etc |
|
467 | + * |
|
468 | + * @access public |
|
469 | + * @return void |
|
470 | + */ |
|
471 | 471 | public function load_espresso_addons() { |
472 | 472 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
473 | 473 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
@@ -493,14 +493,14 @@ discard block |
||
493 | 493 | } |
494 | 494 | } |
495 | 495 | /** |
496 | - * detect_if_activation_or_upgrade |
|
497 | - * |
|
498 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
499 | - * and either setting up the DB or setting up maintenance mode etc. |
|
500 | - * |
|
501 | - * @access private |
|
502 | - * @return void |
|
503 | - */ |
|
496 | + * detect_if_activation_or_upgrade |
|
497 | + * |
|
498 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
499 | + * and either setting up the DB or setting up maintenance mode etc. |
|
500 | + * |
|
501 | + * @access private |
|
502 | + * @return void |
|
503 | + */ |
|
504 | 504 | public function detect_if_activation_or_upgrade() { |
505 | 505 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
506 | 506 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
@@ -804,11 +804,11 @@ discard block |
||
804 | 804 | $query_params = array( 'page' => 'espresso_about' ); |
805 | 805 | |
806 | 806 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
807 | - $query_params['new_activation'] = TRUE; |
|
807 | + $query_params['new_activation'] = TRUE; |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
811 | - $query_params['reactivation'] = TRUE; |
|
811 | + $query_params['reactivation'] = TRUE; |
|
812 | 812 | } |
813 | 813 | $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
814 | 814 | wp_safe_redirect( $url ); |
@@ -893,13 +893,13 @@ discard block |
||
893 | 893 | |
894 | 894 | |
895 | 895 | /** |
896 | - * register_shortcodes_modules_and_widgets |
|
897 | - * |
|
898 | - * generate lists of shortcodes and modules, then verify paths and classes |
|
899 | - * |
|
900 | - * @access public |
|
901 | - * @return void |
|
902 | - */ |
|
896 | + * register_shortcodes_modules_and_widgets |
|
897 | + * |
|
898 | + * generate lists of shortcodes and modules, then verify paths and classes |
|
899 | + * |
|
900 | + * @access public |
|
901 | + * @return void |
|
902 | + */ |
|
903 | 903 | public function register_shortcodes_modules_and_widgets() { |
904 | 904 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
905 | 905 | do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
@@ -911,11 +911,11 @@ discard block |
||
911 | 911 | |
912 | 912 | |
913 | 913 | /** |
914 | - * _incompatible_addon_error |
|
915 | - * |
|
916 | - * @access public |
|
917 | - * @return void |
|
918 | - */ |
|
914 | + * _incompatible_addon_error |
|
915 | + * |
|
916 | + * @access public |
|
917 | + * @return void |
|
918 | + */ |
|
919 | 919 | private function _incompatible_addon_error() { |
920 | 920 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
921 | 921 | // get array of classes hooking into here |
@@ -1057,14 +1057,14 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | |
1059 | 1059 | /** |
1060 | - * load_controllers |
|
1061 | - * |
|
1062 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
1063 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
1064 | - * |
|
1065 | - * @access public |
|
1066 | - * @return void |
|
1067 | - */ |
|
1060 | + * load_controllers |
|
1061 | + * |
|
1062 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
1063 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
1064 | + * |
|
1065 | + * @access public |
|
1066 | + * @return void |
|
1067 | + */ |
|
1068 | 1068 | public function load_controllers() { |
1069 | 1069 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
1070 | 1070 | do_action( 'AHEE__EE_System__load_controllers__start' ); |
@@ -1082,13 +1082,13 @@ discard block |
||
1082 | 1082 | |
1083 | 1083 | |
1084 | 1084 | /** |
1085 | - * core_loaded_and_ready |
|
1086 | - * |
|
1087 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
1088 | - * |
|
1089 | - * @access public |
|
1090 | - * @return void |
|
1091 | - */ |
|
1085 | + * core_loaded_and_ready |
|
1086 | + * |
|
1087 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
1088 | + * |
|
1089 | + * @access public |
|
1090 | + * @return void |
|
1091 | + */ |
|
1092 | 1092 | public function core_loaded_and_ready() { |
1093 | 1093 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
1094 | 1094 | do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
@@ -1100,13 +1100,13 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | /** |
1103 | - * initialize |
|
1104 | - * |
|
1105 | - * this is the best place to begin initializing client code |
|
1106 | - * |
|
1107 | - * @access public |
|
1108 | - * @return void |
|
1109 | - */ |
|
1103 | + * initialize |
|
1104 | + * |
|
1105 | + * this is the best place to begin initializing client code |
|
1106 | + * |
|
1107 | + * @access public |
|
1108 | + * @return void |
|
1109 | + */ |
|
1110 | 1110 | public function initialize() { |
1111 | 1111 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
1112 | 1112 | do_action( 'AHEE__EE_System__initialize' ); |
@@ -1116,13 +1116,13 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | |
1118 | 1118 | /** |
1119 | - * initialize_last |
|
1120 | - * |
|
1121 | - * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
1122 | - * |
|
1123 | - * @access public |
|
1124 | - * @return void |
|
1125 | - */ |
|
1119 | + * initialize_last |
|
1120 | + * |
|
1121 | + * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
1122 | + * |
|
1123 | + * @access public |
|
1124 | + * @return void |
|
1125 | + */ |
|
1126 | 1126 | public function initialize_last() { |
1127 | 1127 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
1128 | 1128 | do_action( 'AHEE__EE_System__initialize_last' ); |
@@ -1132,14 +1132,14 @@ discard block |
||
1132 | 1132 | |
1133 | 1133 | |
1134 | 1134 | /** |
1135 | - * set_hooks_for_shortcodes_modules_and_addons |
|
1136 | - * |
|
1137 | - * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
1138 | - * this happens at the very beginning of the wp_loaded hookpoint |
|
1139 | - * |
|
1140 | - * @access public |
|
1141 | - * @return void |
|
1142 | - */ |
|
1135 | + * set_hooks_for_shortcodes_modules_and_addons |
|
1136 | + * |
|
1137 | + * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
1138 | + * this happens at the very beginning of the wp_loaded hookpoint |
|
1139 | + * |
|
1140 | + * @access public |
|
1141 | + * @return void |
|
1142 | + */ |
|
1143 | 1143 | public function set_hooks_for_shortcodes_modules_and_addons() { |
1144 | 1144 | // do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
1145 | 1145 | } |
@@ -1148,13 +1148,13 @@ discard block |
||
1148 | 1148 | |
1149 | 1149 | |
1150 | 1150 | /** |
1151 | - * do_not_cache |
|
1152 | - * |
|
1153 | - * sets no cache headers and defines no cache constants for WP plugins |
|
1154 | - * |
|
1155 | - * @access public |
|
1156 | - * @return void |
|
1157 | - */ |
|
1151 | + * do_not_cache |
|
1152 | + * |
|
1153 | + * sets no cache headers and defines no cache constants for WP plugins |
|
1154 | + * |
|
1155 | + * @access public |
|
1156 | + * @return void |
|
1157 | + */ |
|
1158 | 1158 | public static function do_not_cache() { |
1159 | 1159 | // set no cache constants |
1160 | 1160 | if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | final class EE_Admin { |
25 | 25 | |
26 | 26 | /** |
27 | - * EE_Admin Object |
|
28 | - * @private _instance |
|
29 | - * @private protected |
|
30 | - */ |
|
27 | + * EE_Admin Object |
|
28 | + * @private _instance |
|
29 | + * @private protected |
|
30 | + */ |
|
31 | 31 | private static $_instance = NULL; |
32 | 32 | |
33 | 33 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
59 | - * class constructor |
|
60 | - */ |
|
59 | + * class constructor |
|
60 | + */ |
|
61 | 61 | protected function __construct() { |
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | |
169 | 169 | |
170 | 170 | /** |
171 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | - * |
|
173 | - * @access public |
|
174 | - * @return void |
|
175 | - */ |
|
171 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | + * |
|
173 | + * @access public |
|
174 | + * @return void |
|
175 | + */ |
|
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
466 | - * admin_init |
|
467 | - * |
|
468 | - * @access public |
|
469 | - * @return void |
|
470 | - */ |
|
466 | + * admin_init |
|
467 | + * |
|
468 | + * @access public |
|
469 | + * @return void |
|
470 | + */ |
|
471 | 471 | public function admin_init() { |
472 | 472 | |
473 | 473 | /** |
@@ -624,11 +624,11 @@ discard block |
||
624 | 624 | |
625 | 625 | |
626 | 626 | /** |
627 | - * dismiss_persistent_admin_notice |
|
628 | - * |
|
629 | - * @access public |
|
630 | - * @return void |
|
631 | - */ |
|
627 | + * dismiss_persistent_admin_notice |
|
628 | + * |
|
629 | + * @access public |
|
630 | + * @return void |
|
631 | + */ |
|
632 | 632 | public function dismiss_ee_nag_notice_callback() { |
633 | 633 | EE_Error::dismiss_persistent_admin_notice(); |
634 | 634 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -220,8 +222,9 @@ discard block |
||
220 | 222 | */ |
221 | 223 | public function remove_pages_from_nav_menu( $post_type ) { |
222 | 224 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
224 | - return $post_type; |
|
225 | + if ( $post_type->name !== 'page' ) { |
|
226 | + return $post_type; |
|
227 | + } |
|
225 | 228 | |
226 | 229 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
227 | 230 | |
@@ -240,8 +243,9 @@ discard block |
||
240 | 243 | */ |
241 | 244 | public function enable_hidden_ee_nav_menu_metaboxes() { |
242 | 245 | global $wp_meta_boxes, $pagenow; |
243 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) |
|
244 | - return; |
|
246 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
247 | + return; |
|
248 | + } |
|
245 | 249 | |
246 | 250 | $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories' ) ); |
247 | 251 | $hidden_meta_boxes = array(); |
@@ -296,8 +300,9 @@ discard block |
||
296 | 300 | * @return string the (maybe) modified link |
297 | 301 | */ |
298 | 302 | public function modify_edit_post_link( $link, $id, $context ) { |
299 | - if ( ! $post = get_post( $id ) ) |
|
300 | - return $link; |
|
303 | + if ( ! $post = get_post( $id ) ) { |
|
304 | + return $link; |
|
305 | + } |
|
301 | 306 | |
302 | 307 | if ( $post->post_type == 'espresso_attendees' ) { |
303 | 308 | $query_args = array( |
@@ -337,7 +342,10 @@ discard block |
||
337 | 342 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
338 | 343 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
339 | 344 | <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
345 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) { |
|
346 | + echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); |
|
347 | +} |
|
348 | +?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | 349 | <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
342 | 350 | </a> |
343 | 351 | </li> |
@@ -864,8 +872,9 @@ discard block |
||
864 | 872 | */ |
865 | 873 | public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
866 | 874 | EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
867 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
868 | - $config['page_path'] = $page_path; |
|
875 | + if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
876 | + $config['page_path'] = $page_path; |
|
877 | + } |
|
869 | 878 | EE_Register_Admin_Page::register( $page_basename, $config ); |
870 | 879 | } |
871 | 880 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function instance() { |
49 | 49 | // check if class object is instantiated |
50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
51 | 51 | self::$_instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
64 | 64 | // set autoloaders for our admin page classes based on included path information |
65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
66 | 66 | // admin hooks |
67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
68 | 68 | // load EE_Request_Handler early |
69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
103 | - define( 'JQPLOT_URL', EE_GLOBAL_ASSETS_URL . 'scripts/jqplot/' ); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | + define('JQPLOT_URL', EE_GLOBAL_ASSETS_URL.'scripts/jqplot/'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,23 +113,23 @@ discard block |
||
113 | 113 | * @param string $plugin |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public function filter_plugin_actions( $links, $plugin ) { |
|
116 | + public function filter_plugin_actions($links, $plugin) { |
|
117 | 117 | // set $main_file in stone |
118 | 118 | static $main_file; |
119 | 119 | // if $main_file is not set yet |
120 | - if ( ! $main_file ) { |
|
121 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
120 | + if ( ! $main_file) { |
|
121 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
122 | 122 | } |
123 | - if ( $plugin == $main_file ) { |
|
123 | + if ($plugin == $main_file) { |
|
124 | 124 | // compare current plugin to this one |
125 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
126 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
127 | - array_unshift( $links, $maintenance_link ); |
|
125 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
126 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
127 | + array_unshift($links, $maintenance_link); |
|
128 | 128 | } else { |
129 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
130 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
129 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
130 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
131 | 131 | // add before other links |
132 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
132 | + array_unshift($links, $org_settings_link, $events_link); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | return $links; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | */ |
146 | 146 | public function get_request() { |
147 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
148 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
147 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
148 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param array $admin_page_folder_names |
158 | 158 | * @return array |
159 | 159 | */ |
160 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
160 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
161 | 161 | return array( |
162 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
163 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
164 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
162 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
163 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
164 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
@@ -176,36 +176,36 @@ discard block |
||
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
179 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
179 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
180 | 180 | //ok so we want to enable the entire admin |
181 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
182 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
183 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
184 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
185 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
186 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
182 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
183 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
184 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
185 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
186 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
187 | 187 | //at a glance dashboard widget |
188 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
188 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
189 | 189 | //filter for get_edit_post_link used on comments for custom post types |
190 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
190 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
194 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
194 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
195 | 195 | try { |
196 | 196 | //this loads the controller for the admin pages which will setup routing etc |
197 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
198 | - } catch ( EE_Error $e ) { |
|
197 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
198 | + } catch (EE_Error $e) { |
|
199 | 199 | $e->get_error(); |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
204 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
205 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
204 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
205 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
206 | 206 | |
207 | 207 | //exclude EE critical pages from all nav menus and wp_list_pages |
208 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
208 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | * @param object $post_type WP post type object |
219 | 219 | * @return object WP post type object |
220 | 220 | */ |
221 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
221 | + public function remove_pages_from_nav_menu($post_type) { |
|
222 | 222 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
223 | + if ($post_type->name !== 'page') |
|
224 | 224 | return $post_type; |
225 | 225 | |
226 | 226 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function enable_hidden_ee_nav_menu_metaboxes() { |
242 | 242 | global $wp_meta_boxes, $pagenow; |
243 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) |
|
243 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') |
|
244 | 244 | return; |
245 | 245 | |
246 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories' ) ); |
|
246 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories')); |
|
247 | 247 | $hidden_meta_boxes = array(); |
248 | 248 | |
249 | - foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) { |
|
250 | - foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) { |
|
251 | - foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) { |
|
252 | - if ( in_array( $box['id'], $initial_meta_boxes ) ) { |
|
253 | - unset( $box['id'] ); |
|
249 | + foreach (array_keys($wp_meta_boxes['nav-menus']) as $context) { |
|
250 | + foreach (array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority) { |
|
251 | + foreach ($wp_meta_boxes['nav-menus'][$context][$priority] as $box) { |
|
252 | + if (in_array($box['id'], $initial_meta_boxes)) { |
|
253 | + unset($box['id']); |
|
254 | 254 | } else { |
255 | 255 | $hidden_meta_boxes[] = $box['id']; |
256 | 256 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | $user = wp_get_current_user(); |
262 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
262 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @return void |
279 | 279 | */ |
280 | 280 | public function register_custom_nav_menu_boxes() { |
281 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
281 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return string the (maybe) modified link |
297 | 297 | */ |
298 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
299 | - if ( ! $post = get_post( $id ) ) |
|
298 | + public function modify_edit_post_link($link, $id, $context) { |
|
299 | + if ( ! $post = get_post($id)) |
|
300 | 300 | return $link; |
301 | 301 | |
302 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
302 | + if ($post->post_type == 'espresso_attendees') { |
|
303 | 303 | $query_args = array( |
304 | 304 | 'action' => 'edit_attendee', |
305 | 305 | 'post' => $id |
306 | 306 | ); |
307 | 307 | EE_Registry::instance()->load_helper('URL'); |
308 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
308 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
309 | 309 | } |
310 | 310 | return $link; |
311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | global $nav_menu_selected_id; |
318 | 318 | |
319 | 319 | $db_fields = false; |
320 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
320 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
321 | 321 | $current_tab = 'event-archives'; |
322 | 322 | |
323 | 323 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | ?> |
337 | 337 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
338 | 338 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
339 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
339 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
340 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
342 | 342 | </a> |
343 | 343 | </li> |
344 | 344 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -356,13 +356,13 @@ discard block |
||
356 | 356 | <?php */ ?> |
357 | 357 | |
358 | 358 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
359 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
359 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
360 | 360 | ?>"> |
361 | 361 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
362 | 362 | <?php |
363 | 363 | $pages = $this->_get_extra_nav_menu_pages_items(); |
364 | 364 | $args['walker'] = $walker; |
365 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
365 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
366 | 366 | ?> |
367 | 367 | </ul> |
368 | 368 | </div><!-- /.tabs-panel --> |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | <p class="button-controls"> |
371 | 371 | <span class="list-controls"> |
372 | 372 | <a href="<?php |
373 | - echo esc_url( add_query_arg( |
|
373 | + echo esc_url(add_query_arg( |
|
374 | 374 | array( |
375 | 375 | 'extra-nav-menu-pages-tab' => 'event-archives', |
376 | 376 | 'selectall' => 1, |
377 | 377 | ), |
378 | - remove_query_arg( $removed_args ) |
|
378 | + remove_query_arg($removed_args) |
|
379 | 379 | )); |
380 | 380 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
381 | 381 | </span> |
382 | 382 | |
383 | 383 | <span class="add-to-menu"> |
384 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
384 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
385 | 385 | <span class="spinner"></span> |
386 | 386 | </span> |
387 | 387 | </p> |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | private function _get_extra_nav_menu_pages_items() { |
403 | 403 | $menuitems[] = array( |
404 | 404 | 'title' => __('Event List', 'event_espresso'), |
405 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
405 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
406 | 406 | 'description' => __('Archive page for all events.', 'event_espresso') |
407 | 407 | ); |
408 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
408 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @param $menuitem |
418 | 418 | * @return stdClass |
419 | 419 | */ |
420 | - private function _setup_extra_nav_menu_pages_items( $menuitem ) { |
|
420 | + private function _setup_extra_nav_menu_pages_items($menuitem) { |
|
421 | 421 | $menu_item = new stdClass(); |
422 | 422 | $keys = array( |
423 | 423 | 'ID' => 0, |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'xfn' => '' |
438 | 438 | ); |
439 | 439 | |
440 | - foreach ( $keys as $key => $value) { |
|
440 | + foreach ($keys as $key => $value) { |
|
441 | 441 | $menu_item->$key = isset($menuitem[$key]) ? $menuitem[$key] : $value; |
442 | 442 | } |
443 | 443 | return $menu_item; |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | * - check if doing post processing of one of EE CPTs |
478 | 478 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
479 | 479 | */ |
480 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
481 | - if ( isset( $_POST['post_type'] ) ) { |
|
482 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
483 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
480 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
481 | + if (isset($_POST['post_type'])) { |
|
482 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
483 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
@@ -496,37 +496,37 @@ discard block |
||
496 | 496 | public function enqueue_admin_scripts() { |
497 | 497 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
498 | 498 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
499 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
499 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
500 | 500 | // register cookie script for future dependencies |
501 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
501 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
502 | 502 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
503 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
503 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
504 | 504 | // register jQuery Validate |
505 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
505 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
506 | 506 | } |
507 | 507 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
508 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
508 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
509 | 509 | //joyride style |
510 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
511 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
512 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
510 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
511 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
512 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
513 | 513 | //joyride JS |
514 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
514 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
515 | 515 | // wanna go for a joyride? |
516 | 516 | wp_enqueue_style('ee-joyride-css'); |
517 | 517 | wp_enqueue_script('jquery-joyride'); |
518 | 518 | } |
519 | 519 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
520 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
520 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
521 | 521 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
522 | 522 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
523 | 523 | } |
524 | 524 | //accounting.js library |
525 | 525 | // @link http://josscrowcroft.github.io/accounting.js/ |
526 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
527 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
528 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
529 | - wp_enqueue_script( 'ee-accounting' ); |
|
526 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
527 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
528 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
529 | + wp_enqueue_script('ee-accounting'); |
|
530 | 530 | // array of settings to get converted to JSON array via wp_localize_script |
531 | 531 | $currency_config = array( |
532 | 532 | 'currency' => array( |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | public function get_persistent_admin_notices() { |
574 | 574 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
575 | 575 | $args = array( |
576 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
577 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
576 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
577 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
578 | 578 | ); |
579 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
580 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
579 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
580 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | |
@@ -598,20 +598,20 @@ discard block |
||
598 | 598 | * @param $elements |
599 | 599 | * @return array |
600 | 600 | */ |
601 | - public function dashboard_glance_items( $elements ) { |
|
601 | + public function dashboard_glance_items($elements) { |
|
602 | 602 | $events = EEM_Event::instance()->count(); |
603 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
604 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
603 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
604 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
605 | 605 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
606 | 606 | $registrations = EEM_Registration::instance()->count(); |
607 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
608 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
607 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
608 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
609 | 609 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
610 | 610 | |
611 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
611 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
612 | 612 | |
613 | - foreach ( $items as $item ) { |
|
614 | - $elements[] = sprintf( '<a href="%s" title="%s">%s</a>', $item['url'], $item['title'], $item['text'] ); |
|
613 | + foreach ($items as $item) { |
|
614 | + $elements[] = sprintf('<a href="%s" title="%s">%s</a>', $item['url'], $item['title'], $item['text']); |
|
615 | 615 | } |
616 | 616 | return $elements; |
617 | 617 | } |
@@ -630,14 +630,14 @@ discard block |
||
630 | 630 | * @param $post |
631 | 631 | * @return void |
632 | 632 | */ |
633 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
633 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
634 | 634 | // default post types |
635 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
635 | + $post_types = array('post' => 0, 'page' => 1); |
|
636 | 636 | // add CPTs |
637 | 637 | $CPTs = EE_Register_CPTs::get_CPTs(); |
638 | - $post_types = array_merge( $post_types, $CPTs ); |
|
638 | + $post_types = array_merge($post_types, $CPTs); |
|
639 | 639 | // for default or CPT posts... |
640 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
640 | + if (isset($post_types[$post->post_type])) { |
|
641 | 641 | // whether to proceed with update |
642 | 642 | $update_post_shortcodes = FALSE; |
643 | 643 | // post on frontpage ? |
@@ -645,32 +645,32 @@ discard block |
||
645 | 645 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
646 | 646 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
647 | 647 | // array of shortcodes indexed by post name |
648 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
648 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
649 | 649 | // empty both arrays |
650 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
650 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
651 | 651 | // loop thru shortcodes |
652 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
652 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
653 | 653 | // convert to UPPERCASE to get actual shortcode |
654 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
654 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
655 | 655 | // is the shortcode in the post_content ? |
656 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
656 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
657 | 657 | // map shortcode to post names and post IDs |
658 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
658 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
659 | 659 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
660 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
660 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
661 | 661 | // check that posts page is already being tracked |
662 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) { |
|
662 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
663 | 663 | // if not, then ensure that it is properly added |
664 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
664 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
665 | 665 | } |
666 | 666 | // add shortcode to "Posts page" tracking |
667 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
667 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
668 | 668 | } |
669 | 669 | $update_post_shortcodes = TRUE; |
670 | 670 | } |
671 | 671 | } |
672 | - if ( $update_post_shortcodes ) { |
|
673 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
672 | + if ($update_post_shortcodes) { |
|
673 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
674 | 674 | } |
675 | 675 | } |
676 | 676 | } |
@@ -688,38 +688,38 @@ discard block |
||
688 | 688 | * @throws EE_Error |
689 | 689 | * @return string |
690 | 690 | */ |
691 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
691 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
692 | 692 | // check for date_format or time_format |
693 | - switch ( $option ) { |
|
693 | + switch ($option) { |
|
694 | 694 | case 'date_format' : |
695 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
695 | + $date_time_format = $value.' '.get_option('time_format'); |
|
696 | 696 | break; |
697 | 697 | case 'time_format' : |
698 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
698 | + $date_time_format = get_option('date_format').' '.$value; |
|
699 | 699 | break; |
700 | 700 | default : |
701 | 701 | $date_time_format = FALSE; |
702 | 702 | } |
703 | 703 | // do we have a date_time format to check ? |
704 | - if ( $date_time_format ) { |
|
704 | + if ($date_time_format) { |
|
705 | 705 | // because DateTime chokes on some formats, check first that strtotime can parse it |
706 | - $date_string = strtotime( date( $date_time_format )); |
|
706 | + $date_string = strtotime(date($date_time_format)); |
|
707 | 707 | // invalid date time formats will evaluate to either "0" or "" |
708 | - if ( empty( $date_string )) { |
|
708 | + if (empty($date_string)) { |
|
709 | 709 | // trigger WP settings error |
710 | 710 | add_settings_error( |
711 | 711 | 'date_format', |
712 | 712 | 'date_format', |
713 | 713 | sprintf( |
714 | - __('The following date time "%s" ( %s ) can not be properly parsed by PHP due to its format and may cause incompatibility issues with Event Espresso. You will need to choose a more standard date time format in order for everything to operate correctly. %sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), |
|
715 | - date( $date_time_format ), |
|
714 | + __('The following date time "%s" ( %s ) can not be properly parsed by PHP due to its format and may cause incompatibility issues with Event Espresso. You will need to choose a more standard date time format in order for everything to operate correctly. %sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), |
|
715 | + date($date_time_format), |
|
716 | 716 | $date_time_format, |
717 | 717 | '<br /><span style="color:#D54E21;">', |
718 | 718 | '</span>' |
719 | 719 | ) |
720 | 720 | ); |
721 | 721 | // set format to something valid |
722 | - switch ( $option ) { |
|
722 | + switch ($option) { |
|
723 | 723 | case 'date_format' : |
724 | 724 | $value = 'F j, Y'; |
725 | 725 | break; |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | * @param $value |
746 | 746 | * @return void |
747 | 747 | */ |
748 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
749 | - if ( $option == 'page_for_posts' ) { |
|
748 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
749 | + if ($option == 'page_for_posts') { |
|
750 | 750 | global $wpdb; |
751 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
752 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
753 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
754 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
755 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
751 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
752 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
753 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
754 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
755 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | |
@@ -765,8 +765,8 @@ discard block |
||
765 | 765 | * @param $content |
766 | 766 | * @return string |
767 | 767 | */ |
768 | - public function its_eSpresso( $content ) { |
|
769 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
768 | + public function its_eSpresso($content) { |
|
769 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | |
@@ -779,9 +779,9 @@ discard block |
||
779 | 779 | */ |
780 | 780 | public function espresso_admin_footer() { |
781 | 781 | return sprintf( |
782 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
782 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
783 | 783 | '<a href="http://eventespresso.com/" title="', |
784 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
784 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
785 | 785 | ); |
786 | 786 | } |
787 | 787 | |
@@ -801,11 +801,11 @@ discard block |
||
801 | 801 | * @param array $config |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
805 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
806 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
804 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
805 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
806 | + if (class_exists('EE_Register_Admin_Page')) |
|
807 | 807 | $config['page_path'] = $page_path; |
808 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
808 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 |
@@ -78,8 +78,8 @@ |
||
78 | 78 | |
79 | 79 | |
80 | 80 | /** |
81 | - * @var EE_CPT_Base |
|
82 | - */ |
|
81 | + * @var EE_CPT_Base |
|
82 | + */ |
|
83 | 83 | protected $_cpt_model_obj = FALSE; |
84 | 84 | |
85 | 85 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param object $post The post object of the cpt that was saved. |
109 | 109 | * @return void |
110 | 110 | */ |
111 | - abstract protected function _insert_update_cpt_item( $post_id, $post ); |
|
111 | + abstract protected function _insert_update_cpt_item($post_id, $post); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param string $post_id The ID of the cpt that was trashed |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - abstract public function trash_cpt_item( $post_id ); |
|
124 | + abstract public function trash_cpt_item($post_id); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param string $post_id theID of the cpt that was untrashed |
133 | 133 | * @return void |
134 | 134 | */ |
135 | - abstract public function restore_cpt_item( $post_id ); |
|
135 | + abstract public function restore_cpt_item($post_id); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $post_id the ID of the cpt that was deleted |
144 | 144 | * @return void |
145 | 145 | */ |
146 | - abstract public function delete_cpt_item( $post_id ); |
|
146 | + abstract public function delete_cpt_item($post_id); |
|
147 | 147 | |
148 | 148 | |
149 | 149 | |
@@ -156,25 +156,25 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function _before_page_setup() { |
158 | 158 | |
159 | - $page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug; |
|
159 | + $page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug; |
|
160 | 160 | |
161 | - $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes ); |
|
161 | + $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes); |
|
162 | 162 | |
163 | 163 | //let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page |
164 | - $this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page ); |
|
164 | + $this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page); |
|
165 | 165 | |
166 | 166 | //tweak pagenow for page loading. |
167 | - add_action( 'current_screen', array( $this, 'modify_pagenow') ); |
|
167 | + add_action('current_screen', array($this, 'modify_pagenow')); |
|
168 | 168 | |
169 | 169 | |
170 | 170 | //TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param. |
171 | 171 | //get current page from autosave |
172 | - $current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
173 | - $this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page; |
|
172 | + $current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
173 | + $this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page; |
|
174 | 174 | |
175 | 175 | |
176 | 176 | //autosave... make sure its only for the correct page |
177 | - if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) { |
|
177 | + if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) { |
|
178 | 178 | //setup autosave ajax hook |
179 | 179 | //add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented |
180 | 180 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return void |
192 | 192 | */ |
193 | - public function modify_pagenow( $current_screen ) { |
|
193 | + public function modify_pagenow($current_screen) { |
|
194 | 194 | global $pagenow; |
195 | 195 | //corresponding pagenow maps for our custom routes. |
196 | 196 | $pagenow_map = array( |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | ); |
201 | 201 | |
202 | 202 | //possibly reset pagenow. |
203 | - if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $pagenow_map[$this->_req_data['action'] ] ) ) { |
|
203 | + if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($pagenow_map[$this->_req_data['action']])) { |
|
204 | 204 | $pagenow = $pagenow_map[$this->_req_data['action']]; |
205 | 205 | } |
206 | 206 | } |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param array $ids an array of ids for containers that hold form inputs we want autosave to pickup. Typically you would send along the id of a metabox container. |
216 | 216 | * @return void |
217 | 217 | */ |
218 | - protected function _register_autosave_containers( $ids ) { |
|
219 | - $this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids ); |
|
218 | + protected function _register_autosave_containers($ids) { |
|
219 | + $this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -231,22 +231,22 @@ discard block |
||
231 | 231 | |
232 | 232 | $containers = array(); |
233 | 233 | |
234 | - if ( empty( $wp_meta_boxes ) ) |
|
234 | + if (empty($wp_meta_boxes)) |
|
235 | 235 | return; |
236 | 236 | |
237 | - $current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
237 | + $current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
238 | 238 | |
239 | - foreach ( $current_metaboxes as $box_context ) { |
|
240 | - foreach ( $box_context as $box_details ) { |
|
241 | - foreach ( $box_details as $box ) { |
|
242 | - if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){ |
|
239 | + foreach ($current_metaboxes as $box_context) { |
|
240 | + foreach ($box_context as $box_details) { |
|
241 | + foreach ($box_details as $box) { |
|
242 | + if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) { |
|
243 | 243 | $containers[] = $box['id']; |
244 | 244 | } |
245 | 245 | } |
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | - $this->_autosave_containers = array_merge( $this->_autosave_containers, $containers ); |
|
249 | + $this->_autosave_containers = array_merge($this->_autosave_containers, $containers); |
|
250 | 250 | |
251 | 251 | //add hidden inputs container |
252 | 252 | $this->_autosave_containers[] = 'ee-cpt-hidden-inputs'; |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2 |
264 | 264 | |
265 | 265 | //filter _autosave_containers |
266 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this ); |
|
267 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this ); |
|
266 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this); |
|
267 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this); |
|
268 | 268 | |
269 | - wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
269 | + wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
270 | 270 | |
271 | 271 | $unsaved_data_msg = array( |
272 | - 'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
272 | + 'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
273 | 273 | 'inputChanged' => 0 |
274 | 274 | ); |
275 | 275 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | public function load_page_dependencies() { |
282 | 282 | try { |
283 | 283 | $this->_load_page_dependencies(); |
284 | - } catch ( EE_Error $e ) { |
|
284 | + } catch (EE_Error $e) { |
|
285 | 285 | $e->get_error(); |
286 | 286 | } |
287 | 287 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | protected function _load_page_dependencies() { |
298 | 298 | |
299 | 299 | //we only add stuff if this is a cpt_route! |
300 | - if ( !$this->_cpt_route ) { |
|
300 | + if ( ! $this->_cpt_route) { |
|
301 | 301 | parent::_load_page_dependencies(); |
302 | 302 | return; |
303 | 303 | } |
@@ -307,72 +307,72 @@ discard block |
||
307 | 307 | |
308 | 308 | //the following filters are for setting all the redirects on DEFAULT WP custom post type actions |
309 | 309 | //let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects! Otherwise the redirects will happen on ALL post saves which wouldn't be good of course! |
310 | - add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') ); |
|
310 | + add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input')); |
|
311 | 311 | |
312 | 312 | //inject our Admin page nav tabs... |
313 | 313 | //let's make sure the nav tabs are set if they aren't already |
314 | 314 | //if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs(); |
315 | - add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) ); |
|
315 | + add_action('post_edit_form_tag', array($this, 'inject_nav_tabs')); |
|
316 | 316 | |
317 | 317 | //modify the post_updated messages array |
318 | - add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 ); |
|
318 | + add_action('post_updated_messages', array($this, 'post_update_messages'), 10); |
|
319 | 319 | |
320 | 320 | //add shortlink button to cpt edit screens. We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts! |
321 | - add_filter( 'get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 ); |
|
321 | + add_filter('get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4); |
|
322 | 322 | |
323 | 323 | //This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class. |
324 | - if ( !empty($this->_labels['publishbox'] ) ) { |
|
324 | + if ( ! empty($this->_labels['publishbox'])) { |
|
325 | 325 | |
326 | - $box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
326 | + $box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
327 | 327 | |
328 | - remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
329 | - add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
328 | + remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
329 | + add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | //let's add page_templates metabox if this cpt added support for it. |
333 | - if ( $this->_supports_page_templates($this->_cpt_object->name) ) { |
|
334 | - add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' ); |
|
333 | + if ($this->_supports_page_templates($this->_cpt_object->name)) { |
|
334 | + add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default'); |
|
335 | 335 | }/**/ |
336 | 336 | |
337 | 337 | |
338 | 338 | //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form |
339 | - if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) |
|
340 | - add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
339 | + if (method_exists($this, 'extra_permalink_field_buttons')) |
|
340 | + add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4); |
|
341 | 341 | |
342 | 342 | //add preview button |
343 | - add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 ); |
|
343 | + add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4); |
|
344 | 344 | |
345 | 345 | |
346 | 346 | //insert our own post_stati dropdown |
347 | - add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 ); |
|
347 | + add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10); |
|
348 | 348 | |
349 | 349 | //This allows adding additional information to the publish post submitbox on the wp post edit form |
350 | - if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) |
|
351 | - add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
350 | + if (method_exists($this, 'extra_misc_actions_publish_box')) |
|
351 | + add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10); |
|
352 | 352 | |
353 | 353 | //This allows for adding additional stuff after the title field on the wp post edit form. This is also before the wp_editor for post description field. |
354 | - if ( method_exists( $this, 'edit_form_after_title' ) ) |
|
355 | - add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
354 | + if (method_exists($this, 'edit_form_after_title')) |
|
355 | + add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10); |
|
356 | 356 | |
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route. |
360 | 360 | */ |
361 | - add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 ); |
|
361 | + add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3); |
|
362 | 362 | |
363 | 363 | |
364 | 364 | parent::_load_page_dependencies(); |
365 | 365 | |
366 | 366 | //notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes. |
367 | 367 | global $pagenow; |
368 | - do_action( 'load-' . $pagenow ); |
|
368 | + do_action('load-'.$pagenow); |
|
369 | 369 | |
370 | 370 | $this->modify_current_screen(); |
371 | - add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 ); |
|
371 | + add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30); |
|
372 | 372 | //we route REALLY early. |
373 | 373 | try { |
374 | 374 | $this->_route_admin_request(); |
375 | - } catch ( EE_Error $e ) { |
|
375 | + } catch (EE_Error $e) { |
|
376 | 376 | $e->get_error(); |
377 | 377 | } |
378 | 378 | } |
@@ -391,21 +391,21 @@ discard block |
||
391 | 391 | * |
392 | 392 | * @return string possibly a new url for our route. |
393 | 393 | */ |
394 | - public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) { |
|
394 | + public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) { |
|
395 | 395 | $routes_to_match = array( |
396 | 396 | 0 => array( |
397 | 397 | 'edit.php?post_type=espresso_attendees', |
398 | 398 | 'admin.php?page=espresso_registrations&action=contact_list' |
399 | 399 | ), |
400 | 400 | 1 => array( |
401 | - 'edit.php?post_type=' . $this->_cpt_object->name, |
|
402 | - 'admin.php?page=' . $this->_cpt_object->name |
|
401 | + 'edit.php?post_type='.$this->_cpt_object->name, |
|
402 | + 'admin.php?page='.$this->_cpt_object->name |
|
403 | 403 | ) |
404 | 404 | ); |
405 | 405 | |
406 | - foreach( $routes_to_match as $route_matches ) { |
|
407 | - if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) { |
|
408 | - return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url ); |
|
406 | + foreach ($routes_to_match as $route_matches) { |
|
407 | + if (strpos($good_protocol_url, $route_matches[0]) !== false) { |
|
408 | + return str_replace($route_matches[0], $route_matches[1], $good_protocol_url); |
|
409 | 409 | |
410 | 410 | } |
411 | 411 | } |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | * @param string $cpt_name The cpt slug we're checking on. |
422 | 422 | * @return bool True supported, false not. |
423 | 423 | */ |
424 | - private function _supports_page_templates( $cpt_name ) { |
|
424 | + private function _supports_page_templates($cpt_name) { |
|
425 | 425 | $cpt_args = EE_Register_CPTs::get_CPTs(); |
426 | - $cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array(); |
|
427 | - return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE; |
|
426 | + $cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array(); |
|
427 | + return ! empty($cpt_args['page_templates']) ? TRUE : FALSE; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | public function page_template_meta_box() { |
440 | 440 | global $post; |
441 | 441 | $template = ''; |
442 | - if ( count( get_page_templates( $post ) ) != 0 ) { |
|
443 | - $page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE ); |
|
444 | - $template = !empty( $page_template ) ? $page_template : ''; |
|
442 | + if (count(get_page_templates($post)) != 0) { |
|
443 | + $page_template = get_post_meta($post->ID, '_wp_page_template', TRUE); |
|
444 | + $template = ! empty($page_template) ? $page_template : ''; |
|
445 | 445 | } |
446 | 446 | ?> |
447 | 447 | <p><strong><?php _e('Template') ?></strong></p> |
@@ -465,10 +465,10 @@ discard block |
||
465 | 465 | * @param string $new_slug what the slug is |
466 | 466 | * @return string The new html string for the permalink area |
467 | 467 | */ |
468 | - public function preview_button_html( $return, $id, $new_title, $new_slug ) { |
|
469 | - $post = get_post( $id ); |
|
470 | - if ( 'publish' != get_post_status( $post ) ) { |
|
471 | - $return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n"; |
|
468 | + public function preview_button_html($return, $id, $new_title, $new_slug) { |
|
469 | + $post = get_post($id); |
|
470 | + if ('publish' != get_post_status($post)) { |
|
471 | + $return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n"; |
|
472 | 472 | } |
473 | 473 | return $return; |
474 | 474 | } |
@@ -488,18 +488,18 @@ discard block |
||
488 | 488 | 'cur_status' => $this->_cpt_model_obj->status(), |
489 | 489 | 'statuses' => $statuses, |
490 | 490 | 'cur_status_label' => $cur_status_label, |
491 | - 'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label ) |
|
491 | + 'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label) |
|
492 | 492 | ); |
493 | 493 | |
494 | 494 | //we'll add a trash post status (WP doesn't add one for some reason) |
495 | - if ( $this->_cpt_model_obj->status() == 'trash' ) { |
|
495 | + if ($this->_cpt_model_obj->status() == 'trash') { |
|
496 | 496 | $template_args['cur_status_label'] = __('Trashed', 'event_espresso'); |
497 | 497 | $statuses['trash'] = __('Trashed', 'event_espresso'); |
498 | 498 | $template_args['statuses'] = $statuses; |
499 | 499 | } |
500 | 500 | |
501 | - $template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php'; |
|
502 | - EEH_Template::display_template( $template, $template_args ); |
|
501 | + $template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php'; |
|
502 | + EEH_Template::display_template($template, $template_args); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -538,22 +538,22 @@ discard block |
||
538 | 538 | public function do_extra_autosave_stuff() { |
539 | 539 | |
540 | 540 | //next let's check for the autosave nonce (we'll use _verify_nonce ) |
541 | - $nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL; |
|
542 | - $this->_verify_nonce( $nonce, 'autosave' ); |
|
541 | + $nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL; |
|
542 | + $this->_verify_nonce($nonce, 'autosave'); |
|
543 | 543 | |
544 | 544 | |
545 | 545 | //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it) |
546 | - if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true); |
|
546 | + if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true); |
|
547 | 547 | |
548 | 548 | //if we made it here then the nonce checked out. Let's run our methods and actions |
549 | - if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) { |
|
550 | - call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) ); |
|
549 | + if (method_exists($this, '_ee_autosave_'.$this->_current_view)) { |
|
550 | + call_user_func(array($this, '_ee_autosave_'.$this->_current_view)); |
|
551 | 551 | } else { |
552 | 552 | $this->_template_args['success'] = TRUE; |
553 | 553 | } |
554 | 554 | |
555 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this ); |
|
556 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this ); |
|
555 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this); |
|
556 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this); |
|
557 | 557 | |
558 | 558 | //now let's return json |
559 | 559 | $this->_return_json(); |
@@ -573,18 +573,18 @@ discard block |
||
573 | 573 | protected function _extend_page_config_for_cpt() { |
574 | 574 | |
575 | 575 | //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug |
576 | - if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) |
|
576 | + if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug)) |
|
577 | 577 | return; |
578 | 578 | |
579 | 579 | //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes |
580 | - if ( !empty( $this->_cpt_object ) ) { |
|
581 | - $this->_page_routes = array_merge( array( |
|
580 | + if ( ! empty($this->_cpt_object)) { |
|
581 | + $this->_page_routes = array_merge(array( |
|
582 | 582 | 'create_new' => '_create_new_cpt_item', |
583 | 583 | 'edit' => '_edit_cpt_item' |
584 | - ), $this->_page_routes ); |
|
584 | + ), $this->_page_routes); |
|
585 | 585 | |
586 | 586 | |
587 | - $this->_page_config = array_merge( array( |
|
587 | + $this->_page_config = array_merge(array( |
|
588 | 588 | 'create_new' => array( |
589 | 589 | 'nav' => array( |
590 | 590 | 'label' => $this->_cpt_object->labels->add_new_item, |
@@ -606,23 +606,23 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | //load the next section only if this is a matching cpt route as set in the cpt routes array. |
609 | - if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) |
|
609 | + if ( ! isset($this->_cpt_routes[$this->_req_action])) |
|
610 | 610 | return; |
611 | 611 | |
612 | 612 | |
613 | - $this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE; |
|
613 | + $this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE; |
|
614 | 614 | //add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') ); |
615 | 615 | |
616 | 616 | |
617 | - if ( empty( $this->_cpt_object ) ) { |
|
618 | - $msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) ); |
|
619 | - throw new EE_Error( $msg ); |
|
617 | + if (empty($this->_cpt_object)) { |
|
618 | + $msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this)); |
|
619 | + throw new EE_Error($msg); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | |
623 | - if ( $this->_cpt_route ) { |
|
624 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
625 | - $this->_set_model_object( $id ); |
|
623 | + if ($this->_cpt_route) { |
|
624 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
625 | + $this->_set_model_object($id); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | } |
@@ -638,17 +638,17 @@ discard block |
||
638 | 638 | * @param int $id The id to retrieve the model object for. If empty we set a default object. |
639 | 639 | * @return void |
640 | 640 | */ |
641 | - protected function _set_model_object( $id = NULL ) { |
|
641 | + protected function _set_model_object($id = NULL) { |
|
642 | 642 | |
643 | - if ( empty( $this->_cpt_model_names ) || ! isset( $this->_cpt_routes[ $this->_req_action ] ) || ( is_object( $this->_cpt_model_obj ) && $this->_cpt_model_obj->ID() == $id )) { |
|
643 | + if (empty($this->_cpt_model_names) || ! isset($this->_cpt_routes[$this->_req_action]) || (is_object($this->_cpt_model_obj) && $this->_cpt_model_obj->ID() == $id)) { |
|
644 | 644 | //get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent. |
645 | 645 | return; |
646 | 646 | } |
647 | 647 | // load CPT object model |
648 | - $model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] ); |
|
649 | - $this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object(); |
|
648 | + $model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]); |
|
649 | + $this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object(); |
|
650 | 650 | //d( $this->_cpt_model_obj ); |
651 | - do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' ); |
|
651 | + do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object'); |
|
652 | 652 | } |
653 | 653 | |
654 | 654 | |
@@ -662,47 +662,47 @@ discard block |
||
662 | 662 | */ |
663 | 663 | public function admin_init_global() { |
664 | 664 | |
665 | - $post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL; |
|
665 | + $post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL; |
|
666 | 666 | |
667 | 667 | //its possible this is a new save so let's catch that instead |
668 | - $post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post; |
|
668 | + $post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post; |
|
669 | 669 | $post_type = $post ? $post->post_type : false; |
670 | 670 | |
671 | 671 | $current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork'; |
672 | 672 | |
673 | - $route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
673 | + $route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
674 | 674 | |
675 | - add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 ); |
|
676 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 ); |
|
675 | + add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3); |
|
676 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
677 | 677 | |
678 | 678 | |
679 | - if ( $post_type === $route_to_check ) { |
|
680 | - add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 ); |
|
679 | + if ($post_type === $route_to_check) { |
|
680 | + add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2); |
|
681 | 681 | //catch trashed wp redirect |
682 | - add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 ); |
|
682 | + add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | //now let's filter redirect if we're on a revision page and the revision is for an event CPT. |
686 | - $revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL; |
|
686 | + $revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
|
687 | 687 | |
688 | 688 | /**var_dump($this->_req_data); |
689 | 689 | exit();/**/ |
690 | 690 | |
691 | - if ( !empty( $revision ) ) { |
|
692 | - $action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL; |
|
691 | + if ( ! empty($revision)) { |
|
692 | + $action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL; |
|
693 | 693 | |
694 | 694 | //doing a restore? |
695 | - if ( !empty( $action ) && $action == 'restore' ) { |
|
695 | + if ( ! empty($action) && $action == 'restore') { |
|
696 | 696 | |
697 | 697 | //get post for revision |
698 | - $rev_post = get_post( $revision ); |
|
699 | - $rev_parent = get_post( $rev_post->post_parent ); |
|
698 | + $rev_post = get_post($revision); |
|
699 | + $rev_parent = get_post($rev_post->post_parent); |
|
700 | 700 | |
701 | 701 | //only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts. |
702 | - if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) { |
|
703 | - add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 ); |
|
702 | + if ($rev_parent && $rev_parent->post_type == $this->page_slug) { |
|
703 | + add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2); |
|
704 | 704 | //restores of revisions |
705 | - add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 ); |
|
705 | + add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2); |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | |
@@ -711,15 +711,15 @@ discard block |
||
711 | 711 | //NOTE we ONLY want to run these hooks if we're on the right class for the given post type. Otherwise we could see some really freaky things happen! |
712 | 712 | |
713 | 713 | |
714 | - if ( $post_type && $post_type === $route_to_check ) { |
|
714 | + if ($post_type && $post_type === $route_to_check) { |
|
715 | 715 | //$post_id, $post |
716 | - add_action('save_post', array( $this, 'insert_update'), 10, 2 ); |
|
716 | + add_action('save_post', array($this, 'insert_update'), 10, 2); |
|
717 | 717 | |
718 | 718 | //$post_id |
719 | - add_action('trashed_post', array( $this, 'trash_cpt_item' ), 10 ); |
|
720 | - add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 ); |
|
721 | - add_action('untrashed_post', array( $this, 'restore_cpt_item'), 10 ); |
|
722 | - add_action('after_delete_post', array( $this, 'delete_cpt_item'), 10 ); |
|
719 | + add_action('trashed_post', array($this, 'trash_cpt_item'), 10); |
|
720 | + add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10); |
|
721 | + add_action('untrashed_post', array($this, 'restore_cpt_item'), 10); |
|
722 | + add_action('after_delete_post', array($this, 'delete_cpt_item'), 10); |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | } |
@@ -734,15 +734,15 @@ discard block |
||
734 | 734 | * @return void |
735 | 735 | */ |
736 | 736 | public function verify_cpt_object() { |
737 | - $label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
737 | + $label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
738 | 738 | // verify event object |
739 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
740 | - throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) ); |
|
739 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
740 | + throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label)); |
|
741 | 741 | } |
742 | 742 | //if auto-draft then throw an error |
743 | - if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) { |
|
743 | + if ($this->_cpt_model_obj->get('status') == 'auto-draft') { |
|
744 | 744 | EE_Error::overwrite_errors(); |
745 | - EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ ); |
|
745 | + EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__); |
|
746 | 746 | } |
747 | 747 | } |
748 | 748 | |
@@ -771,22 +771,22 @@ discard block |
||
771 | 771 | public function load_global_scripts_styles() { |
772 | 772 | parent::load_global_scripts_styles(); |
773 | 773 | |
774 | - if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
774 | + if ($this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
775 | 775 | //setup custom post status object for localize script but only if we've got a cpt object |
776 | 776 | $statuses = $this->_cpt_model_obj->get_custom_post_statuses(); |
777 | 777 | |
778 | - if ( !empty($statuses) ) { |
|
778 | + if ( ! empty($statuses)) { |
|
779 | 779 | //get ALL statuses! |
780 | 780 | $statuses = $this->_cpt_model_obj->get_all_post_statuses(); |
781 | 781 | //setup object |
782 | 782 | $ee_cpt_statuses = array(); |
783 | - foreach ( $statuses as $status => $label ) { |
|
783 | + foreach ($statuses as $status => $label) { |
|
784 | 784 | $ee_cpt_statuses[$status] = array( |
785 | 785 | 'label' => $label, |
786 | - 'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label ) |
|
786 | + 'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label) |
|
787 | 787 | ); |
788 | 788 | } |
789 | - wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses ); |
|
789 | + wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses); |
|
790 | 790 | } |
791 | 791 | } |
792 | 792 | } |
@@ -800,10 +800,10 @@ discard block |
||
800 | 800 | * @param WP_Post $post Post object from WP |
801 | 801 | * @return void |
802 | 802 | */ |
803 | - public function insert_update( $post_id, $post ) { |
|
803 | + public function insert_update($post_id, $post) { |
|
804 | 804 | |
805 | 805 | //make sure that if this is a revision OR trash action that we don't do any updates! |
806 | - if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) |
|
806 | + if (isset($this->_req_data['action']) && ($this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash')) |
|
807 | 807 | return; |
808 | 808 | |
809 | 809 | //check for autosave and update our req_data property accordingly. |
@@ -818,19 +818,19 @@ discard block |
||
818 | 818 | }/**/ //TODO reactivate after autosave is implemented in 4.2 |
819 | 819 | |
820 | 820 | //take care of updating any selected page_template IF this cpt supports it. |
821 | - if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) { |
|
821 | + if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) { |
|
822 | 822 | $post->page_template = $this->_req_data['page_template']; |
823 | - $page_templates = wp_get_theme()->get_page_templates( $post ); |
|
824 | - if ( 'default' != $this->_req_data['page_template'] && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) { |
|
825 | - EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
823 | + $page_templates = wp_get_theme()->get_page_templates($post); |
|
824 | + if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) { |
|
825 | + EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
826 | 826 | } else { |
827 | - update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] ); |
|
827 | + update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']); |
|
828 | 828 | } |
829 | 829 | } |
830 | 830 | |
831 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
831 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
832 | 832 | return; //TODO we'll remove this after reimplementing autosave in 4.2 |
833 | - $this->_insert_update_cpt_item( $post_id, $post ); |
|
833 | + $this->_insert_update_cpt_item($post_id, $post); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | * @param int $post_id ID of the post |
844 | 844 | * @return void |
845 | 845 | */ |
846 | - public function dont_permanently_delete_ee_cpts( $post_id ) { |
|
847 | - delete_post_meta( $post_id, '_wp_trash_meta_status' ); |
|
846 | + public function dont_permanently_delete_ee_cpts($post_id) { |
|
847 | + delete_post_meta($post_id, '_wp_trash_meta_status'); |
|
848 | 848 | delete_post_meta($post_id, '_wp_trash_meta_time'); |
849 | 849 | |
850 | 850 | //our cpts may have comments so let's take care of that too |
@@ -863,14 +863,14 @@ discard block |
||
863 | 863 | * @param int $revision_id ID of revision being restored |
864 | 864 | * @return void |
865 | 865 | */ |
866 | - public function restore_revision( $post_id, $revision_id ) { |
|
867 | - $this->_restore_cpt_item( $post_id, $revision_id ); |
|
866 | + public function restore_revision($post_id, $revision_id) { |
|
867 | + $this->_restore_cpt_item($post_id, $revision_id); |
|
868 | 868 | |
869 | 869 | //global action |
870 | - do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
870 | + do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
871 | 871 | |
872 | 872 | //class specific action so you can limit hooking into a specific page. |
873 | - do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id ); |
|
873 | + do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | * @param int $revision_id ID of revision for item |
882 | 882 | * @return void |
883 | 883 | */ |
884 | - abstract protected function _restore_cpt_item( $post_id, $revision_id ); |
|
884 | + abstract protected function _restore_cpt_item($post_id, $revision_id); |
|
885 | 885 | |
886 | 886 | |
887 | 887 | |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | */ |
901 | 901 | public function modify_current_screen() { |
902 | 902 | //ONLY do this if the current page_route IS a cpt route |
903 | - if ( !$this->_cpt_route ) return; |
|
903 | + if ( ! $this->_cpt_route) return; |
|
904 | 904 | //routing things REALLY early b/c this is a cpt admin page |
905 | - set_current_screen( $this->_cpt_routes[$this->_req_action]); |
|
905 | + set_current_screen($this->_cpt_routes[$this->_req_action]); |
|
906 | 906 | $this->_current_screen = get_current_screen(); |
907 | 907 | $this->_current_screen->base = 'event-espresso'; |
908 | 908 | $this->_add_help_tabs(); //we make sure we add any help tabs back in! |
@@ -923,8 +923,8 @@ discard block |
||
923 | 923 | * @param string $title The new title (or existing if there is no editor_title defined) |
924 | 924 | * @return string |
925 | 925 | */ |
926 | - public function add_custom_editor_default_title( $title ) { |
|
927 | - return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
926 | + public function add_custom_editor_default_title($title) { |
|
927 | + return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | |
@@ -937,11 +937,11 @@ discard block |
||
937 | 937 | * @param bool $allow_slugs Whether to allow post slugs in the shortlink. |
938 | 938 | * @return string |
939 | 939 | */ |
940 | - public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
|
941 | - if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
|
942 | - $post = get_post( $id ); |
|
943 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
944 | - $shortlink = home_url('?p=' . $post->ID); |
|
940 | + public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) { |
|
941 | + if ( ! empty($id) && '' != get_option('permalink_structure')) { |
|
942 | + $post = get_post($id); |
|
943 | + if (isset($post->post_type) && $this->page_slug == $post->post_type) |
|
944 | + $shortlink = home_url('?p='.$post->ID); |
|
945 | 945 | } |
946 | 946 | return $shortlink; |
947 | 947 | } |
@@ -954,10 +954,10 @@ discard block |
||
954 | 954 | * @return void |
955 | 955 | */ |
956 | 956 | public function route_admin_request() { |
957 | - if ( $this->_cpt_route ) return; |
|
957 | + if ($this->_cpt_route) return; |
|
958 | 958 | try { |
959 | 959 | $this->_route_admin_request(); |
960 | - } catch ( EE_Error $e ) { |
|
960 | + } catch (EE_Error $e) { |
|
961 | 961 | $e->get_error(); |
962 | 962 | } |
963 | 963 | } |
@@ -970,12 +970,12 @@ discard block |
||
970 | 970 | * @return string html |
971 | 971 | */ |
972 | 972 | public function cpt_post_form_hidden_input() { |
973 | - echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />'; |
|
973 | + echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />'; |
|
974 | 974 | |
975 | 975 | //we're also going to add the route value and the current page so we can direct autosave parsing correctly |
976 | 976 | echo '<div id="ee-cpt-hidden-inputs">'; |
977 | - echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />'; |
|
978 | - echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />'; |
|
977 | + echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />'; |
|
978 | + echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />'; |
|
979 | 979 | echo '</div>'; |
980 | 980 | } |
981 | 981 | |
@@ -988,12 +988,12 @@ discard block |
||
988 | 988 | * @param int $status Status for http header |
989 | 989 | * @return string new (or original) url to redirect to. |
990 | 990 | */ |
991 | - public function revision_redirect( $location, $status ) { |
|
991 | + public function revision_redirect($location, $status) { |
|
992 | 992 | //get revision |
993 | 993 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
994 | 994 | |
995 | 995 | //can't do anything without revision so let's get out if not present |
996 | - if ( empty( $rev_id ) ) |
|
996 | + if (empty($rev_id)) |
|
997 | 997 | return $location; |
998 | 998 | |
999 | 999 | //get rev_post_data |
@@ -1007,8 +1007,8 @@ discard block |
||
1007 | 1007 | 'message' => 5 |
1008 | 1008 | ); |
1009 | 1009 | |
1010 | - $this->_process_notices( $query_args, TRUE ); |
|
1011 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1010 | + $this->_process_notices($query_args, TRUE); |
|
1011 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | |
@@ -1021,16 +1021,16 @@ discard block |
||
1021 | 1021 | * @param string $context optional, defaults to display. How to write the '&' |
1022 | 1022 | * @return string the link |
1023 | 1023 | */ |
1024 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
1025 | - $post = get_post( $id ); |
|
1026 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1024 | + public function modify_edit_post_link($link, $id, $context) { |
|
1025 | + $post = get_post($id); |
|
1026 | + if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]) |
|
1027 | 1027 | return $link; |
1028 | 1028 | $query_args = array( |
1029 | 1029 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1030 | 1030 | 'post' => $id |
1031 | 1031 | ); |
1032 | 1032 | |
1033 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1033 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | |
@@ -1042,12 +1042,12 @@ discard block |
||
1042 | 1042 | * @param bool $force_delete whether this is forcing a hard delete instead of trash |
1043 | 1043 | * @return string new delete link |
1044 | 1044 | */ |
1045 | - public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
|
1045 | + public function modify_delete_post_link($delete_link, $post_id, $force_delete) { |
|
1046 | 1046 | $post = get_post($post_id); |
1047 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1047 | + if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])) |
|
1048 | 1048 | return $delete_link; |
1049 | 1049 | |
1050 | - return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
|
1050 | + return add_query_arg(array('current_route' => 'trash'), $delete_link); |
|
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | |
@@ -1058,16 +1058,16 @@ discard block |
||
1058 | 1058 | * @param string $status status |
1059 | 1059 | * @return string url to redirect to |
1060 | 1060 | */ |
1061 | - public function cpt_trash_post_location_redirect( $location, $status ) { |
|
1062 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1061 | + public function cpt_trash_post_location_redirect($location, $status) { |
|
1062 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post'])) |
|
1063 | 1063 | return $location; |
1064 | 1064 | |
1065 | - $post = get_post( $this->_req_data['post'] ); |
|
1066 | - $query_args = array( 'action' => 'default' ); |
|
1065 | + $post = get_post($this->_req_data['post']); |
|
1066 | + $query_args = array('action' => 'default'); |
|
1067 | 1067 | $this->_cpt_object = get_post_type_object($post->post_type); |
1068 | - EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) ); |
|
1069 | - $this->_process_notices( $query_args, TRUE ); |
|
1070 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1068 | + EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name)); |
|
1069 | + $this->_process_notices($query_args, TRUE); |
|
1070 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | * @param string $post_id This is the 'ID' value of the wp_posts table |
1083 | 1083 | * @return string the new location to redirect to |
1084 | 1084 | */ |
1085 | - public function cpt_post_location_redirect( $location, $post_id ) { |
|
1085 | + public function cpt_post_location_redirect($location, $post_id) { |
|
1086 | 1086 | //we DO have a match so let's setup the url |
1087 | 1087 | |
1088 | 1088 | //we have to get the post to determine our route |
@@ -1090,14 +1090,14 @@ discard block |
||
1090 | 1090 | $edit_route = $this->_cpt_edit_routes[$post->post_type]; |
1091 | 1091 | |
1092 | 1092 | //shared query_args |
1093 | - $query_args = array( 'action' => $edit_route, 'post' => $post_id ); |
|
1093 | + $query_args = array('action' => $edit_route, 'post' => $post_id); |
|
1094 | 1094 | $admin_url = $this->_admin_base_url; |
1095 | 1095 | // $append = ''; |
1096 | 1096 | |
1097 | - if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) { |
|
1098 | - $status = get_post_status( $post_id ); |
|
1099 | - if ( isset( $this->_req_data['publish'] ) ) { |
|
1100 | - switch ( $status ) { |
|
1097 | + if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) { |
|
1098 | + $status = get_post_status($post_id); |
|
1099 | + if (isset($this->_req_data['publish'])) { |
|
1100 | + switch ($status) { |
|
1101 | 1101 | case 'pending': |
1102 | 1102 | $message = 8; |
1103 | 1103 | break; |
@@ -1110,13 +1110,13 @@ discard block |
||
1110 | 1110 | } else { |
1111 | 1111 | $message = 'draft' == $status ? 10 : 1; |
1112 | 1112 | } |
1113 | - } else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) { |
|
1113 | + } else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) { |
|
1114 | 1114 | $message = 2; |
1115 | 1115 | // $append = '#postcustom'; |
1116 | - } else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) { |
|
1116 | + } else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) { |
|
1117 | 1117 | $message = 3; |
1118 | 1118 | // $append = '#postcustom'; |
1119 | - } elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) { |
|
1119 | + } elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') { |
|
1120 | 1120 | $message = 7; |
1121 | 1121 | } else { |
1122 | 1122 | $message = 4; |
@@ -1124,12 +1124,12 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | //change the message if the post type is not viewable on the frontend |
1126 | 1126 | $this->_cpt_object = get_post_type_object($post->post_type); |
1127 | - $message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1127 | + $message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1128 | 1128 | |
1129 | - $query_args = array_merge( array( 'message' => $message ), $query_args ); |
|
1129 | + $query_args = array_merge(array('message' => $message), $query_args); |
|
1130 | 1130 | |
1131 | - $this->_process_notices( $query_args, TRUE ); |
|
1132 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1131 | + $this->_process_notices($query_args, TRUE); |
|
1132 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
@@ -1161,10 +1161,10 @@ discard block |
||
1161 | 1161 | * @param array $messages the original messages array |
1162 | 1162 | * @return array the new messages array |
1163 | 1163 | */ |
1164 | - public function post_update_messages( $messages ) { |
|
1164 | + public function post_update_messages($messages) { |
|
1165 | 1165 | global $post; |
1166 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1167 | - $id = empty( $id ) && is_object( $post ) ? $post->ID : NULL; |
|
1166 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1167 | + $id = empty($id) && is_object($post) ? $post->ID : NULL; |
|
1168 | 1168 | |
1169 | 1169 | // $post_type = $post ? $post->post_type : false; |
1170 | 1170 | |
@@ -1177,9 +1177,9 @@ discard block |
||
1177 | 1177 | 0 => '', //Unused. Messages start at index 1. |
1178 | 1178 | |
1179 | 1179 | 1 => sprintf( |
1180 | - __( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1180 | + __('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1181 | 1181 | $this->_cpt_object->labels->singular_name, |
1182 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1182 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1183 | 1183 | '</a>' |
1184 | 1184 | ), |
1185 | 1185 | |
@@ -1187,38 +1187,38 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | 3 => __('Custom field deleted.'), |
1189 | 1189 | |
1190 | - 4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1190 | + 4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1191 | 1191 | |
1192 | - 5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE, |
|
1192 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE, |
|
1193 | 1193 | |
1194 | 1194 | 6 => sprintf( |
1195 | - __( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1195 | + __('%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1196 | 1196 | $this->_cpt_object->labels->singular_name, |
1197 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1197 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1198 | 1198 | '</a>' |
1199 | 1199 | ), |
1200 | 1200 | |
1201 | - 7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1201 | + 7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1202 | 1202 | |
1203 | 1203 | 8 => sprintf( |
1204 | 1204 | __('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'), |
1205 | 1205 | $this->_cpt_object->labels->singular_name, |
1206 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">', |
|
1206 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">', |
|
1207 | 1207 | '</a>' |
1208 | 1208 | ), |
1209 | 1209 | |
1210 | 1210 | 9 => sprintf( |
1211 | - __( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1211 | + __('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1212 | 1212 | $this->_cpt_object->labels->singular_name, |
1213 | - '<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>', |
|
1214 | - '<a target="_blank" href="' . esc_url( get_permalink( $id )), |
|
1213 | + '<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>', |
|
1214 | + '<a target="_blank" href="'.esc_url(get_permalink($id)), |
|
1215 | 1215 | '</a>' |
1216 | 1216 | ), |
1217 | 1217 | |
1218 | 1218 | 10 => sprintf( |
1219 | 1219 | __('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'), |
1220 | 1220 | $this->_cpt_object->labels->singular_name, |
1221 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) , |
|
1221 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))), |
|
1222 | 1222 | '</a>' |
1223 | 1223 | ) |
1224 | 1224 | ); |
@@ -1245,24 +1245,24 @@ discard block |
||
1245 | 1245 | $post_type_object = $this->_cpt_object; |
1246 | 1246 | $title = $post_type_object->labels->add_new_item; |
1247 | 1247 | $editing = TRUE; |
1248 | - wp_enqueue_script( 'autosave' ); |
|
1249 | - $post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE ); |
|
1248 | + wp_enqueue_script('autosave'); |
|
1249 | + $post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE); |
|
1250 | 1250 | $post_ID = $post->ID; |
1251 | 1251 | $is_IE = $is_IE; |
1252 | 1252 | |
1253 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1253 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1254 | 1254 | |
1255 | 1255 | //modify the default editor title field with default title. |
1256 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1256 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1257 | 1257 | |
1258 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1258 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | |
1262 | 1262 | |
1263 | 1263 | |
1264 | 1264 | public function add_new_admin_page_global() { |
1265 | - $admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php'; |
|
1265 | + $admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php'; |
|
1266 | 1266 | ?> |
1267 | 1267 | <script type="text/javascript"> |
1268 | 1268 | adminpage = '<?php echo $admin_page; ?>'; |
@@ -1284,16 +1284,16 @@ discard block |
||
1284 | 1284 | */ |
1285 | 1285 | protected function _edit_cpt_item() { |
1286 | 1286 | global $post, $title, $is_IE, $post_type, $post_type_object; |
1287 | - $post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1288 | - $post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL; |
|
1287 | + $post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1288 | + $post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL; |
|
1289 | 1289 | |
1290 | - if ( empty ( $post ) ) { |
|
1291 | - wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') ); |
|
1290 | + if (empty ($post)) { |
|
1291 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
1292 | 1292 | } |
1293 | 1293 | |
1294 | - if ( ! empty( $_GET['get-post-lock'] ) ) { |
|
1295 | - wp_set_post_lock( $post_id ); |
|
1296 | - wp_redirect( get_edit_post_link( $post_id, 'url' ) ); |
|
1294 | + if ( ! empty($_GET['get-post-lock'])) { |
|
1295 | + wp_set_post_lock($post_id); |
|
1296 | + wp_redirect(get_edit_post_link($post_id, 'url')); |
|
1297 | 1297 | exit(); |
1298 | 1298 | } |
1299 | 1299 | |
@@ -1305,32 +1305,32 @@ discard block |
||
1305 | 1305 | $post_type_object = $this->_cpt_object; |
1306 | 1306 | $is_IE = $is_IE; |
1307 | 1307 | |
1308 | - if ( ! wp_check_post_lock( $post->ID ) ) { |
|
1309 | - $active_post_lock = wp_set_post_lock( $post->ID ); |
|
1308 | + if ( ! wp_check_post_lock($post->ID)) { |
|
1309 | + $active_post_lock = wp_set_post_lock($post->ID); |
|
1310 | 1310 | //wp_enqueue_script('autosave'); |
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | $title = $this->_cpt_object->labels->edit_item; |
1314 | 1314 | |
1315 | - add_action('admin_footer', '_admin_notice_post_locked' ); |
|
1315 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
1316 | 1316 | |
1317 | - if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) { |
|
1318 | - $create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this ); |
|
1317 | + if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) { |
|
1318 | + $create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this); |
|
1319 | 1319 | |
1320 | - $post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' ); |
|
1320 | + $post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php'); |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | - if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) { |
|
1323 | + if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) { |
|
1324 | 1324 | wp_enqueue_script('admin-comments'); |
1325 | 1325 | enqueue_comment_hotkeys_js(); |
1326 | 1326 | } |
1327 | 1327 | |
1328 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1328 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1329 | 1329 | |
1330 | 1330 | //modify the default editor title field with default title. |
1331 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1331 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1332 | 1332 | |
1333 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1333 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1334 | 1334 | |
1335 | 1335 | } |
1336 | 1336 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * EE_Admin_Page_CPT class |
4 | 6 | * |
@@ -231,8 +233,9 @@ discard block |
||
231 | 233 | |
232 | 234 | $containers = array(); |
233 | 235 | |
234 | - if ( empty( $wp_meta_boxes ) ) |
|
235 | - return; |
|
236 | + if ( empty( $wp_meta_boxes ) ) { |
|
237 | + return; |
|
238 | + } |
|
236 | 239 | |
237 | 240 | $current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array(); |
238 | 241 | |
@@ -336,8 +339,9 @@ discard block |
||
336 | 339 | |
337 | 340 | |
338 | 341 | //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form |
339 | - if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) |
|
340 | - add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
342 | + if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) { |
|
343 | + add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
344 | + } |
|
341 | 345 | |
342 | 346 | //add preview button |
343 | 347 | add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 ); |
@@ -347,12 +351,14 @@ discard block |
||
347 | 351 | add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 ); |
348 | 352 | |
349 | 353 | //This allows adding additional information to the publish post submitbox on the wp post edit form |
350 | - if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) |
|
351 | - add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
354 | + if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) { |
|
355 | + add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
356 | + } |
|
352 | 357 | |
353 | 358 | //This allows for adding additional stuff after the title field on the wp post edit form. This is also before the wp_editor for post description field. |
354 | - if ( method_exists( $this, 'edit_form_after_title' ) ) |
|
355 | - add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
359 | + if ( method_exists( $this, 'edit_form_after_title' ) ) { |
|
360 | + add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
361 | + } |
|
356 | 362 | |
357 | 363 | |
358 | 364 | /** |
@@ -543,7 +549,9 @@ discard block |
||
543 | 549 | |
544 | 550 | |
545 | 551 | //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it) |
546 | - if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true); |
|
552 | + if ( !defined('DOING_AUTOSAVE') ) { |
|
553 | + define('DOING_AUTOSAVE', true); |
|
554 | + } |
|
547 | 555 | |
548 | 556 | //if we made it here then the nonce checked out. Let's run our methods and actions |
549 | 557 | if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) { |
@@ -573,8 +581,9 @@ discard block |
||
573 | 581 | protected function _extend_page_config_for_cpt() { |
574 | 582 | |
575 | 583 | //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug |
576 | - if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) |
|
577 | - return; |
|
584 | + if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) { |
|
585 | + return; |
|
586 | + } |
|
578 | 587 | |
579 | 588 | //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes |
580 | 589 | if ( !empty( $this->_cpt_object ) ) { |
@@ -606,8 +615,9 @@ discard block |
||
606 | 615 | } |
607 | 616 | |
608 | 617 | //load the next section only if this is a matching cpt route as set in the cpt routes array. |
609 | - if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) |
|
610 | - return; |
|
618 | + if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) { |
|
619 | + return; |
|
620 | + } |
|
611 | 621 | |
612 | 622 | |
613 | 623 | $this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE; |
@@ -803,8 +813,9 @@ discard block |
||
803 | 813 | public function insert_update( $post_id, $post ) { |
804 | 814 | |
805 | 815 | //make sure that if this is a revision OR trash action that we don't do any updates! |
806 | - if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) |
|
807 | - return; |
|
816 | + if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) { |
|
817 | + return; |
|
818 | + } |
|
808 | 819 | |
809 | 820 | //check for autosave and update our req_data property accordingly. |
810 | 821 | /*if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE && isset( $this->_req_data['ee_autosave_data'] ) ) { |
@@ -828,8 +839,10 @@ discard block |
||
828 | 839 | } |
829 | 840 | } |
830 | 841 | |
831 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
832 | - return; //TODO we'll remove this after reimplementing autosave in 4.2 |
|
842 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
843 | + return; |
|
844 | + } |
|
845 | + //TODO we'll remove this after reimplementing autosave in 4.2 |
|
833 | 846 | $this->_insert_update_cpt_item( $post_id, $post ); |
834 | 847 | } |
835 | 848 | |
@@ -900,7 +913,9 @@ discard block |
||
900 | 913 | */ |
901 | 914 | public function modify_current_screen() { |
902 | 915 | //ONLY do this if the current page_route IS a cpt route |
903 | - if ( !$this->_cpt_route ) return; |
|
916 | + if ( !$this->_cpt_route ) { |
|
917 | + return; |
|
918 | + } |
|
904 | 919 | //routing things REALLY early b/c this is a cpt admin page |
905 | 920 | set_current_screen( $this->_cpt_routes[$this->_req_action]); |
906 | 921 | $this->_current_screen = get_current_screen(); |
@@ -940,8 +955,9 @@ discard block |
||
940 | 955 | public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
941 | 956 | if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
942 | 957 | $post = get_post( $id ); |
943 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
944 | - $shortlink = home_url('?p=' . $post->ID); |
|
958 | + if ( isset($post->post_type) && $this->page_slug == $post->post_type ) { |
|
959 | + $shortlink = home_url('?p=' . $post->ID); |
|
960 | + } |
|
945 | 961 | } |
946 | 962 | return $shortlink; |
947 | 963 | } |
@@ -954,7 +970,9 @@ discard block |
||
954 | 970 | * @return void |
955 | 971 | */ |
956 | 972 | public function route_admin_request() { |
957 | - if ( $this->_cpt_route ) return; |
|
973 | + if ( $this->_cpt_route ) { |
|
974 | + return; |
|
975 | + } |
|
958 | 976 | try { |
959 | 977 | $this->_route_admin_request(); |
960 | 978 | } catch ( EE_Error $e ) { |
@@ -993,8 +1011,9 @@ discard block |
||
993 | 1011 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
994 | 1012 | |
995 | 1013 | //can't do anything without revision so let's get out if not present |
996 | - if ( empty( $rev_id ) ) |
|
997 | - return $location; |
|
1014 | + if ( empty( $rev_id ) ) { |
|
1015 | + return $location; |
|
1016 | + } |
|
998 | 1017 | |
999 | 1018 | //get rev_post_data |
1000 | 1019 | $rev = get_post($rev_id); |
@@ -1023,8 +1042,9 @@ discard block |
||
1023 | 1042 | */ |
1024 | 1043 | public function modify_edit_post_link( $link, $id, $context ) { |
1025 | 1044 | $post = get_post( $id ); |
1026 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1027 | - return $link; |
|
1045 | + if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) { |
|
1046 | + return $link; |
|
1047 | + } |
|
1028 | 1048 | $query_args = array( |
1029 | 1049 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1030 | 1050 | 'post' => $id |
@@ -1044,8 +1064,9 @@ discard block |
||
1044 | 1064 | */ |
1045 | 1065 | public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
1046 | 1066 | $post = get_post($post_id); |
1047 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1048 | - return $delete_link; |
|
1067 | + if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) { |
|
1068 | + return $delete_link; |
|
1069 | + } |
|
1049 | 1070 | |
1050 | 1071 | return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
1051 | 1072 | } |
@@ -1059,8 +1080,9 @@ discard block |
||
1059 | 1080 | * @return string url to redirect to |
1060 | 1081 | */ |
1061 | 1082 | public function cpt_trash_post_location_redirect( $location, $status ) { |
1062 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1063 | - return $location; |
|
1083 | + if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) { |
|
1084 | + return $location; |
|
1085 | + } |
|
1064 | 1086 | |
1065 | 1087 | $post = get_post( $this->_req_data['post'] ); |
1066 | 1088 | $query_args = array( 'action' => 'default' ); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function do_initial_loads() { |
33 | 33 | //we want to use the corresponding admin page object (but not route it!). To do this we just set _routing to false. That way this page object is being loaded on all pages to make sure we hook into admin properly. But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;) |
34 | 34 | //This is important because we have hooks that help redirect custom post type saves |
35 | - if ( !isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] != $this->_menu_map->menu_slug ) ) { |
|
35 | + if ( ! isset($_REQUEST['page']) || (isset($_REQUEST['page']) && $_REQUEST['page'] != $this->_menu_map->menu_slug)) { |
|
36 | 36 | $this->_routing = FALSE; |
37 | 37 | $this->_initialize_admin_page(); |
38 | 38 | } else { |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | $this->_initialize_admin_page(); |
41 | 41 | //added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality |
42 | 42 | remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization'); |
43 | - add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100 ); |
|
43 | + add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100); |
|
44 | 44 | //end removal of autosave functionality. |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function wp_just_in_time_script_localization() { |
49 | - wp_localize_script( 'autosave', 'autosaveL10n', array( |
|
49 | + wp_localize_script('autosave', 'autosaveL10n', array( |
|
50 | 50 | 'autosaveInterval' => 172800, |
51 | 51 | 'savingText' => __('Saving Draft…'), |
52 | 52 | 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.') |
53 | - ) ); |
|
53 | + )); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -88,16 +88,16 @@ discard block |
||
88 | 88 | $this->_set_init_properties(); |
89 | 89 | |
90 | 90 | //global styles/scripts across all wp admin pages |
91 | - add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5 ); |
|
91 | + add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5); |
|
92 | 92 | |
93 | 93 | //load initial stuff. |
94 | 94 | $this->_set_file_and_folder_name(); |
95 | 95 | |
96 | 96 | $this->_set_menu_map(); |
97 | 97 | |
98 | - if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) ) |
|
98 | + if (empty($this->_menu_map) || is_array($this->_menu_map)) |
|
99 | 99 | { |
100 | - EE_Error::doing_it_wrong( get_class( $this ) . '::$_menu_map', sprintf( __('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core. Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso' ), get_class( $this ) ), '4.4.0' ); |
|
100 | + EE_Error::doing_it_wrong(get_class($this).'::$_menu_map', sprintf(__('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core. Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso'), get_class($this)), '4.4.0'); |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function load_wp_global_scripts_styles() { |
160 | 160 | /** STYLES **/ |
161 | 161 | //register |
162 | - wp_register_style('espresso_menu', EE_ADMIN_URL . 'assets/admin-menu-styles.css'); |
|
162 | + wp_register_style('espresso_menu', EE_ADMIN_URL.'assets/admin-menu-styles.css'); |
|
163 | 163 | |
164 | 164 | |
165 | 165 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | |
202 | 202 | |
203 | 203 | protected function _set_capability() { |
204 | - $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability; |
|
205 | - $this->capability = apply_filters( 'FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability ); |
|
204 | + $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability; |
|
205 | + $this->capability = apply_filters('FHEE_'.$this->_menu_map->menu_slug.'_capability', $capability); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | public function initialize_admin_page() { |
221 | 221 | //let's check user access first |
222 | 222 | $this->_check_user_access(); |
223 | - if ( !is_object( $this->_loaded_page_object) ) return; |
|
223 | + if ( ! is_object($this->_loaded_page_object)) return; |
|
224 | 224 | $this->_loaded_page_object->route_admin_request(); |
225 | 225 | return; |
226 | 226 | } |
@@ -232,25 +232,25 @@ discard block |
||
232 | 232 | |
233 | 233 | |
234 | 234 | public function set_page_dependencies($wp_page_slug) { |
235 | - if ( !$this->_load_page ) return; |
|
235 | + if ( ! $this->_load_page) return; |
|
236 | 236 | |
237 | - if ( !is_object($this->_loaded_page_object) ) { |
|
237 | + if ( ! is_object($this->_loaded_page_object)) { |
|
238 | 238 | $msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso'); |
239 | - $msg[] = $msg[0] . "\r\n" . sprintf( |
|
239 | + $msg[] = $msg[0]."\r\n".sprintf( |
|
240 | 240 | __('The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory', 'event_espresso'), |
241 | 241 | $this->_file_name, |
242 | 242 | $this->_file_name, |
243 | - $this->_folder_path . $this->_file_name, |
|
243 | + $this->_folder_path.$this->_file_name, |
|
244 | 244 | $this->_menu_map->menu_slug |
245 | 245 | ); |
246 | - throw new EE_Error( implode( '||', $msg) ); |
|
246 | + throw new EE_Error(implode('||', $msg)); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
250 | - $page_hook = 'load-' . $wp_page_slug; |
|
250 | + $page_hook = 'load-'.$wp_page_slug; |
|
251 | 251 | //hook into page load hook so all page specific stuff get's loaded. |
252 | - if ( !empty($wp_page_slug) ) |
|
253 | - add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') ); |
|
252 | + if ( ! empty($wp_page_slug)) |
|
253 | + add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies')); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function do_initial_loads() { |
263 | 263 | //no loading or initializing if menu map is setup incorrectly. |
264 | - if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) ) { |
|
264 | + if (empty($this->_menu_map) || is_array($this->_menu_map)) { |
|
265 | 265 | return; |
266 | 266 | } |
267 | 267 | $this->_initialize_admin_page(); |
@@ -278,19 +278,19 @@ discard block |
||
278 | 278 | $bt = debug_backtrace(); |
279 | 279 | //for more reliable determination of folder name |
280 | 280 | //we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this). Why? Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins) |
281 | - $class = get_class( $this ); |
|
282 | - foreach ( $bt as $index => $values ) { |
|
283 | - if ( isset( $values['class'] ) && $values['class'] == $class ) { |
|
281 | + $class = get_class($this); |
|
282 | + foreach ($bt as $index => $values) { |
|
283 | + if (isset($values['class']) && $values['class'] == $class) { |
|
284 | 284 | $file_index = $index - 1; |
285 | - $this->_folder_name = basename(dirname($bt[$file_index]['file']) ); |
|
286 | - if ( !empty( $this->_folder_name ) ) break; |
|
285 | + $this->_folder_name = basename(dirname($bt[$file_index]['file'])); |
|
286 | + if ( ! empty($this->_folder_name)) break; |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
290 | - $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS; |
|
290 | + $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.DS; |
|
291 | 291 | |
292 | - $this->_file_name = preg_replace( '/^ee/' , 'EE', $this->_folder_name ); |
|
293 | - $this->_file_name = ucwords( str_replace('_', ' ', $this->_file_name) ); |
|
292 | + $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name); |
|
293 | + $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name)); |
|
294 | 294 | $this->_file_name = str_replace(' ', '_', $this->_file_name); |
295 | 295 | } |
296 | 296 | |
@@ -302,19 +302,19 @@ discard block |
||
302 | 302 | * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks files/classes |
303 | 303 | * @return array |
304 | 304 | */ |
305 | - public function register_hooks( $extend = FALSE ) { |
|
305 | + public function register_hooks($extend = FALSE) { |
|
306 | 306 | |
307 | 307 | //get a list of files in the directory that have the "Hook" in their name an |
308 | 308 | |
309 | 309 | //if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property. Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf. |
310 | - if ( $extend ) { |
|
311 | - $hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS . '*' . $this->_file_name . '_Hooks_Extend.class.php' ); |
|
312 | - $this->_hook_paths = $this->_register_hook_files( $hook_files_glob_path, $extend ); |
|
310 | + if ($extend) { |
|
311 | + $hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS.'*'.$this->_file_name.'_Hooks_Extend.class.php'); |
|
312 | + $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | //loop through decaf folders |
316 | - $hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' ); |
|
317 | - $this->_hook_paths = array_merge( $this->_register_hook_files( $hook_files_glob_path ), $this->_hook_paths ); //making sure any extended hook paths are later in the array than the core hook paths! |
|
316 | + $hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php'); |
|
317 | + $this->_hook_paths = array_merge($this->_register_hook_files($hook_files_glob_path), $this->_hook_paths); //making sure any extended hook paths are later in the array than the core hook paths! |
|
318 | 318 | |
319 | 319 | return $this->_hook_paths; |
320 | 320 | |
@@ -322,27 +322,27 @@ discard block |
||
322 | 322 | |
323 | 323 | |
324 | 324 | |
325 | - protected function _register_hook_files( $hook_files_glob_path, $extend = FALSE ) { |
|
325 | + protected function _register_hook_files($hook_files_glob_path, $extend = FALSE) { |
|
326 | 326 | $hook_paths = array(); |
327 | - if ( $hook_files = glob( $hook_files_glob_path ) ) { |
|
328 | - if ( empty( $hook_files ) ) { |
|
327 | + if ($hook_files = glob($hook_files_glob_path)) { |
|
328 | + if (empty($hook_files)) { |
|
329 | 329 | return array(); |
330 | 330 | } |
331 | - foreach ( $hook_files as $file ) { |
|
331 | + foreach ($hook_files as $file) { |
|
332 | 332 | //lets get the linked admin. |
333 | - $hook_file = $extend ? str_replace( EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS, '', $file ) : str_replace($this->_folder_path, '', $file ); |
|
334 | - $replace = $extend ? '_' . $this->_file_name . '_Hooks_Extend.class.php' : '_' . $this->_file_name . '_Hooks.class.php'; |
|
335 | - $rel_admin = str_replace( $replace, '', $hook_file); |
|
333 | + $hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS, '', $file) : str_replace($this->_folder_path, '', $file); |
|
334 | + $replace = $extend ? '_'.$this->_file_name.'_Hooks_Extend.class.php' : '_'.$this->_file_name.'_Hooks.class.php'; |
|
335 | + $rel_admin = str_replace($replace, '', $hook_file); |
|
336 | 336 | $rel_admin = strtolower($rel_admin); |
337 | 337 | $hook_paths[] = $file; |
338 | 338 | |
339 | 339 | //make sure we haven't already got a hook setup for this page path |
340 | - if ( in_array( $rel_admin, $this->_files_hooked ) ) |
|
340 | + if (in_array($rel_admin, $this->_files_hooked)) |
|
341 | 341 | continue; |
342 | 342 | |
343 | 343 | $this->hook_file = $hook_file; |
344 | - $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
|
345 | - $filter = add_filter( $rel_admin_hook, array($this, 'load_admin_hook') ); |
|
344 | + $rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin; |
|
345 | + $filter = add_filter($rel_admin_hook, array($this, 'load_admin_hook')); |
|
346 | 346 | $this->_files_hooked[] = $rel_admin; |
347 | 347 | } |
348 | 348 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | protected function _initialize_admin_page() { |
368 | 368 | |
369 | 369 | //JUST CHECK WE'RE ON RIGHT PAGE. |
370 | - if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) |
|
370 | + if (( ! isset($_REQUEST['page']) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing) |
|
371 | 371 | return; //not on the right page so let's get out. |
372 | 372 | $this->_load_page = TRUE; |
373 | 373 | |
@@ -375,30 +375,30 @@ discard block |
||
375 | 375 | // spl_autoload_register(array( $this, 'set_autoloaders') ); |
376 | 376 | |
377 | 377 | //we don't need to do a page_request check here because it's only called via WP menu system. |
378 | - $admin_page = $this->_file_name . '_Admin_Page'; |
|
379 | - $hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page; |
|
378 | + $admin_page = $this->_file_name.'_Admin_Page'; |
|
379 | + $hook_suffix = $this->_menu_map->menu_slug.'_'.$admin_page; |
|
380 | 380 | $admin_page = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}", $admin_page); |
381 | 381 | |
382 | 382 | // define requested admin page class name then load the file and instantiate |
383 | - $path_to_file = str_replace( array( '\\', '/' ), DS, $this->_folder_path . $admin_page . '.core.php' ); |
|
384 | - $path_to_file=apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",$path_to_file );//so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
|
383 | + $path_to_file = str_replace(array('\\', '/'), DS, $this->_folder_path.$admin_page.'.core.php'); |
|
384 | + $path_to_file = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}", $path_to_file); //so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
|
385 | 385 | |
386 | - if ( is_readable( $path_to_file )) { |
|
386 | + if (is_readable($path_to_file)) { |
|
387 | 387 | // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place |
388 | - do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization' ); |
|
389 | - do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug ); |
|
390 | - require_once( $path_to_file ); |
|
391 | - $a = new ReflectionClass( $admin_page ); |
|
392 | - $this->_loaded_page_object = $a->newInstance( $this->_routing ); |
|
388 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization'); |
|
389 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_'.$this->_menu_map->menu_slug); |
|
390 | + require_once($path_to_file); |
|
391 | + $a = new ReflectionClass($admin_page); |
|
392 | + $this->_loaded_page_object = $a->newInstance($this->_routing); |
|
393 | 393 | } |
394 | - do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization' ); |
|
395 | - do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug ); |
|
394 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization'); |
|
395 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_'.$this->_menu_map->menu_slug); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
399 | 399 | |
400 | 400 | public function get_admin_page_name() { |
401 | - return $this->_file_name . '_Admin_Page'; |
|
401 | + return $this->_file_name.'_Admin_Page'; |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | * @return bool|die true if pass (or admin) wp_die if fail |
432 | 432 | */ |
433 | 433 | private function _check_user_access() { |
434 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $this->_menu_map->capability, $this->_menu_map->menu_slug ) ) { |
|
435 | - wp_die( __('You don\'t have access to this page.'), '', array( 'back_link' => true ) ); |
|
434 | + if ( ! EE_Registry::instance()->CAP->current_user_can($this->_menu_map->capability, $this->_menu_map->menu_slug)) { |
|
435 | + wp_die(__('You don\'t have access to this page.'), '', array('back_link' => true)); |
|
436 | 436 | } |
437 | 437 | return true; |
438 | 438 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -220,7 +222,9 @@ discard block |
||
220 | 222 | public function initialize_admin_page() { |
221 | 223 | //let's check user access first |
222 | 224 | $this->_check_user_access(); |
223 | - if ( !is_object( $this->_loaded_page_object) ) return; |
|
225 | + if ( !is_object( $this->_loaded_page_object) ) { |
|
226 | + return; |
|
227 | + } |
|
224 | 228 | $this->_loaded_page_object->route_admin_request(); |
225 | 229 | return; |
226 | 230 | } |
@@ -232,7 +236,9 @@ discard block |
||
232 | 236 | |
233 | 237 | |
234 | 238 | public function set_page_dependencies($wp_page_slug) { |
235 | - if ( !$this->_load_page ) return; |
|
239 | + if ( !$this->_load_page ) { |
|
240 | + return; |
|
241 | + } |
|
236 | 242 | |
237 | 243 | if ( !is_object($this->_loaded_page_object) ) { |
238 | 244 | $msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso'); |
@@ -249,8 +255,9 @@ discard block |
||
249 | 255 | $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
250 | 256 | $page_hook = 'load-' . $wp_page_slug; |
251 | 257 | //hook into page load hook so all page specific stuff get's loaded. |
252 | - if ( !empty($wp_page_slug) ) |
|
253 | - add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') ); |
|
258 | + if ( !empty($wp_page_slug) ) { |
|
259 | + add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') ); |
|
260 | + } |
|
254 | 261 | } |
255 | 262 | |
256 | 263 | |
@@ -283,7 +290,9 @@ discard block |
||
283 | 290 | if ( isset( $values['class'] ) && $values['class'] == $class ) { |
284 | 291 | $file_index = $index - 1; |
285 | 292 | $this->_folder_name = basename(dirname($bt[$file_index]['file']) ); |
286 | - if ( !empty( $this->_folder_name ) ) break; |
|
293 | + if ( !empty( $this->_folder_name ) ) { |
|
294 | + break; |
|
295 | + } |
|
287 | 296 | } |
288 | 297 | } |
289 | 298 | |
@@ -337,8 +346,9 @@ discard block |
||
337 | 346 | $hook_paths[] = $file; |
338 | 347 | |
339 | 348 | //make sure we haven't already got a hook setup for this page path |
340 | - if ( in_array( $rel_admin, $this->_files_hooked ) ) |
|
341 | - continue; |
|
349 | + if ( in_array( $rel_admin, $this->_files_hooked ) ) { |
|
350 | + continue; |
|
351 | + } |
|
342 | 352 | |
343 | 353 | $this->hook_file = $hook_file; |
344 | 354 | $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
@@ -367,8 +377,10 @@ discard block |
||
367 | 377 | protected function _initialize_admin_page() { |
368 | 378 | |
369 | 379 | //JUST CHECK WE'RE ON RIGHT PAGE. |
370 | - if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) |
|
371 | - return; //not on the right page so let's get out. |
|
380 | + if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) { |
|
381 | + return; |
|
382 | + } |
|
383 | + //not on the right page so let's get out. |
|
372 | 384 | $this->_load_page = TRUE; |
373 | 385 | |
374 | 386 | //let's set page specific autoloaders. Note that this just sets autoloaders for THIS set of admin pages. |
@@ -214,7 +214,6 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @access public |
216 | 216 | * @uses _initialize_admin_page() |
217 | - * @param string $dir_name directory name for specific admin_page being loaded. |
|
218 | 217 | * @return void |
219 | 218 | */ |
220 | 219 | public function initialize_admin_page() { |
@@ -231,6 +230,9 @@ discard block |
||
231 | 230 | |
232 | 231 | |
233 | 232 | |
233 | + /** |
|
234 | + * @param string $wp_page_slug |
|
235 | + */ |
|
234 | 236 | public function set_page_dependencies($wp_page_slug) { |
235 | 237 | if ( !$this->_load_page ) return; |
236 | 238 |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -237,8 +238,9 @@ discard block |
||
237 | 238 | //first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects ) |
238 | 239 | usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) ); |
239 | 240 | foreach ( $this->_admin_menu_groups as $group ) { |
240 | - if ( ! $group instanceof EE_Admin_Page_Menu_Group ) |
|
241 | - throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
241 | + if ( ! $group instanceof EE_Admin_Page_Menu_Group ) { |
|
242 | + throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
243 | + } |
|
242 | 244 | $groups[$group->menu_slug] = $group; |
243 | 245 | } |
244 | 246 | return $groups; |
@@ -494,8 +496,9 @@ discard block |
||
494 | 496 | //let's sort the groups, make sure it's a valid group, add header (if to show). |
495 | 497 | foreach ( $pages_array as $group => $menu_maps ) { |
496 | 498 | //valid_group? |
497 | - if ( ! array_key_exists( $group, $menu_groups ) ) |
|
498 | - continue; |
|
499 | + if ( ! array_key_exists( $group, $menu_groups ) ) { |
|
500 | + continue; |
|
501 | + } |
|
499 | 502 | |
500 | 503 | //sort pages. |
501 | 504 | usort( $menu_maps, array( $this, '_sort_menu_maps' ) ); |
@@ -510,8 +513,9 @@ discard block |
||
510 | 513 | |
511 | 514 | //now let's setup the _prepped_menu_maps property |
512 | 515 | foreach ( $menu_groups as $group => $group_objs ) { |
513 | - if ( isset( $pages_array[$group] ) ) |
|
514 | - $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
516 | + if ( isset( $pages_array[$group] ) ) { |
|
517 | + $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
518 | + } |
|
515 | 519 | }/**/ |
516 | 520 | |
517 | 521 | } |
@@ -656,8 +660,9 @@ discard block |
||
656 | 660 | * @return int sort order |
657 | 661 | */ |
658 | 662 | private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) { |
659 | - if ( $a->menu_order == $b->menu_order ) |
|
660 | - return 0; |
|
663 | + if ( $a->menu_order == $b->menu_order ) { |
|
664 | + return 0; |
|
665 | + } |
|
661 | 666 | return ($a->menu_order < $b->menu_order) ? -1 : 1; |
662 | 667 | } |
663 | 668 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | //let's do a scan and see what installed pages we have |
120 | 120 | $this->_get_installed_pages(); |
121 | 121 | //set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to). |
122 | - add_action('admin_menu', array( $this, 'set_menus' )); |
|
123 | - add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) ); |
|
122 | + add_action('admin_menu', array($this, 'set_menus')); |
|
123 | + add_action('network_admin_menu', array($this, 'set_network_menus')); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | * @return void |
134 | 134 | */ |
135 | 135 | private function _define_caffeinated_constants() { |
136 | - define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/'); |
|
137 | - define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/'); |
|
138 | - define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/'); |
|
139 | - define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/'); |
|
140 | - define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/'); |
|
141 | - define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/'); |
|
136 | + define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/'); |
|
137 | + define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/'); |
|
138 | + define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/'); |
|
139 | + define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/'); |
|
140 | + define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/'); |
|
141 | + define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | //set array of EE_Admin_Page_Menu_Group objects |
158 | 158 | $groups = array( |
159 | - 'main' => new EE_Admin_Page_Menu_Group( array( |
|
159 | + 'main' => new EE_Admin_Page_Menu_Group(array( |
|
160 | 160 | 'menu_label' => __('Main', 'event_espresso'), |
161 | 161 | 'show_on_menu' => EE_Admin_Page_Menu_Map::NONE, |
162 | 162 | 'menu_slug' => 'main', |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | 'menu_order' => 0, |
165 | 165 | 'parent_slug' => 'espresso_events', |
166 | 166 | )), |
167 | - 'management' => new EE_Admin_Page_Menu_Group( array( |
|
167 | + 'management' => new EE_Admin_Page_Menu_Group(array( |
|
168 | 168 | 'menu_label' => __('Management', 'event_espresso'), |
169 | 169 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
170 | 170 | 'menu_slug' => 'management', |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'menu_order' => 10, |
173 | 173 | 'parent_slug' => 'espresso_events' |
174 | 174 | )), |
175 | - 'settings' => new EE_Admin_Page_Menu_Group( array( |
|
175 | + 'settings' => new EE_Admin_Page_Menu_Group(array( |
|
176 | 176 | 'menu_label' => __('Settings', 'event_espresso'), |
177 | 177 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
178 | 178 | 'menu_slug' => 'settings', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'menu_order' => 30, |
181 | 181 | 'parent_slug' => 'espresso_events' |
182 | 182 | )), |
183 | - 'templates' => new EE_Admin_Page_Menu_Group( array( |
|
183 | + 'templates' => new EE_Admin_Page_Menu_Group(array( |
|
184 | 184 | 'menu_label' => __('Templates', 'event_espresso'), |
185 | 185 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
186 | 186 | 'menu_slug' => 'templates', |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | 'menu_order' => 40, |
189 | 189 | 'parent_slug' => 'espresso_events' |
190 | 190 | )), |
191 | - 'extras' => new EE_Admin_Page_Menu_Group( array( |
|
191 | + 'extras' => new EE_Admin_Page_Menu_Group(array( |
|
192 | 192 | 'menu_label' => __('Extras', 'event_espresso'), |
193 | 193 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
194 | 194 | 'menu_slug' => 'extras', |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'parent_slug' => 'espresso_events', |
198 | 198 | 'maintenance_mode_parent' => 'espresso_maintenance_settings' |
199 | 199 | )), |
200 | - 'tools' => new EE_Admin_Page_Menu_Group( array( |
|
200 | + 'tools' => new EE_Admin_Page_Menu_Group(array( |
|
201 | 201 | 'menu_label' => __("Tools", "event_espresso"), |
202 | 202 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
203 | 203 | 'menu_slug' => 'tools', |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | 'menu_order' => 60, |
206 | 206 | 'parent_slug' => 'espresso_events' |
207 | 207 | )), |
208 | - 'addons' => new EE_Admin_Page_Menu_Group( array( |
|
208 | + 'addons' => new EE_Admin_Page_Menu_Group(array( |
|
209 | 209 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
210 | 210 | 'menu_label' => __('Add-ons', 'event_espresso'), |
211 | 211 | 'menu_slug' => 'addons', |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | )) |
216 | 216 | ); |
217 | 217 | |
218 | - $this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups ); |
|
218 | + $this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | private function _rearrange_menu_groups() { |
234 | 234 | $groups = array(); |
235 | 235 | //first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects ) |
236 | - usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) ); |
|
237 | - foreach ( $this->_admin_menu_groups as $group ) { |
|
238 | - if ( ! $group instanceof EE_Admin_Page_Menu_Group ) |
|
239 | - throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
236 | + usort($this->_admin_menu_groups, array($this, '_sort_menu_maps')); |
|
237 | + foreach ($this->_admin_menu_groups as $group) { |
|
238 | + if ( ! $group instanceof EE_Admin_Page_Menu_Group) |
|
239 | + throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE))); |
|
240 | 240 | $groups[$group->menu_slug] = $group; |
241 | 241 | } |
242 | 242 | return $groups; |
@@ -254,48 +254,48 @@ discard block |
||
254 | 254 | */ |
255 | 255 | private function _get_installed_pages() { |
256 | 256 | $installed_refs = array(); |
257 | - $exclude = array( 'assets', 'templates' ); |
|
257 | + $exclude = array('assets', 'templates'); |
|
258 | 258 | // grab everything in the admin core directory |
259 | - $admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR ); |
|
260 | - if ( $admin_screens ) { |
|
261 | - foreach( $admin_screens as $admin_screen ) { |
|
259 | + $admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR); |
|
260 | + if ($admin_screens) { |
|
261 | + foreach ($admin_screens as $admin_screen) { |
|
262 | 262 | // files and anything in the exclude array need not apply |
263 | - if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) { |
|
263 | + if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) { |
|
264 | 264 | // these folders represent the different EE admin pages |
265 | - $installed_refs[ basename( $admin_screen ) ] = $admin_screen; |
|
265 | + $installed_refs[basename($admin_screen)] = $admin_screen; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
270 | - if ( empty( $installed_refs ) ) { |
|
270 | + if (empty($installed_refs)) { |
|
271 | 271 | $error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso'); |
272 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES ); |
|
273 | - throw new EE_Error( implode( '||', $error_msg )); |
|
272 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES); |
|
273 | + throw new EE_Error(implode('||', $error_msg)); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | //this just checks the caffeinated folder and takes care of setting up any caffeinated stuff. |
277 | 277 | $installed_refs = $this->_set_caffeinated($installed_refs); |
278 | 278 | //allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.; |
279 | - $installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs ); |
|
280 | - $this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends ); |
|
279 | + $installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs); |
|
280 | + $this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends); |
|
281 | 281 | |
282 | 282 | //loop through admin pages and setup the $_installed_pages array. |
283 | 283 | $hooks_ref = array(); |
284 | - foreach ( $installed_refs as $page => $path ) { |
|
284 | + foreach ($installed_refs as $page => $path) { |
|
285 | 285 | // set autoloaders for our admin page classes based on included path information |
286 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path ); |
|
286 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path); |
|
287 | 287 | // build list of installed pages |
288 | - $this->_installed_pages[$page] = $this->_load_admin_page( $page, $path ); |
|
288 | + $this->_installed_pages[$page] = $this->_load_admin_page($page, $path); |
|
289 | 289 | // verify returned object |
290 | - if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) { |
|
291 | - if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) { |
|
290 | + if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) { |
|
291 | + if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) { |
|
292 | 292 | continue; |
293 | 293 | } |
294 | 294 | |
295 | 295 | //skip if in full maintenance mode and maintenance_mode_parent is set |
296 | 296 | $maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent; |
297 | - if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
298 | - unset( $installed_refs[$page] ); |
|
297 | + if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
298 | + unset($installed_refs[$page]); |
|
299 | 299 | continue; |
300 | 300 | } |
301 | 301 | |
@@ -303,45 +303,45 @@ discard block |
||
303 | 303 | //flag for register hooks on extended pages b/c extended pages use the default INIT. |
304 | 304 | $extend = FALSE; |
305 | 305 | //now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals. If there are then let's hook into the init admin filter and load our extend instead. |
306 | - if ( isset( $this->_caffeinated_extends[$page] ) ) { |
|
306 | + if (isset($this->_caffeinated_extends[$page])) { |
|
307 | 307 | $this->_current_caf_extend_slug = $page; |
308 | - $path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name(); |
|
309 | - $path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";'; |
|
310 | - $page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name(); |
|
311 | - $page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";'; |
|
308 | + $path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name(); |
|
309 | + $path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";'; |
|
310 | + $page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name(); |
|
311 | + $page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";'; |
|
312 | 312 | |
313 | - $hook_function_path = create_function( '$path_to_file', $path_runtime); |
|
314 | - $hook_function_page = create_function( '$admin_page', $page_runtime ); |
|
313 | + $hook_function_path = create_function('$path_to_file', $path_runtime); |
|
314 | + $hook_function_page = create_function('$admin_page', $page_runtime); |
|
315 | 315 | |
316 | - add_filter( $path_hook, $hook_function_path ); |
|
317 | - add_filter( $page_hook, $hook_function_page ); |
|
316 | + add_filter($path_hook, $hook_function_path); |
|
317 | + add_filter($page_hook, $hook_function_page); |
|
318 | 318 | $extend = TRUE; |
319 | 319 | } |
320 | 320 | //let's do the registered hooks |
321 | - $extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend ); |
|
321 | + $extended_hooks = $this->_installed_pages[$page]->register_hooks($extend); |
|
322 | 322 | $hooks_ref = array_merge($hooks_ref, $extended_hooks); |
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
326 | 326 | //the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder. So we want to make sure we load the file for the parent. |
327 | 327 | //first make sure we've got unique values |
328 | - $hooks_ref = array_unique( $hooks_ref ); |
|
328 | + $hooks_ref = array_unique($hooks_ref); |
|
329 | 329 | //now let's loop and require! |
330 | - foreach ( $hooks_ref as $path ) { |
|
331 | - require_once( $path ); |
|
330 | + foreach ($hooks_ref as $path) { |
|
331 | + require_once($path); |
|
332 | 332 | } |
333 | 333 | //make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested. |
334 | 334 | global $ee_menu_slugs; |
335 | 335 | $ee_menu_slugs = $this->_menu_slugs; |
336 | 336 | |
337 | 337 | //we need to loop again to run any early code |
338 | - foreach ( $installed_refs as $page => $path ) { |
|
339 | - if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) { |
|
338 | + foreach ($installed_refs as $page => $path) { |
|
339 | + if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) { |
|
340 | 340 | $this->_installed_pages[$page]->do_initial_loads(); |
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
344 | - do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages ); |
|
344 | + do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages); |
|
345 | 345 | |
346 | 346 | } |
347 | 347 | |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | * @param string $page_slug |
354 | 354 | * @return EE_Admin_Page |
355 | 355 | */ |
356 | - public function get_admin_page_object( $page_slug = '' ) { |
|
357 | - if ( isset( $this->_installed_pages[ $page_slug ] )) { |
|
358 | - return $this->_installed_pages[ $page_slug ]->loaded_page_object(); |
|
356 | + public function get_admin_page_object($page_slug = '') { |
|
357 | + if (isset($this->_installed_pages[$page_slug])) { |
|
358 | + return $this->_installed_pages[$page_slug]->loaded_page_object(); |
|
359 | 359 | } |
360 | 360 | return NULL; |
361 | 361 | } |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | * @param $dir_name |
369 | 369 | * @return string |
370 | 370 | */ |
371 | - private function _get_classname_for_admin_page( $dir_name = '' ) { |
|
372 | - $class_name = str_replace( '_', ' ', strtolower( $dir_name )); |
|
373 | - return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page'; |
|
371 | + private function _get_classname_for_admin_page($dir_name = '') { |
|
372 | + $class_name = str_replace('_', ' ', strtolower($dir_name)); |
|
373 | + return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page'; |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | * @param $dir_name |
382 | 382 | * @return string |
383 | 383 | */ |
384 | - private function _get_classname_for_admin_init_page( $dir_name = '' ) { |
|
385 | - $class_name = str_replace( '_', ' ', strtolower( $dir_name )); |
|
386 | - return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init'; |
|
384 | + private function _get_classname_for_admin_init_page($dir_name = '') { |
|
385 | + $class_name = str_replace('_', ' ', strtolower($dir_name)); |
|
386 | + return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init'; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | * @throws EE_Error |
397 | 397 | * @return object|bool return page object if valid, bool false if not. |
398 | 398 | */ |
399 | - private function _load_admin_page( $page = '', $path = '' ) { |
|
400 | - $class_name = $this->_get_classname_for_admin_init_page( $page ); |
|
401 | - EE_Registry::instance()->load_file( $path, $class_name, 'core' ); |
|
402 | - if ( ! class_exists( $class_name )) { |
|
403 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page); |
|
404 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no Init class in place for the %s admin page.', 'event_espresso') . '<br />' . __( 'Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name ); |
|
405 | - throw new EE_Error( implode( '||', $error_msg )); |
|
399 | + private function _load_admin_page($page = '', $path = '') { |
|
400 | + $class_name = $this->_get_classname_for_admin_init_page($page); |
|
401 | + EE_Registry::instance()->load_file($path, $class_name, 'core'); |
|
402 | + if ( ! class_exists($class_name)) { |
|
403 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page); |
|
404 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no Init class in place for the %s admin page.', 'event_espresso').'<br />'.__('Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name); |
|
405 | + throw new EE_Error(implode('||', $error_msg)); |
|
406 | 406 | } |
407 | 407 | $a = new ReflectionClass($class_name); |
408 | 408 | return $a->newInstance(); |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | public function set_menus() { |
422 | 422 | //prep the menu pages (sort, group.) |
423 | 423 | $this->_prep_pages(); |
424 | - foreach( $this->_prepped_menu_maps as $menu_map ) { |
|
425 | - if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) { |
|
426 | - $menu_map->add_menu_page( FALSE ); |
|
424 | + foreach ($this->_prepped_menu_maps as $menu_map) { |
|
425 | + if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) { |
|
426 | + $menu_map->add_menu_page(FALSE); |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
@@ -436,11 +436,11 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @return void |
438 | 438 | */ |
439 | - public function set_network_menus(){ |
|
439 | + public function set_network_menus() { |
|
440 | 440 | $this->_prep_pages(); |
441 | - foreach( $this->_prepped_menu_maps as $menu_map ) { |
|
442 | - if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) { |
|
443 | - $menu_map->add_menu_page( TRUE ); |
|
441 | + foreach ($this->_prepped_menu_maps as $menu_map) { |
|
442 | + if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) { |
|
443 | + $menu_map->add_menu_page(TRUE); |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 | } |
@@ -461,22 +461,22 @@ discard block |
||
461 | 461 | //rearrange _admin_menu_groups to be indexed by group slug. |
462 | 462 | $menu_groups = $this->_rearrange_menu_groups(); |
463 | 463 | |
464 | - foreach( $this->_installed_pages as $page ) { |
|
465 | - if ( $page instanceof EE_Admin_page_Init ) { |
|
464 | + foreach ($this->_installed_pages as $page) { |
|
465 | + if ($page instanceof EE_Admin_page_Init) { |
|
466 | 466 | $page_map = $page->get_menu_map(); |
467 | 467 | //if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item. |
468 | - if ( is_array( $page_map ) || empty( $page_map ) ) { |
|
469 | - EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core. This means that full functionality for this component is not available. This error message usually appears with an Add-on that is out of date. Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) ); |
|
468 | + if (is_array($page_map) || empty($page_map)) { |
|
469 | + EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core. This means that full functionality for this component is not available. This error message usually appears with an Add-on that is out of date. Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label)); |
|
470 | 470 | continue; |
471 | 471 | } |
472 | 472 | |
473 | 473 | //if page map is NOT a EE_Admin_Page_Menu_Map object then throw error. |
474 | - if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) { |
|
475 | - throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object. Instead it is %s. Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) ); |
|
474 | + if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) { |
|
475 | + throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object. Instead it is %s. Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map)); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | //use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array. |
479 | - if ( empty( $page_map->maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
479 | + if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
480 | 480 | continue; |
481 | 481 | } |
482 | 482 | |
@@ -485,21 +485,21 @@ discard block |
||
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
488 | - if ( empty( $pages_array )) { |
|
489 | - throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') ); |
|
488 | + if (empty($pages_array)) { |
|
489 | + throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso')); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | //let's sort the groups, make sure it's a valid group, add header (if to show). |
493 | - foreach ( $pages_array as $group => $menu_maps ) { |
|
493 | + foreach ($pages_array as $group => $menu_maps) { |
|
494 | 494 | //valid_group? |
495 | - if ( ! array_key_exists( $group, $menu_groups ) ) |
|
495 | + if ( ! array_key_exists($group, $menu_groups)) |
|
496 | 496 | continue; |
497 | 497 | |
498 | 498 | //sort pages. |
499 | - usort( $menu_maps, array( $this, '_sort_menu_maps' ) ); |
|
499 | + usort($menu_maps, array($this, '_sort_menu_maps')); |
|
500 | 500 | |
501 | 501 | //prepend header |
502 | - array_unshift( $menu_maps, $menu_groups[$group] ); |
|
502 | + array_unshift($menu_maps, $menu_groups[$group]); |
|
503 | 503 | |
504 | 504 | //reset $pages_array with prepped data |
505 | 505 | $pages_array[$group] = $menu_maps; |
@@ -507,9 +507,9 @@ discard block |
||
507 | 507 | |
508 | 508 | |
509 | 509 | //now let's setup the _prepped_menu_maps property |
510 | - foreach ( $menu_groups as $group => $group_objs ) { |
|
511 | - if ( isset( $pages_array[$group] ) ) |
|
512 | - $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
510 | + foreach ($menu_groups as $group => $group_objs) { |
|
511 | + if (isset($pages_array[$group])) |
|
512 | + $this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]); |
|
513 | 513 | }/**/ |
514 | 514 | |
515 | 515 | } |
@@ -529,10 +529,10 @@ discard block |
||
529 | 529 | * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded. |
530 | 530 | * @return array |
531 | 531 | */ |
532 | - private function _set_caffeinated( $installed_refs ) { |
|
532 | + private function _set_caffeinated($installed_refs) { |
|
533 | 533 | |
534 | 534 | //first let's check if there IS a caffeinated folder. If there is not then lets get out. |
535 | - if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) { |
|
535 | + if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) { |
|
536 | 536 | return $installed_refs; |
537 | 537 | } |
538 | 538 | |
@@ -541,15 +541,15 @@ discard block |
||
541 | 541 | $exclude = array('tickets'); |
542 | 542 | |
543 | 543 | //okay let's setup an "New" pages first (we'll return installed refs later) |
544 | - $new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR ); |
|
545 | - if ( $new_admin_screens ) { |
|
546 | - foreach( $new_admin_screens as $admin_screen ) { |
|
544 | + $new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR); |
|
545 | + if ($new_admin_screens) { |
|
546 | + foreach ($new_admin_screens as $admin_screen) { |
|
547 | 547 | // files and anything in the exclude array need not apply |
548 | - if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) { |
|
548 | + if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) { |
|
549 | 549 | // these folders represent the different NEW EE admin pages |
550 | - $installed_refs[ basename( $admin_screen ) ] = $admin_screen; |
|
550 | + $installed_refs[basename($admin_screen)] = $admin_screen; |
|
551 | 551 | // set autoloaders for our admin page classes based on included path information |
552 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen ); |
|
552 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen); |
|
553 | 553 | // $this->_caf_autoloader[] = array( |
554 | 554 | // 'dir' => 'new', |
555 | 555 | // 'folder' => basename( $admin_screen ) |
@@ -559,18 +559,18 @@ discard block |
||
559 | 559 | } |
560 | 560 | |
561 | 561 | //let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page) |
562 | - $extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR ); |
|
563 | - if ( $extends ) { |
|
564 | - foreach( $extends as $extend ) { |
|
565 | - if ( is_dir( $extend ) ) { |
|
566 | - $extend_ref = basename( $extend ); |
|
562 | + $extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR); |
|
563 | + if ($extends) { |
|
564 | + foreach ($extends as $extend) { |
|
565 | + if (is_dir($extend)) { |
|
566 | + $extend_ref = basename($extend); |
|
567 | 567 | //now let's make sure there is a file that matches the expected format |
568 | - $filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) ); |
|
569 | - $filename = 'Extend_' . $filename . '_Admin_Page'; |
|
570 | - $this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' ); |
|
568 | + $filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref))); |
|
569 | + $filename = 'Extend_'.$filename.'_Admin_Page'; |
|
570 | + $this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php'); |
|
571 | 571 | $this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename; |
572 | 572 | // set autoloaders for our admin page classes based on included path information |
573 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend ); |
|
573 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend); |
|
574 | 574 | // $this->_caf_autoloader[] = array( |
575 | 575 | // 'dir' => 'extend', |
576 | 576 | // 'folder' => $extend_ref |
@@ -581,22 +581,22 @@ discard block |
||
581 | 581 | |
582 | 582 | //let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!). |
583 | 583 | $ee_admin_hooks = array(); |
584 | - $hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' ); |
|
585 | - if ( $hooks ) { |
|
586 | - foreach ( $hooks as $hook ) { |
|
587 | - if ( is_readable( $hook ) ) { |
|
584 | + $hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php'); |
|
585 | + if ($hooks) { |
|
586 | + foreach ($hooks as $hook) { |
|
587 | + if (is_readable($hook)) { |
|
588 | 588 | require_once $hook; |
589 | - $classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook ); |
|
589 | + $classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook); |
|
590 | 590 | $classname = str_replace('.class.php', '', $classname); |
591 | - if ( class_exists( $classname ) ) { |
|
592 | - $a = new ReflectionClass( $classname ); |
|
591 | + if (class_exists($classname)) { |
|
592 | + $a = new ReflectionClass($classname); |
|
593 | 593 | $ee_admin_hooks[] = $a->newInstance(); |
594 | 594 | } |
595 | 595 | } |
596 | 596 | } |
597 | 597 | }/**/ |
598 | 598 | |
599 | - $ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks ); |
|
599 | + $ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks); |
|
600 | 600 | |
601 | 601 | return $installed_refs; |
602 | 602 | |
@@ -653,8 +653,8 @@ discard block |
||
653 | 653 | * @param EE_Admin_Page_Menu_Map $b being compared to |
654 | 654 | * @return int sort order |
655 | 655 | */ |
656 | - private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) { |
|
657 | - if ( $a->menu_order == $b->menu_order ) |
|
656 | + private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) { |
|
657 | + if ($a->menu_order == $b->menu_order) |
|
658 | 658 | return 0; |
659 | 659 | return ($a->menu_order < $b->menu_order) ? -1 : 1; |
660 | 660 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'action' => 'admin_option_settings', |
61 | 61 | 'page' => 'espresso_general_settings' |
62 | 62 | ); |
63 | - return '<p>' . sprintf( __('That\'s it for the tour! At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons. There are help tours available on all Event Espresso Admin pages. If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="' . EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php') ) . '">', '</a>' ) . '</p>'; |
|
63 | + return '<p>'.sprintf(__('That\'s it for the tour! At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons. There are help tours available on all Event Espresso Admin pages. If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="'.EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')).'">', '</a>').'</p>'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <div class="wrap espresso-admin about-wrap"> |
2 | 2 | |
3 | 3 | <h1><?php echo $admin_page_title; ?></h1> |
4 | - <div class="about-text"><?php echo !empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div> |
|
5 | - <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf( esc_attr__( '%s Logo', 'event_espresso' ), 'Event Espresso' ); ?>"/><br /><?php printf( __('Version %s', 'event_espresso' ), EVENT_ESPRESSO_VERSION ); ?></div> |
|
4 | + <div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div> |
|
5 | + <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf(esc_attr__('%s Logo', 'event_espresso'), 'Event Espresso'); ?>"/><br /><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div> |
|
6 | 6 | |
7 | 7 | <?php echo $nav_tabs; ?> |
8 | 8 | |
9 | 9 | |
10 | 10 | <?php |
11 | - do_action( 'AHEE__admin_wrapper__template__before_about_admin_page_content' ); |
|
11 | + do_action('AHEE__admin_wrapper__template__before_about_admin_page_content'); |
|
12 | 12 | echo $about_admin_page_content; |
13 | - do_action( 'AHEE__admin_wrapper__template__after_about_admin_page_content' ); |
|
13 | + do_action('AHEE__admin_wrapper__template__after_about_admin_page_content'); |
|
14 | 14 | ?> |
15 | 15 | |
16 | 16 | </div> |