@@ -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,11 +101,11 @@ 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 | |
| 107 | 107 | //make sure none of the old hooks are left hanging around |
| 108 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
| 108 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
| 109 | 109 | |
| 110 | 110 | //we need to reset the migration manager in order for it to detect DMSs properly |
| 111 | 111 | EE_Data_Migration_Manager::reset(); |
@@ -125,28 +125,28 @@ discard block |
||
| 125 | 125 | * @access private |
| 126 | 126 | * @param \EE_Registry $Registry |
| 127 | 127 | */ |
| 128 | - private function __construct( EE_Registry $Registry ) { |
|
| 128 | + private function __construct(EE_Registry $Registry) { |
|
| 129 | 129 | $this->registry = $Registry; |
| 130 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
| 130 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
| 131 | 131 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
| 132 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
| 132 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
| 133 | 133 | // when an ee addon is activated, we want to call the core hook(s) again |
| 134 | 134 | // because the newly-activated addon didn't get a chance to run at all |
| 135 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
| 135 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
| 136 | 136 | // detect whether install or upgrade |
| 137 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
| 137 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
| 138 | 138 | // load EE_Config, EE_Textdomain, etc |
| 139 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
| 139 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
| 140 | 140 | // load EE_Config, EE_Textdomain, etc |
| 141 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
| 141 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
| 142 | 142 | // you wanna get going? I wanna get going... let's get going! |
| 143 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
| 143 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
| 144 | 144 | //other housekeeping |
| 145 | 145 | //exclude EE critical pages from wp_list_pages |
| 146 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
| 146 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
| 147 | 147 | // ALL EE Addons should use the following hook point to attach their initial setup too |
| 148 | 148 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
| 149 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
| 149 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -166,30 +166,30 @@ discard block |
||
| 166 | 166 | public function load_espresso_addons() { |
| 167 | 167 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
| 168 | 168 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
| 169 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
| 169 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
| 170 | 170 | //load and setup EE_Capabilities |
| 171 | - $this->registry->load_core( 'Capabilities' ); |
|
| 171 | + $this->registry->load_core('Capabilities'); |
|
| 172 | 172 | //caps need to be initialized on every request so that capability maps are set. |
| 173 | 173 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
| 174 | 174 | $this->registry->CAP->init_caps(); |
| 175 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
| 175 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
| 176 | 176 | //if the WP API basic auth plugin isn't already loaded, load it now. |
| 177 | 177 | //We want it for mobile apps. Just include the entire plugin |
| 178 | 178 | //also, don't load the basic auth when a plugin is getting activated, because |
| 179 | 179 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
| 180 | 180 | //and causes a fatal error |
| 181 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
| 182 | - && ! function_exists( 'json_basic_auth_error' ) |
|
| 181 | + if ( ! function_exists('json_basic_auth_handler') |
|
| 182 | + && ! function_exists('json_basic_auth_error') |
|
| 183 | 183 | && ! ( |
| 184 | - isset( $_GET[ 'action'] ) |
|
| 185 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
| 184 | + isset($_GET['action']) |
|
| 185 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
| 186 | 186 | ) |
| 187 | 187 | && ! ( |
| 188 | - isset( $_GET['activate' ] ) |
|
| 189 | - && $_GET['activate' ] === 'true' |
|
| 188 | + isset($_GET['activate']) |
|
| 189 | + && $_GET['activate'] === 'true' |
|
| 190 | 190 | ) |
| 191 | 191 | ) { |
| 192 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
| 192 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
@@ -205,10 +205,10 @@ discard block |
||
| 205 | 205 | * @access public |
| 206 | 206 | * @return void |
| 207 | 207 | */ |
| 208 | - public function detect_activations_or_upgrades(){ |
|
| 208 | + public function detect_activations_or_upgrades() { |
|
| 209 | 209 | //first off: let's make sure to handle core |
| 210 | 210 | $this->detect_if_activation_or_upgrade(); |
| 211 | - foreach($this->registry->addons as $addon){ |
|
| 211 | + foreach ($this->registry->addons as $addon) { |
|
| 212 | 212 | //detect teh request type for that addon |
| 213 | 213 | $addon->detect_activation_or_upgrade(); |
| 214 | 214 | } |
@@ -229,41 +229,41 @@ discard block |
||
| 229 | 229 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
| 230 | 230 | |
| 231 | 231 | // load M-Mode class |
| 232 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
| 232 | + $this->registry->load_core('Maintenance_Mode'); |
|
| 233 | 233 | // check if db has been updated, or if its a brand-new installation |
| 234 | 234 | |
| 235 | 235 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
| 236 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
| 236 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
| 237 | 237 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
| 238 | 238 | |
| 239 | - switch($request_type){ |
|
| 239 | + switch ($request_type) { |
|
| 240 | 240 | case EE_System::req_type_new_activation: |
| 241 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
| 242 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 241 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
| 242 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 243 | 243 | break; |
| 244 | 244 | case EE_System::req_type_reactivation: |
| 245 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
| 246 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 245 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
| 246 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 247 | 247 | break; |
| 248 | 248 | case EE_System::req_type_upgrade: |
| 249 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
| 249 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
| 250 | 250 | //migrations may be required now that we've upgraded |
| 251 | 251 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
| 252 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 252 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 253 | 253 | // echo "done upgrade";die; |
| 254 | 254 | break; |
| 255 | 255 | case EE_System::req_type_downgrade: |
| 256 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
| 256 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
| 257 | 257 | //its possible migrations are no longer required |
| 258 | 258 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
| 259 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 259 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 260 | 260 | break; |
| 261 | 261 | case EE_System::req_type_normal: |
| 262 | 262 | default: |
| 263 | 263 | // $this->_maybe_redirect_to_ee_about(); |
| 264 | 264 | break; |
| 265 | 265 | } |
| 266 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
| 266 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | * initializing the database later during the request |
| 272 | 272 | * @param array $espresso_db_update |
| 273 | 273 | */ |
| 274 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
| 275 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
| 274 | + protected function _handle_core_version_change($espresso_db_update) { |
|
| 275 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
| 276 | 276 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
| 277 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
| 277 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | |
@@ -289,44 +289,44 @@ discard block |
||
| 289 | 289 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
| 290 | 290 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
| 291 | 291 | */ |
| 292 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
| 293 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
| 294 | - if( ! $espresso_db_update){ |
|
| 295 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
| 292 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
| 293 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
| 294 | + if ( ! $espresso_db_update) { |
|
| 295 | + $espresso_db_update = get_option('espresso_db_update'); |
|
| 296 | 296 | } |
| 297 | 297 | // check that option is an array |
| 298 | - if( ! is_array( $espresso_db_update )) { |
|
| 298 | + if ( ! is_array($espresso_db_update)) { |
|
| 299 | 299 | // if option is FALSE, then it never existed |
| 300 | - if ( $espresso_db_update === FALSE ) { |
|
| 300 | + if ($espresso_db_update === FALSE) { |
|
| 301 | 301 | // make $espresso_db_update an array and save option with autoload OFF |
| 302 | - $espresso_db_update = array(); |
|
| 303 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
| 302 | + $espresso_db_update = array(); |
|
| 303 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
| 304 | 304 | } else { |
| 305 | 305 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
| 306 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
| 307 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
| 306 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
| 307 | + update_option('espresso_db_update', $espresso_db_update); |
|
| 308 | 308 | } |
| 309 | - }else{ |
|
| 309 | + } else { |
|
| 310 | 310 | $corrected_db_update = array(); |
| 311 | 311 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
| 312 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
| 313 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
| 312 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
| 313 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
| 314 | 314 | //the key is an int, and the value IS NOT an array |
| 315 | 315 | //so it must be numerically-indexed, where values are versions installed... |
| 316 | 316 | //fix it! |
| 317 | 317 | $version_string = $should_be_array; |
| 318 | 318 | $corrected_db_update[$version_string] = array('unknown-date'); |
| 319 | - }else{ |
|
| 319 | + } else { |
|
| 320 | 320 | //ok it checks out |
| 321 | 321 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | $espresso_db_update = $corrected_db_update; |
| 325 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
| 325 | + update_option('espresso_db_update', $espresso_db_update); |
|
| 326 | 326 | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
| 329 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
| 330 | 330 | return $espresso_db_update; |
| 331 | 331 | } |
| 332 | 332 | |
@@ -346,34 +346,34 @@ discard block |
||
| 346 | 346 | * so we prefer to only do it when necessary |
| 347 | 347 | * @return void |
| 348 | 348 | */ |
| 349 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
| 349 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
| 350 | 350 | $request_type = $this->detect_req_type(); |
| 351 | 351 | //only initialize system if we're not in maintenance mode. |
| 352 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
| 353 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
| 352 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
| 353 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
| 354 | 354 | |
| 355 | - if( $verify_schema ) { |
|
| 355 | + if ($verify_schema) { |
|
| 356 | 356 | EEH_Activation::initialize_db_and_folders(); |
| 357 | 357 | } |
| 358 | 358 | EEH_Activation::initialize_db_content(); |
| 359 | 359 | EEH_Activation::system_initialization(); |
| 360 | - if( $initialize_addons_too ) { |
|
| 360 | + if ($initialize_addons_too) { |
|
| 361 | 361 | $this->initialize_addons(); |
| 362 | 362 | } |
| 363 | - }else{ |
|
| 364 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
| 363 | + } else { |
|
| 364 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
| 365 | 365 | } |
| 366 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
| 367 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
| 366 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
| 367 | + add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
| 372 | 372 | * Initializes the db for all registered addons |
| 373 | 373 | */ |
| 374 | - public function initialize_addons(){ |
|
| 374 | + public function initialize_addons() { |
|
| 375 | 375 | //foreach registered addon, make sure its db is up-to-date too |
| 376 | - foreach($this->registry->addons as $addon){ |
|
| 376 | + foreach ($this->registry->addons as $addon) { |
|
| 377 | 377 | $addon->initialize_db_if_no_migrations_required(); |
| 378 | 378 | } |
| 379 | 379 | } |
@@ -385,16 +385,16 @@ discard block |
||
| 385 | 385 | * @param string $current_version_to_add version to be added to the version history |
| 386 | 386 | * @return boolean success as to whether or not this option was changed |
| 387 | 387 | */ |
| 388 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
| 389 | - if( ! $version_history ) { |
|
| 388 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
| 389 | + if ( ! $version_history) { |
|
| 390 | 390 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
| 391 | 391 | } |
| 392 | - if( $current_version_to_add == NULL){ |
|
| 392 | + if ($current_version_to_add == NULL) { |
|
| 393 | 393 | $current_version_to_add = espresso_version(); |
| 394 | 394 | } |
| 395 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
| 395 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
| 396 | 396 | // re-save |
| 397 | - return update_option( 'espresso_db_update', $version_history ); |
|
| 397 | + return update_option('espresso_db_update', $version_history); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | |
@@ -411,10 +411,10 @@ discard block |
||
| 411 | 411 | * but still know if this is a new install or not |
| 412 | 412 | * @return int one of the constants on EE_System::req_type_ |
| 413 | 413 | */ |
| 414 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
| 415 | - if ( $this->_req_type === NULL ){ |
|
| 416 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
| 417 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
| 414 | + public function detect_req_type($espresso_db_update = NULL) { |
|
| 415 | + if ($this->_req_type === NULL) { |
|
| 416 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
| 417 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
| 418 | 418 | } |
| 419 | 419 | return $this->_req_type; |
| 420 | 420 | } |
@@ -430,39 +430,39 @@ discard block |
||
| 430 | 430 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
| 431 | 431 | * @return int one of the constants on EE_System::req_type_* |
| 432 | 432 | */ |
| 433 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
| 434 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
| 435 | - if( $activation_history_for_addon ){ |
|
| 433 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
| 434 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
| 435 | + if ($activation_history_for_addon) { |
|
| 436 | 436 | //it exists, so this isn't a completely new install |
| 437 | 437 | //check if this version already in that list of previously installed versions |
| 438 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
| 438 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
| 439 | 439 | //it a version we haven't seen before |
| 440 | - if( $version_is_higher === 1 ){ |
|
| 440 | + if ($version_is_higher === 1) { |
|
| 441 | 441 | $req_type = EE_System::req_type_upgrade; |
| 442 | - }else{ |
|
| 442 | + } else { |
|
| 443 | 443 | $req_type = EE_System::req_type_downgrade; |
| 444 | 444 | } |
| 445 | - delete_option( $activation_indicator_option_name ); |
|
| 445 | + delete_option($activation_indicator_option_name); |
|
| 446 | 446 | } else { |
| 447 | 447 | // its not an update. maybe a reactivation? |
| 448 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
| 449 | - if ( $version_is_higher === -1 ){ |
|
| 448 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
| 449 | + if ($version_is_higher === -1) { |
|
| 450 | 450 | $req_type = EE_System::req_type_downgrade; |
| 451 | - }elseif( $version_is_higher === 0 ){ |
|
| 451 | + }elseif ($version_is_higher === 0) { |
|
| 452 | 452 | //we've seen this version before, but it's an activation. must be a reactivation |
| 453 | 453 | $req_type = EE_System::req_type_reactivation; |
| 454 | - }else{//$version_is_higher === 1 |
|
| 454 | + } else {//$version_is_higher === 1 |
|
| 455 | 455 | $req_type = EE_System::req_type_upgrade; |
| 456 | 456 | } |
| 457 | - delete_option( $activation_indicator_option_name ); |
|
| 457 | + delete_option($activation_indicator_option_name); |
|
| 458 | 458 | } else { |
| 459 | 459 | //we've seen this version before and the activation indicate doesn't show it was just activated |
| 460 | - if ( $version_is_higher === -1 ){ |
|
| 460 | + if ($version_is_higher === -1) { |
|
| 461 | 461 | $req_type = EE_System::req_type_downgrade; |
| 462 | - }elseif( $version_is_higher === 0 ){ |
|
| 462 | + }elseif ($version_is_higher === 0) { |
|
| 463 | 463 | //we've seen this version before and it's not an activation. its normal request |
| 464 | 464 | $req_type = EE_System::req_type_normal; |
| 465 | - }else{//$version_is_higher === 1 |
|
| 465 | + } else {//$version_is_higher === 1 |
|
| 466 | 466 | $req_type = EE_System::req_type_upgrade; |
| 467 | 467 | } |
| 468 | 468 | } |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | } else { |
| 471 | 471 | //brand new install |
| 472 | 472 | $req_type = EE_System::req_type_new_activation; |
| 473 | - delete_option( $activation_indicator_option_name ); |
|
| 473 | + delete_option($activation_indicator_option_name); |
|
| 474 | 474 | } |
| 475 | 475 | return $req_type; |
| 476 | 476 | } |
@@ -488,30 +488,30 @@ discard block |
||
| 488 | 488 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
| 489 | 489 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
| 490 | 490 | */ |
| 491 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
| 491 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
| 492 | 492 | //find the most recently-activated version |
| 493 | 493 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
| 494 | 494 | $most_recently_active_version = '0.0.0.dev.000'; |
| 495 | - if( is_array( $activation_history_for_addon ) ){ |
|
| 496 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
| 495 | + if (is_array($activation_history_for_addon)) { |
|
| 496 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
| 497 | 497 | //check there is a record of when this version was activated. Otherwise, |
| 498 | 498 | //mark it as unknown |
| 499 | - if( ! $times_activated ){ |
|
| 500 | - $times_activated = array( 'unknown-date'); |
|
| 499 | + if ( ! $times_activated) { |
|
| 500 | + $times_activated = array('unknown-date'); |
|
| 501 | 501 | } |
| 502 | - if( is_string( $times_activated ) ){ |
|
| 503 | - $times_activated = array( $times_activated ); |
|
| 502 | + if (is_string($times_activated)) { |
|
| 503 | + $times_activated = array($times_activated); |
|
| 504 | 504 | } |
| 505 | - foreach( $times_activated as $an_activation ){ |
|
| 506 | - if( $an_activation != 'unknown-date' && |
|
| 507 | - $an_activation > $most_recently_active_version_activation ){ |
|
| 505 | + foreach ($times_activated as $an_activation) { |
|
| 506 | + if ($an_activation != 'unknown-date' && |
|
| 507 | + $an_activation > $most_recently_active_version_activation) { |
|
| 508 | 508 | $most_recently_active_version = $version; |
| 509 | 509 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
| 514 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | |
@@ -521,24 +521,24 @@ discard block |
||
| 521 | 521 | * @return void |
| 522 | 522 | */ |
| 523 | 523 | public function redirect_to_about_ee() { |
| 524 | - $notices = EE_Error::get_notices( FALSE ); |
|
| 524 | + $notices = EE_Error::get_notices(FALSE); |
|
| 525 | 525 | //if current user is an admin and it's not an ajax request |
| 526 | 526 | if ( |
| 527 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
| 528 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
| 529 | - && ! isset( $notices[ 'errors' ] ) |
|
| 527 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
| 528 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
| 529 | + && ! isset($notices['errors']) |
|
| 530 | 530 | ) { |
| 531 | - $query_params = array( 'page' => 'espresso_about' ); |
|
| 531 | + $query_params = array('page' => 'espresso_about'); |
|
| 532 | 532 | |
| 533 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
| 533 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
| 534 | 534 | $query_params['new_activation'] = TRUE; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
| 537 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
| 538 | 538 | $query_params['reactivation'] = TRUE; |
| 539 | 539 | } |
| 540 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
| 541 | - wp_safe_redirect( $url ); |
|
| 540 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
| 541 | + wp_safe_redirect($url); |
|
| 542 | 542 | exit(); |
| 543 | 543 | } |
| 544 | 544 | } |
@@ -552,31 +552,31 @@ discard block |
||
| 552 | 552 | * |
| 553 | 553 | * @return void |
| 554 | 554 | */ |
| 555 | - public function load_core_configuration(){ |
|
| 556 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
| 557 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
| 555 | + public function load_core_configuration() { |
|
| 556 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
| 557 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
| 558 | 558 | //load textdomain |
| 559 | 559 | EE_Load_Textdomain::load_textdomain(); |
| 560 | 560 | // load and setup EE_Config and EE_Network_Config |
| 561 | - $this->registry->load_core( 'Config' ); |
|
| 562 | - $this->registry->load_core( 'Network_Config' ); |
|
| 561 | + $this->registry->load_core('Config'); |
|
| 562 | + $this->registry->load_core('Network_Config'); |
|
| 563 | 563 | // setup autoloaders |
| 564 | 564 | // enable logging? |
| 565 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
| 566 | - $this->registry->load_core( 'Log' ); |
|
| 565 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
| 566 | + $this->registry->load_core('Log'); |
|
| 567 | 567 | } |
| 568 | 568 | // check for activation errors |
| 569 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
| 570 | - if ( $activation_errors ) { |
|
| 571 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 572 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
| 569 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
| 570 | + if ($activation_errors) { |
|
| 571 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
| 572 | + update_option('ee_plugin_activation_errors', FALSE); |
|
| 573 | 573 | } |
| 574 | 574 | // get model names |
| 575 | 575 | $this->_parse_model_names(); |
| 576 | 576 | |
| 577 | 577 | //load caf stuff a chance to play during the activation process too. |
| 578 | 578 | $this->_maybe_brew_regular(); |
| 579 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
| 579 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | |
@@ -585,23 +585,23 @@ discard block |
||
| 585 | 585 | * |
| 586 | 586 | * @return void |
| 587 | 587 | */ |
| 588 | - private function _parse_model_names(){ |
|
| 588 | + private function _parse_model_names() { |
|
| 589 | 589 | //get all the files in the EE_MODELS folder that end in .model.php |
| 590 | - $models = glob( EE_MODELS.'*.model.php'); |
|
| 590 | + $models = glob(EE_MODELS.'*.model.php'); |
|
| 591 | 591 | $model_names = array(); |
| 592 | 592 | $non_abstract_db_models = array(); |
| 593 | - foreach( $models as $model ){ |
|
| 593 | + foreach ($models as $model) { |
|
| 594 | 594 | // get model classname |
| 595 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
| 596 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
| 595 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
| 596 | + $short_name = str_replace('EEM_', '', $classname); |
|
| 597 | 597 | $reflectionClass = new ReflectionClass($classname); |
| 598 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
| 599 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
| 598 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
| 599 | + $non_abstract_db_models[$short_name] = $classname; |
|
| 600 | 600 | } |
| 601 | - $model_names[ $short_name ] = $classname; |
|
| 601 | + $model_names[$short_name] = $classname; |
|
| 602 | 602 | } |
| 603 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
| 604 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
| 603 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
| 604 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | |
@@ -611,8 +611,8 @@ discard block |
||
| 611 | 611 | * @return void |
| 612 | 612 | */ |
| 613 | 613 | private function _maybe_brew_regular() { |
| 614 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
| 615 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
| 614 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
| 615 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | * @return void |
| 630 | 630 | */ |
| 631 | 631 | public function register_shortcodes_modules_and_widgets() { |
| 632 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
| 632 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
| 633 | 633 | // check for addons using old hookpoint |
| 634 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
| 634 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
| 635 | 635 | $this->_incompatible_addon_error(); |
| 636 | 636 | } |
| 637 | 637 | } |
@@ -645,19 +645,19 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | private function _incompatible_addon_error() { |
| 647 | 647 | // get array of classes hooking into here |
| 648 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
| 649 | - if ( ! empty( $class_names )) { |
|
| 650 | - $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 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
| 649 | + if ( ! empty($class_names)) { |
|
| 650 | + $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'); |
|
| 651 | 651 | $msg .= '<ul>'; |
| 652 | - foreach ( $class_names as $class_name ) { |
|
| 653 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
| 652 | + foreach ($class_names as $class_name) { |
|
| 653 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
| 654 | 654 | } |
| 655 | 655 | $msg .= '</ul>'; |
| 656 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
| 656 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
| 657 | 657 | // save list of incompatible addons to wp-options for later use |
| 658 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
| 659 | - if ( is_admin() ) { |
|
| 660 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 658 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
| 659 | + if (is_admin()) { |
|
| 660 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | } |
@@ -674,26 +674,26 @@ discard block |
||
| 674 | 674 | * |
| 675 | 675 | * @return void |
| 676 | 676 | */ |
| 677 | - public function brew_espresso(){ |
|
| 678 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
| 677 | + public function brew_espresso() { |
|
| 678 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
| 679 | 679 | // load some final core systems |
| 680 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
| 681 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
| 682 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
| 683 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
| 684 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
| 685 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
| 686 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
| 687 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
| 688 | - add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
| 689 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
| 690 | - |
|
| 691 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
| 680 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
| 681 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
| 682 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
| 683 | + add_action('init', array($this, 'load_controllers'), 7); |
|
| 684 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
| 685 | + add_action('init', array($this, 'initialize'), 10); |
|
| 686 | + add_action('init', array($this, 'initialize_last'), 100); |
|
| 687 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
| 688 | + add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
| 689 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
| 690 | + |
|
| 691 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
| 692 | 692 | // pew pew pew |
| 693 | - $this->registry->load_core( 'PUE' ); |
|
| 694 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
| 693 | + $this->registry->load_core('PUE'); |
|
| 694 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
| 695 | 695 | } |
| 696 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
| 696 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | */ |
| 708 | 708 | public function set_hooks_for_core() { |
| 709 | 709 | $this->_deactivate_incompatible_addons(); |
| 710 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
| 710 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | |
@@ -716,15 +716,15 @@ discard block |
||
| 716 | 716 | * Using the information gathered in EE_System::_incompatible_addon_error, |
| 717 | 717 | * deactivates any addons considered incompatible with the current version of EE |
| 718 | 718 | */ |
| 719 | - private function _deactivate_incompatible_addons(){ |
|
| 720 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
| 721 | - if ( ! empty( $incompatible_addons )) { |
|
| 722 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
| 723 | - foreach ( $active_plugins as $active_plugin ) { |
|
| 724 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
| 725 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
| 726 | - unset( $_GET['activate'] ); |
|
| 727 | - espresso_deactivate_plugin( $active_plugin ); |
|
| 719 | + private function _deactivate_incompatible_addons() { |
|
| 720 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
| 721 | + if ( ! empty($incompatible_addons)) { |
|
| 722 | + $active_plugins = get_option('active_plugins', array()); |
|
| 723 | + foreach ($active_plugins as $active_plugin) { |
|
| 724 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
| 725 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
| 726 | + unset($_GET['activate']); |
|
| 727 | + espresso_deactivate_plugin($active_plugin); |
|
| 728 | 728 | } |
| 729 | 729 | } |
| 730 | 730 | } |
@@ -741,10 +741,10 @@ discard block |
||
| 741 | 741 | */ |
| 742 | 742 | public function perform_activations_upgrades_and_migrations() { |
| 743 | 743 | //first check if we had previously attempted to setup EE's directories but failed |
| 744 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
| 744 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
| 745 | 745 | EEH_Activation::create_upload_directories(); |
| 746 | 746 | } |
| 747 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
| 747 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | |
@@ -756,10 +756,10 @@ discard block |
||
| 756 | 756 | * @return void |
| 757 | 757 | */ |
| 758 | 758 | public function load_CPTs_and_session() { |
| 759 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
| 759 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
| 760 | 760 | // register Custom Post Types |
| 761 | - $this->registry->load_core( 'Register_CPTs' ); |
|
| 762 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
| 761 | + $this->registry->load_core('Register_CPTs'); |
|
| 762 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | |
@@ -774,16 +774,16 @@ discard block |
||
| 774 | 774 | * @return void |
| 775 | 775 | */ |
| 776 | 776 | public function load_controllers() { |
| 777 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
| 777 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
| 778 | 778 | // let's get it started |
| 779 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
| 780 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
| 781 | - $this->registry->load_core( 'Front_Controller', array(), false, true ); |
|
| 782 | - } else if ( ! EE_FRONT_AJAX ) { |
|
| 783 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
| 784 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
| 779 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
| 780 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
| 781 | + $this->registry->load_core('Front_Controller', array(), false, true); |
|
| 782 | + } else if ( ! EE_FRONT_AJAX) { |
|
| 783 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
| 784 | + EE_Registry::instance()->load_core('Admin'); |
|
| 785 | 785 | } |
| 786 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
| 786 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | |
@@ -797,9 +797,9 @@ discard block |
||
| 797 | 797 | * @return void |
| 798 | 798 | */ |
| 799 | 799 | public function core_loaded_and_ready() { |
| 800 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
| 801 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
| 802 | - $this->registry->load_core( 'Session' ); |
|
| 800 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
| 801 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
| 802 | + $this->registry->load_core('Session'); |
|
| 803 | 803 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
| 804 | 804 | } |
| 805 | 805 | |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | * @return void |
| 815 | 815 | */ |
| 816 | 816 | public function initialize() { |
| 817 | - do_action( 'AHEE__EE_System__initialize' ); |
|
| 817 | + do_action('AHEE__EE_System__initialize'); |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | * @return void |
| 829 | 829 | */ |
| 830 | 830 | public function initialize_last() { |
| 831 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
| 831 | + do_action('AHEE__EE_System__initialize_last'); |
|
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | |
@@ -860,21 +860,21 @@ discard block |
||
| 860 | 860 | */ |
| 861 | 861 | public static function do_not_cache() { |
| 862 | 862 | // set no cache constants |
| 863 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
| 864 | - define( 'DONOTCACHEPAGE', true ); |
|
| 863 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
| 864 | + define('DONOTCACHEPAGE', true); |
|
| 865 | 865 | } |
| 866 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
| 867 | - define( 'DONOTCACHCEOBJECT', true ); |
|
| 866 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
| 867 | + define('DONOTCACHCEOBJECT', true); |
|
| 868 | 868 | } |
| 869 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
| 870 | - define( 'DONOTCACHEDB', true ); |
|
| 869 | + if ( ! defined('DONOTCACHEDB')) { |
|
| 870 | + define('DONOTCACHEDB', true); |
|
| 871 | 871 | } |
| 872 | 872 | // add no cache headers |
| 873 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
| 873 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
| 874 | 874 | // plus a little extra for nginx and Google Chrome |
| 875 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
| 875 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
| 876 | 876 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
| 877 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
| 877 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | * @param $headers |
| 887 | 887 | * @return array |
| 888 | 888 | */ |
| 889 | - public static function extra_nocache_headers ( $headers ) { |
|
| 889 | + public static function extra_nocache_headers($headers) { |
|
| 890 | 890 | // for NGINX |
| 891 | 891 | $headers['X-Accel-Expires'] = 0; |
| 892 | 892 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -915,14 +915,14 @@ discard block |
||
| 915 | 915 | * @param WP_Admin_Bar $admin_bar |
| 916 | 916 | * @return void |
| 917 | 917 | */ |
| 918 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
| 918 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
| 919 | 919 | |
| 920 | 920 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
| 921 | - 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' )) { |
|
| 921 | + 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')) { |
|
| 922 | 922 | return; |
| 923 | 923 | } |
| 924 | 924 | |
| 925 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 925 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 926 | 926 | $menu_class = 'espresso_menu_item_class'; |
| 927 | 927 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
| 928 | 928 | //because they're only defined in each of their respective constructors |
@@ -934,20 +934,20 @@ discard block |
||
| 934 | 934 | //Top Level |
| 935 | 935 | $admin_bar->add_menu(array( |
| 936 | 936 | 'id' => 'espresso-toolbar', |
| 937 | - '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>', |
|
| 937 | + '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>', |
|
| 938 | 938 | 'href' => $events_admin_url, |
| 939 | 939 | 'meta' => array( |
| 940 | 940 | 'title' => __('Event Espresso', 'event_espresso'), |
| 941 | - 'class' => $menu_class . 'first' |
|
| 941 | + 'class' => $menu_class.'first' |
|
| 942 | 942 | ), |
| 943 | 943 | )); |
| 944 | 944 | |
| 945 | 945 | //Events |
| 946 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
| 946 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
| 947 | 947 | $admin_bar->add_menu(array( |
| 948 | 948 | 'id' => 'espresso-toolbar-events', |
| 949 | 949 | 'parent' => 'espresso-toolbar', |
| 950 | - 'title' => __( 'Events', 'event_espresso' ), |
|
| 950 | + 'title' => __('Events', 'event_espresso'), |
|
| 951 | 951 | 'href' => $events_admin_url, |
| 952 | 952 | 'meta' => array( |
| 953 | 953 | 'title' => __('Events', 'event_espresso'), |
@@ -958,13 +958,13 @@ discard block |
||
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | |
| 961 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
| 961 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
| 962 | 962 | //Events Add New |
| 963 | 963 | $admin_bar->add_menu(array( |
| 964 | 964 | 'id' => 'espresso-toolbar-events-new', |
| 965 | 965 | 'parent' => 'espresso-toolbar-events', |
| 966 | 966 | 'title' => __('Add New', 'event_espresso'), |
| 967 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
| 967 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
| 968 | 968 | 'meta' => array( |
| 969 | 969 | 'title' => __('Add New', 'event_espresso'), |
| 970 | 970 | 'target' => '', |
@@ -973,18 +973,18 @@ discard block |
||
| 973 | 973 | )); |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
| 976 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
| 977 | 977 | |
| 978 | 978 | //Current post |
| 979 | 979 | global $post; |
| 980 | 980 | |
| 981 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
| 981 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
| 982 | 982 | //Events Edit Current Event |
| 983 | 983 | $admin_bar->add_menu(array( |
| 984 | 984 | 'id' => 'espresso-toolbar-events-edit', |
| 985 | 985 | 'parent' => 'espresso-toolbar-events', |
| 986 | 986 | 'title' => __('Edit Event', 'event_espresso'), |
| 987 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
| 987 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
| 988 | 988 | 'meta' => array( |
| 989 | 989 | 'title' => __('Edit Event', 'event_espresso'), |
| 990 | 990 | 'target' => '', |
@@ -996,11 +996,11 @@ discard block |
||
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | //Events View |
| 999 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
| 999 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
| 1000 | 1000 | $admin_bar->add_menu(array( |
| 1001 | 1001 | 'id' => 'espresso-toolbar-events-view', |
| 1002 | 1002 | 'parent' => 'espresso-toolbar-events', |
| 1003 | - 'title' => __( 'View', 'event_espresso' ), |
|
| 1003 | + 'title' => __('View', 'event_espresso'), |
|
| 1004 | 1004 | 'href' => $events_admin_url, |
| 1005 | 1005 | 'meta' => array( |
| 1006 | 1006 | 'title' => __('View', 'event_espresso'), |
@@ -1010,12 +1010,12 @@ discard block |
||
| 1010 | 1010 | )); |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
| 1013 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
| 1014 | 1014 | //Events View All |
| 1015 | 1015 | $admin_bar->add_menu(array( |
| 1016 | 1016 | 'id' => 'espresso-toolbar-events-all', |
| 1017 | 1017 | 'parent' => 'espresso-toolbar-events-view', |
| 1018 | - 'title' => __( 'All', 'event_espresso' ), |
|
| 1018 | + 'title' => __('All', 'event_espresso'), |
|
| 1019 | 1019 | 'href' => $events_admin_url, |
| 1020 | 1020 | 'meta' => array( |
| 1021 | 1021 | 'title' => __('All', 'event_espresso'), |
@@ -1026,13 +1026,13 @@ discard block |
||
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | |
| 1029 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
| 1029 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
| 1030 | 1030 | //Events View Today |
| 1031 | 1031 | $admin_bar->add_menu(array( |
| 1032 | 1032 | 'id' => 'espresso-toolbar-events-today', |
| 1033 | 1033 | 'parent' => 'espresso-toolbar-events-view', |
| 1034 | 1034 | 'title' => __('Today', 'event_espresso'), |
| 1035 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
| 1035 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
| 1036 | 1036 | 'meta' => array( |
| 1037 | 1037 | 'title' => __('Today', 'event_espresso'), |
| 1038 | 1038 | 'target' => '', |
@@ -1042,13 +1042,13 @@ discard block |
||
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | 1044 | |
| 1045 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
| 1045 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
| 1046 | 1046 | //Events View This Month |
| 1047 | 1047 | $admin_bar->add_menu(array( |
| 1048 | 1048 | 'id' => 'espresso-toolbar-events-month', |
| 1049 | 1049 | 'parent' => 'espresso-toolbar-events-view', |
| 1050 | - 'title' => __( 'This Month', 'event_espresso'), |
|
| 1051 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
| 1050 | + 'title' => __('This Month', 'event_espresso'), |
|
| 1051 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
| 1052 | 1052 | 'meta' => array( |
| 1053 | 1053 | 'title' => __('This Month', 'event_espresso'), |
| 1054 | 1054 | 'target' => '', |
@@ -1058,11 +1058,11 @@ discard block |
||
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | //Registration Overview |
| 1061 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
| 1061 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
| 1062 | 1062 | $admin_bar->add_menu(array( |
| 1063 | 1063 | 'id' => 'espresso-toolbar-registrations', |
| 1064 | 1064 | 'parent' => 'espresso-toolbar', |
| 1065 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
| 1065 | + 'title' => __('Registrations', 'event_espresso'), |
|
| 1066 | 1066 | 'href' => $reg_admin_url, |
| 1067 | 1067 | 'meta' => array( |
| 1068 | 1068 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1073,12 +1073,12 @@ discard block |
||
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | //Registration Overview Today |
| 1076 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
| 1076 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
| 1077 | 1077 | $admin_bar->add_menu(array( |
| 1078 | 1078 | 'id' => 'espresso-toolbar-registrations-today', |
| 1079 | 1079 | 'parent' => 'espresso-toolbar-registrations', |
| 1080 | - 'title' => __( 'Today', 'event_espresso'), |
|
| 1081 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
| 1080 | + 'title' => __('Today', 'event_espresso'), |
|
| 1081 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
| 1082 | 1082 | 'meta' => array( |
| 1083 | 1083 | 'title' => __('Today', 'event_espresso'), |
| 1084 | 1084 | 'target' => '', |
@@ -1088,14 +1088,14 @@ discard block |
||
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | //Registration Overview Today Completed |
| 1091 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
| 1091 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
| 1092 | 1092 | $admin_bar->add_menu(array( |
| 1093 | 1093 | 'id' => 'espresso-toolbar-registrations-today-approved', |
| 1094 | 1094 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1095 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
| 1096 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
| 1095 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1096 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
| 1097 | 1097 | 'meta' => array( |
| 1098 | - 'title' => __('Approved', 'event_espresso' ), |
|
| 1098 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1099 | 1099 | 'target' => '', |
| 1100 | 1100 | 'class' => $menu_class |
| 1101 | 1101 | ), |
@@ -1103,14 +1103,14 @@ discard block |
||
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | //Registration Overview Today Pending\ |
| 1106 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
| 1106 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
| 1107 | 1107 | $admin_bar->add_menu(array( |
| 1108 | 1108 | 'id' => 'espresso-toolbar-registrations-today-pending', |
| 1109 | 1109 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1110 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
| 1111 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
| 1110 | + 'title' => __('Pending', 'event_espresso'), |
|
| 1111 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
| 1112 | 1112 | 'meta' => array( |
| 1113 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
| 1113 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
| 1114 | 1114 | 'target' => '', |
| 1115 | 1115 | 'class' => $menu_class |
| 1116 | 1116 | ), |
@@ -1118,14 +1118,14 @@ discard block |
||
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | 1120 | //Registration Overview Today Incomplete |
| 1121 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
| 1121 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
| 1122 | 1122 | $admin_bar->add_menu(array( |
| 1123 | 1123 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
| 1124 | 1124 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1125 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
| 1126 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
| 1125 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1126 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
| 1127 | 1127 | 'meta' => array( |
| 1128 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
| 1128 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1129 | 1129 | 'target' => '', |
| 1130 | 1130 | 'class' => $menu_class |
| 1131 | 1131 | ), |
@@ -1133,12 +1133,12 @@ discard block |
||
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | 1135 | //Registration Overview Today Incomplete |
| 1136 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
| 1136 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
| 1137 | 1137 | $admin_bar->add_menu(array( |
| 1138 | 1138 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
| 1139 | 1139 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1140 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
| 1141 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
| 1140 | + 'title' => __('Cancelled', 'event_espresso'), |
|
| 1141 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
| 1142 | 1142 | 'meta' => array( |
| 1143 | 1143 | 'title' => __('Cancelled', 'event_espresso'), |
| 1144 | 1144 | 'target' => '', |
@@ -1148,12 +1148,12 @@ discard block |
||
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | //Registration Overview This Month |
| 1151 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
| 1151 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
| 1152 | 1152 | $admin_bar->add_menu(array( |
| 1153 | 1153 | 'id' => 'espresso-toolbar-registrations-month', |
| 1154 | 1154 | 'parent' => 'espresso-toolbar-registrations', |
| 1155 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
| 1156 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
| 1155 | + 'title' => __('This Month', 'event_espresso'), |
|
| 1156 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
| 1157 | 1157 | 'meta' => array( |
| 1158 | 1158 | 'title' => __('This Month', 'event_espresso'), |
| 1159 | 1159 | 'target' => '', |
@@ -1163,12 +1163,12 @@ discard block |
||
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | //Registration Overview This Month Approved |
| 1166 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
| 1166 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
| 1167 | 1167 | $admin_bar->add_menu(array( |
| 1168 | 1168 | 'id' => 'espresso-toolbar-registrations-month-approved', |
| 1169 | 1169 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1170 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
| 1171 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
| 1170 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1171 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
| 1172 | 1172 | 'meta' => array( |
| 1173 | 1173 | 'title' => __('Approved', 'event_espresso'), |
| 1174 | 1174 | 'target' => '', |
@@ -1178,12 +1178,12 @@ discard block |
||
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | //Registration Overview This Month Pending |
| 1181 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
| 1181 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
| 1182 | 1182 | $admin_bar->add_menu(array( |
| 1183 | 1183 | 'id' => 'espresso-toolbar-registrations-month-pending', |
| 1184 | 1184 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1185 | - 'title' => __( 'Pending', 'event_espresso'), |
|
| 1186 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
| 1185 | + 'title' => __('Pending', 'event_espresso'), |
|
| 1186 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
| 1187 | 1187 | 'meta' => array( |
| 1188 | 1188 | 'title' => __('Pending', 'event_espresso'), |
| 1189 | 1189 | 'target' => '', |
@@ -1193,14 +1193,14 @@ discard block |
||
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | //Registration Overview This Month Not Approved |
| 1196 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
| 1196 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
| 1197 | 1197 | $admin_bar->add_menu(array( |
| 1198 | 1198 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
| 1199 | 1199 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1200 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
| 1201 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
| 1200 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1201 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
| 1202 | 1202 | 'meta' => array( |
| 1203 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
| 1203 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1204 | 1204 | 'target' => '', |
| 1205 | 1205 | 'class' => $menu_class |
| 1206 | 1206 | ), |
@@ -1209,12 +1209,12 @@ discard block |
||
| 1209 | 1209 | |
| 1210 | 1210 | |
| 1211 | 1211 | //Registration Overview This Month Cancelled |
| 1212 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
| 1212 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
| 1213 | 1213 | $admin_bar->add_menu(array( |
| 1214 | 1214 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
| 1215 | 1215 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1216 | 1216 | 'title' => __('Cancelled', 'event_espresso'), |
| 1217 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
| 1217 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
| 1218 | 1218 | 'meta' => array( |
| 1219 | 1219 | 'title' => __('Cancelled', 'event_espresso'), |
| 1220 | 1220 | 'target' => '', |
@@ -1224,11 +1224,11 @@ discard block |
||
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | 1226 | //Extensions & Services |
| 1227 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
| 1227 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
| 1228 | 1228 | $admin_bar->add_menu(array( |
| 1229 | 1229 | 'id' => 'espresso-toolbar-extensions-and-services', |
| 1230 | 1230 | 'parent' => 'espresso-toolbar', |
| 1231 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
| 1231 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
| 1232 | 1232 | 'href' => $extensions_admin_url, |
| 1233 | 1233 | 'meta' => array( |
| 1234 | 1234 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1250,8 +1250,8 @@ discard block |
||
| 1250 | 1250 | * @param array $exclude_array any existing pages being excluded are in this array. |
| 1251 | 1251 | * @return array |
| 1252 | 1252 | */ |
| 1253 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
| 1254 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
| 1253 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
| 1254 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | |
@@ -1271,12 +1271,12 @@ discard block |
||
| 1271 | 1271 | */ |
| 1272 | 1272 | public function wp_enqueue_scripts() { |
| 1273 | 1273 | // 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' ); |
| 1274 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
| 1274 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
| 1275 | 1275 | // 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' ); |
| 1276 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
| 1276 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
| 1277 | 1277 | // register jQuery Validate and additional methods |
| 1278 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE ); |
|
| 1279 | - 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 ); |
|
| 1278 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
| 1279 | + 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); |
|
| 1280 | 1280 | } |
| 1281 | 1281 | } |
| 1282 | 1282 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @since $VID:$ |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | -class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy{ |
|
| 15 | +class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy { |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Arguments that will be passed into the select2 javascript constructor |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param array $select2_js_args pass in the EXACT array of JS arguments you want |
| 26 | 26 | * to pass into the select2 js/html input. See https://select2.github.io |
| 27 | 27 | */ |
| 28 | - public function __construct( $select2_js_args = array() ) { |
|
| 28 | + public function __construct($select2_js_args = array()) { |
|
| 29 | 29 | $this->_select2_js_args = $select2_js_args; |
| 30 | 30 | parent::__construct(); |
| 31 | 31 | } |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | public function enqueue_js() { |
| 38 | 38 | // need to first deregister the select2 script in case some other plugin **cough cough Toolset Types cough** |
| 39 | 39 | // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
| 40 | - wp_deregister_script( 'select2' ); |
|
| 41 | - wp_deregister_style( 'select2' ); |
|
| 42 | - wp_register_script( 'select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true ); |
|
| 43 | - wp_register_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
| 44 | - wp_enqueue_script( 'form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true ); |
|
| 45 | - wp_enqueue_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
| 40 | + wp_deregister_script('select2'); |
|
| 41 | + wp_deregister_style('select2'); |
|
| 42 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true); |
|
| 43 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 44 | + wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL.'scripts/form_section_select2_init.js', array('select2'), '1.0.0', true); |
|
| 45 | + wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * Sets the exact js args which will be passed into the select2 js/html input |
| 58 | 58 | * @param array $js_args |
| 59 | 59 | */ |
| 60 | - public function set_js_args( $js_args ) { |
|
| 60 | + public function set_js_args($js_args) { |
|
| 61 | 61 | $this->_select2_js_args = $js_args; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | * @param array $other_js_data |
| 67 | 67 | * @return array |
| 68 | 68 | */ |
| 69 | - public function get_other_js_data( $other_js_data = array() ) { |
|
| 70 | - $other_js_data = parent::get_other_js_data( $other_js_data ); |
|
| 71 | - if( ! isset( $other_js_data[ 'select2s' ] ) ) { |
|
| 69 | + public function get_other_js_data($other_js_data = array()) { |
|
| 70 | + $other_js_data = parent::get_other_js_data($other_js_data); |
|
| 71 | + if ( ! isset($other_js_data['select2s'])) { |
|
| 72 | 72 | $other_js_data['select2s'] = array(); |
| 73 | 73 | } |
| 74 | - $other_js_data[ 'select2s' ][ $this->_input->html_id() ] = $this->get_js_args(); |
|
| 74 | + $other_js_data['select2s'][$this->_input->html_id()] = $this->get_js_args(); |
|
| 75 | 75 | return $other_js_data; |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |