@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | * update_espresso_config |
| 374 | 374 | * |
| 375 | 375 | * @access public |
| 376 | - * @return bool |
|
| 376 | + * @return boolean|null |
|
| 377 | 377 | */ |
| 378 | 378 | protected function _reset_espresso_addon_config() { |
| 379 | 379 | $this->_addon_option_names = array(); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | * @param string $name |
| 460 | 460 | * @param string $config_class |
| 461 | 461 | * @param EE_Config_Base $config_obj |
| 462 | - * @param array $tests_to_run |
|
| 462 | + * @param integer[] $tests_to_run |
|
| 463 | 463 | * @param bool $display_errors |
| 464 | 464 | * @return bool TRUE on success, FALSE on fail |
| 465 | 465 | */ |
@@ -1736,7 +1736,7 @@ discard block |
||
| 1736 | 1736 | |
| 1737 | 1737 | |
| 1738 | 1738 | /** |
| 1739 | - * @return array |
|
| 1739 | + * @return integer[] |
|
| 1740 | 1740 | */ |
| 1741 | 1741 | public function get_critical_pages_array() { |
| 1742 | 1742 | return array( |
@@ -1750,7 +1750,7 @@ discard block |
||
| 1750 | 1750 | |
| 1751 | 1751 | |
| 1752 | 1752 | /** |
| 1753 | - * @return array |
|
| 1753 | + * @return string[] |
|
| 1754 | 1754 | */ |
| 1755 | 1755 | public function get_critical_pages_shortcodes_array() { |
| 1756 | 1756 | return array( |
@@ -2785,7 +2785,7 @@ discard block |
||
| 2785 | 2785 | * according to max_input_vars |
| 2786 | 2786 | * |
| 2787 | 2787 | * @param int $input_count the count of input vars. |
| 2788 | - * @return array { |
|
| 2788 | + * @return string { |
|
| 2789 | 2789 | * An array that represents whether available space and if no available space the error |
| 2790 | 2790 | * message. |
| 2791 | 2791 | * @type bool $has_space whether more inputs can be added. |
@@ -2105,7 +2105,7 @@ discard block |
||
| 2105 | 2105 | public function __construct( $CNT_ISO = '' ) { |
| 2106 | 2106 | // get country code from organization settings or use default |
| 2107 | 2107 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
| 2108 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
| 2108 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
| 2109 | 2109 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
| 2110 | 2110 | : ''; |
| 2111 | 2111 | // but override if requested |
@@ -2794,8 +2794,8 @@ discard block |
||
| 2794 | 2794 | */ |
| 2795 | 2795 | public function max_input_vars_limit_check( $input_count = 0 ) { |
| 2796 | 2796 | if ( ! empty( $this->php->max_input_vars ) |
| 2797 | - && ( $input_count >= $this->php->max_input_vars ) |
|
| 2798 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
| 2797 | + && ( $input_count >= $this->php->max_input_vars ) |
|
| 2798 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
| 2799 | 2799 | ) { |
| 2800 | 2800 | return sprintf( |
| 2801 | 2801 | __( |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | |
| 5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public static function instance() { |
| 123 | 123 | // check if class object is instantiated, and instantiated properly |
| 124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
| 124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
| 125 | 125 | self::$_instance = new self(); |
| 126 | 126 | } |
| 127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
| 141 | 141 | * site was put into maintenance mode) |
| 142 | 142 | * @return EE_Config |
| 143 | 143 | */ |
| 144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
| 145 | - if ( $hard_reset ) { |
|
| 144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
| 145 | + if ($hard_reset) { |
|
| 146 | 146 | self::$_instance->_addon_option_names = array(); |
| 147 | 147 | self::$_instance->_initialize_config(); |
| 148 | 148 | self::$_instance->update_espresso_config(); |
| 149 | 149 | } |
| 150 | - if ( self::$_instance instanceof EE_Config ) { |
|
| 150 | + if (self::$_instance instanceof EE_Config) { |
|
| 151 | 151 | self::$_instance->update_addon_option_names(); |
| 152 | 152 | } |
| 153 | 153 | self::$_instance = null; |
| 154 | 154 | //we don't need to reset the static properties imo because those should |
| 155 | 155 | //only change when a module is added or removed. Currently we don't |
| 156 | 156 | //support removing a module during a request when it previously existed |
| 157 | - if ( $reinstantiate ) { |
|
| 157 | + if ($reinstantiate) { |
|
| 158 | 158 | return self::instance(); |
| 159 | 159 | } else { |
| 160 | 160 | return null; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @return \EE_Config |
| 171 | 171 | */ |
| 172 | 172 | private function __construct() { |
| 173 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
| 173 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
| 174 | 174 | // setup empty config classes |
| 175 | 175 | $this->_initialize_config(); |
| 176 | 176 | // load existing EE site settings |
@@ -180,17 +180,17 @@ discard block |
||
| 180 | 180 | // register shortcodes and modules |
| 181 | 181 | add_action( |
| 182 | 182 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
| 183 | - array( $this, 'register_shortcodes_and_modules' ), |
|
| 183 | + array($this, 'register_shortcodes_and_modules'), |
|
| 184 | 184 | 999 |
| 185 | 185 | ); |
| 186 | 186 | // initialize shortcodes and modules |
| 187 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
| 187 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
| 188 | 188 | // register widgets |
| 189 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
| 189 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
| 190 | 190 | // shutdown |
| 191 | - add_action( 'shutdown', array( $this, 'update_addon_option_names' ), 10 ); |
|
| 191 | + add_action('shutdown', array($this, 'update_addon_option_names'), 10); |
|
| 192 | 192 | // construct__end hook |
| 193 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
| 193 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
| 194 | 194 | // hardcoded hack |
| 195 | 195 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
| 196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @return string current theme set. |
| 204 | 204 | */ |
| 205 | 205 | public static function get_current_theme() { |
| 206 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
| 206 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
| 207 | 207 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | private function _initialize_config() { |
| 219 | 219 | EE_Config::trim_log(); |
| 220 | 220 | //set defaults |
| 221 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
| 221 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
| 222 | 222 | $this->addons = new stdClass(); |
| 223 | 223 | // set _module_route_map |
| 224 | 224 | EE_Config::$_module_route_map = array(); |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | private function _load_core_config() { |
| 240 | 240 | // load_core_config__start hook |
| 241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
| 241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
| 242 | 242 | $espresso_config = $this->get_espresso_config(); |
| 243 | - foreach ( $espresso_config as $config => $settings ) { |
|
| 243 | + foreach ($espresso_config as $config => $settings) { |
|
| 244 | 244 | // load_core_config__start hook |
| 245 | 245 | $settings = apply_filters( |
| 246 | 246 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -248,22 +248,22 @@ discard block |
||
| 248 | 248 | $config, |
| 249 | 249 | $this |
| 250 | 250 | ); |
| 251 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
| 252 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
| 251 | + if (is_object($settings) && property_exists($this, $config)) { |
|
| 252 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
| 253 | 253 | //call configs populate method to ensure any defaults are set for empty values. |
| 254 | - if ( method_exists( $settings, 'populate' ) ) { |
|
| 254 | + if (method_exists($settings, 'populate')) { |
|
| 255 | 255 | $this->{$config}->populate(); |
| 256 | 256 | } |
| 257 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
| 257 | + if (method_exists($settings, 'do_hooks')) { |
|
| 258 | 258 | $this->{$config}->do_hooks(); |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
| 262 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
| 263 | 263 | $this->update_espresso_config(); |
| 264 | 264 | } |
| 265 | 265 | // load_core_config__end hook |
| 266 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
| 266 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | |
@@ -278,23 +278,23 @@ discard block |
||
| 278 | 278 | $this->core = $this->core instanceof EE_Core_Config |
| 279 | 279 | ? $this->core |
| 280 | 280 | : new EE_Core_Config(); |
| 281 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
| 281 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
| 282 | 282 | $this->organization = $this->organization instanceof EE_Organization_Config |
| 283 | 283 | ? $this->organization |
| 284 | 284 | : new EE_Organization_Config(); |
| 285 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
| 285 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
| 286 | 286 | $this->currency = $this->currency instanceof EE_Currency_Config |
| 287 | 287 | ? $this->currency |
| 288 | 288 | : new EE_Currency_Config(); |
| 289 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
| 289 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
| 290 | 290 | $this->registration = $this->registration instanceof EE_Registration_Config |
| 291 | 291 | ? $this->registration |
| 292 | 292 | : new EE_Registration_Config(); |
| 293 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
| 293 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
| 294 | 294 | $this->admin = $this->admin instanceof EE_Admin_Config |
| 295 | 295 | ? $this->admin |
| 296 | 296 | : new EE_Admin_Config(); |
| 297 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
| 297 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
| 298 | 298 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
| 299 | 299 | ? $this->template_settings |
| 300 | 300 | : new EE_Template_Config(); |
@@ -305,15 +305,15 @@ discard block |
||
| 305 | 305 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
| 306 | 306 | ? $this->map_settings |
| 307 | 307 | : new EE_Map_Config(); |
| 308 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
| 308 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
| 309 | 309 | $this->environment = $this->environment instanceof EE_Environment_Config |
| 310 | 310 | ? $this->environment |
| 311 | 311 | : new EE_Environment_Config(); |
| 312 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
| 312 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
| 313 | 313 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
| 314 | 314 | ? $this->gateway |
| 315 | 315 | : new EE_Gateway_Config(); |
| 316 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
| 316 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | // grab espresso configuration |
| 329 | 329 | return apply_filters( |
| 330 | 330 | 'FHEE__EE_Config__get_espresso_config__CFG', |
| 331 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
| 331 | + get_option(EE_Config::OPTION_NAME, array()) |
|
| 332 | 332 | ); |
| 333 | 333 | } |
| 334 | 334 | |
@@ -342,12 +342,12 @@ discard block |
||
| 342 | 342 | * @param $old_value |
| 343 | 343 | * @param $value |
| 344 | 344 | */ |
| 345 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
| 345 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
| 346 | 346 | // make sure we're checking the ee config |
| 347 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
| 347 | + if ($option === EE_Config::OPTION_NAME) { |
|
| 348 | 348 | // run a loose comparison of the old value against the new value for type and properties, |
| 349 | 349 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
| 350 | - if ( $value != $old_value ) { |
|
| 350 | + if ($value != $old_value) { |
|
| 351 | 351 | // if they are NOT the same, then remove the hook, |
| 352 | 352 | // which means the subsequent update results will be based solely on the update query results |
| 353 | 353 | // the reason we do this is because, as stated above, |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | // the string it sees in the db looks the same as the new one it has been passed!!! |
| 363 | 363 | // This results in the query returning an "affected rows" value of ZERO, |
| 364 | 364 | // which gets returned immediately by WP update_option and looks like an error. |
| 365 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
| 365 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | } |
@@ -377,11 +377,11 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | protected function _reset_espresso_addon_config() { |
| 379 | 379 | $this->_addon_option_names = array(); |
| 380 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
| 381 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
| 382 | - $config_class = get_class( $addon_config_obj ); |
|
| 383 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
| 384 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
| 380 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
| 381 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
| 382 | + $config_class = get_class($addon_config_obj); |
|
| 383 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
| 384 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
| 385 | 385 | } |
| 386 | 386 | $this->addons->{$addon_name} = null; |
| 387 | 387 | } |
@@ -397,18 +397,18 @@ discard block |
||
| 397 | 397 | * @param bool $add_error |
| 398 | 398 | * @return bool |
| 399 | 399 | */ |
| 400 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
| 400 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
| 401 | 401 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
| 402 | 402 | //$clone = clone( self::$_instance ); |
| 403 | 403 | //self::$_instance = NULL; |
| 404 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
| 404 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
| 405 | 405 | $this->_reset_espresso_addon_config(); |
| 406 | 406 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
| 407 | 407 | // but BEFORE the actual update occurs |
| 408 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
| 408 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
| 409 | 409 | // now update "ee_config" |
| 410 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
| 411 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
| 410 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
| 411 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
| 412 | 412 | // if not saved... check if the hook we just added still exists; |
| 413 | 413 | // if it does, it means one of two things: |
| 414 | 414 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -419,17 +419,17 @@ discard block |
||
| 419 | 419 | // but just means no update occurred, so don't display an error to the user. |
| 420 | 420 | // BUT... if update_option returns FALSE, AND the hook is missing, |
| 421 | 421 | // then it means that something truly went wrong |
| 422 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
| 422 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
| 423 | 423 | // remove our action since we don't want it in the system anymore |
| 424 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
| 425 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
| 424 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
| 425 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
| 426 | 426 | //self::$_instance = $clone; |
| 427 | 427 | //unset( $clone ); |
| 428 | 428 | // if config remains the same or was updated successfully |
| 429 | - if ( $saved ) { |
|
| 430 | - if ( $add_success ) { |
|
| 429 | + if ($saved) { |
|
| 430 | + if ($add_success) { |
|
| 431 | 431 | EE_Error::add_success( |
| 432 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
| 432 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
| 433 | 433 | __FILE__, |
| 434 | 434 | __FUNCTION__, |
| 435 | 435 | __LINE__ |
@@ -437,9 +437,9 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | return true; |
| 439 | 439 | } else { |
| 440 | - if ( $add_error ) { |
|
| 440 | + if ($add_error) { |
|
| 441 | 441 | EE_Error::add_error( |
| 442 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
| 442 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
| 443 | 443 | __FILE__, |
| 444 | 444 | __FUNCTION__, |
| 445 | 445 | __LINE__ |
@@ -468,16 +468,16 @@ discard block |
||
| 468 | 468 | $name = '', |
| 469 | 469 | $config_class = '', |
| 470 | 470 | $config_obj = null, |
| 471 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
| 471 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
| 472 | 472 | $display_errors = true |
| 473 | 473 | ) { |
| 474 | 474 | try { |
| 475 | - foreach ( $tests_to_run as $test ) { |
|
| 476 | - switch ( $test ) { |
|
| 475 | + foreach ($tests_to_run as $test) { |
|
| 476 | + switch ($test) { |
|
| 477 | 477 | // TEST #1 : check that section was set |
| 478 | 478 | case 1 : |
| 479 | - if ( empty( $section ) ) { |
|
| 480 | - if ( $display_errors ) { |
|
| 479 | + if (empty($section)) { |
|
| 480 | + if ($display_errors) { |
|
| 481 | 481 | throw new EE_Error( |
| 482 | 482 | sprintf( |
| 483 | 483 | __( |
@@ -493,11 +493,11 @@ discard block |
||
| 493 | 493 | break; |
| 494 | 494 | // TEST #2 : check that settings section exists |
| 495 | 495 | case 2 : |
| 496 | - if ( ! isset( $this->{$section} ) ) { |
|
| 497 | - if ( $display_errors ) { |
|
| 496 | + if ( ! isset($this->{$section} )) { |
|
| 497 | + if ($display_errors) { |
|
| 498 | 498 | throw new EE_Error( |
| 499 | 499 | sprintf( |
| 500 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
| 500 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
| 501 | 501 | $section |
| 502 | 502 | ) |
| 503 | 503 | ); |
@@ -508,9 +508,9 @@ discard block |
||
| 508 | 508 | // TEST #3 : check that section is the proper format |
| 509 | 509 | case 3 : |
| 510 | 510 | if ( |
| 511 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
| 511 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
| 512 | 512 | ) { |
| 513 | - if ( $display_errors ) { |
|
| 513 | + if ($display_errors) { |
|
| 514 | 514 | throw new EE_Error( |
| 515 | 515 | sprintf( |
| 516 | 516 | __( |
@@ -526,8 +526,8 @@ discard block |
||
| 526 | 526 | break; |
| 527 | 527 | // TEST #4 : check that config section name has been set |
| 528 | 528 | case 4 : |
| 529 | - if ( empty( $name ) ) { |
|
| 530 | - if ( $display_errors ) { |
|
| 529 | + if (empty($name)) { |
|
| 530 | + if ($display_errors) { |
|
| 531 | 531 | throw new EE_Error( |
| 532 | 532 | __( |
| 533 | 533 | 'No name has been provided for the specific configuration section.', |
@@ -540,8 +540,8 @@ discard block |
||
| 540 | 540 | break; |
| 541 | 541 | // TEST #5 : check that a config class name has been set |
| 542 | 542 | case 5 : |
| 543 | - if ( empty( $config_class ) ) { |
|
| 544 | - if ( $display_errors ) { |
|
| 543 | + if (empty($config_class)) { |
|
| 544 | + if ($display_errors) { |
|
| 545 | 545 | throw new EE_Error( |
| 546 | 546 | __( |
| 547 | 547 | 'No class name has been provided for the specific configuration section.', |
@@ -554,8 +554,8 @@ discard block |
||
| 554 | 554 | break; |
| 555 | 555 | // TEST #6 : verify config class is accessible |
| 556 | 556 | case 6 : |
| 557 | - if ( ! class_exists( $config_class ) ) { |
|
| 558 | - if ( $display_errors ) { |
|
| 557 | + if ( ! class_exists($config_class)) { |
|
| 558 | + if ($display_errors) { |
|
| 559 | 559 | throw new EE_Error( |
| 560 | 560 | sprintf( |
| 561 | 561 | __( |
@@ -571,11 +571,11 @@ discard block |
||
| 571 | 571 | break; |
| 572 | 572 | // TEST #7 : check that config has even been set |
| 573 | 573 | case 7 : |
| 574 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
| 575 | - if ( $display_errors ) { |
|
| 574 | + if ( ! isset($this->{$section}->{$name} )) { |
|
| 575 | + if ($display_errors) { |
|
| 576 | 576 | throw new EE_Error( |
| 577 | 577 | sprintf( |
| 578 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
| 578 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
| 579 | 579 | $section, |
| 580 | 580 | $name |
| 581 | 581 | ) |
@@ -584,13 +584,13 @@ discard block |
||
| 584 | 584 | return false; |
| 585 | 585 | } else { |
| 586 | 586 | // and make sure it's not serialized |
| 587 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
| 587 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
| 588 | 588 | } |
| 589 | 589 | break; |
| 590 | 590 | // TEST #8 : check that config is the requested type |
| 591 | 591 | case 8 : |
| 592 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
| 593 | - if ( $display_errors ) { |
|
| 592 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
| 593 | + if ($display_errors) { |
|
| 594 | 594 | throw new EE_Error( |
| 595 | 595 | sprintf( |
| 596 | 596 | __( |
@@ -608,12 +608,12 @@ discard block |
||
| 608 | 608 | break; |
| 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 | } |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | break; |
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | - } catch ( EE_Error $e ) { |
|
| 625 | + } catch (EE_Error $e) { |
|
| 626 | 626 | $e->get_error(); |
| 627 | 627 | } |
| 628 | 628 | // you have successfully run the gauntlet |
@@ -639,8 +639,8 @@ discard block |
||
| 639 | 639 | * @param string $name |
| 640 | 640 | * @return string |
| 641 | 641 | */ |
| 642 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
| 643 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
| 642 | + private function _generate_config_option_name($section = '', $name = '') { |
|
| 643 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | |
@@ -654,10 +654,10 @@ discard block |
||
| 654 | 654 | * @param string $name |
| 655 | 655 | * @return string |
| 656 | 656 | */ |
| 657 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
| 658 | - return ! empty( $config_class ) |
|
| 657 | + private function _set_config_class($config_class = '', $name = '') { |
|
| 658 | + return ! empty($config_class) |
|
| 659 | 659 | ? $config_class |
| 660 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
| 660 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | |
@@ -672,36 +672,36 @@ discard block |
||
| 672 | 672 | * @param EE_Config_Base $config_obj |
| 673 | 673 | * @return EE_Config_Base |
| 674 | 674 | */ |
| 675 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
| 675 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
| 676 | 676 | // ensure config class is set to something |
| 677 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 677 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 678 | 678 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
| 679 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
| 679 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
| 680 | 680 | return null; |
| 681 | 681 | } |
| 682 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 682 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 683 | 683 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
| 684 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
| 685 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
| 684 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
| 685 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
| 686 | 686 | $this->update_addon_option_names(); |
| 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 | - EE_Config::log( $config_option_name ); |
|
| 694 | - update_option( $config_option_name, $config_obj ); |
|
| 692 | + if (get_option($config_option_name)) { |
|
| 693 | + EE_Config::log($config_option_name); |
|
| 694 | + update_option($config_option_name, $config_obj); |
|
| 695 | 695 | $this->{$section}->{$name} = $config_obj; |
| 696 | 696 | return $this->{$section}->{$name}; |
| 697 | 697 | } else { |
| 698 | 698 | // create a wp-option for this config |
| 699 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
| 700 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
| 699 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
| 700 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
| 701 | 701 | return $this->{$section}->{$name}; |
| 702 | 702 | } else { |
| 703 | 703 | EE_Error::add_error( |
| 704 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
| 704 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
| 705 | 705 | __FILE__, |
| 706 | 706 | __FUNCTION__, |
| 707 | 707 | __LINE__ |
@@ -724,40 +724,40 @@ discard block |
||
| 724 | 724 | * @param bool $throw_errors |
| 725 | 725 | * @return bool |
| 726 | 726 | */ |
| 727 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
| 728 | - $config_obj = maybe_unserialize( $config_obj ); |
|
| 727 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
| 728 | + $config_obj = maybe_unserialize($config_obj); |
|
| 729 | 729 | // get class name of the incoming object |
| 730 | - $config_class = get_class( $config_obj ); |
|
| 730 | + $config_class = get_class($config_obj); |
|
| 731 | 731 | // run tests 1-5 and 9 to verify config |
| 732 | 732 | if ( ! $this->_verify_config_params( |
| 733 | 733 | $section, |
| 734 | 734 | $name, |
| 735 | 735 | $config_class, |
| 736 | 736 | $config_obj, |
| 737 | - array( 1, 2, 3, 4, 7, 9 ) |
|
| 737 | + array(1, 2, 3, 4, 7, 9) |
|
| 738 | 738 | ) |
| 739 | 739 | ) { |
| 740 | 740 | return false; |
| 741 | 741 | } |
| 742 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 742 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 743 | 743 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
| 744 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
| 744 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
| 745 | 745 | // save new config to db |
| 746 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
| 746 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
| 747 | 747 | } else { |
| 748 | 748 | // first check if the record already exists |
| 749 | - $existing_config = get_option( $config_option_name ); |
|
| 750 | - $config_obj = serialize( $config_obj ); |
|
| 749 | + $existing_config = get_option($config_option_name); |
|
| 750 | + $config_obj = serialize($config_obj); |
|
| 751 | 751 | // just return if db record is already up to date (NOT type safe comparison) |
| 752 | - if ( $existing_config == $config_obj ) { |
|
| 752 | + if ($existing_config == $config_obj) { |
|
| 753 | 753 | $this->{$section}->{$name} = $config_obj; |
| 754 | 754 | return true; |
| 755 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
| 756 | - EE_Config::log( $config_option_name ); |
|
| 755 | + } else if (update_option($config_option_name, $config_obj)) { |
|
| 756 | + EE_Config::log($config_option_name); |
|
| 757 | 757 | // update wp-option for this config class |
| 758 | 758 | $this->{$section}->{$name} = $config_obj; |
| 759 | 759 | return true; |
| 760 | - } elseif ( $throw_errors ) { |
|
| 760 | + } elseif ($throw_errors) { |
|
| 761 | 761 | EE_Error::add_error( |
| 762 | 762 | sprintf( |
| 763 | 763 | __( |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | 'event_espresso' |
| 766 | 766 | ), |
| 767 | 767 | $config_class, |
| 768 | - 'EE_Config->' . $section . '->' . $name |
|
| 768 | + 'EE_Config->'.$section.'->'.$name |
|
| 769 | 769 | ), |
| 770 | 770 | __FILE__, |
| 771 | 771 | __FUNCTION__, |
@@ -787,34 +787,34 @@ discard block |
||
| 787 | 787 | * @param string $config_class |
| 788 | 788 | * @return mixed EE_Config_Base | NULL |
| 789 | 789 | */ |
| 790 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
| 790 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
| 791 | 791 | // ensure config class is set to something |
| 792 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 792 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 793 | 793 | // run tests 1-4, 6 and 7 to verify that all params have been set |
| 794 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
| 794 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
| 795 | 795 | return null; |
| 796 | 796 | } |
| 797 | 797 | // now test if the requested config object exists, but suppress errors |
| 798 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
| 798 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
| 799 | 799 | // config already exists, so pass it back |
| 800 | 800 | return $this->{$section}->{$name}; |
| 801 | 801 | } |
| 802 | 802 | // load config option from db if it exists |
| 803 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
| 803 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
| 804 | 804 | // verify the newly retrieved config object, but suppress errors |
| 805 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
| 805 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
| 806 | 806 | // config is good, so set it and pass it back |
| 807 | 807 | $this->{$section}->{$name} = $config_obj; |
| 808 | 808 | return $this->{$section}->{$name}; |
| 809 | 809 | } |
| 810 | 810 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
| 811 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
| 811 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
| 812 | 812 | // verify the newly created config object |
| 813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
| 813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
| 814 | 814 | return $this->{$section}->{$name}; |
| 815 | 815 | } else { |
| 816 | 816 | EE_Error::add_error( |
| 817 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
| 817 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
| 818 | 818 | __FILE__, |
| 819 | 819 | __FUNCTION__, |
| 820 | 820 | __LINE__ |
@@ -832,9 +832,9 @@ discard block |
||
| 832 | 832 | * @param string $config_option_name |
| 833 | 833 | * @return mixed EE_Config_Base | FALSE |
| 834 | 834 | */ |
| 835 | - public function get_config_option( $config_option_name = '' ) { |
|
| 835 | + public function get_config_option($config_option_name = '') { |
|
| 836 | 836 | // retrieve the wp-option for this config class. |
| 837 | - return maybe_unserialize( get_option( $config_option_name ) ); |
|
| 837 | + return maybe_unserialize(get_option($config_option_name)); |
|
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | |
@@ -844,11 +844,11 @@ discard block |
||
| 844 | 844 | * |
| 845 | 845 | * @param string $config_option_name |
| 846 | 846 | */ |
| 847 | - public static function log( $config_option_name = '' ) { |
|
| 848 | - if ( ! empty( $config_option_name ) ) { |
|
| 849 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
| 850 | - $config_log[ (string) microtime( true ) ] = $config_option_name; |
|
| 851 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
| 847 | + public static function log($config_option_name = '') { |
|
| 848 | + if ( ! empty($config_option_name)) { |
|
| 849 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
| 850 | + $config_log[(string) microtime(true)] = $config_option_name; |
|
| 851 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | |
@@ -859,12 +859,12 @@ discard block |
||
| 859 | 859 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
| 860 | 860 | */ |
| 861 | 861 | public static function trim_log() { |
| 862 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
| 863 | - $log_length = count( $config_log ); |
|
| 864 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
| 865 | - ksort( $config_log ); |
|
| 866 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
| 867 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
| 862 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
| 863 | + $log_length = count($config_log); |
|
| 864 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
| 865 | + ksort($config_log); |
|
| 866 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
| 867 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
| 868 | 868 | } |
| 869 | 869 | } |
| 870 | 870 | |
@@ -879,14 +879,14 @@ discard block |
||
| 879 | 879 | * @return string |
| 880 | 880 | */ |
| 881 | 881 | public static function get_page_for_posts() { |
| 882 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
| 883 | - if ( ! $page_for_posts ) { |
|
| 882 | + $page_for_posts = get_option('page_for_posts'); |
|
| 883 | + if ( ! $page_for_posts) { |
|
| 884 | 884 | return 'posts'; |
| 885 | 885 | } |
| 886 | 886 | /** @type WPDB $wpdb */ |
| 887 | 887 | global $wpdb; |
| 888 | 888 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
| 889 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
| 889 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | |
@@ -942,17 +942,17 @@ discard block |
||
| 942 | 942 | ) |
| 943 | 943 | ) { |
| 944 | 944 | // grab list of installed widgets |
| 945 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
| 945 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
| 946 | 946 | // filter list of modules to register |
| 947 | 947 | $widgets_to_register = apply_filters( |
| 948 | 948 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
| 949 | 949 | $widgets_to_register |
| 950 | 950 | ); |
| 951 | - if ( ! empty( $widgets_to_register ) ) { |
|
| 951 | + if ( ! empty($widgets_to_register)) { |
|
| 952 | 952 | // cycle thru widget folders |
| 953 | - foreach ( $widgets_to_register as $widget_path ) { |
|
| 953 | + foreach ($widgets_to_register as $widget_path) { |
|
| 954 | 954 | // add to list of installed widget modules |
| 955 | - EE_Config::register_ee_widget( $widget_path ); |
|
| 955 | + EE_Config::register_ee_widget($widget_path); |
|
| 956 | 956 | } |
| 957 | 957 | } |
| 958 | 958 | // filter list of installed modules |
@@ -972,57 +972,57 @@ discard block |
||
| 972 | 972 | * @param string $widget_path - full path up to and including widget folder |
| 973 | 973 | * @return void |
| 974 | 974 | */ |
| 975 | - public static function register_ee_widget( $widget_path = null ) { |
|
| 976 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
| 975 | + public static function register_ee_widget($widget_path = null) { |
|
| 976 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
| 977 | 977 | $widget_ext = '.widget.php'; |
| 978 | 978 | // make all separators match |
| 979 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
| 979 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
| 980 | 980 | // does the file path INCLUDE the actual file name as part of the path ? |
| 981 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
| 981 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
| 982 | 982 | // grab and shortcode file name from directory name and break apart at dots |
| 983 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
| 983 | + $file_name = explode('.', basename($widget_path)); |
|
| 984 | 984 | // take first segment from file name pieces and remove class prefix if it exists |
| 985 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
| 985 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
| 986 | 986 | // sanitize shortcode directory name |
| 987 | - $widget = sanitize_key( $widget ); |
|
| 987 | + $widget = sanitize_key($widget); |
|
| 988 | 988 | // now we need to rebuild the shortcode path |
| 989 | - $widget_path = explode( DS, $widget_path ); |
|
| 989 | + $widget_path = explode(DS, $widget_path); |
|
| 990 | 990 | // remove last segment |
| 991 | - array_pop( $widget_path ); |
|
| 991 | + array_pop($widget_path); |
|
| 992 | 992 | // glue it back together |
| 993 | - $widget_path = implode( DS, $widget_path ); |
|
| 993 | + $widget_path = implode(DS, $widget_path); |
|
| 994 | 994 | } else { |
| 995 | 995 | // grab and sanitize widget directory name |
| 996 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
| 996 | + $widget = sanitize_key(basename($widget_path)); |
|
| 997 | 997 | } |
| 998 | 998 | // create classname from widget directory name |
| 999 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
| 999 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
| 1000 | 1000 | // add class prefix |
| 1001 | - $widget_class = 'EEW_' . $widget; |
|
| 1001 | + $widget_class = 'EEW_'.$widget; |
|
| 1002 | 1002 | // does the widget exist ? |
| 1003 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
| 1003 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
| 1004 | 1004 | $msg = sprintf( |
| 1005 | 1005 | __( |
| 1006 | 1006 | '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', |
| 1007 | 1007 | 'event_espresso' |
| 1008 | 1008 | ), |
| 1009 | 1009 | $widget_class, |
| 1010 | - $widget_path . DS . $widget_class . $widget_ext |
|
| 1010 | + $widget_path.DS.$widget_class.$widget_ext |
|
| 1011 | 1011 | ); |
| 1012 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1012 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1013 | 1013 | return; |
| 1014 | 1014 | } |
| 1015 | 1015 | // load the widget class file |
| 1016 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
| 1016 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
| 1017 | 1017 | // verify that class exists |
| 1018 | - if ( ! class_exists( $widget_class ) ) { |
|
| 1019 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
| 1020 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1018 | + if ( ! class_exists($widget_class)) { |
|
| 1019 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
| 1020 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1021 | 1021 | return; |
| 1022 | 1022 | } |
| 1023 | - register_widget( $widget_class ); |
|
| 1023 | + register_widget($widget_class); |
|
| 1024 | 1024 | // add to array of registered widgets |
| 1025 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
| 1025 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | |
@@ -1035,17 +1035,17 @@ discard block |
||
| 1035 | 1035 | */ |
| 1036 | 1036 | private function _register_shortcodes() { |
| 1037 | 1037 | // grab list of installed shortcodes |
| 1038 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
| 1038 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
| 1039 | 1039 | // filter list of modules to register |
| 1040 | 1040 | $shortcodes_to_register = apply_filters( |
| 1041 | 1041 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
| 1042 | 1042 | $shortcodes_to_register |
| 1043 | 1043 | ); |
| 1044 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
| 1044 | + if ( ! empty($shortcodes_to_register)) { |
|
| 1045 | 1045 | // cycle thru shortcode folders |
| 1046 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
| 1046 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
| 1047 | 1047 | // add to list of installed shortcode modules |
| 1048 | - EE_Config::register_shortcode( $shortcode_path ); |
|
| 1048 | + EE_Config::register_shortcode($shortcode_path); |
|
| 1049 | 1049 | } |
| 1050 | 1050 | } |
| 1051 | 1051 | // filter list of installed modules |
@@ -1064,64 +1064,64 @@ discard block |
||
| 1064 | 1064 | * @param string $shortcode_path - full path up to and including shortcode folder |
| 1065 | 1065 | * @return bool |
| 1066 | 1066 | */ |
| 1067 | - public static function register_shortcode( $shortcode_path = null ) { |
|
| 1068 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
| 1067 | + public static function register_shortcode($shortcode_path = null) { |
|
| 1068 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
| 1069 | 1069 | $shortcode_ext = '.shortcode.php'; |
| 1070 | 1070 | // make all separators match |
| 1071 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
| 1071 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
| 1072 | 1072 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1073 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
| 1073 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
| 1074 | 1074 | // grab shortcode file name from directory name and break apart at dots |
| 1075 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
| 1075 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
| 1076 | 1076 | // take first segment from file name pieces and remove class prefix if it exists |
| 1077 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
| 1078 | - ? substr( $shortcode_file[0], 4 ) |
|
| 1077 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
| 1078 | + ? substr($shortcode_file[0], 4) |
|
| 1079 | 1079 | : $shortcode_file[0]; |
| 1080 | 1080 | // sanitize shortcode directory name |
| 1081 | - $shortcode = sanitize_key( $shortcode ); |
|
| 1081 | + $shortcode = sanitize_key($shortcode); |
|
| 1082 | 1082 | // now we need to rebuild the shortcode path |
| 1083 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
| 1083 | + $shortcode_path = explode(DS, $shortcode_path); |
|
| 1084 | 1084 | // remove last segment |
| 1085 | - array_pop( $shortcode_path ); |
|
| 1085 | + array_pop($shortcode_path); |
|
| 1086 | 1086 | // glue it back together |
| 1087 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
| 1087 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
| 1088 | 1088 | } else { |
| 1089 | 1089 | // we need to generate the filename based off of the folder name |
| 1090 | 1090 | // grab and sanitize shortcode directory name |
| 1091 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
| 1092 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
| 1091 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
| 1092 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
| 1093 | 1093 | } |
| 1094 | 1094 | // create classname from shortcode directory or file name |
| 1095 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
| 1095 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
| 1096 | 1096 | // add class prefix |
| 1097 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1097 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1098 | 1098 | // does the shortcode exist ? |
| 1099 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
| 1099 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
| 1100 | 1100 | $msg = sprintf( |
| 1101 | 1101 | __( |
| 1102 | 1102 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
| 1103 | 1103 | 'event_espresso' |
| 1104 | 1104 | ), |
| 1105 | 1105 | $shortcode_class, |
| 1106 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
| 1106 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
| 1107 | 1107 | ); |
| 1108 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1108 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1109 | 1109 | return false; |
| 1110 | 1110 | } |
| 1111 | 1111 | // load the shortcode class file |
| 1112 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
| 1112 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
| 1113 | 1113 | // verify that class exists |
| 1114 | - if ( ! class_exists( $shortcode_class ) ) { |
|
| 1114 | + if ( ! class_exists($shortcode_class)) { |
|
| 1115 | 1115 | $msg = sprintf( |
| 1116 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
| 1116 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
| 1117 | 1117 | $shortcode_class |
| 1118 | 1118 | ); |
| 1119 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1119 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1120 | 1120 | return false; |
| 1121 | 1121 | } |
| 1122 | - $shortcode = strtoupper( $shortcode ); |
|
| 1122 | + $shortcode = strtoupper($shortcode); |
|
| 1123 | 1123 | // add to array of registered shortcodes |
| 1124 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
| 1124 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
| 1125 | 1125 | return true; |
| 1126 | 1126 | } |
| 1127 | 1127 | |
@@ -1135,22 +1135,22 @@ discard block |
||
| 1135 | 1135 | */ |
| 1136 | 1136 | private function _register_modules() { |
| 1137 | 1137 | // grab list of installed modules |
| 1138 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
| 1138 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
| 1139 | 1139 | // filter list of modules to register |
| 1140 | 1140 | $modules_to_register = apply_filters( |
| 1141 | 1141 | 'FHEE__EE_Config__register_modules__modules_to_register', |
| 1142 | 1142 | $modules_to_register |
| 1143 | 1143 | ); |
| 1144 | - if ( ! empty( $modules_to_register ) ) { |
|
| 1144 | + if ( ! empty($modules_to_register)) { |
|
| 1145 | 1145 | // loop through folders |
| 1146 | - foreach ( $modules_to_register as $module_path ) { |
|
| 1146 | + foreach ($modules_to_register as $module_path) { |
|
| 1147 | 1147 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
| 1148 | 1148 | if ( |
| 1149 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
| 1150 | - && $module_path !== EE_MODULES . 'gateways' |
|
| 1149 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
| 1150 | + && $module_path !== EE_MODULES.'gateways' |
|
| 1151 | 1151 | ) { |
| 1152 | 1152 | // add to list of installed modules |
| 1153 | - EE_Config::register_module( $module_path ); |
|
| 1153 | + EE_Config::register_module($module_path); |
|
| 1154 | 1154 | } |
| 1155 | 1155 | } |
| 1156 | 1156 | } |
@@ -1170,39 +1170,39 @@ discard block |
||
| 1170 | 1170 | * @param string $module_path - full path up to and including module folder |
| 1171 | 1171 | * @return bool |
| 1172 | 1172 | */ |
| 1173 | - public static function register_module( $module_path = null ) { |
|
| 1174 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
| 1173 | + public static function register_module($module_path = null) { |
|
| 1174 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
| 1175 | 1175 | $module_ext = '.module.php'; |
| 1176 | 1176 | // make all separators match |
| 1177 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
| 1177 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
| 1178 | 1178 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1179 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
| 1179 | + if (strpos($module_path, $module_ext) !== false) { |
|
| 1180 | 1180 | // grab and shortcode file name from directory name and break apart at dots |
| 1181 | - $module_file = explode( '.', basename( $module_path ) ); |
|
| 1181 | + $module_file = explode('.', basename($module_path)); |
|
| 1182 | 1182 | // now we need to rebuild the shortcode path |
| 1183 | - $module_path = explode( DS, $module_path ); |
|
| 1183 | + $module_path = explode(DS, $module_path); |
|
| 1184 | 1184 | // remove last segment |
| 1185 | - array_pop( $module_path ); |
|
| 1185 | + array_pop($module_path); |
|
| 1186 | 1186 | // glue it back together |
| 1187 | - $module_path = implode( DS, $module_path ) . DS; |
|
| 1187 | + $module_path = implode(DS, $module_path).DS; |
|
| 1188 | 1188 | // take first segment from file name pieces and sanitize it |
| 1189 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
| 1189 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
| 1190 | 1190 | // ensure class prefix is added |
| 1191 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
| 1191 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
| 1192 | 1192 | } else { |
| 1193 | 1193 | // we need to generate the filename based off of the folder name |
| 1194 | 1194 | // grab and sanitize module name |
| 1195 | - $module = strtolower( basename( $module_path ) ); |
|
| 1196 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
| 1195 | + $module = strtolower(basename($module_path)); |
|
| 1196 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
| 1197 | 1197 | // like trailingslashit() |
| 1198 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
| 1198 | + $module_path = rtrim($module_path, DS).DS; |
|
| 1199 | 1199 | // create classname from module directory name |
| 1200 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
| 1200 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
| 1201 | 1201 | // add class prefix |
| 1202 | - $module_class = 'EED_' . $module; |
|
| 1202 | + $module_class = 'EED_'.$module; |
|
| 1203 | 1203 | } |
| 1204 | 1204 | // does the module exist ? |
| 1205 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
| 1205 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
| 1206 | 1206 | $msg = sprintf( |
| 1207 | 1207 | __( |
| 1208 | 1208 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1210,19 +1210,19 @@ discard block |
||
| 1210 | 1210 | ), |
| 1211 | 1211 | $module |
| 1212 | 1212 | ); |
| 1213 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1213 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1214 | 1214 | return false; |
| 1215 | 1215 | } |
| 1216 | 1216 | // load the module class file |
| 1217 | - require_once( $module_path . $module_class . $module_ext ); |
|
| 1217 | + require_once($module_path.$module_class.$module_ext); |
|
| 1218 | 1218 | // verify that class exists |
| 1219 | - if ( ! class_exists( $module_class ) ) { |
|
| 1220 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
| 1221 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1219 | + if ( ! class_exists($module_class)) { |
|
| 1220 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
| 1221 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1222 | 1222 | return false; |
| 1223 | 1223 | } |
| 1224 | 1224 | // add to array of registered modules |
| 1225 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
| 1225 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
| 1226 | 1226 | do_action( |
| 1227 | 1227 | 'AHEE__EE_Config__register_module__complete', |
| 1228 | 1228 | $module_class, |
@@ -1242,26 +1242,26 @@ discard block |
||
| 1242 | 1242 | */ |
| 1243 | 1243 | private function _initialize_shortcodes() { |
| 1244 | 1244 | // cycle thru shortcode folders |
| 1245 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
| 1245 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
| 1246 | 1246 | // add class prefix |
| 1247 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1247 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1248 | 1248 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1249 | 1249 | // which set hooks ? |
| 1250 | - if ( is_admin() ) { |
|
| 1250 | + if (is_admin()) { |
|
| 1251 | 1251 | // fire immediately |
| 1252 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
| 1252 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
| 1253 | 1253 | } else { |
| 1254 | 1254 | // delay until other systems are online |
| 1255 | 1255 | add_action( |
| 1256 | 1256 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
| 1257 | - array( $shortcode_class, 'set_hooks' ) |
|
| 1257 | + array($shortcode_class, 'set_hooks') |
|
| 1258 | 1258 | ); |
| 1259 | 1259 | // convert classname to UPPERCASE and create WP shortcode. |
| 1260 | - $shortcode_tag = strtoupper( $shortcode ); |
|
| 1260 | + $shortcode_tag = strtoupper($shortcode); |
|
| 1261 | 1261 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
| 1262 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
| 1262 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
| 1263 | 1263 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
| 1264 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
| 1264 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
| 1265 | 1265 | } |
| 1266 | 1266 | } |
| 1267 | 1267 | } |
@@ -1278,17 +1278,17 @@ discard block |
||
| 1278 | 1278 | */ |
| 1279 | 1279 | private function _initialize_modules() { |
| 1280 | 1280 | // cycle thru shortcode folders |
| 1281 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
| 1281 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
| 1282 | 1282 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1283 | 1283 | // which set hooks ? |
| 1284 | - if ( is_admin() ) { |
|
| 1284 | + if (is_admin()) { |
|
| 1285 | 1285 | // fire immediately |
| 1286 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
| 1286 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
| 1287 | 1287 | } else { |
| 1288 | 1288 | // delay until other systems are online |
| 1289 | 1289 | add_action( |
| 1290 | 1290 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
| 1291 | - array( $module_class, 'set_hooks' ) |
|
| 1291 | + array($module_class, 'set_hooks') |
|
| 1292 | 1292 | ); |
| 1293 | 1293 | } |
| 1294 | 1294 | } |
@@ -1306,29 +1306,29 @@ discard block |
||
| 1306 | 1306 | * @param string $key - url param key indicating a route is being called |
| 1307 | 1307 | * @return bool |
| 1308 | 1308 | */ |
| 1309 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
| 1310 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
| 1311 | - $module = str_replace( 'EED_', '', $module ); |
|
| 1312 | - $module_class = 'EED_' . $module; |
|
| 1313 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
| 1314 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
| 1315 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1309 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
| 1310 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
| 1311 | + $module = str_replace('EED_', '', $module); |
|
| 1312 | + $module_class = 'EED_'.$module; |
|
| 1313 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
| 1314 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
| 1315 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1316 | 1316 | return false; |
| 1317 | 1317 | } |
| 1318 | - if ( empty( $route ) ) { |
|
| 1319 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
| 1320 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1318 | + if (empty($route)) { |
|
| 1319 | + $msg = sprintf(__('No route has 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( 'EED_' . $module, $method_name ) ) { |
|
| 1323 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
| 1324 | 1324 | $msg = sprintf( |
| 1325 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
| 1325 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
| 1326 | 1326 | $route |
| 1327 | 1327 | ); |
| 1328 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1328 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1329 | 1329 | return false; |
| 1330 | 1330 | } |
| 1331 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
| 1331 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
| 1332 | 1332 | return true; |
| 1333 | 1333 | } |
| 1334 | 1334 | |
@@ -1342,11 +1342,11 @@ discard block |
||
| 1342 | 1342 | * @param string $key - url param key indicating a route is being called |
| 1343 | 1343 | * @return string |
| 1344 | 1344 | */ |
| 1345 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
| 1346 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
| 1347 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
| 1348 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
| 1349 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
| 1345 | + public static function get_route($route = null, $key = 'ee') { |
|
| 1346 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
| 1347 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
| 1348 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
| 1349 | + return EE_Config::$_module_route_map[$key][$route]; |
|
| 1350 | 1350 | } |
| 1351 | 1351 | return null; |
| 1352 | 1352 | } |
@@ -1376,49 +1376,49 @@ discard block |
||
| 1376 | 1376 | * @param string $key - url param key indicating a route is being called |
| 1377 | 1377 | * @return bool |
| 1378 | 1378 | */ |
| 1379 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
| 1380 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
| 1381 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
| 1379 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
| 1380 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
| 1381 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1382 | 1382 | $msg = sprintf( |
| 1383 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
| 1383 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
| 1384 | 1384 | $route |
| 1385 | 1385 | ); |
| 1386 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1386 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1387 | 1387 | return false; |
| 1388 | 1388 | } |
| 1389 | - if ( empty( $forward ) ) { |
|
| 1390 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
| 1391 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1389 | + if (empty($forward)) { |
|
| 1390 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
| 1391 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1392 | 1392 | return false; |
| 1393 | 1393 | } |
| 1394 | - if ( is_array( $forward ) ) { |
|
| 1395 | - if ( ! isset( $forward[1] ) ) { |
|
| 1394 | + if (is_array($forward)) { |
|
| 1395 | + if ( ! isset($forward[1])) { |
|
| 1396 | 1396 | $msg = sprintf( |
| 1397 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
| 1397 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
| 1398 | 1398 | $route |
| 1399 | 1399 | ); |
| 1400 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1400 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1401 | 1401 | return false; |
| 1402 | 1402 | } |
| 1403 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
| 1403 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
| 1404 | 1404 | $msg = sprintf( |
| 1405 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
| 1405 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
| 1406 | 1406 | $forward[1], |
| 1407 | 1407 | $route |
| 1408 | 1408 | ); |
| 1409 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1409 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1410 | 1410 | return false; |
| 1411 | 1411 | } |
| 1412 | - } else if ( ! function_exists( $forward ) ) { |
|
| 1412 | + } else if ( ! function_exists($forward)) { |
|
| 1413 | 1413 | $msg = sprintf( |
| 1414 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
| 1414 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
| 1415 | 1415 | $forward, |
| 1416 | 1416 | $route |
| 1417 | 1417 | ); |
| 1418 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1418 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1419 | 1419 | return false; |
| 1420 | 1420 | } |
| 1421 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
| 1421 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
| 1422 | 1422 | return true; |
| 1423 | 1423 | } |
| 1424 | 1424 | |
@@ -1434,12 +1434,12 @@ discard block |
||
| 1434 | 1434 | * @param string $key - url param key indicating a route is being called |
| 1435 | 1435 | * @return string |
| 1436 | 1436 | */ |
| 1437 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
| 1438 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
| 1439 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
| 1437 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
| 1438 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
| 1439 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
| 1440 | 1440 | return apply_filters( |
| 1441 | 1441 | 'FHEE__EE_Config__get_forward', |
| 1442 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
| 1442 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
| 1443 | 1443 | $route, |
| 1444 | 1444 | $status |
| 1445 | 1445 | ); |
@@ -1461,17 +1461,17 @@ discard block |
||
| 1461 | 1461 | * @param string $key - url param key indicating a route is being called |
| 1462 | 1462 | * @return bool |
| 1463 | 1463 | */ |
| 1464 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
| 1465 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
| 1466 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
| 1464 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
| 1465 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
| 1466 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1467 | 1467 | $msg = sprintf( |
| 1468 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
| 1468 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
| 1469 | 1469 | $route |
| 1470 | 1470 | ); |
| 1471 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1471 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1472 | 1472 | return false; |
| 1473 | 1473 | } |
| 1474 | - if ( ! is_readable( $view ) ) { |
|
| 1474 | + if ( ! is_readable($view)) { |
|
| 1475 | 1475 | $msg = sprintf( |
| 1476 | 1476 | __( |
| 1477 | 1477 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1479,10 +1479,10 @@ discard block |
||
| 1479 | 1479 | ), |
| 1480 | 1480 | $view |
| 1481 | 1481 | ); |
| 1482 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1482 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1483 | 1483 | return false; |
| 1484 | 1484 | } |
| 1485 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
| 1485 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
| 1486 | 1486 | return true; |
| 1487 | 1487 | } |
| 1488 | 1488 | |
@@ -1498,12 +1498,12 @@ discard block |
||
| 1498 | 1498 | * @param string $key - url param key indicating a route is being called |
| 1499 | 1499 | * @return string |
| 1500 | 1500 | */ |
| 1501 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
| 1502 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
| 1503 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
| 1501 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
| 1502 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
| 1503 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
| 1504 | 1504 | return apply_filters( |
| 1505 | 1505 | 'FHEE__EE_Config__get_view', |
| 1506 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
| 1506 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
| 1507 | 1507 | $route, |
| 1508 | 1508 | $status |
| 1509 | 1509 | ); |
@@ -1514,7 +1514,7 @@ discard block |
||
| 1514 | 1514 | |
| 1515 | 1515 | |
| 1516 | 1516 | public function update_addon_option_names() { |
| 1517 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
| 1517 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | 1520 | |
@@ -1537,22 +1537,22 @@ discard block |
||
| 1537 | 1537 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
| 1538 | 1538 | * @throws \EE_Error |
| 1539 | 1539 | */ |
| 1540 | - public function get_pretty( $property ) { |
|
| 1541 | - if ( ! property_exists( $this, $property ) ) { |
|
| 1540 | + public function get_pretty($property) { |
|
| 1541 | + if ( ! property_exists($this, $property)) { |
|
| 1542 | 1542 | throw new EE_Error( |
| 1543 | 1543 | sprintf( |
| 1544 | 1544 | __( |
| 1545 | 1545 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
| 1546 | 1546 | 'event_espresso' |
| 1547 | 1547 | ), |
| 1548 | - get_class( $this ), |
|
| 1548 | + get_class($this), |
|
| 1549 | 1549 | $property |
| 1550 | 1550 | ) |
| 1551 | 1551 | ); |
| 1552 | 1552 | } |
| 1553 | 1553 | //just handling escaping of strings for now. |
| 1554 | - if ( is_string( $this->{$property} ) ) { |
|
| 1555 | - return stripslashes( $this->{$property} ); |
|
| 1554 | + if (is_string($this->{$property} )) { |
|
| 1555 | + return stripslashes($this->{$property} ); |
|
| 1556 | 1556 | } |
| 1557 | 1557 | return $this->{$property}; |
| 1558 | 1558 | } |
@@ -1561,17 +1561,17 @@ discard block |
||
| 1561 | 1561 | |
| 1562 | 1562 | public function populate() { |
| 1563 | 1563 | //grab defaults via a new instance of this class. |
| 1564 | - $class_name = get_class( $this ); |
|
| 1564 | + $class_name = get_class($this); |
|
| 1565 | 1565 | $defaults = new $class_name; |
| 1566 | 1566 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
| 1567 | 1567 | //default from our $defaults object. |
| 1568 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
| 1569 | - if ( $this->{$property} === null ) { |
|
| 1568 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
| 1569 | + if ($this->{$property} === null) { |
|
| 1570 | 1570 | $this->{$property} = $value; |
| 1571 | 1571 | } |
| 1572 | 1572 | } |
| 1573 | 1573 | //cleanup |
| 1574 | - unset( $defaults ); |
|
| 1574 | + unset($defaults); |
|
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | 1577 | |
@@ -1587,7 +1587,7 @@ discard block |
||
| 1587 | 1587 | * @param $a |
| 1588 | 1588 | * @return bool |
| 1589 | 1589 | */ |
| 1590 | - public function __isset( $a ) { |
|
| 1590 | + public function __isset($a) { |
|
| 1591 | 1591 | return false; |
| 1592 | 1592 | } |
| 1593 | 1593 | |
@@ -1599,7 +1599,7 @@ discard block |
||
| 1599 | 1599 | * @param $a |
| 1600 | 1600 | * @return bool |
| 1601 | 1601 | */ |
| 1602 | - public function __unset( $a ) { |
|
| 1602 | + public function __unset($a) { |
|
| 1603 | 1603 | return false; |
| 1604 | 1604 | } |
| 1605 | 1605 | |
@@ -1698,18 +1698,18 @@ discard block |
||
| 1698 | 1698 | */ |
| 1699 | 1699 | public function __construct() { |
| 1700 | 1700 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
| 1701 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
| 1701 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
| 1702 | 1702 | // set default organization settings |
| 1703 | 1703 | $this->current_blog_id = get_current_blog_id(); |
| 1704 | 1704 | $this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id; |
| 1705 | 1705 | $this->ee_ueip_optin = is_main_site() |
| 1706 | - ? get_option( 'ee_ueip_optin', true ) |
|
| 1706 | + ? get_option('ee_ueip_optin', true) |
|
| 1707 | 1707 | : get_blog_option( |
| 1708 | 1708 | $current_main_site_id, |
| 1709 | 1709 | 'ee_ueip_optin', |
| 1710 | 1710 | true |
| 1711 | 1711 | ); |
| 1712 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
| 1712 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
| 1713 | 1713 | $this->post_shortcodes = array(); |
| 1714 | 1714 | $this->module_route_map = array(); |
| 1715 | 1715 | $this->module_forward_map = array(); |
@@ -1725,9 +1725,9 @@ discard block |
||
| 1725 | 1725 | $this->thank_you_page_url = ''; |
| 1726 | 1726 | $this->cancel_page_url = ''; |
| 1727 | 1727 | //cpt slugs |
| 1728 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
| 1728 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
| 1729 | 1729 | //ueip constant check |
| 1730 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
| 1730 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
| 1731 | 1731 | $this->ee_ueip_optin = false; |
| 1732 | 1732 | $this->ee_ueip_has_notified = true; |
| 1733 | 1733 | } |
@@ -1770,8 +1770,8 @@ discard block |
||
| 1770 | 1770 | * @return string |
| 1771 | 1771 | */ |
| 1772 | 1772 | public function reg_page_url() { |
| 1773 | - if ( ! $this->reg_page_url ) { |
|
| 1774 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
| 1773 | + if ( ! $this->reg_page_url) { |
|
| 1774 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
| 1775 | 1775 | } |
| 1776 | 1776 | return $this->reg_page_url; |
| 1777 | 1777 | } |
@@ -1786,12 +1786,12 @@ discard block |
||
| 1786 | 1786 | * @access public |
| 1787 | 1787 | * @return string |
| 1788 | 1788 | */ |
| 1789 | - public function txn_page_url( $query_args = array() ) { |
|
| 1790 | - if ( ! $this->txn_page_url ) { |
|
| 1791 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
| 1789 | + public function txn_page_url($query_args = array()) { |
|
| 1790 | + if ( ! $this->txn_page_url) { |
|
| 1791 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
| 1792 | 1792 | } |
| 1793 | - if ( $query_args ) { |
|
| 1794 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
| 1793 | + if ($query_args) { |
|
| 1794 | + return add_query_arg($query_args, $this->txn_page_url); |
|
| 1795 | 1795 | } else { |
| 1796 | 1796 | return $this->txn_page_url; |
| 1797 | 1797 | } |
@@ -1807,12 +1807,12 @@ discard block |
||
| 1807 | 1807 | * @access public |
| 1808 | 1808 | * @return string |
| 1809 | 1809 | */ |
| 1810 | - public function thank_you_page_url( $query_args = array() ) { |
|
| 1811 | - if ( ! $this->thank_you_page_url ) { |
|
| 1812 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
| 1810 | + public function thank_you_page_url($query_args = array()) { |
|
| 1811 | + if ( ! $this->thank_you_page_url) { |
|
| 1812 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
| 1813 | 1813 | } |
| 1814 | - if ( $query_args ) { |
|
| 1815 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
| 1814 | + if ($query_args) { |
|
| 1815 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
| 1816 | 1816 | } else { |
| 1817 | 1817 | return $this->thank_you_page_url; |
| 1818 | 1818 | } |
@@ -1827,8 +1827,8 @@ discard block |
||
| 1827 | 1827 | * @return string |
| 1828 | 1828 | */ |
| 1829 | 1829 | public function cancel_page_url() { |
| 1830 | - if ( ! $this->cancel_page_url ) { |
|
| 1831 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
| 1830 | + if ( ! $this->cancel_page_url) { |
|
| 1831 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
| 1832 | 1832 | } |
| 1833 | 1833 | return $this->cancel_page_url; |
| 1834 | 1834 | } |
@@ -1859,7 +1859,7 @@ discard block |
||
| 1859 | 1859 | //reset all url properties |
| 1860 | 1860 | $this->_reset_urls(); |
| 1861 | 1861 | //return what to save to db |
| 1862 | - return array_keys( get_object_vars( $this ) ); |
|
| 1862 | + return array_keys(get_object_vars($this)); |
|
| 1863 | 1863 | } |
| 1864 | 1864 | |
| 1865 | 1865 | } |
@@ -2007,14 +2007,14 @@ discard block |
||
| 2007 | 2007 | */ |
| 2008 | 2008 | public function __construct() { |
| 2009 | 2009 | // set default organization settings |
| 2010 | - $this->name = get_bloginfo( 'name' ); |
|
| 2010 | + $this->name = get_bloginfo('name'); |
|
| 2011 | 2011 | $this->address_1 = '123 Onna Road'; |
| 2012 | 2012 | $this->address_2 = 'PO Box 123'; |
| 2013 | 2013 | $this->city = 'Inna City'; |
| 2014 | 2014 | $this->STA_ID = 4; |
| 2015 | 2015 | $this->CNT_ISO = 'US'; |
| 2016 | 2016 | $this->zip = '12345'; |
| 2017 | - $this->email = get_bloginfo( 'admin_email' ); |
|
| 2017 | + $this->email = get_bloginfo('admin_email'); |
|
| 2018 | 2018 | $this->phone = ''; |
| 2019 | 2019 | $this->vat = '123456789'; |
| 2020 | 2020 | $this->logo_url = ''; |
@@ -2102,45 +2102,45 @@ discard block |
||
| 2102 | 2102 | * @param string $CNT_ISO |
| 2103 | 2103 | * @return \EE_Currency_Config |
| 2104 | 2104 | */ |
| 2105 | - public function __construct( $CNT_ISO = '' ) { |
|
| 2105 | + public function __construct($CNT_ISO = '') { |
|
| 2106 | 2106 | // get country code from organization settings or use default |
| 2107 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
| 2107 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
| 2108 | 2108 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
| 2109 | 2109 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
| 2110 | 2110 | : ''; |
| 2111 | 2111 | // but override if requested |
| 2112 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
| 2113 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
| 2112 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
| 2113 | + EE_Registry::instance()->load_helper('Activation'); |
|
| 2114 | 2114 | // 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 |
| 2115 | 2115 | if ( |
| 2116 | - ! empty( $CNT_ISO ) |
|
| 2116 | + ! empty($CNT_ISO) |
|
| 2117 | 2117 | && EE_Maintenance_Mode::instance()->models_can_query() |
| 2118 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
| 2118 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
| 2119 | 2119 | ) { |
| 2120 | 2120 | // retrieve the country settings from the db, just in case they have been customized |
| 2121 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
| 2122 | - if ( $country instanceof EE_Country ) { |
|
| 2123 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 2124 | - $this->name = $country->currency_name_single(); // Dollar |
|
| 2125 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
| 2126 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 2127 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 2128 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 2129 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 2130 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 2121 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
| 2122 | + if ($country instanceof EE_Country) { |
|
| 2123 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 2124 | + $this->name = $country->currency_name_single(); // Dollar |
|
| 2125 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
| 2126 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 2127 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 2128 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 2129 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 2130 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 2131 | 2131 | } |
| 2132 | 2132 | } |
| 2133 | 2133 | // fallback to hardcoded defaults, in case the above failed |
| 2134 | - if ( empty( $this->code ) ) { |
|
| 2134 | + if (empty($this->code)) { |
|
| 2135 | 2135 | // set default currency settings |
| 2136 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 2137 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
| 2138 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
| 2139 | - $this->sign = '$'; // currency sign: $ |
|
| 2140 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
| 2141 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 2142 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 2143 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 2136 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 2137 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
| 2138 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
| 2139 | + $this->sign = '$'; // currency sign: $ |
|
| 2140 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
| 2141 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 2142 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 2143 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 2144 | 2144 | } |
| 2145 | 2145 | } |
| 2146 | 2146 | } |
@@ -2303,7 +2303,7 @@ discard block |
||
| 2303 | 2303 | * @since 4.8.8.rc.019 |
| 2304 | 2304 | */ |
| 2305 | 2305 | public function do_hooks() { |
| 2306 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
| 2306 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | 2309 | |
@@ -2312,7 +2312,7 @@ discard block |
||
| 2312 | 2312 | * @return void |
| 2313 | 2313 | */ |
| 2314 | 2314 | public function set_default_reg_status_on_EEM_Event() { |
| 2315 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
| 2315 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
| 2316 | 2316 | } |
| 2317 | 2317 | |
| 2318 | 2318 | |
@@ -2417,10 +2417,10 @@ discard block |
||
| 2417 | 2417 | * @param bool $reset |
| 2418 | 2418 | * @return string |
| 2419 | 2419 | */ |
| 2420 | - public function log_file_name( $reset = false ) { |
|
| 2421 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
| 2422 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
| 2423 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
| 2420 | + public function log_file_name($reset = false) { |
|
| 2421 | + if (empty($this->log_file_name) || $reset) { |
|
| 2422 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
| 2423 | + EE_Config::instance()->update_espresso_config(false, false); |
|
| 2424 | 2424 | } |
| 2425 | 2425 | return $this->log_file_name; |
| 2426 | 2426 | } |
@@ -2431,10 +2431,10 @@ discard block |
||
| 2431 | 2431 | * @param bool $reset |
| 2432 | 2432 | * @return string |
| 2433 | 2433 | */ |
| 2434 | - public function debug_file_name( $reset = false ) { |
|
| 2435 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
| 2436 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
| 2437 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
| 2434 | + public function debug_file_name($reset = false) { |
|
| 2435 | + if (empty($this->debug_file_name) || $reset) { |
|
| 2436 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
| 2437 | + EE_Config::instance()->update_espresso_config(false, false); |
|
| 2438 | 2438 | } |
| 2439 | 2439 | return $this->debug_file_name; |
| 2440 | 2440 | } |
@@ -2606,21 +2606,21 @@ discard block |
||
| 2606 | 2606 | // set default map settings |
| 2607 | 2607 | $this->use_google_maps = true; |
| 2608 | 2608 | // for event details pages (reg page) |
| 2609 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2610 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2611 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2612 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
| 2613 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
| 2614 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2615 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2609 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2610 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2611 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2612 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
| 2613 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
| 2614 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2615 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2616 | 2616 | // for event list pages |
| 2617 | - $this->event_list_map_width = 300; // ee_map_width |
|
| 2618 | - $this->event_list_map_height = 185; // ee_map_height |
|
| 2619 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2620 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
| 2621 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
| 2622 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2623 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2617 | + $this->event_list_map_width = 300; // ee_map_width |
|
| 2618 | + $this->event_list_map_height = 185; // ee_map_height |
|
| 2619 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2620 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
| 2621 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
| 2622 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2623 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2624 | 2624 | } |
| 2625 | 2625 | |
| 2626 | 2626 | } |
@@ -2773,7 +2773,7 @@ discard block |
||
| 2773 | 2773 | * @return void |
| 2774 | 2774 | */ |
| 2775 | 2775 | protected function _set_php_values() { |
| 2776 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
| 2776 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
| 2777 | 2777 | $this->php->version = phpversion(); |
| 2778 | 2778 | } |
| 2779 | 2779 | |
@@ -2792,10 +2792,10 @@ discard block |
||
| 2792 | 2792 | * @type string $msg Any message to be displayed. |
| 2793 | 2793 | * } |
| 2794 | 2794 | */ |
| 2795 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
| 2796 | - if ( ! empty( $this->php->max_input_vars ) |
|
| 2797 | - && ( $input_count >= $this->php->max_input_vars ) |
|
| 2798 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
| 2795 | + public function max_input_vars_limit_check($input_count = 0) { |
|
| 2796 | + if ( ! empty($this->php->max_input_vars) |
|
| 2797 | + && ($input_count >= $this->php->max_input_vars) |
|
| 2798 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
| 2799 | 2799 | ) { |
| 2800 | 2800 | return sprintf( |
| 2801 | 2801 | __( |
@@ -2861,7 +2861,7 @@ discard block |
||
| 2861 | 2861 | */ |
| 2862 | 2862 | public function __construct() { |
| 2863 | 2863 | $this->payment_settings = array(); |
| 2864 | - $this->active_gateways = array( 'Invoice' => false ); |
|
| 2864 | + $this->active_gateways = array('Invoice' => false); |
|
| 2865 | 2865 | } |
| 2866 | 2866 | } |
| 2867 | 2867 | |