@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | * @param \EE_Registry $registry |
| 133 | 133 | * @return \EE_Config instance |
| 134 | 134 | */ |
| 135 | - public static function instance( \EE_Registry $registry = null ) { |
|
| 135 | + public static function instance(\EE_Registry $registry = null) { |
|
| 136 | 136 | // check if class object is instantiated, and instantiated properly |
| 137 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
| 138 | - self::$_instance = new self( $registry ); |
|
| 137 | + if ( ! self::$_instance instanceof EE_Config) { |
|
| 138 | + self::$_instance = new self($registry); |
|
| 139 | 139 | } |
| 140 | 140 | return self::$_instance; |
| 141 | 141 | } |
@@ -153,22 +153,22 @@ discard block |
||
| 153 | 153 | * @param \EE_Registry $registry |
| 154 | 154 | * @return \EE_Config |
| 155 | 155 | */ |
| 156 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE, \EE_Registry $registry = null ){ |
|
| 157 | - if ( $hard_reset ) { |
|
| 156 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE, \EE_Registry $registry = null) { |
|
| 157 | + if ($hard_reset) { |
|
| 158 | 158 | self::$_instance->_config_option_names = array(); |
| 159 | 159 | self::$_instance->_initialize_config(); |
| 160 | 160 | self::$_instance->update_espresso_config(); |
| 161 | 161 | } |
| 162 | - if( self::$_instance instanceof EE_Config ){ |
|
| 162 | + if (self::$_instance instanceof EE_Config) { |
|
| 163 | 163 | self::$_instance->shutdown(); |
| 164 | 164 | } |
| 165 | 165 | self::$_instance = null; |
| 166 | 166 | //we don't need to reset the static properties imo because those should |
| 167 | 167 | //only change when a module is added or removed. Currently we don't |
| 168 | 168 | //support removing a module during a request when it previously existed |
| 169 | - if( $reinstantiate ){ |
|
| 170 | - return self::instance( $registry ); |
|
| 171 | - }else{ |
|
| 169 | + if ($reinstantiate) { |
|
| 170 | + return self::instance($registry); |
|
| 171 | + } else { |
|
| 172 | 172 | return NULL; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param \EE_Registry $registry |
| 183 | 183 | * @throws \EE_Error |
| 184 | 184 | */ |
| 185 | - private function __construct( \EE_Registry $registry ) { |
|
| 185 | + private function __construct(\EE_Registry $registry) { |
|
| 186 | 186 | // if ( ! did_action( 'AHEE__EE_System__load_core_configuration__begin' ) ) { |
| 187 | 187 | // throw new EE_Error( |
| 188 | 188 | // __( |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | // ) |
| 192 | 192 | // ); |
| 193 | 193 | // } |
| 194 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
| 194 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
| 195 | 195 | $this->registry = $registry; |
| 196 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
| 196 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
| 197 | 197 | // setup empty config classes |
| 198 | 198 | $this->_initialize_config(); |
| 199 | 199 | // load existing EE site settings |
@@ -201,15 +201,15 @@ discard block |
||
| 201 | 201 | // confirm everything loaded correctly and set filtered defaults if not |
| 202 | 202 | $this->_verify_config(); |
| 203 | 203 | // register shortcodes and modules |
| 204 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
| 204 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
| 205 | 205 | // initialize shortcodes and modules |
| 206 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
| 206 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
| 207 | 207 | // register widgets |
| 208 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
| 208 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
| 209 | 209 | // shutdown |
| 210 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
| 210 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
| 211 | 211 | // construct__end hook |
| 212 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
| 212 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
| 213 | 213 | // hardcoded hack |
| 214 | 214 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
| 215 | 215 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @return string current theme set. |
| 223 | 223 | */ |
| 224 | 224 | public static function get_current_theme() { |
| 225 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
| 225 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | |
@@ -256,30 +256,30 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | private function _load_core_config() { |
| 258 | 258 | // load_core_config__start hook |
| 259 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
| 259 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
| 260 | 260 | $espresso_config = $this->get_espresso_config(); |
| 261 | - foreach ( $espresso_config as $config => $settings ) { |
|
| 262 | - if ( $config === 'registry' ) { |
|
| 261 | + foreach ($espresso_config as $config => $settings) { |
|
| 262 | + if ($config === 'registry') { |
|
| 263 | 263 | continue; |
| 264 | 264 | } |
| 265 | 265 | // load_core_config__start hook |
| 266 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
| 267 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
| 268 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
| 266 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
| 267 | + if (is_object($settings) && property_exists($this, $config)) { |
|
| 268 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
| 269 | 269 | //call configs populate method to ensure any defaults are set for empty values. |
| 270 | - if ( method_exists( $settings, 'populate' ) ) { |
|
| 270 | + if (method_exists($settings, 'populate')) { |
|
| 271 | 271 | $this->{$config}->populate(); |
| 272 | 272 | } |
| 273 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
| 273 | + if (method_exists($settings, 'do_hooks')) { |
|
| 274 | 274 | $this->{$config}->do_hooks(); |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
| 278 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
| 279 | 279 | $this->update_espresso_config(); |
| 280 | 280 | } |
| 281 | 281 | // load_core_config__end hook |
| 282 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
| 282 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | |
@@ -293,40 +293,40 @@ discard block |
||
| 293 | 293 | protected function _verify_config() { |
| 294 | 294 | |
| 295 | 295 | $this->core = $this->core instanceof EE_Core_Config |
| 296 | - ? $this->core : new EE_Core_Config(); |
|
| 297 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
| 296 | + ? $this->core : new EE_Core_Config(); |
|
| 297 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
| 298 | 298 | |
| 299 | 299 | $this->organization = $this->organization instanceof EE_Organization_Config |
| 300 | - ? $this->organization : new EE_Organization_Config(); |
|
| 301 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
| 300 | + ? $this->organization : new EE_Organization_Config(); |
|
| 301 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
| 302 | 302 | |
| 303 | 303 | $this->currency = $this->currency instanceof EE_Currency_Config |
| 304 | 304 | ? $this->currency : new EE_Currency_Config(); |
| 305 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
| 305 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
| 306 | 306 | |
| 307 | 307 | $this->registration = $this->registration instanceof EE_Registration_Config |
| 308 | 308 | ? $this->registration : new EE_Registration_Config(); |
| 309 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
| 309 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
| 310 | 310 | |
| 311 | 311 | $this->admin = $this->admin instanceof EE_Admin_Config |
| 312 | 312 | ? $this->admin : new EE_Admin_Config(); |
| 313 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
| 313 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
| 314 | 314 | |
| 315 | 315 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
| 316 | 316 | ? $this->template_settings : new EE_Template_Config(); |
| 317 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
| 317 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
| 318 | 318 | |
| 319 | 319 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
| 320 | 320 | ? $this->map_settings : new EE_Map_Config(); |
| 321 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
| 321 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
| 322 | 322 | |
| 323 | 323 | $this->environment = $this->environment instanceof EE_Environment_Config |
| 324 | 324 | ? $this->environment : new EE_Environment_Config(); |
| 325 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
| 325 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
| 326 | 326 | |
| 327 | 327 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
| 328 | 328 | ? $this->gateway : new EE_Gateway_Config(); |
| 329 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
| 329 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
| 330 | 330 | |
| 331 | 331 | } |
| 332 | 332 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | public function get_espresso_config() { |
| 342 | 342 | // grab espresso configuration |
| 343 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
| 343 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | |
@@ -353,12 +353,12 @@ discard block |
||
| 353 | 353 | * @param $old_value |
| 354 | 354 | * @param $value |
| 355 | 355 | */ |
| 356 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
| 356 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
| 357 | 357 | // make sure we're checking the ee config |
| 358 | - if ( $option == 'ee_config' ) { |
|
| 358 | + if ($option == 'ee_config') { |
|
| 359 | 359 | // run a loose comparison of the old value against the new value for type and properties, |
| 360 | 360 | // but NOT exact instance like WP update_option does |
| 361 | - if ( $value != $old_value ) { |
|
| 361 | + if ($value != $old_value) { |
|
| 362 | 362 | // if they are NOT the same, then remove the hook, |
| 363 | 363 | // which means the subsequent update results will be based solely on the update query results |
| 364 | 364 | // the reason we do this is because, as stated above, |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | // the string it sees in the db looks the same as the new one it has been passed!!! |
| 374 | 374 | // This results in the query returning an "affected rows" value of ZERO, |
| 375 | 375 | // which gets returned immediately by WP update_option and looks like an error. |
| 376 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
| 376 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | } |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | */ |
| 389 | 389 | protected function _reset_espresso_addon_config() { |
| 390 | 390 | $this->_config_option_names = array(); |
| 391 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
| 392 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
| 393 | - $config_class = get_class( $addon_config_obj ); |
|
| 394 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
| 395 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
| 391 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
| 392 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
| 393 | + $config_class = get_class($addon_config_obj); |
|
| 394 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
| 395 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
| 396 | 396 | } |
| 397 | 397 | $this->addons->{$addon_name} = NULL; |
| 398 | 398 | } |
@@ -408,21 +408,21 @@ discard block |
||
| 408 | 408 | * @param bool $add_error |
| 409 | 409 | * @return bool |
| 410 | 410 | */ |
| 411 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
| 411 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
| 412 | 412 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
| 413 | 413 | //$clone = clone( self::$_instance ); |
| 414 | 414 | //self::$_instance = NULL; |
| 415 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
| 415 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
| 416 | 416 | $this->_reset_espresso_addon_config(); |
| 417 | 417 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
| 418 | 418 | // but BEFORE the actual update occurs |
| 419 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
| 419 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
| 420 | 420 | // we don't want to save the registry property with the rest of the config, |
| 421 | 421 | // so save it to a local variable, then remove it |
| 422 | 422 | $registry = $this->registry; |
| 423 | 423 | $this->registry = null; |
| 424 | 424 | // now update "ee_config" |
| 425 | - $saved = update_option( 'ee_config', $this ); |
|
| 425 | + $saved = update_option('ee_config', $this); |
|
| 426 | 426 | // and restore the registry |
| 427 | 427 | $this->registry = $registry; |
| 428 | 428 | // Now if the update didn't save... check if the hook we just added still exists; |
@@ -435,25 +435,25 @@ discard block |
||
| 435 | 435 | // but just means no update occurred, so don't display an error to the user. |
| 436 | 436 | // BUT... if update_option returns FALSE, AND the hook is missing, |
| 437 | 437 | // then it means that something truly went wrong |
| 438 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
| 438 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
| 439 | 439 | // remove our action since we don't want it in the system anymore |
| 440 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
| 441 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
| 440 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
| 441 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
| 442 | 442 | //self::$_instance = $clone; |
| 443 | 443 | //unset( $clone ); |
| 444 | 444 | // if config remains the same or was updated successfully |
| 445 | - if ( $saved ) { |
|
| 446 | - if ( $add_success ) { |
|
| 445 | + if ($saved) { |
|
| 446 | + if ($add_success) { |
|
| 447 | 447 | EE_Error::add_success( |
| 448 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
| 448 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
| 449 | 449 | __FILE__, __FUNCTION__, __LINE__ |
| 450 | 450 | ); |
| 451 | 451 | } |
| 452 | 452 | return TRUE; |
| 453 | 453 | } else { |
| 454 | - if ( $add_error ) { |
|
| 454 | + if ($add_error) { |
|
| 455 | 455 | EE_Error::add_error( |
| 456 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
| 456 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
| 457 | 457 | __FILE__, __FUNCTION__, __LINE__ |
| 458 | 458 | ); |
| 459 | 459 | } |
@@ -479,20 +479,20 @@ discard block |
||
| 479 | 479 | $name = '', |
| 480 | 480 | $config_class = '', |
| 481 | 481 | $config_obj = NULL, |
| 482 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
| 482 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
| 483 | 483 | $display_errors = TRUE |
| 484 | 484 | ) { |
| 485 | 485 | try { |
| 486 | - foreach ( $tests_to_run as $test ) { |
|
| 487 | - switch ( $test ) { |
|
| 486 | + foreach ($tests_to_run as $test) { |
|
| 487 | + switch ($test) { |
|
| 488 | 488 | |
| 489 | 489 | // TEST #1 : check that section was set |
| 490 | 490 | case 1 : |
| 491 | - if ( empty( $section ) ) { |
|
| 492 | - if ( $display_errors ) { |
|
| 491 | + if (empty($section)) { |
|
| 492 | + if ($display_errors) { |
|
| 493 | 493 | throw new EE_Error( |
| 494 | 494 | sprintf( |
| 495 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
| 495 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
| 496 | 496 | $config_class |
| 497 | 497 | ) |
| 498 | 498 | ); |
@@ -503,11 +503,11 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | // TEST #2 : check that settings section exists |
| 505 | 505 | case 2 : |
| 506 | - if ( ! isset( $this->{$section} ) ) { |
|
| 507 | - if ( $display_errors ) { |
|
| 506 | + if ( ! isset($this->{$section} )) { |
|
| 507 | + if ($display_errors) { |
|
| 508 | 508 | throw new EE_Error( |
| 509 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
| 510 | - $section ) |
|
| 509 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
| 510 | + $section) |
|
| 511 | 511 | ); |
| 512 | 512 | } |
| 513 | 513 | return false; |
@@ -517,12 +517,12 @@ discard block |
||
| 517 | 517 | // TEST #3 : check that section is the proper format |
| 518 | 518 | case 3 : |
| 519 | 519 | if ( |
| 520 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
| 520 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
| 521 | 521 | ) { |
| 522 | - if ( $display_errors ) { |
|
| 522 | + if ($display_errors) { |
|
| 523 | 523 | throw new EE_Error( |
| 524 | 524 | sprintf( |
| 525 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
| 525 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
| 526 | 526 | $section |
| 527 | 527 | ) |
| 528 | 528 | ); |
@@ -533,10 +533,10 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | // TEST #4 : check that config section name has been set |
| 535 | 535 | case 4 : |
| 536 | - if ( empty( $name ) ) { |
|
| 537 | - if ( $display_errors ) { |
|
| 536 | + if (empty($name)) { |
|
| 537 | + if ($display_errors) { |
|
| 538 | 538 | throw new EE_Error( |
| 539 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
| 539 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
| 540 | 540 | ); |
| 541 | 541 | } |
| 542 | 542 | return false; |
@@ -545,10 +545,10 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | // TEST #5 : check that a config class name has been set |
| 547 | 547 | case 5 : |
| 548 | - if ( empty( $config_class ) ) { |
|
| 549 | - if ( $display_errors ) { |
|
| 548 | + if (empty($config_class)) { |
|
| 549 | + if ($display_errors) { |
|
| 550 | 550 | throw new EE_Error( |
| 551 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
| 551 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
| 552 | 552 | ); |
| 553 | 553 | } |
| 554 | 554 | return false; |
@@ -557,11 +557,11 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | // TEST #6 : verify config class is accessible |
| 559 | 559 | case 6 : |
| 560 | - if ( ! class_exists( $config_class ) ) { |
|
| 561 | - if ( $display_errors ) { |
|
| 560 | + if ( ! class_exists($config_class)) { |
|
| 561 | + if ($display_errors) { |
|
| 562 | 562 | throw new EE_Error( |
| 563 | 563 | sprintf( |
| 564 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
| 564 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
| 565 | 565 | $config_class |
| 566 | 566 | ) |
| 567 | 567 | ); |
@@ -572,11 +572,11 @@ discard block |
||
| 572 | 572 | |
| 573 | 573 | // TEST #7 : check that config has even been set |
| 574 | 574 | case 7 : |
| 575 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
| 576 | - if ( $display_errors ) { |
|
| 575 | + if ( ! isset($this->{$section}->{$name} )) { |
|
| 576 | + if ($display_errors) { |
|
| 577 | 577 | throw new EE_Error( |
| 578 | 578 | sprintf( |
| 579 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
| 579 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
| 580 | 580 | $section, |
| 581 | 581 | $name |
| 582 | 582 | ) |
@@ -585,17 +585,17 @@ discard block |
||
| 585 | 585 | return false; |
| 586 | 586 | } else { |
| 587 | 587 | // and make sure it's not serialized |
| 588 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
| 588 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
| 589 | 589 | } |
| 590 | 590 | break; |
| 591 | 591 | |
| 592 | 592 | // TEST #8 : check that config is the requested type |
| 593 | 593 | case 8 : |
| 594 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
| 595 | - if ( $display_errors ) { |
|
| 594 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
| 595 | + if ($display_errors) { |
|
| 596 | 596 | throw new EE_Error( |
| 597 | 597 | sprintf( |
| 598 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
| 598 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
| 599 | 599 | $section, |
| 600 | 600 | $name, |
| 601 | 601 | $config_class |
@@ -608,12 +608,12 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | // TEST #9 : verify config object |
| 610 | 610 | case 9 : |
| 611 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
| 612 | - if ( $display_errors ) { |
|
| 611 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
| 612 | + if ($display_errors) { |
|
| 613 | 613 | throw new EE_Error( |
| 614 | 614 | sprintf( |
| 615 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
| 616 | - print_r( $config_obj, true ) |
|
| 615 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
| 616 | + print_r($config_obj, true) |
|
| 617 | 617 | ) |
| 618 | 618 | ); |
| 619 | 619 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | - } catch( EE_Error $e ) { |
|
| 627 | + } catch (EE_Error $e) { |
|
| 628 | 628 | $e->get_error(); |
| 629 | 629 | } |
| 630 | 630 | // you have successfully run the gauntlet |
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | * @param string $name |
| 642 | 642 | * @return string |
| 643 | 643 | */ |
| 644 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
| 645 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
| 644 | + private function _generate_config_option_name($section = '', $name = '') { |
|
| 645 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | |
@@ -656,10 +656,10 @@ discard block |
||
| 656 | 656 | * @param string $name |
| 657 | 657 | * @return string |
| 658 | 658 | */ |
| 659 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
| 660 | - return ! empty( $config_class ) |
|
| 659 | + private function _set_config_class($config_class = '', $name = '') { |
|
| 660 | + return ! empty($config_class) |
|
| 661 | 661 | ? $config_class |
| 662 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
| 662 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | |
@@ -673,34 +673,34 @@ discard block |
||
| 673 | 673 | * @param EE_Config_Base $config_obj |
| 674 | 674 | * @return EE_Config_Base |
| 675 | 675 | */ |
| 676 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
| 676 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
| 677 | 677 | // ensure config class is set to something |
| 678 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 678 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 679 | 679 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
| 680 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
| 680 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
| 681 | 681 | return null; |
| 682 | 682 | } |
| 683 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 683 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 684 | 684 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
| 685 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
| 686 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
| 685 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
| 686 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
| 687 | 687 | } |
| 688 | 688 | // verify the incoming config object but suppress errors |
| 689 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
| 689 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
| 690 | 690 | $config_obj = new $config_class(); |
| 691 | 691 | } |
| 692 | - if ( get_option( $config_option_name ) ) { |
|
| 693 | - update_option( $config_option_name, $config_obj ); |
|
| 692 | + if (get_option($config_option_name)) { |
|
| 693 | + update_option($config_option_name, $config_obj); |
|
| 694 | 694 | $this->{$section}->{$name} = $config_obj; |
| 695 | 695 | return $this->{$section}->{$name}; |
| 696 | 696 | } else { |
| 697 | 697 | // create a wp-option for this config |
| 698 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
| 699 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
| 698 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
| 699 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
| 700 | 700 | return $this->{$section}->{$name}; |
| 701 | 701 | } else { |
| 702 | 702 | EE_Error::add_error( |
| 703 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
| 703 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
| 704 | 704 | __FILE__, __FUNCTION__, __LINE__ |
| 705 | 705 | ); |
| 706 | 706 | return null; |
@@ -721,37 +721,37 @@ discard block |
||
| 721 | 721 | * @param bool $throw_errors |
| 722 | 722 | * @return bool |
| 723 | 723 | */ |
| 724 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
| 725 | - $config_obj = maybe_unserialize( $config_obj ); |
|
| 724 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
| 725 | + $config_obj = maybe_unserialize($config_obj); |
|
| 726 | 726 | // get class name of the incoming object |
| 727 | - $config_class = get_class( $config_obj ); |
|
| 727 | + $config_class = get_class($config_obj); |
|
| 728 | 728 | // run tests 1-5 and 9 to verify config |
| 729 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
| 729 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
| 730 | 730 | return false; |
| 731 | 731 | } |
| 732 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 732 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 733 | 733 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
| 734 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
| 734 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
| 735 | 735 | // save new config to db |
| 736 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
| 736 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
| 737 | 737 | } else { |
| 738 | 738 | // first check if the record already exists |
| 739 | - $existing_config = get_option( $config_option_name ); |
|
| 740 | - $config_obj = serialize( $config_obj ); |
|
| 739 | + $existing_config = get_option($config_option_name); |
|
| 740 | + $config_obj = serialize($config_obj); |
|
| 741 | 741 | // just return if db record is already up to date |
| 742 | - if ( $existing_config == $config_obj ) { |
|
| 742 | + if ($existing_config == $config_obj) { |
|
| 743 | 743 | $this->{$section}->{$name} = $config_obj; |
| 744 | 744 | return true; |
| 745 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
| 745 | + } else if (update_option($config_option_name, $config_obj)) { |
|
| 746 | 746 | // update wp-option for this config class |
| 747 | 747 | $this->{$section}->{$name} = $config_obj; |
| 748 | 748 | return true; |
| 749 | - } elseif ( $throw_errors ) { |
|
| 749 | + } elseif ($throw_errors) { |
|
| 750 | 750 | EE_Error::add_error( |
| 751 | 751 | sprintf( |
| 752 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
| 752 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
| 753 | 753 | $config_class, |
| 754 | - 'EE_Config->' . $section . '->' . $name |
|
| 754 | + 'EE_Config->'.$section.'->'.$name |
|
| 755 | 755 | ), |
| 756 | 756 | __FILE__, __FUNCTION__, __LINE__ |
| 757 | 757 | ); |
@@ -771,34 +771,34 @@ discard block |
||
| 771 | 771 | * @param string $config_class |
| 772 | 772 | * @return mixed EE_Config_Base | NULL |
| 773 | 773 | */ |
| 774 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
| 774 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
| 775 | 775 | // ensure config class is set to something |
| 776 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 776 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 777 | 777 | // run tests 1-4, 6 and 7 to verify that all params have been set |
| 778 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
| 778 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
| 779 | 779 | return NULL; |
| 780 | 780 | } |
| 781 | 781 | // now test if the requested config object exists, but suppress errors |
| 782 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
| 782 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
| 783 | 783 | // config already exists, so pass it back |
| 784 | 784 | return $this->{$section}->{$name}; |
| 785 | 785 | } |
| 786 | 786 | // load config option from db if it exists |
| 787 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
| 787 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
| 788 | 788 | // verify the newly retrieved config object, but suppress errors |
| 789 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
| 789 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
| 790 | 790 | // config is good, so set it and pass it back |
| 791 | 791 | $this->{$section}->{$name} = $config_obj; |
| 792 | 792 | return $this->{$section}->{$name}; |
| 793 | 793 | } |
| 794 | 794 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
| 795 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
| 795 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
| 796 | 796 | // verify the newly created config object |
| 797 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
| 797 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
| 798 | 798 | return $this->{$section}->{$name}; |
| 799 | 799 | } else { |
| 800 | 800 | EE_Error::add_error( |
| 801 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
| 801 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
| 802 | 802 | __FILE__, __FUNCTION__, __LINE__ |
| 803 | 803 | ); |
| 804 | 804 | } |
@@ -813,9 +813,9 @@ discard block |
||
| 813 | 813 | * @param string $config_option_name |
| 814 | 814 | * @return mixed EE_Config_Base | FALSE |
| 815 | 815 | */ |
| 816 | - public function get_config_option( $config_option_name = '' ) { |
|
| 816 | + public function get_config_option($config_option_name = '') { |
|
| 817 | 817 | // retrieve the wp-option for this config class. |
| 818 | - return maybe_unserialize( get_option( $config_option_name )); |
|
| 818 | + return maybe_unserialize(get_option($config_option_name)); |
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | |
@@ -830,14 +830,14 @@ discard block |
||
| 830 | 830 | * @return string |
| 831 | 831 | */ |
| 832 | 832 | public static function get_page_for_posts() { |
| 833 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
| 834 | - if ( ! $page_for_posts ) { |
|
| 833 | + $page_for_posts = get_option('page_for_posts'); |
|
| 834 | + if ( ! $page_for_posts) { |
|
| 835 | 835 | return 'posts'; |
| 836 | 836 | } |
| 837 | 837 | /** @type WPDB $wpdb */ |
| 838 | 838 | global $wpdb; |
| 839 | 839 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
| 840 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
| 840 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | */ |
| 855 | 855 | public function register_shortcodes_and_modules() { |
| 856 | 856 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
| 857 | - $this->registry->shortcodes =$this->_register_shortcodes(); |
|
| 857 | + $this->registry->shortcodes = $this->_register_shortcodes(); |
|
| 858 | 858 | // allow modules to set hooks for the rest of the system |
| 859 | 859 | $this->registry->modules = $this->_register_modules(); |
| 860 | 860 | } |
@@ -886,21 +886,21 @@ discard block |
||
| 886 | 886 | public function widgets_init() { |
| 887 | 887 | //only init widgets on admin pages when not in complete maintenance, and |
| 888 | 888 | //on frontend when not in any maintenance mode |
| 889 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
| 889 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
| 890 | 890 | // grab list of installed widgets |
| 891 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
| 891 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
| 892 | 892 | // filter list of modules to register |
| 893 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
| 893 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
| 894 | 894 | |
| 895 | - if ( ! empty( $widgets_to_register ) ) { |
|
| 895 | + if ( ! empty($widgets_to_register)) { |
|
| 896 | 896 | // cycle thru widget folders |
| 897 | - foreach ( $widgets_to_register as $widget_path ) { |
|
| 897 | + foreach ($widgets_to_register as $widget_path) { |
|
| 898 | 898 | // add to list of installed widget modules |
| 899 | - EE_Config::register_ee_widget( $widget_path ); |
|
| 899 | + EE_Config::register_ee_widget($widget_path); |
|
| 900 | 900 | } |
| 901 | 901 | } |
| 902 | 902 | // filter list of installed modules |
| 903 | - $this->registry->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', $this->registry->widgets ); |
|
| 903 | + $this->registry->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', $this->registry->widgets); |
|
| 904 | 904 | } |
| 905 | 905 | } |
| 906 | 906 | |
@@ -913,54 +913,54 @@ discard block |
||
| 913 | 913 | * @param string $widget_path - full path up to and including widget folder |
| 914 | 914 | * @return void |
| 915 | 915 | */ |
| 916 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
| 917 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
| 916 | + public static function register_ee_widget($widget_path = NULL) { |
|
| 917 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
| 918 | 918 | $widget_ext = '.widget.php'; |
| 919 | 919 | // make all separators match |
| 920 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
| 920 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
| 921 | 921 | // does the file path INCLUDE the actual file name as part of the path ? |
| 922 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
| 922 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
| 923 | 923 | // grab and shortcode file name from directory name and break apart at dots |
| 924 | - $file_name = explode( '.', basename( $widget_path )); |
|
| 924 | + $file_name = explode('.', basename($widget_path)); |
|
| 925 | 925 | // take first segment from file name pieces and remove class prefix if it exists |
| 926 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
| 926 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
| 927 | 927 | // sanitize shortcode directory name |
| 928 | - $widget = sanitize_key( $widget ); |
|
| 928 | + $widget = sanitize_key($widget); |
|
| 929 | 929 | // now we need to rebuild the shortcode path |
| 930 | - $widget_path = explode( DS, $widget_path ); |
|
| 930 | + $widget_path = explode(DS, $widget_path); |
|
| 931 | 931 | // remove last segment |
| 932 | - array_pop( $widget_path ); |
|
| 932 | + array_pop($widget_path); |
|
| 933 | 933 | // glue it back together |
| 934 | - $widget_path = implode( DS, $widget_path ); |
|
| 934 | + $widget_path = implode(DS, $widget_path); |
|
| 935 | 935 | } else { |
| 936 | 936 | // grab and sanitize widget directory name |
| 937 | - $widget = sanitize_key( basename( $widget_path )); |
|
| 937 | + $widget = sanitize_key(basename($widget_path)); |
|
| 938 | 938 | } |
| 939 | 939 | // create classname from widget directory name |
| 940 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
| 940 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
| 941 | 941 | // add class prefix |
| 942 | - $widget_class = 'EEW_' . $widget; |
|
| 942 | + $widget_class = 'EEW_'.$widget; |
|
| 943 | 943 | // does the widget exist ? |
| 944 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
| 944 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
| 945 | 945 | $msg = sprintf( |
| 946 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
| 946 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
| 947 | 947 | $widget_class, |
| 948 | - $widget_path . DS . $widget_class . $widget_ext |
|
| 948 | + $widget_path.DS.$widget_class.$widget_ext |
|
| 949 | 949 | ); |
| 950 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 950 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 951 | 951 | return; |
| 952 | 952 | } |
| 953 | 953 | // load the widget class file |
| 954 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
| 954 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
| 955 | 955 | // verify that class exists |
| 956 | - if ( ! class_exists( $widget_class )) { |
|
| 957 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
| 958 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 956 | + if ( ! class_exists($widget_class)) { |
|
| 957 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
| 958 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 959 | 959 | return; |
| 960 | 960 | } |
| 961 | - register_widget( $widget_class ); |
|
| 961 | + register_widget($widget_class); |
|
| 962 | 962 | // add to array of registered widgets |
| 963 | - EE_Config::instance()->registry->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
| 963 | + EE_Config::instance()->registry->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
| 964 | 964 | } |
| 965 | 965 | |
| 966 | 966 | |
@@ -973,18 +973,18 @@ discard block |
||
| 973 | 973 | */ |
| 974 | 974 | private function _register_shortcodes() { |
| 975 | 975 | // grab list of installed shortcodes |
| 976 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
| 976 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
| 977 | 977 | // filter list of modules to register |
| 978 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
| 979 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
| 978 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
| 979 | + if ( ! empty($shortcodes_to_register)) { |
|
| 980 | 980 | // cycle thru shortcode folders |
| 981 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
| 981 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
| 982 | 982 | // add to list of installed shortcode modules |
| 983 | - $this->_register_shortcode( $shortcode_path ); |
|
| 983 | + $this->_register_shortcode($shortcode_path); |
|
| 984 | 984 | } |
| 985 | 985 | } |
| 986 | 986 | // filter list of installed modules |
| 987 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', $this->registry->shortcodes ); |
|
| 987 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', $this->registry->shortcodes); |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | |
@@ -996,8 +996,8 @@ discard block |
||
| 996 | 996 | * @param string $shortcode_path - full path up to and including shortcode folder |
| 997 | 997 | * @return bool |
| 998 | 998 | */ |
| 999 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
| 1000 | - EE_Config::instance()->_register_shortcode( $shortcode_path ); |
|
| 999 | + public static function register_shortcode($shortcode_path = NULL) { |
|
| 1000 | + EE_Config::instance()->_register_shortcode($shortcode_path); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | |
@@ -1009,56 +1009,56 @@ discard block |
||
| 1009 | 1009 | * @param string $shortcode_path - full path up to and including shortcode folder |
| 1010 | 1010 | * @return bool |
| 1011 | 1011 | */ |
| 1012 | - public function _register_shortcode( $shortcode_path = NULL ) { |
|
| 1013 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
| 1012 | + public function _register_shortcode($shortcode_path = NULL) { |
|
| 1013 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
| 1014 | 1014 | $shortcode_ext = '.shortcode.php'; |
| 1015 | 1015 | // make all separators match |
| 1016 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
| 1016 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
| 1017 | 1017 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1018 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
| 1018 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
| 1019 | 1019 | // grab shortcode file name from directory name and break apart at dots |
| 1020 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
| 1020 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
| 1021 | 1021 | // take first segment from file name pieces and remove class prefix if it exists |
| 1022 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
| 1022 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
| 1023 | 1023 | // sanitize shortcode directory name |
| 1024 | - $shortcode = sanitize_key( $shortcode ); |
|
| 1024 | + $shortcode = sanitize_key($shortcode); |
|
| 1025 | 1025 | // now we need to rebuild the shortcode path |
| 1026 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
| 1026 | + $shortcode_path = explode(DS, $shortcode_path); |
|
| 1027 | 1027 | // remove last segment |
| 1028 | - array_pop( $shortcode_path ); |
|
| 1028 | + array_pop($shortcode_path); |
|
| 1029 | 1029 | // glue it back together |
| 1030 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
| 1030 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
| 1031 | 1031 | } else { |
| 1032 | 1032 | // we need to generate the filename based off of the folder name |
| 1033 | 1033 | // grab and sanitize shortcode directory name |
| 1034 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
| 1035 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
| 1034 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
| 1035 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
| 1036 | 1036 | } |
| 1037 | 1037 | // create classname from shortcode directory or file name |
| 1038 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
| 1038 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
| 1039 | 1039 | // add class prefix |
| 1040 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1040 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1041 | 1041 | // does the shortcode exist ? |
| 1042 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
| 1042 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
| 1043 | 1043 | $msg = sprintf( |
| 1044 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
| 1044 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
| 1045 | 1045 | $shortcode_class, |
| 1046 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
| 1046 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
| 1047 | 1047 | ); |
| 1048 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1048 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1049 | 1049 | return FALSE; |
| 1050 | 1050 | } |
| 1051 | 1051 | // load the shortcode class file |
| 1052 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
| 1052 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
| 1053 | 1053 | // verify that class exists |
| 1054 | - if ( ! class_exists( $shortcode_class )) { |
|
| 1055 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
| 1056 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1054 | + if ( ! class_exists($shortcode_class)) { |
|
| 1055 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
| 1056 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1057 | 1057 | return FALSE; |
| 1058 | 1058 | } |
| 1059 | - $shortcode = strtoupper( $shortcode ); |
|
| 1059 | + $shortcode = strtoupper($shortcode); |
|
| 1060 | 1060 | // add to array of registered shortcodes |
| 1061 | - $this->registry->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
| 1061 | + $this->registry->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
| 1062 | 1062 | return TRUE; |
| 1063 | 1063 | } |
| 1064 | 1064 | |
@@ -1073,23 +1073,23 @@ discard block |
||
| 1073 | 1073 | */ |
| 1074 | 1074 | private function _register_modules() { |
| 1075 | 1075 | // grab list of installed modules |
| 1076 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
| 1076 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
| 1077 | 1077 | // filter list of modules to register |
| 1078 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
| 1078 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
| 1079 | 1079 | |
| 1080 | 1080 | |
| 1081 | - if ( ! empty( $modules_to_register ) ) { |
|
| 1081 | + if ( ! empty($modules_to_register)) { |
|
| 1082 | 1082 | // loop through folders |
| 1083 | - foreach ( $modules_to_register as $module_path ) { |
|
| 1083 | + foreach ($modules_to_register as $module_path) { |
|
| 1084 | 1084 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
| 1085 | - if ( $module_path !== EE_MODULES . 'zzz-copy-this-module-template' && $module_path !== EE_MODULES . 'gateways' ) { |
|
| 1085 | + if ($module_path !== EE_MODULES.'zzz-copy-this-module-template' && $module_path !== EE_MODULES.'gateways') { |
|
| 1086 | 1086 | // add to list of installed modules |
| 1087 | - $this->_register_module( $module_path ); |
|
| 1087 | + $this->_register_module($module_path); |
|
| 1088 | 1088 | } |
| 1089 | 1089 | } |
| 1090 | 1090 | } |
| 1091 | 1091 | // filter list of installed modules |
| 1092 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', $this->registry->modules ); |
|
| 1092 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', $this->registry->modules); |
|
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | |
@@ -1102,8 +1102,8 @@ discard block |
||
| 1102 | 1102 | * @param string $module_path - full path up to and including module folder |
| 1103 | 1103 | * @return bool |
| 1104 | 1104 | */ |
| 1105 | - public static function register_module( $module_path = NULL ) { |
|
| 1106 | - EE_Config::instance()->_register_module( $module_path ); |
|
| 1105 | + public static function register_module($module_path = NULL) { |
|
| 1106 | + EE_Config::instance()->_register_module($module_path); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | |
@@ -1116,54 +1116,54 @@ discard block |
||
| 1116 | 1116 | * @param string $module_path - full path up to and including module folder |
| 1117 | 1117 | * @return bool |
| 1118 | 1118 | */ |
| 1119 | - public function _register_module( $module_path = NULL ) { |
|
| 1120 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
| 1119 | + public function _register_module($module_path = NULL) { |
|
| 1120 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
| 1121 | 1121 | $module_ext = '.module.php'; |
| 1122 | 1122 | // make all separators match |
| 1123 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
| 1123 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
| 1124 | 1124 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1125 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
| 1125 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
| 1126 | 1126 | // grab and shortcode file name from directory name and break apart at dots |
| 1127 | - $module_file = explode( '.', basename( $module_path )); |
|
| 1127 | + $module_file = explode('.', basename($module_path)); |
|
| 1128 | 1128 | // now we need to rebuild the shortcode path |
| 1129 | - $module_path = explode( DS, $module_path ); |
|
| 1129 | + $module_path = explode(DS, $module_path); |
|
| 1130 | 1130 | // remove last segment |
| 1131 | - array_pop( $module_path ); |
|
| 1131 | + array_pop($module_path); |
|
| 1132 | 1132 | // glue it back together |
| 1133 | - $module_path = implode( DS, $module_path ) . DS; |
|
| 1133 | + $module_path = implode(DS, $module_path).DS; |
|
| 1134 | 1134 | // take first segment from file name pieces and sanitize it |
| 1135 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
| 1135 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
| 1136 | 1136 | // ensure class prefix is added |
| 1137 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
| 1137 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
| 1138 | 1138 | } else { |
| 1139 | 1139 | // we need to generate the filename based off of the folder name |
| 1140 | 1140 | // grab and sanitize module name |
| 1141 | - $module = strtolower( basename( $module_path )); |
|
| 1142 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
| 1141 | + $module = strtolower(basename($module_path)); |
|
| 1142 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
| 1143 | 1143 | // like trailingslashit() |
| 1144 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
| 1144 | + $module_path = rtrim($module_path, DS).DS; |
|
| 1145 | 1145 | // create classname from module directory name |
| 1146 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
| 1146 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
| 1147 | 1147 | // add class prefix |
| 1148 | - $module_class = 'EED_' . $module; |
|
| 1148 | + $module_class = 'EED_'.$module; |
|
| 1149 | 1149 | } |
| 1150 | 1150 | // does the module exist ? |
| 1151 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
| 1152 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
| 1153 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1151 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
| 1152 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
| 1153 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1154 | 1154 | return FALSE; |
| 1155 | 1155 | } |
| 1156 | 1156 | // load the module class file |
| 1157 | - require_once( $module_path . $module_class . $module_ext ); |
|
| 1157 | + require_once($module_path.$module_class.$module_ext); |
|
| 1158 | 1158 | // verify that class exists |
| 1159 | - if ( ! class_exists( $module_class )) { |
|
| 1160 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
| 1161 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1159 | + if ( ! class_exists($module_class)) { |
|
| 1160 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
| 1161 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1162 | 1162 | return FALSE; |
| 1163 | 1163 | } |
| 1164 | 1164 | // add to array of registered modules |
| 1165 | - $this->registry->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
| 1166 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Config::instance()->registry->modules->{$module_class} ); |
|
| 1165 | + $this->registry->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
| 1166 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Config::instance()->registry->modules->{$module_class} ); |
|
| 1167 | 1167 | return TRUE; |
| 1168 | 1168 | } |
| 1169 | 1169 | |
@@ -1177,23 +1177,23 @@ discard block |
||
| 1177 | 1177 | */ |
| 1178 | 1178 | private function _initialize_shortcodes() { |
| 1179 | 1179 | // cycle thru shortcode folders |
| 1180 | - foreach ( $this->registry->shortcodes as $shortcode => $shortcode_path ) { |
|
| 1180 | + foreach ($this->registry->shortcodes as $shortcode => $shortcode_path) { |
|
| 1181 | 1181 | // add class prefix |
| 1182 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1182 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1183 | 1183 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1184 | 1184 | // which set hooks ? |
| 1185 | - if ( is_admin() ) { |
|
| 1185 | + if (is_admin()) { |
|
| 1186 | 1186 | // fire immediately |
| 1187 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
| 1187 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
| 1188 | 1188 | } else { |
| 1189 | 1189 | // delay until other systems are online |
| 1190 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
| 1190 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
| 1191 | 1191 | // convert classname to UPPERCASE and create WP shortcode. |
| 1192 | - $shortcode_tag = strtoupper( $shortcode ); |
|
| 1192 | + $shortcode_tag = strtoupper($shortcode); |
|
| 1193 | 1193 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
| 1194 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
| 1194 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
| 1195 | 1195 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
| 1196 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
| 1196 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | } |
| 1199 | 1199 | } |
@@ -1210,15 +1210,15 @@ discard block |
||
| 1210 | 1210 | */ |
| 1211 | 1211 | private function _initialize_modules() { |
| 1212 | 1212 | // cycle thru shortcode folders |
| 1213 | - foreach ( $this->registry->modules as $module_class => $module_path ) { |
|
| 1213 | + foreach ($this->registry->modules as $module_class => $module_path) { |
|
| 1214 | 1214 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1215 | 1215 | // which set hooks ? |
| 1216 | - if ( is_admin() ) { |
|
| 1216 | + if (is_admin()) { |
|
| 1217 | 1217 | // fire immediately |
| 1218 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
| 1218 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
| 1219 | 1219 | } else { |
| 1220 | 1220 | // delay until other systems are online |
| 1221 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
| 1221 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| 1224 | 1224 | } |
@@ -1236,26 +1236,26 @@ discard block |
||
| 1236 | 1236 | * @param string $key - url param key indicating a route is being called |
| 1237 | 1237 | * @return bool |
| 1238 | 1238 | */ |
| 1239 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
| 1240 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
| 1241 | - $module = str_replace( 'EED_', '', $module ); |
|
| 1242 | - $module_class = 'EED_' . $module; |
|
| 1243 | - if ( ! isset( EE_Config::instance()->registry->modules->{$module_class} )) { |
|
| 1244 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
| 1245 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1239 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
| 1240 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
| 1241 | + $module = str_replace('EED_', '', $module); |
|
| 1242 | + $module_class = 'EED_'.$module; |
|
| 1243 | + if ( ! isset(EE_Config::instance()->registry->modules->{$module_class} )) { |
|
| 1244 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
| 1245 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1246 | 1246 | return FALSE; |
| 1247 | 1247 | } |
| 1248 | - if ( empty( $route )) { |
|
| 1249 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
| 1250 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1248 | + if (empty($route)) { |
|
| 1249 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
| 1250 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1251 | 1251 | return FALSE; |
| 1252 | 1252 | } |
| 1253 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
| 1254 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
| 1255 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1253 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
| 1254 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
| 1255 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1256 | 1256 | return FALSE; |
| 1257 | 1257 | } |
| 1258 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
| 1258 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
| 1259 | 1259 | return TRUE; |
| 1260 | 1260 | } |
| 1261 | 1261 | |
@@ -1269,11 +1269,11 @@ discard block |
||
| 1269 | 1269 | * @param string $key - url param key indicating a route is being called |
| 1270 | 1270 | * @return string |
| 1271 | 1271 | */ |
| 1272 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
| 1273 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
| 1274 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
| 1275 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
| 1276 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
| 1272 | + public static function get_route($route = NULL, $key = 'ee') { |
|
| 1273 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
| 1274 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
| 1275 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
| 1276 | + return EE_Config::$_module_route_map[$key][$route]; |
|
| 1277 | 1277 | } |
| 1278 | 1278 | return NULL; |
| 1279 | 1279 | } |
@@ -1302,35 +1302,35 @@ discard block |
||
| 1302 | 1302 | * @param string $key - url param key indicating a route is being called |
| 1303 | 1303 | * @return bool |
| 1304 | 1304 | */ |
| 1305 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
| 1306 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
| 1307 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
| 1308 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
| 1309 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1305 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
| 1306 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
| 1307 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1308 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
| 1309 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1310 | 1310 | return FALSE; |
| 1311 | 1311 | } |
| 1312 | - if ( empty( $forward )) { |
|
| 1313 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
| 1314 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1312 | + if (empty($forward)) { |
|
| 1313 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
| 1314 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1315 | 1315 | return FALSE; |
| 1316 | 1316 | } |
| 1317 | - if ( is_array( $forward )) { |
|
| 1318 | - if ( ! isset( $forward[1] )) { |
|
| 1319 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
| 1320 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1317 | + if (is_array($forward)) { |
|
| 1318 | + if ( ! isset($forward[1])) { |
|
| 1319 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
| 1320 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1321 | 1321 | return FALSE; |
| 1322 | 1322 | } |
| 1323 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
| 1324 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
| 1325 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1323 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
| 1324 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
| 1325 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1326 | 1326 | return FALSE; |
| 1327 | 1327 | } |
| 1328 | - } else if ( ! function_exists( $forward )) { |
|
| 1329 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
| 1330 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1328 | + } else if ( ! function_exists($forward)) { |
|
| 1329 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
| 1330 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1331 | 1331 | return FALSE; |
| 1332 | 1332 | } |
| 1333 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
| 1333 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
| 1334 | 1334 | return TRUE; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
@@ -1345,10 +1345,10 @@ discard block |
||
| 1345 | 1345 | * @param string $key - url param key indicating a route is being called |
| 1346 | 1346 | * @return string |
| 1347 | 1347 | */ |
| 1348 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
| 1349 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
| 1350 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
| 1351 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
| 1348 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
| 1349 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
| 1350 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
| 1351 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
| 1352 | 1352 | } |
| 1353 | 1353 | return NULL; |
| 1354 | 1354 | } |
@@ -1365,19 +1365,19 @@ discard block |
||
| 1365 | 1365 | * @param string $key - url param key indicating a route is being called |
| 1366 | 1366 | * @return bool |
| 1367 | 1367 | */ |
| 1368 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
| 1369 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
| 1370 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
| 1371 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
| 1372 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1368 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
| 1369 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
| 1370 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1371 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
| 1372 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1373 | 1373 | return FALSE; |
| 1374 | 1374 | } |
| 1375 | - if ( ! is_readable( $view )) { |
|
| 1376 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
| 1377 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1375 | + if ( ! is_readable($view)) { |
|
| 1376 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
| 1377 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1378 | 1378 | return FALSE; |
| 1379 | 1379 | } |
| 1380 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
| 1380 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
| 1381 | 1381 | return TRUE; |
| 1382 | 1382 | } |
| 1383 | 1383 | |
@@ -1394,10 +1394,10 @@ discard block |
||
| 1394 | 1394 | * @param string $key - url param key indicating a route is being called |
| 1395 | 1395 | * @return string |
| 1396 | 1396 | */ |
| 1397 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
| 1398 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
| 1399 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
| 1400 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
| 1397 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
| 1398 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
| 1399 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
| 1400 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
| 1401 | 1401 | } |
| 1402 | 1402 | return NULL; |
| 1403 | 1403 | } |
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | |
| 1406 | 1406 | |
| 1407 | 1407 | public function shutdown() { |
| 1408 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
| 1408 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | 1411 | |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | * magic functions in use, except we'll allow them to magically set and get stuff... |
| 1422 | 1422 | * basically, they should just be well-defined stdClasses |
| 1423 | 1423 | */ |
| 1424 | -class EE_Config_Base{ |
|
| 1424 | +class EE_Config_Base { |
|
| 1425 | 1425 | |
| 1426 | 1426 | /** |
| 1427 | 1427 | * Utility function for escaping the value of a property and returning. |
@@ -1430,13 +1430,13 @@ discard block |
||
| 1430 | 1430 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
| 1431 | 1431 | * @throws \EE_Error |
| 1432 | 1432 | */ |
| 1433 | - public function get_pretty( $property ) { |
|
| 1434 | - if ( ! property_exists( $this, $property ) ) { |
|
| 1435 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
| 1433 | + public function get_pretty($property) { |
|
| 1434 | + if ( ! property_exists($this, $property)) { |
|
| 1435 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | //just handling escaping of strings for now. |
| 1438 | - if ( is_string( $this->{$property} ) ) { |
|
| 1439 | - return stripslashes( $this->{$property} ); |
|
| 1438 | + if (is_string($this->{$property} )) { |
|
| 1439 | + return stripslashes($this->{$property} ); |
|
| 1440 | 1440 | } |
| 1441 | 1441 | return $this->{$property}; |
| 1442 | 1442 | } |
@@ -1445,19 +1445,19 @@ discard block |
||
| 1445 | 1445 | |
| 1446 | 1446 | public function populate() { |
| 1447 | 1447 | //grab defaults via a new instance of this class. |
| 1448 | - $class_name = get_class( $this ); |
|
| 1448 | + $class_name = get_class($this); |
|
| 1449 | 1449 | $defaults = new $class_name; |
| 1450 | 1450 | |
| 1451 | 1451 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
| 1452 | 1452 | //default from our $defaults object. |
| 1453 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
| 1454 | - if ( is_null( $this->{$property} ) ) { |
|
| 1453 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
| 1454 | + if (is_null($this->{$property} )) { |
|
| 1455 | 1455 | $this->{$property} = $value; |
| 1456 | 1456 | } |
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | 1459 | //cleanup |
| 1460 | - unset( $defaults ); |
|
| 1460 | + unset($defaults); |
|
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | |
@@ -1549,12 +1549,12 @@ discard block |
||
| 1549 | 1549 | */ |
| 1550 | 1550 | public function __construct() { |
| 1551 | 1551 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
| 1552 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
| 1552 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
| 1553 | 1553 | // set default organization settings |
| 1554 | 1554 | $this->current_blog_id = get_current_blog_id(); |
| 1555 | 1555 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
| 1556 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
| 1557 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
| 1556 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
| 1557 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
| 1558 | 1558 | $this->post_shortcodes = array(); |
| 1559 | 1559 | $this->module_route_map = array(); |
| 1560 | 1560 | $this->module_forward_map = array(); |
@@ -1573,7 +1573,7 @@ discard block |
||
| 1573 | 1573 | $this->event_cpt_slug = __('events', 'event_espresso'); |
| 1574 | 1574 | |
| 1575 | 1575 | //ueip constant check |
| 1576 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
| 1576 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
| 1577 | 1577 | $this->ee_ueip_optin = FALSE; |
| 1578 | 1578 | $this->ee_ueip_has_notified = TRUE; |
| 1579 | 1579 | } |
@@ -1613,8 +1613,8 @@ discard block |
||
| 1613 | 1613 | * @return string |
| 1614 | 1614 | */ |
| 1615 | 1615 | public function reg_page_url() { |
| 1616 | - if ( ! $this->reg_page_url ) { |
|
| 1617 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
| 1616 | + if ( ! $this->reg_page_url) { |
|
| 1617 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
| 1618 | 1618 | } |
| 1619 | 1619 | return $this->reg_page_url; |
| 1620 | 1620 | } |
@@ -1627,12 +1627,12 @@ discard block |
||
| 1627 | 1627 | * @return string |
| 1628 | 1628 | */ |
| 1629 | 1629 | public function txn_page_url($query_args = array()) { |
| 1630 | - if ( ! $this->txn_page_url ) { |
|
| 1631 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
| 1630 | + if ( ! $this->txn_page_url) { |
|
| 1631 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
| 1632 | 1632 | } |
| 1633 | - if($query_args){ |
|
| 1634 | - return add_query_arg($query_args,$this->txn_page_url); |
|
| 1635 | - }else{ |
|
| 1633 | + if ($query_args) { |
|
| 1634 | + return add_query_arg($query_args, $this->txn_page_url); |
|
| 1635 | + } else { |
|
| 1636 | 1636 | return $this->txn_page_url; |
| 1637 | 1637 | } |
| 1638 | 1638 | } |
@@ -1644,12 +1644,12 @@ discard block |
||
| 1644 | 1644 | * @return string |
| 1645 | 1645 | */ |
| 1646 | 1646 | public function thank_you_page_url($query_args = array()) { |
| 1647 | - if ( ! $this->thank_you_page_url ) { |
|
| 1648 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
| 1647 | + if ( ! $this->thank_you_page_url) { |
|
| 1648 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
| 1649 | 1649 | } |
| 1650 | - if($query_args){ |
|
| 1651 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
| 1652 | - }else{ |
|
| 1650 | + if ($query_args) { |
|
| 1651 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
| 1652 | + } else { |
|
| 1653 | 1653 | return $this->thank_you_page_url; |
| 1654 | 1654 | } |
| 1655 | 1655 | } |
@@ -1660,8 +1660,8 @@ discard block |
||
| 1660 | 1660 | * @return string |
| 1661 | 1661 | */ |
| 1662 | 1662 | public function cancel_page_url() { |
| 1663 | - if ( ! $this->cancel_page_url ) { |
|
| 1664 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
| 1663 | + if ( ! $this->cancel_page_url) { |
|
| 1664 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
| 1665 | 1665 | } |
| 1666 | 1666 | return $this->cancel_page_url; |
| 1667 | 1667 | } |
@@ -1689,7 +1689,7 @@ discard block |
||
| 1689 | 1689 | //reset all url properties |
| 1690 | 1690 | $this->_reset_urls(); |
| 1691 | 1691 | //return what to save to db |
| 1692 | - return array_keys( get_object_vars( $this ) ); |
|
| 1692 | + return array_keys(get_object_vars($this)); |
|
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | 1695 | } |
@@ -1921,38 +1921,38 @@ discard block |
||
| 1921 | 1921 | * @param null $CNT_ISO |
| 1922 | 1922 | * @return \EE_Currency_Config |
| 1923 | 1923 | */ |
| 1924 | - public function __construct( $CNT_ISO = NULL ) { |
|
| 1924 | + public function __construct($CNT_ISO = NULL) { |
|
| 1925 | 1925 | |
| 1926 | 1926 | // get country code from organization settings or use default |
| 1927 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
| 1927 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
| 1928 | 1928 | // but override if requested |
| 1929 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
| 1929 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
| 1930 | 1930 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
| 1931 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
| 1931 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
| 1932 | 1932 | // retrieve the country settings from the db, just in case they have been customized |
| 1933 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
| 1934 | - if ( $country instanceof EE_Country ) { |
|
| 1935 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 1936 | - $this->name = $country->currency_name_single(); // Dollar |
|
| 1937 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
| 1938 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 1939 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 1940 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1941 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1942 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1933 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
| 1934 | + if ($country instanceof EE_Country) { |
|
| 1935 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 1936 | + $this->name = $country->currency_name_single(); // Dollar |
|
| 1937 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
| 1938 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 1939 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 1940 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1941 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1942 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1943 | 1943 | } |
| 1944 | 1944 | } |
| 1945 | 1945 | // fallback to hardcoded defaults, in case the above failed |
| 1946 | - if ( empty( $this->code )) { |
|
| 1946 | + if (empty($this->code)) { |
|
| 1947 | 1947 | // set default currency settings |
| 1948 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 1949 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
| 1950 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
| 1951 | - $this->sign = '$'; // currency sign: $ |
|
| 1952 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
| 1953 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1954 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1955 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1948 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 1949 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
| 1950 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
| 1951 | + $this->sign = '$'; // currency sign: $ |
|
| 1952 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
| 1953 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1954 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1955 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1956 | 1956 | } |
| 1957 | 1957 | } |
| 1958 | 1958 | } |
@@ -2101,7 +2101,7 @@ discard block |
||
| 2101 | 2101 | * @since 4.8.8.rc.019 |
| 2102 | 2102 | */ |
| 2103 | 2103 | public function do_hooks() { |
| 2104 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
| 2104 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
| 2105 | 2105 | } |
| 2106 | 2106 | |
| 2107 | 2107 | |
@@ -2109,7 +2109,7 @@ discard block |
||
| 2109 | 2109 | * @return void |
| 2110 | 2110 | */ |
| 2111 | 2111 | public function set_default_reg_status_on_EEM_Event() { |
| 2112 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
| 2112 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
| 2113 | 2113 | } |
| 2114 | 2114 | |
| 2115 | 2115 | |
@@ -2214,10 +2214,10 @@ discard block |
||
| 2214 | 2214 | * @param bool $reset |
| 2215 | 2215 | * @return string |
| 2216 | 2216 | */ |
| 2217 | - public function log_file_name( $reset = FALSE ) { |
|
| 2218 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
| 2219 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
| 2220 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
| 2217 | + public function log_file_name($reset = FALSE) { |
|
| 2218 | + if (empty($this->log_file_name) || $reset) { |
|
| 2219 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
| 2220 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
| 2221 | 2221 | } |
| 2222 | 2222 | return $this->log_file_name; |
| 2223 | 2223 | } |
@@ -2229,10 +2229,10 @@ discard block |
||
| 2229 | 2229 | * @param bool $reset |
| 2230 | 2230 | * @return string |
| 2231 | 2231 | */ |
| 2232 | - public function debug_file_name( $reset = FALSE ) { |
|
| 2233 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
| 2234 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
| 2235 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
| 2232 | + public function debug_file_name($reset = FALSE) { |
|
| 2233 | + if (empty($this->debug_file_name) || $reset) { |
|
| 2234 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
| 2235 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
| 2236 | 2236 | } |
| 2237 | 2237 | return $this->debug_file_name; |
| 2238 | 2238 | } |
@@ -2405,21 +2405,21 @@ discard block |
||
| 2405 | 2405 | // set default map settings |
| 2406 | 2406 | $this->use_google_maps = TRUE; |
| 2407 | 2407 | // for event details pages (reg page) |
| 2408 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2409 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2410 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2411 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 2412 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 2413 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2414 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2408 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2409 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2410 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2411 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 2412 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 2413 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2414 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2415 | 2415 | // for event list pages |
| 2416 | - $this->event_list_map_width = 300; // ee_map_width |
|
| 2417 | - $this->event_list_map_height = 185; // ee_map_height |
|
| 2418 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2419 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 2420 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 2421 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2422 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2416 | + $this->event_list_map_width = 300; // ee_map_width |
|
| 2417 | + $this->event_list_map_height = 185; // ee_map_height |
|
| 2418 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2419 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 2420 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 2421 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2422 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2423 | 2423 | } |
| 2424 | 2424 | |
| 2425 | 2425 | } |
@@ -2430,7 +2430,7 @@ discard block |
||
| 2430 | 2430 | /** |
| 2431 | 2431 | * stores Events_Archive settings |
| 2432 | 2432 | */ |
| 2433 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
| 2433 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
| 2434 | 2434 | |
| 2435 | 2435 | public $display_status_banner; |
| 2436 | 2436 | public $display_description; |
@@ -2449,7 +2449,7 @@ discard block |
||
| 2449 | 2449 | /** |
| 2450 | 2450 | * class constructor |
| 2451 | 2451 | */ |
| 2452 | - public function __construct(){ |
|
| 2452 | + public function __construct() { |
|
| 2453 | 2453 | $this->display_status_banner = 0; |
| 2454 | 2454 | $this->display_description = 1; |
| 2455 | 2455 | $this->display_ticket_selector = 0; |
@@ -2469,7 +2469,7 @@ discard block |
||
| 2469 | 2469 | /** |
| 2470 | 2470 | * Stores Event_Single_Config settings |
| 2471 | 2471 | */ |
| 2472 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
| 2472 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
| 2473 | 2473 | |
| 2474 | 2474 | public $display_status_banner_single; |
| 2475 | 2475 | public $display_venue; |
@@ -2498,7 +2498,7 @@ discard block |
||
| 2498 | 2498 | /** |
| 2499 | 2499 | * Stores Ticket_Selector_Config settings |
| 2500 | 2500 | */ |
| 2501 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
| 2501 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
| 2502 | 2502 | public $show_ticket_sale_columns; |
| 2503 | 2503 | public $show_ticket_details; |
| 2504 | 2504 | public $show_expired_tickets; |
@@ -2552,7 +2552,7 @@ discard block |
||
| 2552 | 2552 | * @return void |
| 2553 | 2553 | */ |
| 2554 | 2554 | protected function _set_php_values() { |
| 2555 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
| 2555 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
| 2556 | 2556 | $this->php->version = phpversion(); |
| 2557 | 2557 | } |
| 2558 | 2558 | |
@@ -2571,9 +2571,9 @@ discard block |
||
| 2571 | 2571 | * @type string $msg Any message to be displayed. |
| 2572 | 2572 | * } |
| 2573 | 2573 | */ |
| 2574 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
| 2575 | - if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
| 2576 | - return sprintf( __('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
| 2574 | + public function max_input_vars_limit_check($input_count = 0) { |
|
| 2575 | + if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
| 2576 | + return sprintf(__('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
| 2577 | 2577 | } else { |
| 2578 | 2578 | return ''; |
| 2579 | 2579 | } |
@@ -2608,7 +2608,7 @@ discard block |
||
| 2608 | 2608 | * stores payment gateway info |
| 2609 | 2609 | * @deprecated |
| 2610 | 2610 | */ |
| 2611 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
| 2611 | +class EE_Gateway_Config extends EE_Config_Base { |
|
| 2612 | 2612 | |
| 2613 | 2613 | /** |
| 2614 | 2614 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2630,9 +2630,9 @@ discard block |
||
| 2630 | 2630 | * class constructor |
| 2631 | 2631 | * @deprecated |
| 2632 | 2632 | */ |
| 2633 | - public function __construct(){ |
|
| 2633 | + public function __construct() { |
|
| 2634 | 2634 | $this->payment_settings = array(); |
| 2635 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
| 2635 | + $this->active_gateways = array('Invoice' => FALSE); |
|
| 2636 | 2636 | } |
| 2637 | 2637 | } |
| 2638 | 2638 | |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | public $map_settings = null; |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | - * |
|
| 93 | - * @deprecated |
|
| 94 | - * @var EE_Gateway_Config |
|
| 95 | - */ |
|
| 92 | + * |
|
| 93 | + * @deprecated |
|
| 94 | + * @var EE_Gateway_Config |
|
| 95 | + */ |
|
| 96 | 96 | public $gateway = null; |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | |
| 686 | 686 | /** |
| 687 | 687 | * update_config |
| 688 | - * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
| 688 | + * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
| 689 | 689 | * |
| 690 | 690 | * @access public |
| 691 | 691 | * @param string $section |
@@ -1712,51 +1712,51 @@ discard block |
||
| 1712 | 1712 | class EE_Organization_Config extends EE_Config_Base { |
| 1713 | 1713 | |
| 1714 | 1714 | /** |
| 1715 | - * @var string $name |
|
| 1716 | - * eg EE4.1 |
|
| 1717 | - */ |
|
| 1715 | + * @var string $name |
|
| 1716 | + * eg EE4.1 |
|
| 1717 | + */ |
|
| 1718 | 1718 | public $name; |
| 1719 | 1719 | |
| 1720 | 1720 | /** |
| 1721 | - * @var string $address_1 |
|
| 1722 | - * eg 123 Onna Road |
|
| 1723 | - */ |
|
| 1721 | + * @var string $address_1 |
|
| 1722 | + * eg 123 Onna Road |
|
| 1723 | + */ |
|
| 1724 | 1724 | public $address_1; |
| 1725 | 1725 | |
| 1726 | 1726 | /** |
| 1727 | - * @var string $address_2 |
|
| 1728 | - * eg PO Box 123 |
|
| 1729 | - */ |
|
| 1727 | + * @var string $address_2 |
|
| 1728 | + * eg PO Box 123 |
|
| 1729 | + */ |
|
| 1730 | 1730 | public $address_2; |
| 1731 | 1731 | |
| 1732 | 1732 | /** |
| 1733 | - * @var string $city |
|
| 1734 | - * eg Inna City |
|
| 1735 | - */ |
|
| 1733 | + * @var string $city |
|
| 1734 | + * eg Inna City |
|
| 1735 | + */ |
|
| 1736 | 1736 | public $city; |
| 1737 | 1737 | |
| 1738 | 1738 | /** |
| 1739 | - * @var int $STA_ID |
|
| 1740 | - * eg 4 |
|
| 1741 | - */ |
|
| 1739 | + * @var int $STA_ID |
|
| 1740 | + * eg 4 |
|
| 1741 | + */ |
|
| 1742 | 1742 | public $STA_ID; |
| 1743 | 1743 | |
| 1744 | 1744 | /** |
| 1745 | - * @var string $CNT_ISO |
|
| 1746 | - * eg US |
|
| 1747 | - */ |
|
| 1745 | + * @var string $CNT_ISO |
|
| 1746 | + * eg US |
|
| 1747 | + */ |
|
| 1748 | 1748 | public $CNT_ISO; |
| 1749 | 1749 | |
| 1750 | 1750 | /** |
| 1751 | - * @var string $zip |
|
| 1752 | - * eg 12345 or V1A 2B3 |
|
| 1753 | - */ |
|
| 1751 | + * @var string $zip |
|
| 1752 | + * eg 12345 or V1A 2B3 |
|
| 1753 | + */ |
|
| 1754 | 1754 | public $zip; |
| 1755 | 1755 | |
| 1756 | 1756 | /** |
| 1757 | - * @var string $email |
|
| 1758 | - * eg [email protected] |
|
| 1759 | - */ |
|
| 1757 | + * @var string $email |
|
| 1758 | + * eg [email protected] |
|
| 1759 | + */ |
|
| 1760 | 1760 | public $email; |
| 1761 | 1761 | |
| 1762 | 1762 | |
@@ -1775,9 +1775,9 @@ discard block |
||
| 1775 | 1775 | public $vat; |
| 1776 | 1776 | |
| 1777 | 1777 | /** |
| 1778 | - * @var string $logo_url |
|
| 1779 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
| 1780 | - */ |
|
| 1778 | + * @var string $logo_url |
|
| 1779 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
| 1780 | + */ |
|
| 1781 | 1781 | public $logo_url; |
| 1782 | 1782 | |
| 1783 | 1783 | |
@@ -1871,55 +1871,55 @@ discard block |
||
| 1871 | 1871 | class EE_Currency_Config extends EE_Config_Base { |
| 1872 | 1872 | |
| 1873 | 1873 | /** |
| 1874 | - * @var string $code |
|
| 1875 | - * eg 'US' |
|
| 1876 | - */ |
|
| 1874 | + * @var string $code |
|
| 1875 | + * eg 'US' |
|
| 1876 | + */ |
|
| 1877 | 1877 | public $code; |
| 1878 | 1878 | |
| 1879 | 1879 | /** |
| 1880 | - * @var string $name |
|
| 1881 | - * eg 'Dollar' |
|
| 1882 | - */ |
|
| 1880 | + * @var string $name |
|
| 1881 | + * eg 'Dollar' |
|
| 1882 | + */ |
|
| 1883 | 1883 | public $name; |
| 1884 | 1884 | |
| 1885 | 1885 | /** |
| 1886 | - * plural name |
|
| 1887 | - * @var string $plural |
|
| 1888 | - * eg 'Dollars' |
|
| 1889 | - */ |
|
| 1886 | + * plural name |
|
| 1887 | + * @var string $plural |
|
| 1888 | + * eg 'Dollars' |
|
| 1889 | + */ |
|
| 1890 | 1890 | public $plural; |
| 1891 | 1891 | |
| 1892 | 1892 | /** |
| 1893 | - * currency sign |
|
| 1894 | - * @var string $sign |
|
| 1895 | - * eg '$' |
|
| 1896 | - */ |
|
| 1893 | + * currency sign |
|
| 1894 | + * @var string $sign |
|
| 1895 | + * eg '$' |
|
| 1896 | + */ |
|
| 1897 | 1897 | public $sign; |
| 1898 | 1898 | |
| 1899 | 1899 | /** |
| 1900 | - * Whether the currency sign should come before the number or not |
|
| 1901 | - * @var boolean $sign_b4 |
|
| 1902 | - */ |
|
| 1900 | + * Whether the currency sign should come before the number or not |
|
| 1901 | + * @var boolean $sign_b4 |
|
| 1902 | + */ |
|
| 1903 | 1903 | public $sign_b4; |
| 1904 | 1904 | |
| 1905 | 1905 | /** |
| 1906 | - * How many digits should come after the decimal place |
|
| 1907 | - * @var int $dec_plc |
|
| 1908 | - */ |
|
| 1906 | + * How many digits should come after the decimal place |
|
| 1907 | + * @var int $dec_plc |
|
| 1908 | + */ |
|
| 1909 | 1909 | public $dec_plc; |
| 1910 | 1910 | |
| 1911 | 1911 | /** |
| 1912 | - * Symbol to use for decimal mark |
|
| 1913 | - * @var string $dec_mrk |
|
| 1914 | - * eg '.' |
|
| 1915 | - */ |
|
| 1912 | + * Symbol to use for decimal mark |
|
| 1913 | + * @var string $dec_mrk |
|
| 1914 | + * eg '.' |
|
| 1915 | + */ |
|
| 1916 | 1916 | public $dec_mrk; |
| 1917 | 1917 | |
| 1918 | 1918 | /** |
| 1919 | - * Symbol to use for thousands |
|
| 1920 | - * @var string $thsnds |
|
| 1921 | - * eg ',' |
|
| 1922 | - */ |
|
| 1919 | + * Symbol to use for thousands |
|
| 1920 | + * @var string $thsnds |
|
| 1921 | + * eg ',' |
|
| 1922 | + */ |
|
| 1923 | 1923 | public $thsnds; |
| 1924 | 1924 | |
| 1925 | 1925 | |
@@ -1987,13 +1987,13 @@ discard block |
||
| 1987 | 1987 | * whether or not to show alternate payment options during the reg process if payment status is pending |
| 1988 | 1988 | * @var boolean $show_pending_payment_options |
| 1989 | 1989 | */ |
| 1990 | - public $show_pending_payment_options; |
|
| 1990 | + public $show_pending_payment_options; |
|
| 1991 | 1991 | |
| 1992 | 1992 | /** |
| 1993 | 1993 | * Whether to skip the registration confirmation page |
| 1994 | 1994 | * @var boolean $skip_reg_confirmation |
| 1995 | 1995 | */ |
| 1996 | - public $skip_reg_confirmation; |
|
| 1996 | + public $skip_reg_confirmation; |
|
| 1997 | 1997 | |
| 1998 | 1998 | /** |
| 1999 | 1999 | * an array of SPCO reg steps where: |
@@ -2004,64 +2004,64 @@ discard block |
||
| 2004 | 2004 | * "slug" => the URL param used to trigger the reg step |
| 2005 | 2005 | * @var array $reg_steps |
| 2006 | 2006 | */ |
| 2007 | - public $reg_steps; |
|
| 2007 | + public $reg_steps; |
|
| 2008 | 2008 | |
| 2009 | 2009 | /** |
| 2010 | 2010 | * Whether registration confirmation should be the last page of SPCO |
| 2011 | 2011 | * @var boolean $reg_confirmation_last |
| 2012 | 2012 | */ |
| 2013 | - public $reg_confirmation_last; |
|
| 2013 | + public $reg_confirmation_last; |
|
| 2014 | 2014 | |
| 2015 | 2015 | /** |
| 2016 | 2016 | * Whether or not to enable the EE Bot Trap |
| 2017 | 2017 | * @var boolean $use_bot_trap |
| 2018 | 2018 | */ |
| 2019 | - public $use_bot_trap; |
|
| 2019 | + public $use_bot_trap; |
|
| 2020 | 2020 | |
| 2021 | 2021 | /** |
| 2022 | 2022 | * Whether or not to encrypt some data sent by the EE Bot Trap |
| 2023 | 2023 | * @var boolean $use_encryption |
| 2024 | 2024 | */ |
| 2025 | - public $use_encryption; |
|
| 2025 | + public $use_encryption; |
|
| 2026 | 2026 | |
| 2027 | 2027 | /** |
| 2028 | 2028 | * Whether or not to use ReCaptcha |
| 2029 | 2029 | * @var boolean $use_captcha |
| 2030 | 2030 | */ |
| 2031 | - public $use_captcha; |
|
| 2031 | + public $use_captcha; |
|
| 2032 | 2032 | |
| 2033 | 2033 | /** |
| 2034 | 2034 | * ReCaptcha Theme |
| 2035 | 2035 | * @var string $recaptcha_theme |
| 2036 | 2036 | * options: 'dark ', 'light' |
| 2037 | 2037 | */ |
| 2038 | - public $recaptcha_theme; |
|
| 2038 | + public $recaptcha_theme; |
|
| 2039 | 2039 | |
| 2040 | 2040 | /** |
| 2041 | 2041 | * ReCaptcha Type |
| 2042 | 2042 | * @var string $recaptcha_type |
| 2043 | 2043 | * options: 'audio', 'image' |
| 2044 | 2044 | */ |
| 2045 | - public $recaptcha_type; |
|
| 2045 | + public $recaptcha_type; |
|
| 2046 | 2046 | |
| 2047 | 2047 | /** |
| 2048 | 2048 | * ReCaptcha language |
| 2049 | 2049 | * @var string $recaptcha_language |
| 2050 | 2050 | * eg 'en' |
| 2051 | 2051 | */ |
| 2052 | - public $recaptcha_language; |
|
| 2052 | + public $recaptcha_language; |
|
| 2053 | 2053 | |
| 2054 | 2054 | /** |
| 2055 | 2055 | * ReCaptcha public key |
| 2056 | 2056 | * @var string $recaptcha_publickey |
| 2057 | 2057 | */ |
| 2058 | - public $recaptcha_publickey; |
|
| 2058 | + public $recaptcha_publickey; |
|
| 2059 | 2059 | |
| 2060 | 2060 | /** |
| 2061 | 2061 | * ReCaptcha private key |
| 2062 | 2062 | * @var string $recaptcha_privatekey |
| 2063 | 2063 | */ |
| 2064 | - public $recaptcha_privatekey; |
|
| 2064 | + public $recaptcha_privatekey; |
|
| 2065 | 2065 | |
| 2066 | 2066 | /** |
| 2067 | 2067 | * ReCaptcha width |
@@ -2127,58 +2127,58 @@ discard block |
||
| 2127 | 2127 | class EE_Admin_Config extends EE_Config_Base { |
| 2128 | 2128 | |
| 2129 | 2129 | /** |
| 2130 | - * @var boolean $use_personnel_manager |
|
| 2131 | - */ |
|
| 2130 | + * @var boolean $use_personnel_manager |
|
| 2131 | + */ |
|
| 2132 | 2132 | public $use_personnel_manager; |
| 2133 | 2133 | |
| 2134 | 2134 | /** |
| 2135 | - * @var boolean $use_dashboard_widget |
|
| 2136 | - */ |
|
| 2135 | + * @var boolean $use_dashboard_widget |
|
| 2136 | + */ |
|
| 2137 | 2137 | public $use_dashboard_widget; |
| 2138 | 2138 | |
| 2139 | 2139 | /** |
| 2140 | - * @var int $events_in_dashboard |
|
| 2141 | - */ |
|
| 2140 | + * @var int $events_in_dashboard |
|
| 2141 | + */ |
|
| 2142 | 2142 | public $events_in_dashboard; |
| 2143 | 2143 | |
| 2144 | 2144 | /** |
| 2145 | - * @var boolean $use_event_timezones |
|
| 2146 | - */ |
|
| 2145 | + * @var boolean $use_event_timezones |
|
| 2146 | + */ |
|
| 2147 | 2147 | public $use_event_timezones; |
| 2148 | 2148 | |
| 2149 | 2149 | /** |
| 2150 | - * @var boolean $use_full_logging |
|
| 2151 | - */ |
|
| 2150 | + * @var boolean $use_full_logging |
|
| 2151 | + */ |
|
| 2152 | 2152 | public $use_full_logging; |
| 2153 | 2153 | |
| 2154 | 2154 | /** |
| 2155 | - * @var string $log_file_name |
|
| 2156 | - */ |
|
| 2155 | + * @var string $log_file_name |
|
| 2156 | + */ |
|
| 2157 | 2157 | public $log_file_name; |
| 2158 | 2158 | |
| 2159 | 2159 | /** |
| 2160 | - * @var string $debug_file_name |
|
| 2161 | - */ |
|
| 2160 | + * @var string $debug_file_name |
|
| 2161 | + */ |
|
| 2162 | 2162 | public $debug_file_name; |
| 2163 | 2163 | |
| 2164 | 2164 | /** |
| 2165 | - * @var boolean $use_remote_logging |
|
| 2166 | - */ |
|
| 2165 | + * @var boolean $use_remote_logging |
|
| 2166 | + */ |
|
| 2167 | 2167 | public $use_remote_logging; |
| 2168 | 2168 | |
| 2169 | 2169 | /** |
| 2170 | - * @var string $remote_logging_url |
|
| 2171 | - */ |
|
| 2170 | + * @var string $remote_logging_url |
|
| 2171 | + */ |
|
| 2172 | 2172 | public $remote_logging_url; |
| 2173 | 2173 | |
| 2174 | 2174 | /** |
| 2175 | - * @var boolean $show_reg_footer |
|
| 2176 | - */ |
|
| 2175 | + * @var boolean $show_reg_footer |
|
| 2176 | + */ |
|
| 2177 | 2177 | public $show_reg_footer; |
| 2178 | 2178 | |
| 2179 | 2179 | /** |
| 2180 | - * @var string $affiliate_id |
|
| 2181 | - */ |
|
| 2180 | + * @var string $affiliate_id |
|
| 2181 | + */ |
|
| 2182 | 2182 | public $affiliate_id; |
| 2183 | 2183 | |
| 2184 | 2184 | |
@@ -2252,43 +2252,43 @@ discard block |
||
| 2252 | 2252 | class EE_Template_Config extends EE_Config_Base { |
| 2253 | 2253 | |
| 2254 | 2254 | /** |
| 2255 | - * @var boolean $enable_default_style |
|
| 2256 | - */ |
|
| 2255 | + * @var boolean $enable_default_style |
|
| 2256 | + */ |
|
| 2257 | 2257 | public $enable_default_style; |
| 2258 | 2258 | |
| 2259 | 2259 | /** |
| 2260 | - * @var string $custom_style_sheet |
|
| 2261 | - */ |
|
| 2260 | + * @var string $custom_style_sheet |
|
| 2261 | + */ |
|
| 2262 | 2262 | public $custom_style_sheet; |
| 2263 | 2263 | |
| 2264 | 2264 | /** |
| 2265 | - * @var boolean $display_address_in_regform |
|
| 2266 | - */ |
|
| 2265 | + * @var boolean $display_address_in_regform |
|
| 2266 | + */ |
|
| 2267 | 2267 | public $display_address_in_regform; |
| 2268 | 2268 | |
| 2269 | 2269 | /** |
| 2270 | - * @var int $display_description_on_multi_reg_page |
|
| 2271 | - */ |
|
| 2270 | + * @var int $display_description_on_multi_reg_page |
|
| 2271 | + */ |
|
| 2272 | 2272 | public $display_description_on_multi_reg_page; |
| 2273 | 2273 | |
| 2274 | 2274 | /** |
| 2275 | - * @var boolean $use_custom_templates |
|
| 2276 | - */ |
|
| 2275 | + * @var boolean $use_custom_templates |
|
| 2276 | + */ |
|
| 2277 | 2277 | public $use_custom_templates; |
| 2278 | 2278 | |
| 2279 | 2279 | /** |
| 2280 | - * @var string $current_espresso_theme |
|
| 2281 | - */ |
|
| 2280 | + * @var string $current_espresso_theme |
|
| 2281 | + */ |
|
| 2282 | 2282 | public $current_espresso_theme; |
| 2283 | 2283 | |
| 2284 | 2284 | /** |
| 2285 | - * @var EE_Event_Single_Config $EED_Event_Single |
|
| 2286 | - */ |
|
| 2285 | + * @var EE_Event_Single_Config $EED_Event_Single |
|
| 2286 | + */ |
|
| 2287 | 2287 | public $EED_Event_Single; |
| 2288 | 2288 | |
| 2289 | 2289 | /** |
| 2290 | - * @var EE_Events_Archive_Config $EED_Events_Archive |
|
| 2291 | - */ |
|
| 2290 | + * @var EE_Events_Archive_Config $EED_Events_Archive |
|
| 2291 | + */ |
|
| 2292 | 2292 | public $EED_Events_Archive; |
| 2293 | 2293 | |
| 2294 | 2294 | |
@@ -2321,78 +2321,78 @@ discard block |
||
| 2321 | 2321 | class EE_Map_Config extends EE_Config_Base { |
| 2322 | 2322 | |
| 2323 | 2323 | /** |
| 2324 | - * @var boolean $use_google_maps |
|
| 2325 | - */ |
|
| 2324 | + * @var boolean $use_google_maps |
|
| 2325 | + */ |
|
| 2326 | 2326 | public $use_google_maps; |
| 2327 | 2327 | |
| 2328 | 2328 | /** |
| 2329 | - * @var int $event_details_map_width |
|
| 2330 | - */ |
|
| 2329 | + * @var int $event_details_map_width |
|
| 2330 | + */ |
|
| 2331 | 2331 | public $event_details_map_width; |
| 2332 | 2332 | |
| 2333 | 2333 | /** |
| 2334 | - * @var int $event_details_map_height |
|
| 2335 | - */ |
|
| 2334 | + * @var int $event_details_map_height |
|
| 2335 | + */ |
|
| 2336 | 2336 | public $event_details_map_height; |
| 2337 | 2337 | |
| 2338 | 2338 | /** |
| 2339 | - * @var int $event_details_map_zoom |
|
| 2340 | - */ |
|
| 2339 | + * @var int $event_details_map_zoom |
|
| 2340 | + */ |
|
| 2341 | 2341 | public $event_details_map_zoom; |
| 2342 | 2342 | |
| 2343 | 2343 | /** |
| 2344 | - * @var boolean $event_details_display_nav |
|
| 2345 | - */ |
|
| 2344 | + * @var boolean $event_details_display_nav |
|
| 2345 | + */ |
|
| 2346 | 2346 | public $event_details_display_nav; |
| 2347 | 2347 | |
| 2348 | 2348 | /** |
| 2349 | - * @var boolean $event_details_nav_size |
|
| 2350 | - */ |
|
| 2349 | + * @var boolean $event_details_nav_size |
|
| 2350 | + */ |
|
| 2351 | 2351 | public $event_details_nav_size; |
| 2352 | 2352 | |
| 2353 | 2353 | /** |
| 2354 | - * @var string $event_details_control_type |
|
| 2355 | - */ |
|
| 2354 | + * @var string $event_details_control_type |
|
| 2355 | + */ |
|
| 2356 | 2356 | public $event_details_control_type; |
| 2357 | 2357 | |
| 2358 | 2358 | /** |
| 2359 | - * @var string $event_details_map_align |
|
| 2360 | - */ |
|
| 2359 | + * @var string $event_details_map_align |
|
| 2360 | + */ |
|
| 2361 | 2361 | public $event_details_map_align; |
| 2362 | 2362 | |
| 2363 | 2363 | /** |
| 2364 | - * @var int $event_list_map_width |
|
| 2365 | - */ |
|
| 2364 | + * @var int $event_list_map_width |
|
| 2365 | + */ |
|
| 2366 | 2366 | public $event_list_map_width; |
| 2367 | 2367 | |
| 2368 | 2368 | /** |
| 2369 | - * @var int $event_list_map_height |
|
| 2370 | - */ |
|
| 2369 | + * @var int $event_list_map_height |
|
| 2370 | + */ |
|
| 2371 | 2371 | public $event_list_map_height; |
| 2372 | 2372 | |
| 2373 | 2373 | /** |
| 2374 | - * @var int $event_list_map_zoom |
|
| 2375 | - */ |
|
| 2374 | + * @var int $event_list_map_zoom |
|
| 2375 | + */ |
|
| 2376 | 2376 | public $event_list_map_zoom; |
| 2377 | 2377 | |
| 2378 | 2378 | /** |
| 2379 | - * @var boolean $event_list_display_nav |
|
| 2380 | - */ |
|
| 2379 | + * @var boolean $event_list_display_nav |
|
| 2380 | + */ |
|
| 2381 | 2381 | public $event_list_display_nav; |
| 2382 | 2382 | |
| 2383 | 2383 | /** |
| 2384 | - * @var boolean $event_list_nav_size |
|
| 2385 | - */ |
|
| 2384 | + * @var boolean $event_list_nav_size |
|
| 2385 | + */ |
|
| 2386 | 2386 | public $event_list_nav_size; |
| 2387 | 2387 | |
| 2388 | 2388 | /** |
| 2389 | - * @var string $event_list_control_type |
|
| 2390 | - */ |
|
| 2389 | + * @var string $event_list_control_type |
|
| 2390 | + */ |
|
| 2391 | 2391 | public $event_list_control_type; |
| 2392 | 2392 | |
| 2393 | 2393 | /** |
| 2394 | - * @var string $event_list_map_align |
|
| 2395 | - */ |
|
| 2394 | + * @var string $event_list_map_align |
|
| 2395 | + */ |
|
| 2396 | 2396 | public $event_list_map_align; |
| 2397 | 2397 | |
| 2398 | 2398 | |
@@ -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 | * |
@@ -168,7 +170,7 @@ discard block |
||
| 168 | 170 | //support removing a module during a request when it previously existed |
| 169 | 171 | if( $reinstantiate ){ |
| 170 | 172 | return self::instance( $registry ); |
| 171 | - }else{ |
|
| 173 | + } else{ |
|
| 172 | 174 | return NULL; |
| 173 | 175 | } |
| 174 | 176 | } |
@@ -1632,7 +1634,7 @@ discard block |
||
| 1632 | 1634 | } |
| 1633 | 1635 | if($query_args){ |
| 1634 | 1636 | return add_query_arg($query_args,$this->txn_page_url); |
| 1635 | - }else{ |
|
| 1637 | + } else{ |
|
| 1636 | 1638 | return $this->txn_page_url; |
| 1637 | 1639 | } |
| 1638 | 1640 | } |
@@ -1649,7 +1651,7 @@ discard block |
||
| 1649 | 1651 | } |
| 1650 | 1652 | if($query_args){ |
| 1651 | 1653 | return add_query_arg($query_args,$this->thank_you_page_url); |
| 1652 | - }else{ |
|
| 1654 | + } else{ |
|
| 1653 | 1655 | return $this->thank_you_page_url; |
| 1654 | 1656 | } |
| 1655 | 1657 | } |
@@ -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 | * |
| 4 | 6 | * EE_System |
@@ -306,7 +308,7 @@ discard block |
||
| 306 | 308 | $espresso_db_update = array( $espresso_db_update=>array() ); |
| 307 | 309 | update_option( 'espresso_db_update', $espresso_db_update ); |
| 308 | 310 | } |
| 309 | - }else{ |
|
| 311 | + } else{ |
|
| 310 | 312 | $corrected_db_update = array(); |
| 311 | 313 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
| 312 | 314 | foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
@@ -316,7 +318,7 @@ discard block |
||
| 316 | 318 | //fix it! |
| 317 | 319 | $version_string = $should_be_array; |
| 318 | 320 | $corrected_db_update[$version_string] = array('unknown-date'); |
| 319 | - }else{ |
|
| 321 | + } else{ |
|
| 320 | 322 | //ok it checks out |
| 321 | 323 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
| 322 | 324 | } |
@@ -360,7 +362,7 @@ discard block |
||
| 360 | 362 | if( $initialize_addons_too ) { |
| 361 | 363 | $this->initialize_addons(); |
| 362 | 364 | } |
| 363 | - }else{ |
|
| 365 | + } else{ |
|
| 364 | 366 | EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
| 365 | 367 | } |
| 366 | 368 | if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
@@ -439,7 +441,7 @@ discard block |
||
| 439 | 441 | //it a version we haven't seen before |
| 440 | 442 | if( $version_is_higher === 1 ){ |
| 441 | 443 | $req_type = EE_System::req_type_upgrade; |
| 442 | - }else{ |
|
| 444 | + } else{ |
|
| 443 | 445 | $req_type = EE_System::req_type_downgrade; |
| 444 | 446 | } |
| 445 | 447 | delete_option( $activation_indicator_option_name ); |
@@ -448,10 +450,10 @@ discard block |
||
| 448 | 450 | if( get_option( $activation_indicator_option_name, FALSE ) ){ |
| 449 | 451 | if ( $version_is_higher === -1 ){ |
| 450 | 452 | $req_type = EE_System::req_type_downgrade; |
| 451 | - }elseif( $version_is_higher === 0 ){ |
|
| 453 | + } elseif( $version_is_higher === 0 ){ |
|
| 452 | 454 | //we've seen this version before, but it's an activation. must be a reactivation |
| 453 | 455 | $req_type = EE_System::req_type_reactivation; |
| 454 | - }else{//$version_is_higher === 1 |
|
| 456 | + } else{//$version_is_higher === 1 |
|
| 455 | 457 | $req_type = EE_System::req_type_upgrade; |
| 456 | 458 | } |
| 457 | 459 | delete_option( $activation_indicator_option_name ); |
@@ -459,10 +461,10 @@ discard block |
||
| 459 | 461 | //we've seen this version before and the activation indicate doesn't show it was just activated |
| 460 | 462 | if ( $version_is_higher === -1 ){ |
| 461 | 463 | $req_type = EE_System::req_type_downgrade; |
| 462 | - }elseif( $version_is_higher === 0 ){ |
|
| 464 | + } elseif( $version_is_higher === 0 ){ |
|
| 463 | 465 | //we've seen this version before and it's not an activation. its normal request |
| 464 | 466 | $req_type = EE_System::req_type_normal; |
| 465 | - }else{//$version_is_higher === 1 |
|
| 467 | + } else{//$version_is_higher === 1 |
|
| 466 | 468 | $req_type = EE_System::req_type_upgrade; |
| 467 | 469 | } |
| 468 | 470 | } |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | * @param \EE_Registry $Registry |
| 89 | 89 | * @return \EE_System |
| 90 | 90 | */ |
| 91 | - public static function instance( EE_Registry $Registry = null ) { |
|
| 91 | + public static function instance(EE_Registry $Registry = null) { |
|
| 92 | 92 | // check if class object is instantiated |
| 93 | - if ( ! self::$_instance instanceof EE_System ) { |
|
| 94 | - self::$_instance = new self( $Registry ); |
|
| 93 | + if ( ! self::$_instance instanceof EE_System) { |
|
| 94 | + self::$_instance = new self($Registry); |
|
| 95 | 95 | } |
| 96 | 96 | return self::$_instance; |
| 97 | 97 | } |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | * resets the instance and returns it |
| 102 | 102 | * @return EE_System |
| 103 | 103 | */ |
| 104 | - public static function reset(){ |
|
| 104 | + public static function reset() { |
|
| 105 | 105 | self::$_instance->_req_type = NULL; |
| 106 | 106 | //we need to reset the migration manager in order for it to detect DMSs properly |
| 107 | 107 | EE_Data_Migration_Manager::reset(); |
| 108 | 108 | //make sure none of the old hooks are left hanging around |
| 109 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
| 109 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
| 110 | 110 | self::instance()->detect_activations_or_upgrades(); |
| 111 | 111 | self::instance()->perform_activations_upgrades_and_migrations(); |
| 112 | 112 | return self::instance(); |
@@ -122,28 +122,28 @@ discard block |
||
| 122 | 122 | * @access private |
| 123 | 123 | * @param \EE_Registry $Registry |
| 124 | 124 | */ |
| 125 | - private function __construct( EE_Registry $Registry ) { |
|
| 125 | + private function __construct(EE_Registry $Registry) { |
|
| 126 | 126 | $this->registry = $Registry; |
| 127 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
| 127 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
| 128 | 128 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
| 129 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
| 129 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
| 130 | 130 | // when an ee addon is activated, we want to call the core hook(s) again |
| 131 | 131 | // because the newly-activated addon didn't get a chance to run at all |
| 132 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
| 132 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
| 133 | 133 | // detect whether install or upgrade |
| 134 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
| 134 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
| 135 | 135 | // load EE_Config, EE_Textdomain, etc |
| 136 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
| 136 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
| 137 | 137 | // load shortcodes modules and widgets |
| 138 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
| 138 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
| 139 | 139 | // you wanna get going? I wanna get going... let's get going! |
| 140 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
| 140 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
| 141 | 141 | //other housekeeping |
| 142 | 142 | //exclude EE critical pages from wp_list_pages |
| 143 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
| 143 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
| 144 | 144 | // ALL EE Addons should use the following hook point to attach their initial setup too |
| 145 | 145 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
| 146 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
| 146 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -163,30 +163,30 @@ discard block |
||
| 163 | 163 | public function load_espresso_addons() { |
| 164 | 164 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
| 165 | 165 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
| 166 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
| 166 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
| 167 | 167 | //load and setup EE_Capabilities |
| 168 | - $this->registry->load_core( 'Capabilities' ); |
|
| 168 | + $this->registry->load_core('Capabilities'); |
|
| 169 | 169 | //caps need to be initialized on every request so that capability maps are set. |
| 170 | 170 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
| 171 | 171 | $this->registry->CAP->init_caps(); |
| 172 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
| 172 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
| 173 | 173 | //if the WP API basic auth plugin isn't already loaded, load it now. |
| 174 | 174 | //We want it for mobile apps. Just include the entire plugin |
| 175 | 175 | //also, don't load the basic auth when a plugin is getting activated, because |
| 176 | 176 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
| 177 | 177 | //and causes a fatal error |
| 178 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
| 179 | - && ! function_exists( 'json_basic_auth_error' ) |
|
| 178 | + if ( ! function_exists('json_basic_auth_handler') |
|
| 179 | + && ! function_exists('json_basic_auth_error') |
|
| 180 | 180 | && ! ( |
| 181 | - isset( $_GET[ 'action'] ) |
|
| 182 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
| 181 | + isset($_GET['action']) |
|
| 182 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
| 183 | 183 | ) |
| 184 | 184 | && ! ( |
| 185 | - isset( $_GET['activate' ] ) |
|
| 186 | - && $_GET['activate' ] === 'true' |
|
| 185 | + isset($_GET['activate']) |
|
| 186 | + && $_GET['activate'] === 'true' |
|
| 187 | 187 | ) |
| 188 | 188 | ) { |
| 189 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
| 189 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | * @access public |
| 203 | 203 | * @return void |
| 204 | 204 | */ |
| 205 | - public function detect_activations_or_upgrades(){ |
|
| 205 | + public function detect_activations_or_upgrades() { |
|
| 206 | 206 | //first off: let's make sure to handle core |
| 207 | 207 | $this->detect_if_activation_or_upgrade(); |
| 208 | - foreach($this->registry->addons as $addon){ |
|
| 208 | + foreach ($this->registry->addons as $addon) { |
|
| 209 | 209 | //detect teh request type for that addon |
| 210 | 210 | $addon->detect_activation_or_upgrade(); |
| 211 | 211 | } |
@@ -226,41 +226,41 @@ discard block |
||
| 226 | 226 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
| 227 | 227 | |
| 228 | 228 | // load M-Mode class |
| 229 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
| 229 | + $this->registry->load_core('Maintenance_Mode'); |
|
| 230 | 230 | // check if db has been updated, or if its a brand-new installation |
| 231 | 231 | |
| 232 | 232 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
| 233 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
| 233 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
| 234 | 234 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
| 235 | 235 | |
| 236 | - switch($request_type){ |
|
| 236 | + switch ($request_type) { |
|
| 237 | 237 | case EE_System::req_type_new_activation: |
| 238 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
| 239 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 238 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
| 239 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 240 | 240 | break; |
| 241 | 241 | case EE_System::req_type_reactivation: |
| 242 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
| 243 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 242 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
| 243 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 244 | 244 | break; |
| 245 | 245 | case EE_System::req_type_upgrade: |
| 246 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
| 246 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
| 247 | 247 | //migrations may be required now that we've upgraded |
| 248 | 248 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
| 249 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 249 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 250 | 250 | // echo "done upgrade";die; |
| 251 | 251 | break; |
| 252 | 252 | case EE_System::req_type_downgrade: |
| 253 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
| 253 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
| 254 | 254 | //its possible migrations are no longer required |
| 255 | 255 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
| 256 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 256 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 257 | 257 | break; |
| 258 | 258 | case EE_System::req_type_normal: |
| 259 | 259 | default: |
| 260 | 260 | // $this->_maybe_redirect_to_ee_about(); |
| 261 | 261 | break; |
| 262 | 262 | } |
| 263 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
| 263 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | * initializing the database later during the request |
| 269 | 269 | * @param array $espresso_db_update |
| 270 | 270 | */ |
| 271 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
| 272 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
| 271 | + protected function _handle_core_version_change($espresso_db_update) { |
|
| 272 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
| 273 | 273 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
| 274 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
| 274 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -286,44 +286,44 @@ discard block |
||
| 286 | 286 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
| 287 | 287 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
| 288 | 288 | */ |
| 289 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
| 290 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
| 291 | - if( ! $espresso_db_update){ |
|
| 292 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
| 289 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
| 290 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
| 291 | + if ( ! $espresso_db_update) { |
|
| 292 | + $espresso_db_update = get_option('espresso_db_update'); |
|
| 293 | 293 | } |
| 294 | 294 | // check that option is an array |
| 295 | - if( ! is_array( $espresso_db_update )) { |
|
| 295 | + if ( ! is_array($espresso_db_update)) { |
|
| 296 | 296 | // if option is FALSE, then it never existed |
| 297 | - if ( $espresso_db_update === FALSE ) { |
|
| 297 | + if ($espresso_db_update === FALSE) { |
|
| 298 | 298 | // make $espresso_db_update an array and save option with autoload OFF |
| 299 | - $espresso_db_update = array(); |
|
| 300 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
| 299 | + $espresso_db_update = array(); |
|
| 300 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
| 301 | 301 | } else { |
| 302 | 302 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
| 303 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
| 304 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
| 303 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
| 304 | + update_option('espresso_db_update', $espresso_db_update); |
|
| 305 | 305 | } |
| 306 | - }else{ |
|
| 306 | + } else { |
|
| 307 | 307 | $corrected_db_update = array(); |
| 308 | 308 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
| 309 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
| 310 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
| 309 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
| 310 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
| 311 | 311 | //the key is an int, and the value IS NOT an array |
| 312 | 312 | //so it must be numerically-indexed, where values are versions installed... |
| 313 | 313 | //fix it! |
| 314 | 314 | $version_string = $should_be_array; |
| 315 | 315 | $corrected_db_update[$version_string] = array('unknown-date'); |
| 316 | - }else{ |
|
| 316 | + } else { |
|
| 317 | 317 | //ok it checks out |
| 318 | 318 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | $espresso_db_update = $corrected_db_update; |
| 322 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
| 322 | + update_option('espresso_db_update', $espresso_db_update); |
|
| 323 | 323 | |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
| 326 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
| 327 | 327 | return $espresso_db_update; |
| 328 | 328 | } |
| 329 | 329 | |
@@ -343,34 +343,34 @@ discard block |
||
| 343 | 343 | * so we prefer to only do it when necessary |
| 344 | 344 | * @return void |
| 345 | 345 | */ |
| 346 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
| 346 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
| 347 | 347 | $request_type = $this->detect_req_type(); |
| 348 | 348 | //only initialize system if we're not in maintenance mode. |
| 349 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
| 350 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
| 349 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
| 350 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
| 351 | 351 | |
| 352 | - if( $verify_schema ) { |
|
| 352 | + if ($verify_schema) { |
|
| 353 | 353 | EEH_Activation::initialize_db_and_folders(); |
| 354 | 354 | } |
| 355 | 355 | EEH_Activation::initialize_db_content(); |
| 356 | 356 | EEH_Activation::system_initialization(); |
| 357 | - if( $initialize_addons_too ) { |
|
| 357 | + if ($initialize_addons_too) { |
|
| 358 | 358 | $this->initialize_addons(); |
| 359 | 359 | } |
| 360 | - }else{ |
|
| 361 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
| 360 | + } else { |
|
| 361 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
| 362 | 362 | } |
| 363 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
| 364 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
| 363 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
| 364 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | /** |
| 369 | 369 | * Initializes the db for all registered addons |
| 370 | 370 | */ |
| 371 | - public function initialize_addons(){ |
|
| 371 | + public function initialize_addons() { |
|
| 372 | 372 | //foreach registered addon, make sure its db is up-to-date too |
| 373 | - foreach($this->registry->addons as $addon){ |
|
| 373 | + foreach ($this->registry->addons as $addon) { |
|
| 374 | 374 | $addon->initialize_db_if_no_migrations_required(); |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -382,16 +382,16 @@ discard block |
||
| 382 | 382 | * @param string $current_version_to_add version to be added to the version history |
| 383 | 383 | * @return boolean success as to whether or not this option was changed |
| 384 | 384 | */ |
| 385 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
| 386 | - if( ! $version_history ) { |
|
| 385 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
| 386 | + if ( ! $version_history) { |
|
| 387 | 387 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
| 388 | 388 | } |
| 389 | - if( $current_version_to_add == NULL){ |
|
| 389 | + if ($current_version_to_add == NULL) { |
|
| 390 | 390 | $current_version_to_add = espresso_version(); |
| 391 | 391 | } |
| 392 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
| 392 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
| 393 | 393 | // re-save |
| 394 | - return update_option( 'espresso_db_update', $version_history ); |
|
| 394 | + return update_option('espresso_db_update', $version_history); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | |
@@ -408,10 +408,10 @@ discard block |
||
| 408 | 408 | * but still know if this is a new install or not |
| 409 | 409 | * @return int one of the constants on EE_System::req_type_ |
| 410 | 410 | */ |
| 411 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
| 412 | - if ( $this->_req_type === NULL ){ |
|
| 413 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
| 414 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
| 411 | + public function detect_req_type($espresso_db_update = NULL) { |
|
| 412 | + if ($this->_req_type === NULL) { |
|
| 413 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
| 414 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
| 415 | 415 | } |
| 416 | 416 | return $this->_req_type; |
| 417 | 417 | } |
@@ -427,39 +427,39 @@ discard block |
||
| 427 | 427 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
| 428 | 428 | * @return int one of the constants on EE_System::req_type_* |
| 429 | 429 | */ |
| 430 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
| 431 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
| 432 | - if( $activation_history_for_addon ){ |
|
| 430 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
| 431 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
| 432 | + if ($activation_history_for_addon) { |
|
| 433 | 433 | //it exists, so this isn't a completely new install |
| 434 | 434 | //check if this version already in that list of previously installed versions |
| 435 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
| 435 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
| 436 | 436 | //it a version we haven't seen before |
| 437 | - if( $version_is_higher === 1 ){ |
|
| 437 | + if ($version_is_higher === 1) { |
|
| 438 | 438 | $req_type = EE_System::req_type_upgrade; |
| 439 | - }else{ |
|
| 439 | + } else { |
|
| 440 | 440 | $req_type = EE_System::req_type_downgrade; |
| 441 | 441 | } |
| 442 | - delete_option( $activation_indicator_option_name ); |
|
| 442 | + delete_option($activation_indicator_option_name); |
|
| 443 | 443 | } else { |
| 444 | 444 | // its not an update. maybe a reactivation? |
| 445 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
| 446 | - if ( $version_is_higher === -1 ){ |
|
| 445 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
| 446 | + if ($version_is_higher === -1) { |
|
| 447 | 447 | $req_type = EE_System::req_type_downgrade; |
| 448 | - }elseif( $version_is_higher === 0 ){ |
|
| 448 | + }elseif ($version_is_higher === 0) { |
|
| 449 | 449 | //we've seen this version before, but it's an activation. must be a reactivation |
| 450 | 450 | $req_type = EE_System::req_type_reactivation; |
| 451 | - }else{//$version_is_higher === 1 |
|
| 451 | + } else {//$version_is_higher === 1 |
|
| 452 | 452 | $req_type = EE_System::req_type_upgrade; |
| 453 | 453 | } |
| 454 | - delete_option( $activation_indicator_option_name ); |
|
| 454 | + delete_option($activation_indicator_option_name); |
|
| 455 | 455 | } else { |
| 456 | 456 | //we've seen this version before and the activation indicate doesn't show it was just activated |
| 457 | - if ( $version_is_higher === -1 ){ |
|
| 457 | + if ($version_is_higher === -1) { |
|
| 458 | 458 | $req_type = EE_System::req_type_downgrade; |
| 459 | - }elseif( $version_is_higher === 0 ){ |
|
| 459 | + }elseif ($version_is_higher === 0) { |
|
| 460 | 460 | //we've seen this version before and it's not an activation. its normal request |
| 461 | 461 | $req_type = EE_System::req_type_normal; |
| 462 | - }else{//$version_is_higher === 1 |
|
| 462 | + } else {//$version_is_higher === 1 |
|
| 463 | 463 | $req_type = EE_System::req_type_upgrade; |
| 464 | 464 | } |
| 465 | 465 | } |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | } else { |
| 468 | 468 | //brand new install |
| 469 | 469 | $req_type = EE_System::req_type_new_activation; |
| 470 | - delete_option( $activation_indicator_option_name ); |
|
| 470 | + delete_option($activation_indicator_option_name); |
|
| 471 | 471 | } |
| 472 | 472 | return $req_type; |
| 473 | 473 | } |
@@ -485,30 +485,30 @@ discard block |
||
| 485 | 485 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
| 486 | 486 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
| 487 | 487 | */ |
| 488 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
| 488 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
| 489 | 489 | //find the most recently-activated version |
| 490 | 490 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
| 491 | 491 | $most_recently_active_version = '0.0.0.dev.000'; |
| 492 | - if( is_array( $activation_history_for_addon ) ){ |
|
| 493 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
| 492 | + if (is_array($activation_history_for_addon)) { |
|
| 493 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
| 494 | 494 | //check there is a record of when this version was activated. Otherwise, |
| 495 | 495 | //mark it as unknown |
| 496 | - if( ! $times_activated ){ |
|
| 497 | - $times_activated = array( 'unknown-date'); |
|
| 496 | + if ( ! $times_activated) { |
|
| 497 | + $times_activated = array('unknown-date'); |
|
| 498 | 498 | } |
| 499 | - if( is_string( $times_activated ) ){ |
|
| 500 | - $times_activated = array( $times_activated ); |
|
| 499 | + if (is_string($times_activated)) { |
|
| 500 | + $times_activated = array($times_activated); |
|
| 501 | 501 | } |
| 502 | - foreach( $times_activated as $an_activation ){ |
|
| 503 | - if( $an_activation != 'unknown-date' && |
|
| 504 | - $an_activation > $most_recently_active_version_activation ){ |
|
| 502 | + foreach ($times_activated as $an_activation) { |
|
| 503 | + if ($an_activation != 'unknown-date' && |
|
| 504 | + $an_activation > $most_recently_active_version_activation) { |
|
| 505 | 505 | $most_recently_active_version = $version; |
| 506 | 506 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
| 511 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | |
@@ -518,24 +518,24 @@ discard block |
||
| 518 | 518 | * @return void |
| 519 | 519 | */ |
| 520 | 520 | public function redirect_to_about_ee() { |
| 521 | - $notices = EE_Error::get_notices( FALSE ); |
|
| 521 | + $notices = EE_Error::get_notices(FALSE); |
|
| 522 | 522 | //if current user is an admin and it's not an ajax request |
| 523 | 523 | if ( |
| 524 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
| 525 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
| 526 | - && ! isset( $notices[ 'errors' ] ) |
|
| 524 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
| 525 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
| 526 | + && ! isset($notices['errors']) |
|
| 527 | 527 | ) { |
| 528 | - $query_params = array( 'page' => 'espresso_about' ); |
|
| 528 | + $query_params = array('page' => 'espresso_about'); |
|
| 529 | 529 | |
| 530 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
| 530 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
| 531 | 531 | $query_params['new_activation'] = TRUE; |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
| 534 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
| 535 | 535 | $query_params['reactivation'] = TRUE; |
| 536 | 536 | } |
| 537 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
| 538 | - wp_safe_redirect( $url ); |
|
| 537 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
| 538 | + wp_safe_redirect($url); |
|
| 539 | 539 | exit(); |
| 540 | 540 | } |
| 541 | 541 | } |
@@ -549,31 +549,31 @@ discard block |
||
| 549 | 549 | * |
| 550 | 550 | * @return void |
| 551 | 551 | */ |
| 552 | - public function load_core_configuration(){ |
|
| 553 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
| 554 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
| 552 | + public function load_core_configuration() { |
|
| 553 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
| 554 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
| 555 | 555 | //load textdomain |
| 556 | 556 | EE_Load_Textdomain::load_textdomain(); |
| 557 | 557 | // load and setup EE_Config and EE_Network_Config |
| 558 | - $this->registry->load_core( 'Config' ); |
|
| 559 | - $this->registry->load_core( 'Network_Config' ); |
|
| 558 | + $this->registry->load_core('Config'); |
|
| 559 | + $this->registry->load_core('Network_Config'); |
|
| 560 | 560 | // setup autoloaders |
| 561 | 561 | // enable logging? |
| 562 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
| 563 | - $this->registry->load_core( 'Log' ); |
|
| 562 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
| 563 | + $this->registry->load_core('Log'); |
|
| 564 | 564 | } |
| 565 | 565 | // check for activation errors |
| 566 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
| 567 | - if ( $activation_errors ) { |
|
| 568 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 569 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
| 566 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
| 567 | + if ($activation_errors) { |
|
| 568 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
| 569 | + update_option('ee_plugin_activation_errors', FALSE); |
|
| 570 | 570 | } |
| 571 | 571 | // get model names |
| 572 | 572 | $this->_parse_model_names(); |
| 573 | 573 | |
| 574 | 574 | //load caf stuff a chance to play during the activation process too. |
| 575 | 575 | $this->_maybe_brew_regular(); |
| 576 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
| 576 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | |
@@ -582,23 +582,23 @@ discard block |
||
| 582 | 582 | * |
| 583 | 583 | * @return void |
| 584 | 584 | */ |
| 585 | - private function _parse_model_names(){ |
|
| 585 | + private function _parse_model_names() { |
|
| 586 | 586 | //get all the files in the EE_MODELS folder that end in .model.php |
| 587 | - $models = glob( EE_MODELS.'*.model.php'); |
|
| 587 | + $models = glob(EE_MODELS.'*.model.php'); |
|
| 588 | 588 | $model_names = array(); |
| 589 | 589 | $non_abstract_db_models = array(); |
| 590 | - foreach( $models as $model ){ |
|
| 590 | + foreach ($models as $model) { |
|
| 591 | 591 | // get model classname |
| 592 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
| 593 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
| 592 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
| 593 | + $short_name = str_replace('EEM_', '', $classname); |
|
| 594 | 594 | $reflectionClass = new ReflectionClass($classname); |
| 595 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
| 596 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
| 595 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
| 596 | + $non_abstract_db_models[$short_name] = $classname; |
|
| 597 | 597 | } |
| 598 | - $model_names[ $short_name ] = $classname; |
|
| 598 | + $model_names[$short_name] = $classname; |
|
| 599 | 599 | } |
| 600 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
| 601 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
| 600 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
| 601 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | |
@@ -608,8 +608,8 @@ discard block |
||
| 608 | 608 | * @return void |
| 609 | 609 | */ |
| 610 | 610 | private function _maybe_brew_regular() { |
| 611 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
| 612 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
| 611 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
| 612 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
| 613 | 613 | } |
| 614 | 614 | } |
| 615 | 615 | |
@@ -626,9 +626,9 @@ discard block |
||
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | 628 | public function register_shortcodes_modules_and_widgets() { |
| 629 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
| 629 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
| 630 | 630 | // check for addons using old hookpoint |
| 631 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
| 631 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
| 632 | 632 | $this->_incompatible_addon_error(); |
| 633 | 633 | } |
| 634 | 634 | } |
@@ -642,19 +642,19 @@ discard block |
||
| 642 | 642 | */ |
| 643 | 643 | private function _incompatible_addon_error() { |
| 644 | 644 | // get array of classes hooking into here |
| 645 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
| 646 | - if ( ! empty( $class_names )) { |
|
| 647 | - $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' ); |
|
| 645 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
| 646 | + if ( ! empty($class_names)) { |
|
| 647 | + $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'); |
|
| 648 | 648 | $msg .= '<ul>'; |
| 649 | - foreach ( $class_names as $class_name ) { |
|
| 650 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
| 649 | + foreach ($class_names as $class_name) { |
|
| 650 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
| 651 | 651 | } |
| 652 | 652 | $msg .= '</ul>'; |
| 653 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
| 653 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
| 654 | 654 | // save list of incompatible addons to wp-options for later use |
| 655 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
| 656 | - if ( is_admin() ) { |
|
| 657 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 655 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
| 656 | + if (is_admin()) { |
|
| 657 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 658 | 658 | } |
| 659 | 659 | } |
| 660 | 660 | } |
@@ -671,25 +671,25 @@ discard block |
||
| 671 | 671 | * |
| 672 | 672 | * @return void |
| 673 | 673 | */ |
| 674 | - public function brew_espresso(){ |
|
| 675 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
| 674 | + public function brew_espresso() { |
|
| 675 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
| 676 | 676 | // load some final core systems |
| 677 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
| 678 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
| 679 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
| 680 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
| 681 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
| 682 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
| 683 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
| 684 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
| 685 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
| 686 | - |
|
| 687 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
| 677 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
| 678 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
| 679 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
| 680 | + add_action('init', array($this, 'load_controllers'), 7); |
|
| 681 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
| 682 | + add_action('init', array($this, 'initialize'), 10); |
|
| 683 | + add_action('init', array($this, 'initialize_last'), 100); |
|
| 684 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
| 685 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
| 686 | + |
|
| 687 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
| 688 | 688 | // pew pew pew |
| 689 | - $this->registry->load_core( 'PUE' ); |
|
| 690 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
| 689 | + $this->registry->load_core('PUE'); |
|
| 690 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
| 691 | 691 | } |
| 692 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
| 692 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | */ |
| 704 | 704 | public function set_hooks_for_core() { |
| 705 | 705 | $this->_deactivate_incompatible_addons(); |
| 706 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
| 706 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | |
@@ -712,15 +712,15 @@ discard block |
||
| 712 | 712 | * Using the information gathered in EE_System::_incompatible_addon_error, |
| 713 | 713 | * deactivates any addons considered incompatible with the current version of EE |
| 714 | 714 | */ |
| 715 | - private function _deactivate_incompatible_addons(){ |
|
| 716 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
| 717 | - if ( ! empty( $incompatible_addons )) { |
|
| 718 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
| 719 | - foreach ( $active_plugins as $active_plugin ) { |
|
| 720 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
| 721 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
| 722 | - unset( $_GET['activate'] ); |
|
| 723 | - espresso_deactivate_plugin( $active_plugin ); |
|
| 715 | + private function _deactivate_incompatible_addons() { |
|
| 716 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
| 717 | + if ( ! empty($incompatible_addons)) { |
|
| 718 | + $active_plugins = get_option('active_plugins', array()); |
|
| 719 | + foreach ($active_plugins as $active_plugin) { |
|
| 720 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
| 721 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
| 722 | + unset($_GET['activate']); |
|
| 723 | + espresso_deactivate_plugin($active_plugin); |
|
| 724 | 724 | } |
| 725 | 725 | } |
| 726 | 726 | } |
@@ -737,10 +737,10 @@ discard block |
||
| 737 | 737 | */ |
| 738 | 738 | public function perform_activations_upgrades_and_migrations() { |
| 739 | 739 | //first check if we had previously attempted to setup EE's directories but failed |
| 740 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
| 740 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
| 741 | 741 | EEH_Activation::create_upload_directories(); |
| 742 | 742 | } |
| 743 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
| 743 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | |
@@ -752,10 +752,10 @@ discard block |
||
| 752 | 752 | * @return void |
| 753 | 753 | */ |
| 754 | 754 | public function load_CPTs_and_session() { |
| 755 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
| 755 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
| 756 | 756 | // register Custom Post Types |
| 757 | - $this->registry->load_core( 'Register_CPTs' ); |
|
| 758 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
| 757 | + $this->registry->load_core('Register_CPTs'); |
|
| 758 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | |
@@ -770,16 +770,16 @@ discard block |
||
| 770 | 770 | * @return void |
| 771 | 771 | */ |
| 772 | 772 | public function load_controllers() { |
| 773 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
| 773 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
| 774 | 774 | // let's get it started |
| 775 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
| 776 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
| 777 | - $this->registry->load_core( 'Front_Controller', array(), false, true ); |
|
| 778 | - } else if ( ! EE_FRONT_AJAX ) { |
|
| 779 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
| 780 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
| 775 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
| 776 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
| 777 | + $this->registry->load_core('Front_Controller', array(), false, true); |
|
| 778 | + } else if ( ! EE_FRONT_AJAX) { |
|
| 779 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
| 780 | + EE_Registry::instance()->load_core('Admin'); |
|
| 781 | 781 | } |
| 782 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
| 782 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | |
@@ -793,9 +793,9 @@ discard block |
||
| 793 | 793 | * @return void |
| 794 | 794 | */ |
| 795 | 795 | public function core_loaded_and_ready() { |
| 796 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
| 797 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
| 798 | - $this->registry->load_core( 'Session' ); |
|
| 796 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
| 797 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
| 798 | + $this->registry->load_core('Session'); |
|
| 799 | 799 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
| 800 | 800 | } |
| 801 | 801 | |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | * @return void |
| 811 | 811 | */ |
| 812 | 812 | public function initialize() { |
| 813 | - do_action( 'AHEE__EE_System__initialize' ); |
|
| 813 | + do_action('AHEE__EE_System__initialize'); |
|
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | * @return void |
| 825 | 825 | */ |
| 826 | 826 | public function initialize_last() { |
| 827 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
| 827 | + do_action('AHEE__EE_System__initialize_last'); |
|
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | |
@@ -856,21 +856,21 @@ discard block |
||
| 856 | 856 | */ |
| 857 | 857 | public static function do_not_cache() { |
| 858 | 858 | // set no cache constants |
| 859 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
| 860 | - define( 'DONOTCACHEPAGE', true ); |
|
| 859 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
| 860 | + define('DONOTCACHEPAGE', true); |
|
| 861 | 861 | } |
| 862 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
| 863 | - define( 'DONOTCACHCEOBJECT', true ); |
|
| 862 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
| 863 | + define('DONOTCACHCEOBJECT', true); |
|
| 864 | 864 | } |
| 865 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
| 866 | - define( 'DONOTCACHEDB', true ); |
|
| 865 | + if ( ! defined('DONOTCACHEDB')) { |
|
| 866 | + define('DONOTCACHEDB', true); |
|
| 867 | 867 | } |
| 868 | 868 | // add no cache headers |
| 869 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
| 869 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
| 870 | 870 | // plus a little extra for nginx and Google Chrome |
| 871 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
| 871 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
| 872 | 872 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
| 873 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
| 873 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | * @param $headers |
| 883 | 883 | * @return array |
| 884 | 884 | */ |
| 885 | - public static function extra_nocache_headers ( $headers ) { |
|
| 885 | + public static function extra_nocache_headers($headers) { |
|
| 886 | 886 | // for NGINX |
| 887 | 887 | $headers['X-Accel-Expires'] = 0; |
| 888 | 888 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -911,14 +911,14 @@ discard block |
||
| 911 | 911 | * @param WP_Admin_Bar $admin_bar |
| 912 | 912 | * @return void |
| 913 | 913 | */ |
| 914 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
| 914 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
| 915 | 915 | |
| 916 | 916 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
| 917 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
| 917 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
| 918 | 918 | return; |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 921 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 922 | 922 | $menu_class = 'espresso_menu_item_class'; |
| 923 | 923 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
| 924 | 924 | //because they're only defined in each of their respective constructors |
@@ -930,20 +930,20 @@ discard block |
||
| 930 | 930 | //Top Level |
| 931 | 931 | $admin_bar->add_menu(array( |
| 932 | 932 | 'id' => 'espresso-toolbar', |
| 933 | - '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>', |
|
| 933 | + '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>', |
|
| 934 | 934 | 'href' => $events_admin_url, |
| 935 | 935 | 'meta' => array( |
| 936 | 936 | 'title' => __('Event Espresso', 'event_espresso'), |
| 937 | - 'class' => $menu_class . 'first' |
|
| 937 | + 'class' => $menu_class.'first' |
|
| 938 | 938 | ), |
| 939 | 939 | )); |
| 940 | 940 | |
| 941 | 941 | //Events |
| 942 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
| 942 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
| 943 | 943 | $admin_bar->add_menu(array( |
| 944 | 944 | 'id' => 'espresso-toolbar-events', |
| 945 | 945 | 'parent' => 'espresso-toolbar', |
| 946 | - 'title' => __( 'Events', 'event_espresso' ), |
|
| 946 | + 'title' => __('Events', 'event_espresso'), |
|
| 947 | 947 | 'href' => $events_admin_url, |
| 948 | 948 | 'meta' => array( |
| 949 | 949 | 'title' => __('Events', 'event_espresso'), |
@@ -954,13 +954,13 @@ discard block |
||
| 954 | 954 | } |
| 955 | 955 | |
| 956 | 956 | |
| 957 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
| 957 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
| 958 | 958 | //Events Add New |
| 959 | 959 | $admin_bar->add_menu(array( |
| 960 | 960 | 'id' => 'espresso-toolbar-events-new', |
| 961 | 961 | 'parent' => 'espresso-toolbar-events', |
| 962 | 962 | 'title' => __('Add New', 'event_espresso'), |
| 963 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
| 963 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
| 964 | 964 | 'meta' => array( |
| 965 | 965 | 'title' => __('Add New', 'event_espresso'), |
| 966 | 966 | 'target' => '', |
@@ -969,18 +969,18 @@ discard block |
||
| 969 | 969 | )); |
| 970 | 970 | } |
| 971 | 971 | |
| 972 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
| 972 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
| 973 | 973 | |
| 974 | 974 | //Current post |
| 975 | 975 | global $post; |
| 976 | 976 | |
| 977 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
| 977 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
| 978 | 978 | //Events Edit Current Event |
| 979 | 979 | $admin_bar->add_menu(array( |
| 980 | 980 | 'id' => 'espresso-toolbar-events-edit', |
| 981 | 981 | 'parent' => 'espresso-toolbar-events', |
| 982 | 982 | 'title' => __('Edit Event', 'event_espresso'), |
| 983 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
| 983 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
| 984 | 984 | 'meta' => array( |
| 985 | 985 | 'title' => __('Edit Event', 'event_espresso'), |
| 986 | 986 | 'target' => '', |
@@ -992,11 +992,11 @@ discard block |
||
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | //Events View |
| 995 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
| 995 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
| 996 | 996 | $admin_bar->add_menu(array( |
| 997 | 997 | 'id' => 'espresso-toolbar-events-view', |
| 998 | 998 | 'parent' => 'espresso-toolbar-events', |
| 999 | - 'title' => __( 'View', 'event_espresso' ), |
|
| 999 | + 'title' => __('View', 'event_espresso'), |
|
| 1000 | 1000 | 'href' => $events_admin_url, |
| 1001 | 1001 | 'meta' => array( |
| 1002 | 1002 | 'title' => __('View', 'event_espresso'), |
@@ -1006,12 +1006,12 @@ discard block |
||
| 1006 | 1006 | )); |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
| 1009 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
| 1010 | 1010 | //Events View All |
| 1011 | 1011 | $admin_bar->add_menu(array( |
| 1012 | 1012 | 'id' => 'espresso-toolbar-events-all', |
| 1013 | 1013 | 'parent' => 'espresso-toolbar-events-view', |
| 1014 | - 'title' => __( 'All', 'event_espresso' ), |
|
| 1014 | + 'title' => __('All', 'event_espresso'), |
|
| 1015 | 1015 | 'href' => $events_admin_url, |
| 1016 | 1016 | 'meta' => array( |
| 1017 | 1017 | 'title' => __('All', 'event_espresso'), |
@@ -1022,13 +1022,13 @@ discard block |
||
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | |
| 1025 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
| 1025 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
| 1026 | 1026 | //Events View Today |
| 1027 | 1027 | $admin_bar->add_menu(array( |
| 1028 | 1028 | 'id' => 'espresso-toolbar-events-today', |
| 1029 | 1029 | 'parent' => 'espresso-toolbar-events-view', |
| 1030 | 1030 | 'title' => __('Today', 'event_espresso'), |
| 1031 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
| 1031 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
| 1032 | 1032 | 'meta' => array( |
| 1033 | 1033 | 'title' => __('Today', 'event_espresso'), |
| 1034 | 1034 | 'target' => '', |
@@ -1038,13 +1038,13 @@ discard block |
||
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | |
| 1041 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
| 1041 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
| 1042 | 1042 | //Events View This Month |
| 1043 | 1043 | $admin_bar->add_menu(array( |
| 1044 | 1044 | 'id' => 'espresso-toolbar-events-month', |
| 1045 | 1045 | 'parent' => 'espresso-toolbar-events-view', |
| 1046 | - 'title' => __( 'This Month', 'event_espresso'), |
|
| 1047 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
| 1046 | + 'title' => __('This Month', 'event_espresso'), |
|
| 1047 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
| 1048 | 1048 | 'meta' => array( |
| 1049 | 1049 | 'title' => __('This Month', 'event_espresso'), |
| 1050 | 1050 | 'target' => '', |
@@ -1054,11 +1054,11 @@ discard block |
||
| 1054 | 1054 | } |
| 1055 | 1055 | |
| 1056 | 1056 | //Registration Overview |
| 1057 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
| 1057 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
| 1058 | 1058 | $admin_bar->add_menu(array( |
| 1059 | 1059 | 'id' => 'espresso-toolbar-registrations', |
| 1060 | 1060 | 'parent' => 'espresso-toolbar', |
| 1061 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
| 1061 | + 'title' => __('Registrations', 'event_espresso'), |
|
| 1062 | 1062 | 'href' => $reg_admin_url, |
| 1063 | 1063 | 'meta' => array( |
| 1064 | 1064 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1069,12 +1069,12 @@ discard block |
||
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | 1071 | //Registration Overview Today |
| 1072 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
| 1072 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
| 1073 | 1073 | $admin_bar->add_menu(array( |
| 1074 | 1074 | 'id' => 'espresso-toolbar-registrations-today', |
| 1075 | 1075 | 'parent' => 'espresso-toolbar-registrations', |
| 1076 | - 'title' => __( 'Today', 'event_espresso'), |
|
| 1077 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
| 1076 | + 'title' => __('Today', 'event_espresso'), |
|
| 1077 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
| 1078 | 1078 | 'meta' => array( |
| 1079 | 1079 | 'title' => __('Today', 'event_espresso'), |
| 1080 | 1080 | 'target' => '', |
@@ -1084,14 +1084,14 @@ discard block |
||
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | //Registration Overview Today Completed |
| 1087 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
| 1087 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
| 1088 | 1088 | $admin_bar->add_menu(array( |
| 1089 | 1089 | 'id' => 'espresso-toolbar-registrations-today-approved', |
| 1090 | 1090 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1091 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
| 1092 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
| 1091 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1092 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
| 1093 | 1093 | 'meta' => array( |
| 1094 | - 'title' => __('Approved', 'event_espresso' ), |
|
| 1094 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1095 | 1095 | 'target' => '', |
| 1096 | 1096 | 'class' => $menu_class |
| 1097 | 1097 | ), |
@@ -1099,14 +1099,14 @@ discard block |
||
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | //Registration Overview Today Pending\ |
| 1102 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
| 1102 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
| 1103 | 1103 | $admin_bar->add_menu(array( |
| 1104 | 1104 | 'id' => 'espresso-toolbar-registrations-today-pending', |
| 1105 | 1105 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1106 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
| 1107 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
| 1106 | + 'title' => __('Pending', 'event_espresso'), |
|
| 1107 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
| 1108 | 1108 | 'meta' => array( |
| 1109 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
| 1109 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
| 1110 | 1110 | 'target' => '', |
| 1111 | 1111 | 'class' => $menu_class |
| 1112 | 1112 | ), |
@@ -1114,14 +1114,14 @@ discard block |
||
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | 1116 | //Registration Overview Today Incomplete |
| 1117 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
| 1117 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
| 1118 | 1118 | $admin_bar->add_menu(array( |
| 1119 | 1119 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
| 1120 | 1120 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1121 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
| 1122 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
| 1121 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1122 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
| 1123 | 1123 | 'meta' => array( |
| 1124 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
| 1124 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1125 | 1125 | 'target' => '', |
| 1126 | 1126 | 'class' => $menu_class |
| 1127 | 1127 | ), |
@@ -1129,12 +1129,12 @@ discard block |
||
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | 1131 | //Registration Overview Today Incomplete |
| 1132 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
| 1132 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
| 1133 | 1133 | $admin_bar->add_menu(array( |
| 1134 | 1134 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
| 1135 | 1135 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1136 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
| 1137 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
| 1136 | + 'title' => __('Cancelled', 'event_espresso'), |
|
| 1137 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
| 1138 | 1138 | 'meta' => array( |
| 1139 | 1139 | 'title' => __('Cancelled', 'event_espresso'), |
| 1140 | 1140 | 'target' => '', |
@@ -1144,12 +1144,12 @@ discard block |
||
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | //Registration Overview This Month |
| 1147 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
| 1147 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
| 1148 | 1148 | $admin_bar->add_menu(array( |
| 1149 | 1149 | 'id' => 'espresso-toolbar-registrations-month', |
| 1150 | 1150 | 'parent' => 'espresso-toolbar-registrations', |
| 1151 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
| 1152 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
| 1151 | + 'title' => __('This Month', 'event_espresso'), |
|
| 1152 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
| 1153 | 1153 | 'meta' => array( |
| 1154 | 1154 | 'title' => __('This Month', 'event_espresso'), |
| 1155 | 1155 | 'target' => '', |
@@ -1159,12 +1159,12 @@ discard block |
||
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | //Registration Overview This Month Approved |
| 1162 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
| 1162 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
| 1163 | 1163 | $admin_bar->add_menu(array( |
| 1164 | 1164 | 'id' => 'espresso-toolbar-registrations-month-approved', |
| 1165 | 1165 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1166 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
| 1167 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
| 1166 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1167 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
| 1168 | 1168 | 'meta' => array( |
| 1169 | 1169 | 'title' => __('Approved', 'event_espresso'), |
| 1170 | 1170 | 'target' => '', |
@@ -1174,12 +1174,12 @@ discard block |
||
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | //Registration Overview This Month Pending |
| 1177 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
| 1177 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
| 1178 | 1178 | $admin_bar->add_menu(array( |
| 1179 | 1179 | 'id' => 'espresso-toolbar-registrations-month-pending', |
| 1180 | 1180 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1181 | - 'title' => __( 'Pending', 'event_espresso'), |
|
| 1182 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
| 1181 | + 'title' => __('Pending', 'event_espresso'), |
|
| 1182 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
| 1183 | 1183 | 'meta' => array( |
| 1184 | 1184 | 'title' => __('Pending', 'event_espresso'), |
| 1185 | 1185 | 'target' => '', |
@@ -1189,14 +1189,14 @@ discard block |
||
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | 1191 | //Registration Overview This Month Not Approved |
| 1192 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
| 1192 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
| 1193 | 1193 | $admin_bar->add_menu(array( |
| 1194 | 1194 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
| 1195 | 1195 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1196 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
| 1197 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
| 1196 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1197 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
| 1198 | 1198 | 'meta' => array( |
| 1199 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
| 1199 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1200 | 1200 | 'target' => '', |
| 1201 | 1201 | 'class' => $menu_class |
| 1202 | 1202 | ), |
@@ -1205,12 +1205,12 @@ discard block |
||
| 1205 | 1205 | |
| 1206 | 1206 | |
| 1207 | 1207 | //Registration Overview This Month Cancelled |
| 1208 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
| 1208 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
| 1209 | 1209 | $admin_bar->add_menu(array( |
| 1210 | 1210 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
| 1211 | 1211 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1212 | 1212 | 'title' => __('Cancelled', 'event_espresso'), |
| 1213 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
| 1213 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
| 1214 | 1214 | 'meta' => array( |
| 1215 | 1215 | 'title' => __('Cancelled', 'event_espresso'), |
| 1216 | 1216 | 'target' => '', |
@@ -1220,11 +1220,11 @@ discard block |
||
| 1220 | 1220 | } |
| 1221 | 1221 | |
| 1222 | 1222 | //Extensions & Services |
| 1223 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
| 1223 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
| 1224 | 1224 | $admin_bar->add_menu(array( |
| 1225 | 1225 | 'id' => 'espresso-toolbar-extensions-and-services', |
| 1226 | 1226 | 'parent' => 'espresso-toolbar', |
| 1227 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
| 1227 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
| 1228 | 1228 | 'href' => $extensions_admin_url, |
| 1229 | 1229 | 'meta' => array( |
| 1230 | 1230 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1246,8 +1246,8 @@ discard block |
||
| 1246 | 1246 | * @param array $exclude_array any existing pages being excluded are in this array. |
| 1247 | 1247 | * @return array |
| 1248 | 1248 | */ |
| 1249 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
| 1250 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
| 1249 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
| 1250 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | 1253 | |
@@ -1267,12 +1267,12 @@ discard block |
||
| 1267 | 1267 | */ |
| 1268 | 1268 | public function wp_enqueue_scripts() { |
| 1269 | 1269 | // 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' ); |
| 1270 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
| 1270 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
| 1271 | 1271 | // 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' ); |
| 1272 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
| 1272 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
| 1273 | 1273 | // register jQuery Validate and additional methods |
| 1274 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE ); |
|
| 1275 | - wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE ); |
|
| 1274 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
| 1275 | + wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE); |
|
| 1276 | 1276 | } |
| 1277 | 1277 | } |
| 1278 | 1278 | } |