@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * update_espresso_config |
| 373 | 373 | * |
| 374 | 374 | * @access public |
| 375 | - * @return bool |
|
| 375 | + * @return boolean|null |
|
| 376 | 376 | */ |
| 377 | 377 | protected function _reset_espresso_addon_config() { |
| 378 | 378 | $this->_config_option_names = array(); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | * @param string $name |
| 453 | 453 | * @param string $config_class |
| 454 | 454 | * @param EE_Config_Base $config_obj |
| 455 | - * @param array $tests_to_run |
|
| 455 | + * @param integer[] $tests_to_run |
|
| 456 | 456 | * @param bool $display_errors |
| 457 | 457 | * @return bool TRUE on success, FALSE on fail |
| 458 | 458 | */ |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | * |
| 977 | 977 | * @access public |
| 978 | 978 | * @param string $shortcode_path - full path up to and including shortcode folder |
| 979 | - * @return bool |
|
| 979 | + * @return boolean|null |
|
| 980 | 980 | */ |
| 981 | 981 | public static function register_shortcode( $shortcode_path = NULL ) { |
| 982 | 982 | EE_Config::instance()->_register_shortcode( $shortcode_path ); |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | * |
| 1083 | 1083 | * @access public |
| 1084 | 1084 | * @param string $module_path - full path up to and including module folder |
| 1085 | - * @return bool |
|
| 1085 | + * @return boolean|null |
|
| 1086 | 1086 | */ |
| 1087 | 1087 | public static function register_module( $module_path = NULL ) { |
| 1088 | 1088 | EE_Config::instance()->_register_module( $module_path ); |
@@ -1564,7 +1564,7 @@ discard block |
||
| 1564 | 1564 | |
| 1565 | 1565 | |
| 1566 | 1566 | /** |
| 1567 | - * @return array |
|
| 1567 | + * @return integer[] |
|
| 1568 | 1568 | */ |
| 1569 | 1569 | public function get_critical_pages_array() { |
| 1570 | 1570 | return array( |
@@ -1577,7 +1577,7 @@ discard block |
||
| 1577 | 1577 | |
| 1578 | 1578 | |
| 1579 | 1579 | /** |
| 1580 | - * @return array |
|
| 1580 | + * @return string[] |
|
| 1581 | 1581 | */ |
| 1582 | 1582 | public function get_critical_pages_shortcodes_array() { |
| 1583 | 1583 | return array( |
@@ -1900,7 +1900,7 @@ discard block |
||
| 1900 | 1900 | * class constructor |
| 1901 | 1901 | * |
| 1902 | 1902 | * @access public |
| 1903 | - * @param null $CNT_ISO |
|
| 1903 | + * @param string $CNT_ISO |
|
| 1904 | 1904 | * @return \EE_Currency_Config |
| 1905 | 1905 | */ |
| 1906 | 1906 | public function __construct( $CNT_ISO = NULL ) { |
@@ -2547,7 +2547,7 @@ discard block |
||
| 2547 | 2547 | * |
| 2548 | 2548 | * @param int $input_count the count of input vars. |
| 2549 | 2549 | * |
| 2550 | - * @return array { |
|
| 2550 | + * @return string { |
|
| 2551 | 2551 | * An array that represents whether available space and if no available space the error message. |
| 2552 | 2552 | * @type bool $has_space whether more inputs can be added. |
| 2553 | 2553 | * @type string $msg Any message to be displayed. |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | * @param \EE_Registry $registry |
| 133 | 133 | * @return \EE_Config instance |
| 134 | 134 | */ |
| 135 | - public static function instance( \EE_Registry $registry = null ) { |
|
| 135 | + public static function instance(\EE_Registry $registry = null) { |
|
| 136 | 136 | // check if class object is instantiated, and instantiated properly |
| 137 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
| 138 | - self::$_instance = new self( $registry ); |
|
| 137 | + if ( ! self::$_instance instanceof EE_Config) { |
|
| 138 | + self::$_instance = new self($registry); |
|
| 139 | 139 | } |
| 140 | 140 | return self::$_instance; |
| 141 | 141 | } |
@@ -153,22 +153,22 @@ discard block |
||
| 153 | 153 | * @param \EE_Registry $registry |
| 154 | 154 | * @return \EE_Config |
| 155 | 155 | */ |
| 156 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE, \EE_Registry $registry = null ){ |
|
| 157 | - if ( $hard_reset ) { |
|
| 156 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE, \EE_Registry $registry = null) { |
|
| 157 | + if ($hard_reset) { |
|
| 158 | 158 | self::$_instance->_config_option_names = array(); |
| 159 | 159 | self::$_instance->_initialize_config(); |
| 160 | 160 | self::$_instance->update_espresso_config(); |
| 161 | 161 | } |
| 162 | - if( self::$_instance instanceof EE_Config ){ |
|
| 162 | + if (self::$_instance instanceof EE_Config) { |
|
| 163 | 163 | self::$_instance->shutdown(); |
| 164 | 164 | } |
| 165 | 165 | self::$_instance = null; |
| 166 | 166 | //we don't need to reset the static properties imo because those should |
| 167 | 167 | //only change when a module is added or removed. Currently we don't |
| 168 | 168 | //support removing a module during a request when it previously existed |
| 169 | - if( $reinstantiate ){ |
|
| 170 | - return self::instance( $registry ); |
|
| 171 | - }else{ |
|
| 169 | + if ($reinstantiate) { |
|
| 170 | + return self::instance($registry); |
|
| 171 | + } else { |
|
| 172 | 172 | return NULL; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | * @access private |
| 182 | 182 | * @param \EE_Registry $registry |
| 183 | 183 | */ |
| 184 | - private function __construct( \EE_Registry $registry ) { |
|
| 185 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
| 184 | + private function __construct(\EE_Registry $registry) { |
|
| 185 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
| 186 | 186 | $this->registry = $registry; |
| 187 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
| 187 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
| 188 | 188 | // setup empty config classes |
| 189 | 189 | $this->_initialize_config(); |
| 190 | 190 | // load existing EE site settings |
@@ -192,15 +192,15 @@ discard block |
||
| 192 | 192 | // confirm everything loaded correctly and set filtered defaults if not |
| 193 | 193 | $this->_verify_config(); |
| 194 | 194 | // register shortcodes and modules |
| 195 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
| 195 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
| 196 | 196 | // initialize shortcodes and modules |
| 197 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
| 197 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
| 198 | 198 | // register widgets |
| 199 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
| 199 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
| 200 | 200 | // shutdown |
| 201 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
| 201 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
| 202 | 202 | // construct__end hook |
| 203 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
| 203 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
| 204 | 204 | // hardcoded hack |
| 205 | 205 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
| 206 | 206 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @return string current theme set. |
| 214 | 214 | */ |
| 215 | 215 | public static function get_current_theme() { |
| 216 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
| 216 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
@@ -247,27 +247,27 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | private function _load_core_config() { |
| 249 | 249 | // load_core_config__start hook |
| 250 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
| 250 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
| 251 | 251 | $espresso_config = $this->get_espresso_config(); |
| 252 | - foreach ( $espresso_config as $config => $settings ) { |
|
| 252 | + foreach ($espresso_config as $config => $settings) { |
|
| 253 | 253 | // load_core_config__start hook |
| 254 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
| 255 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
| 256 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
| 254 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
| 255 | + if (is_object($settings) && property_exists($this, $config)) { |
|
| 256 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
| 257 | 257 | //call configs populate method to ensure any defaults are set for empty values. |
| 258 | - if ( method_exists( $settings, 'populate' ) ) { |
|
| 258 | + if (method_exists($settings, 'populate')) { |
|
| 259 | 259 | $this->{$config}->populate(); |
| 260 | 260 | } |
| 261 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
| 261 | + if (method_exists($settings, 'do_hooks')) { |
|
| 262 | 262 | $this->{$config}->do_hooks(); |
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
| 266 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
| 267 | 267 | $this->update_espresso_config(); |
| 268 | 268 | } |
| 269 | 269 | // load_core_config__end hook |
| 270 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
| 270 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
@@ -281,40 +281,40 @@ discard block |
||
| 281 | 281 | protected function _verify_config() { |
| 282 | 282 | |
| 283 | 283 | $this->core = $this->core instanceof EE_Core_Config |
| 284 | - ? $this->core : new EE_Core_Config(); |
|
| 285 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
| 284 | + ? $this->core : new EE_Core_Config(); |
|
| 285 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
| 286 | 286 | |
| 287 | 287 | $this->organization = $this->organization instanceof EE_Organization_Config |
| 288 | - ? $this->organization : new EE_Organization_Config(); |
|
| 289 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
| 288 | + ? $this->organization : new EE_Organization_Config(); |
|
| 289 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
| 290 | 290 | |
| 291 | 291 | $this->currency = $this->currency instanceof EE_Currency_Config |
| 292 | 292 | ? $this->currency : new EE_Currency_Config(); |
| 293 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
| 293 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
| 294 | 294 | |
| 295 | 295 | $this->registration = $this->registration instanceof EE_Registration_Config |
| 296 | 296 | ? $this->registration : new EE_Registration_Config(); |
| 297 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
| 297 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
| 298 | 298 | |
| 299 | 299 | $this->admin = $this->admin instanceof EE_Admin_Config |
| 300 | 300 | ? $this->admin : new EE_Admin_Config(); |
| 301 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
| 301 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
| 302 | 302 | |
| 303 | 303 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
| 304 | 304 | ? $this->template_settings : new EE_Template_Config(); |
| 305 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
| 305 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
| 306 | 306 | |
| 307 | 307 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
| 308 | 308 | ? $this->map_settings : new EE_Map_Config(); |
| 309 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
| 309 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
| 310 | 310 | |
| 311 | 311 | $this->environment = $this->environment instanceof EE_Environment_Config |
| 312 | 312 | ? $this->environment : new EE_Environment_Config(); |
| 313 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
| 313 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
| 314 | 314 | |
| 315 | 315 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
| 316 | 316 | ? $this->gateway : new EE_Gateway_Config(); |
| 317 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
| 317 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
| 318 | 318 | |
| 319 | 319 | } |
| 320 | 320 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function get_espresso_config() { |
| 330 | 330 | // grab espresso configuration |
| 331 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
| 331 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | * @param $old_value |
| 342 | 342 | * @param $value |
| 343 | 343 | */ |
| 344 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
| 344 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
| 345 | 345 | // make sure we're checking the ee config |
| 346 | - if ( $option == 'ee_config' ) { |
|
| 346 | + if ($option == 'ee_config') { |
|
| 347 | 347 | // run a loose comparison of the old value against the new value for type and properties, |
| 348 | 348 | // but NOT exact instance like WP update_option does |
| 349 | - if ( $value != $old_value ) { |
|
| 349 | + if ($value != $old_value) { |
|
| 350 | 350 | // if they are NOT the same, then remove the hook, |
| 351 | 351 | // which means the subsequent update results will be based solely on the update query results |
| 352 | 352 | // the reason we do this is because, as stated above, |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | // the string it sees in the db looks the same as the new one it has been passed!!! |
| 362 | 362 | // This results in the query returning an "affected rows" value of ZERO, |
| 363 | 363 | // which gets returned immediately by WP update_option and looks like an error. |
| 364 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
| 364 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | protected function _reset_espresso_addon_config() { |
| 378 | 378 | $this->_config_option_names = array(); |
| 379 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
| 380 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
| 381 | - $config_class = get_class( $addon_config_obj ); |
|
| 382 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
| 383 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
| 379 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
| 380 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
| 381 | + $config_class = get_class($addon_config_obj); |
|
| 382 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
| 383 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
| 384 | 384 | } |
| 385 | 385 | $this->addons->{$addon_name} = NULL; |
| 386 | 386 | } |
@@ -396,17 +396,17 @@ discard block |
||
| 396 | 396 | * @param bool $add_error |
| 397 | 397 | * @return bool |
| 398 | 398 | */ |
| 399 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
| 399 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
| 400 | 400 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
| 401 | 401 | //$clone = clone( self::$_instance ); |
| 402 | 402 | //self::$_instance = NULL; |
| 403 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
| 403 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
| 404 | 404 | $this->_reset_espresso_addon_config(); |
| 405 | 405 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
| 406 | 406 | // but BEFORE the actual update occurs |
| 407 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
| 407 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
| 408 | 408 | // now update "ee_config" |
| 409 | - $saved = update_option( 'ee_config', $this ); |
|
| 409 | + $saved = update_option('ee_config', $this); |
|
| 410 | 410 | // if not saved... check if the hook we just added still exists; |
| 411 | 411 | // if it does, it means one of two things: |
| 412 | 412 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -417,25 +417,25 @@ discard block |
||
| 417 | 417 | // but just means no update occurred, so don't display an error to the user. |
| 418 | 418 | // BUT... if update_option returns FALSE, AND the hook is missing, |
| 419 | 419 | // then it means that something truly went wrong |
| 420 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
| 420 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
| 421 | 421 | // remove our action since we don't want it in the system anymore |
| 422 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
| 423 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
| 422 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
| 423 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
| 424 | 424 | //self::$_instance = $clone; |
| 425 | 425 | //unset( $clone ); |
| 426 | 426 | // if config remains the same or was updated successfully |
| 427 | - if ( $saved ) { |
|
| 428 | - if ( $add_success ) { |
|
| 427 | + if ($saved) { |
|
| 428 | + if ($add_success) { |
|
| 429 | 429 | EE_Error::add_success( |
| 430 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
| 430 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
| 431 | 431 | __FILE__, __FUNCTION__, __LINE__ |
| 432 | 432 | ); |
| 433 | 433 | } |
| 434 | 434 | return TRUE; |
| 435 | 435 | } else { |
| 436 | - if ( $add_error ) { |
|
| 436 | + if ($add_error) { |
|
| 437 | 437 | EE_Error::add_error( |
| 438 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
| 438 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
| 439 | 439 | __FILE__, __FUNCTION__, __LINE__ |
| 440 | 440 | ); |
| 441 | 441 | } |
@@ -461,20 +461,20 @@ discard block |
||
| 461 | 461 | $name = '', |
| 462 | 462 | $config_class = '', |
| 463 | 463 | $config_obj = NULL, |
| 464 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
| 464 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
| 465 | 465 | $display_errors = TRUE |
| 466 | 466 | ) { |
| 467 | 467 | try { |
| 468 | - foreach ( $tests_to_run as $test ) { |
|
| 469 | - switch ( $test ) { |
|
| 468 | + foreach ($tests_to_run as $test) { |
|
| 469 | + switch ($test) { |
|
| 470 | 470 | |
| 471 | 471 | // TEST #1 : check that section was set |
| 472 | 472 | case 1 : |
| 473 | - if ( empty( $section ) ) { |
|
| 474 | - if ( $display_errors ) { |
|
| 473 | + if (empty($section)) { |
|
| 474 | + if ($display_errors) { |
|
| 475 | 475 | throw new EE_Error( |
| 476 | 476 | sprintf( |
| 477 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
| 477 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
| 478 | 478 | $config_class |
| 479 | 479 | ) |
| 480 | 480 | ); |
@@ -485,11 +485,11 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | // TEST #2 : check that settings section exists |
| 487 | 487 | case 2 : |
| 488 | - if ( ! isset( $this->{$section} ) ) { |
|
| 489 | - if ( $display_errors ) { |
|
| 488 | + if ( ! isset($this->{$section} )) { |
|
| 489 | + if ($display_errors) { |
|
| 490 | 490 | throw new EE_Error( |
| 491 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
| 492 | - $section ) |
|
| 491 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
| 492 | + $section) |
|
| 493 | 493 | ); |
| 494 | 494 | } |
| 495 | 495 | return false; |
@@ -499,12 +499,12 @@ discard block |
||
| 499 | 499 | // TEST #3 : check that section is the proper format |
| 500 | 500 | case 3 : |
| 501 | 501 | if ( |
| 502 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
| 502 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
| 503 | 503 | ) { |
| 504 | - if ( $display_errors ) { |
|
| 504 | + if ($display_errors) { |
|
| 505 | 505 | throw new EE_Error( |
| 506 | 506 | sprintf( |
| 507 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
| 507 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
| 508 | 508 | $section |
| 509 | 509 | ) |
| 510 | 510 | ); |
@@ -515,10 +515,10 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | // TEST #4 : check that config section name has been set |
| 517 | 517 | case 4 : |
| 518 | - if ( empty( $name ) ) { |
|
| 519 | - if ( $display_errors ) { |
|
| 518 | + if (empty($name)) { |
|
| 519 | + if ($display_errors) { |
|
| 520 | 520 | throw new EE_Error( |
| 521 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
| 521 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
| 522 | 522 | ); |
| 523 | 523 | } |
| 524 | 524 | return false; |
@@ -527,10 +527,10 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | // TEST #5 : check that a config class name has been set |
| 529 | 529 | case 5 : |
| 530 | - if ( empty( $config_class ) ) { |
|
| 531 | - if ( $display_errors ) { |
|
| 530 | + if (empty($config_class)) { |
|
| 531 | + if ($display_errors) { |
|
| 532 | 532 | throw new EE_Error( |
| 533 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
| 533 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
| 534 | 534 | ); |
| 535 | 535 | } |
| 536 | 536 | return false; |
@@ -539,11 +539,11 @@ discard block |
||
| 539 | 539 | |
| 540 | 540 | // TEST #6 : verify config class is accessible |
| 541 | 541 | case 6 : |
| 542 | - if ( ! class_exists( $config_class ) ) { |
|
| 543 | - if ( $display_errors ) { |
|
| 542 | + if ( ! class_exists($config_class)) { |
|
| 543 | + if ($display_errors) { |
|
| 544 | 544 | throw new EE_Error( |
| 545 | 545 | sprintf( |
| 546 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
| 546 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
| 547 | 547 | $config_class |
| 548 | 548 | ) |
| 549 | 549 | ); |
@@ -554,11 +554,11 @@ discard block |
||
| 554 | 554 | |
| 555 | 555 | // TEST #7 : check that config has even been set |
| 556 | 556 | case 7 : |
| 557 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
| 558 | - if ( $display_errors ) { |
|
| 557 | + if ( ! isset($this->{$section}->{$name} )) { |
|
| 558 | + if ($display_errors) { |
|
| 559 | 559 | throw new EE_Error( |
| 560 | 560 | sprintf( |
| 561 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
| 561 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
| 562 | 562 | $section, |
| 563 | 563 | $name |
| 564 | 564 | ) |
@@ -567,17 +567,17 @@ discard block |
||
| 567 | 567 | return false; |
| 568 | 568 | } else { |
| 569 | 569 | // and make sure it's not serialized |
| 570 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
| 570 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
| 571 | 571 | } |
| 572 | 572 | break; |
| 573 | 573 | |
| 574 | 574 | // TEST #8 : check that config is the requested type |
| 575 | 575 | case 8 : |
| 576 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
| 577 | - if ( $display_errors ) { |
|
| 576 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
| 577 | + if ($display_errors) { |
|
| 578 | 578 | throw new EE_Error( |
| 579 | 579 | sprintf( |
| 580 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
| 580 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
| 581 | 581 | $section, |
| 582 | 582 | $name, |
| 583 | 583 | $config_class |
@@ -590,12 +590,12 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | // TEST #9 : verify config object |
| 592 | 592 | case 9 : |
| 593 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
| 594 | - if ( $display_errors ) { |
|
| 593 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
| 594 | + if ($display_errors) { |
|
| 595 | 595 | throw new EE_Error( |
| 596 | 596 | sprintf( |
| 597 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
| 598 | - print_r( $config_obj, true ) |
|
| 597 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
| 598 | + print_r($config_obj, true) |
|
| 599 | 599 | ) |
| 600 | 600 | ); |
| 601 | 601 | } |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | } |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - } catch( EE_Error $e ) { |
|
| 609 | + } catch (EE_Error $e) { |
|
| 610 | 610 | $e->get_error(); |
| 611 | 611 | } |
| 612 | 612 | // you have successfully run the gauntlet |
@@ -623,8 +623,8 @@ discard block |
||
| 623 | 623 | * @param string $name |
| 624 | 624 | * @return string |
| 625 | 625 | */ |
| 626 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
| 627 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
| 626 | + private function _generate_config_option_name($section = '', $name = '') { |
|
| 627 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | |
@@ -638,10 +638,10 @@ discard block |
||
| 638 | 638 | * @param string $name |
| 639 | 639 | * @return string |
| 640 | 640 | */ |
| 641 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
| 642 | - return ! empty( $config_class ) |
|
| 641 | + private function _set_config_class($config_class = '', $name = '') { |
|
| 642 | + return ! empty($config_class) |
|
| 643 | 643 | ? $config_class |
| 644 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
| 644 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | |
@@ -655,34 +655,34 @@ discard block |
||
| 655 | 655 | * @param EE_Config_Base $config_obj |
| 656 | 656 | * @return EE_Config_Base |
| 657 | 657 | */ |
| 658 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
| 658 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
| 659 | 659 | // ensure config class is set to something |
| 660 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 660 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 661 | 661 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
| 662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
| 662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
| 663 | 663 | return null; |
| 664 | 664 | } |
| 665 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 665 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 666 | 666 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
| 667 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
| 668 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
| 667 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
| 668 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
| 669 | 669 | } |
| 670 | 670 | // verify the incoming config object but suppress errors |
| 671 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
| 671 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
| 672 | 672 | $config_obj = new $config_class(); |
| 673 | 673 | } |
| 674 | - if ( get_option( $config_option_name ) ) { |
|
| 675 | - update_option( $config_option_name, $config_obj ); |
|
| 674 | + if (get_option($config_option_name)) { |
|
| 675 | + update_option($config_option_name, $config_obj); |
|
| 676 | 676 | $this->{$section}->{$name} = $config_obj; |
| 677 | 677 | return $this->{$section}->{$name}; |
| 678 | 678 | } else { |
| 679 | 679 | // create a wp-option for this config |
| 680 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
| 681 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
| 680 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
| 681 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
| 682 | 682 | return $this->{$section}->{$name}; |
| 683 | 683 | } else { |
| 684 | 684 | EE_Error::add_error( |
| 685 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
| 685 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
| 686 | 686 | __FILE__, __FUNCTION__, __LINE__ |
| 687 | 687 | ); |
| 688 | 688 | return null; |
@@ -703,37 +703,37 @@ discard block |
||
| 703 | 703 | * @param bool $throw_errors |
| 704 | 704 | * @return bool |
| 705 | 705 | */ |
| 706 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
| 707 | - $config_obj = maybe_unserialize( $config_obj ); |
|
| 706 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
| 707 | + $config_obj = maybe_unserialize($config_obj); |
|
| 708 | 708 | // get class name of the incoming object |
| 709 | - $config_class = get_class( $config_obj ); |
|
| 709 | + $config_class = get_class($config_obj); |
|
| 710 | 710 | // run tests 1-5 and 9 to verify config |
| 711 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
| 711 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
| 712 | 712 | return false; |
| 713 | 713 | } |
| 714 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 714 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 715 | 715 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
| 716 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
| 716 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
| 717 | 717 | // save new config to db |
| 718 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
| 718 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
| 719 | 719 | } else { |
| 720 | 720 | // first check if the record already exists |
| 721 | - $existing_config = get_option( $config_option_name ); |
|
| 722 | - $config_obj = serialize( $config_obj ); |
|
| 721 | + $existing_config = get_option($config_option_name); |
|
| 722 | + $config_obj = serialize($config_obj); |
|
| 723 | 723 | // just return if db record is already up to date |
| 724 | - if ( $existing_config == $config_obj ) { |
|
| 724 | + if ($existing_config == $config_obj) { |
|
| 725 | 725 | $this->{$section}->{$name} = $config_obj; |
| 726 | 726 | return true; |
| 727 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
| 727 | + } else if (update_option($config_option_name, $config_obj)) { |
|
| 728 | 728 | // update wp-option for this config class |
| 729 | 729 | $this->{$section}->{$name} = $config_obj; |
| 730 | 730 | return true; |
| 731 | - } elseif ( $throw_errors ) { |
|
| 731 | + } elseif ($throw_errors) { |
|
| 732 | 732 | EE_Error::add_error( |
| 733 | 733 | sprintf( |
| 734 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
| 734 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
| 735 | 735 | $config_class, |
| 736 | - 'EE_Config->' . $section . '->' . $name |
|
| 736 | + 'EE_Config->'.$section.'->'.$name |
|
| 737 | 737 | ), |
| 738 | 738 | __FILE__, __FUNCTION__, __LINE__ |
| 739 | 739 | ); |
@@ -753,34 +753,34 @@ discard block |
||
| 753 | 753 | * @param string $config_class |
| 754 | 754 | * @return mixed EE_Config_Base | NULL |
| 755 | 755 | */ |
| 756 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
| 756 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
| 757 | 757 | // ensure config class is set to something |
| 758 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 758 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 759 | 759 | // run tests 1-4, 6 and 7 to verify that all params have been set |
| 760 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
| 760 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
| 761 | 761 | return NULL; |
| 762 | 762 | } |
| 763 | 763 | // now test if the requested config object exists, but suppress errors |
| 764 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
| 764 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
| 765 | 765 | // config already exists, so pass it back |
| 766 | 766 | return $this->{$section}->{$name}; |
| 767 | 767 | } |
| 768 | 768 | // load config option from db if it exists |
| 769 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
| 769 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
| 770 | 770 | // verify the newly retrieved config object, but suppress errors |
| 771 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
| 771 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
| 772 | 772 | // config is good, so set it and pass it back |
| 773 | 773 | $this->{$section}->{$name} = $config_obj; |
| 774 | 774 | return $this->{$section}->{$name}; |
| 775 | 775 | } |
| 776 | 776 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
| 777 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
| 777 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
| 778 | 778 | // verify the newly created config object |
| 779 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
| 779 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
| 780 | 780 | return $this->{$section}->{$name}; |
| 781 | 781 | } else { |
| 782 | 782 | EE_Error::add_error( |
| 783 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
| 783 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
| 784 | 784 | __FILE__, __FUNCTION__, __LINE__ |
| 785 | 785 | ); |
| 786 | 786 | } |
@@ -795,9 +795,9 @@ discard block |
||
| 795 | 795 | * @param string $config_option_name |
| 796 | 796 | * @return mixed EE_Config_Base | FALSE |
| 797 | 797 | */ |
| 798 | - public function get_config_option( $config_option_name = '' ) { |
|
| 798 | + public function get_config_option($config_option_name = '') { |
|
| 799 | 799 | // retrieve the wp-option for this config class. |
| 800 | - return maybe_unserialize( get_option( $config_option_name )); |
|
| 800 | + return maybe_unserialize(get_option($config_option_name)); |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | |
@@ -812,14 +812,14 @@ discard block |
||
| 812 | 812 | * @return string |
| 813 | 813 | */ |
| 814 | 814 | public static function get_page_for_posts() { |
| 815 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
| 816 | - if ( ! $page_for_posts ) { |
|
| 815 | + $page_for_posts = get_option('page_for_posts'); |
|
| 816 | + if ( ! $page_for_posts) { |
|
| 817 | 817 | return 'posts'; |
| 818 | 818 | } |
| 819 | 819 | /** @type WPDB $wpdb */ |
| 820 | 820 | global $wpdb; |
| 821 | 821 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
| 822 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
| 822 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | */ |
| 837 | 837 | public function register_shortcodes_and_modules() { |
| 838 | 838 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
| 839 | - $this->registry->shortcodes =$this->_register_shortcodes(); |
|
| 839 | + $this->registry->shortcodes = $this->_register_shortcodes(); |
|
| 840 | 840 | // allow modules to set hooks for the rest of the system |
| 841 | 841 | $this->registry->modules = $this->_register_modules(); |
| 842 | 842 | } |
@@ -868,21 +868,21 @@ discard block |
||
| 868 | 868 | public function widgets_init() { |
| 869 | 869 | //only init widgets on admin pages when not in complete maintenance, and |
| 870 | 870 | //on frontend when not in any maintenance mode |
| 871 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
| 871 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
| 872 | 872 | // grab list of installed widgets |
| 873 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
| 873 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
| 874 | 874 | // filter list of modules to register |
| 875 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
| 875 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
| 876 | 876 | |
| 877 | - if ( ! empty( $widgets_to_register ) ) { |
|
| 877 | + if ( ! empty($widgets_to_register)) { |
|
| 878 | 878 | // cycle thru widget folders |
| 879 | - foreach ( $widgets_to_register as $widget_path ) { |
|
| 879 | + foreach ($widgets_to_register as $widget_path) { |
|
| 880 | 880 | // add to list of installed widget modules |
| 881 | - EE_Config::register_ee_widget( $widget_path ); |
|
| 881 | + EE_Config::register_ee_widget($widget_path); |
|
| 882 | 882 | } |
| 883 | 883 | } |
| 884 | 884 | // filter list of installed modules |
| 885 | - $this->registry->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', $this->registry->widgets ); |
|
| 885 | + $this->registry->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', $this->registry->widgets); |
|
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | |
@@ -895,54 +895,54 @@ discard block |
||
| 895 | 895 | * @param string $widget_path - full path up to and including widget folder |
| 896 | 896 | * @return void |
| 897 | 897 | */ |
| 898 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
| 899 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
| 898 | + public static function register_ee_widget($widget_path = NULL) { |
|
| 899 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
| 900 | 900 | $widget_ext = '.widget.php'; |
| 901 | 901 | // make all separators match |
| 902 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
| 902 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
| 903 | 903 | // does the file path INCLUDE the actual file name as part of the path ? |
| 904 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
| 904 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
| 905 | 905 | // grab and shortcode file name from directory name and break apart at dots |
| 906 | - $file_name = explode( '.', basename( $widget_path )); |
|
| 906 | + $file_name = explode('.', basename($widget_path)); |
|
| 907 | 907 | // take first segment from file name pieces and remove class prefix if it exists |
| 908 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
| 908 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
| 909 | 909 | // sanitize shortcode directory name |
| 910 | - $widget = sanitize_key( $widget ); |
|
| 910 | + $widget = sanitize_key($widget); |
|
| 911 | 911 | // now we need to rebuild the shortcode path |
| 912 | - $widget_path = explode( DS, $widget_path ); |
|
| 912 | + $widget_path = explode(DS, $widget_path); |
|
| 913 | 913 | // remove last segment |
| 914 | - array_pop( $widget_path ); |
|
| 914 | + array_pop($widget_path); |
|
| 915 | 915 | // glue it back together |
| 916 | - $widget_path = implode( DS, $widget_path ); |
|
| 916 | + $widget_path = implode(DS, $widget_path); |
|
| 917 | 917 | } else { |
| 918 | 918 | // grab and sanitize widget directory name |
| 919 | - $widget = sanitize_key( basename( $widget_path )); |
|
| 919 | + $widget = sanitize_key(basename($widget_path)); |
|
| 920 | 920 | } |
| 921 | 921 | // create classname from widget directory name |
| 922 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
| 922 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
| 923 | 923 | // add class prefix |
| 924 | - $widget_class = 'EEW_' . $widget; |
|
| 924 | + $widget_class = 'EEW_'.$widget; |
|
| 925 | 925 | // does the widget exist ? |
| 926 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
| 926 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
| 927 | 927 | $msg = sprintf( |
| 928 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
| 928 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
| 929 | 929 | $widget_class, |
| 930 | - $widget_path . DS . $widget_class . $widget_ext |
|
| 930 | + $widget_path.DS.$widget_class.$widget_ext |
|
| 931 | 931 | ); |
| 932 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 932 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 933 | 933 | return; |
| 934 | 934 | } |
| 935 | 935 | // load the widget class file |
| 936 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
| 936 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
| 937 | 937 | // verify that class exists |
| 938 | - if ( ! class_exists( $widget_class )) { |
|
| 939 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
| 940 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 938 | + if ( ! class_exists($widget_class)) { |
|
| 939 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
| 940 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 941 | 941 | return; |
| 942 | 942 | } |
| 943 | - register_widget( $widget_class ); |
|
| 943 | + register_widget($widget_class); |
|
| 944 | 944 | // add to array of registered widgets |
| 945 | - EE_Config::instance()->registry->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
| 945 | + EE_Config::instance()->registry->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | |
@@ -955,18 +955,18 @@ discard block |
||
| 955 | 955 | */ |
| 956 | 956 | private function _register_shortcodes() { |
| 957 | 957 | // grab list of installed shortcodes |
| 958 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
| 958 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
| 959 | 959 | // filter list of modules to register |
| 960 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
| 961 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
| 960 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
| 961 | + if ( ! empty($shortcodes_to_register)) { |
|
| 962 | 962 | // cycle thru shortcode folders |
| 963 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
| 963 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
| 964 | 964 | // add to list of installed shortcode modules |
| 965 | - $this->_register_shortcode( $shortcode_path ); |
|
| 965 | + $this->_register_shortcode($shortcode_path); |
|
| 966 | 966 | } |
| 967 | 967 | } |
| 968 | 968 | // filter list of installed modules |
| 969 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', $this->registry->shortcodes ); |
|
| 969 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', $this->registry->shortcodes); |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | |
@@ -978,8 +978,8 @@ discard block |
||
| 978 | 978 | * @param string $shortcode_path - full path up to and including shortcode folder |
| 979 | 979 | * @return bool |
| 980 | 980 | */ |
| 981 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
| 982 | - EE_Config::instance()->_register_shortcode( $shortcode_path ); |
|
| 981 | + public static function register_shortcode($shortcode_path = NULL) { |
|
| 982 | + EE_Config::instance()->_register_shortcode($shortcode_path); |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | |
@@ -991,56 +991,56 @@ discard block |
||
| 991 | 991 | * @param string $shortcode_path - full path up to and including shortcode folder |
| 992 | 992 | * @return bool |
| 993 | 993 | */ |
| 994 | - public function _register_shortcode( $shortcode_path = NULL ) { |
|
| 995 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
| 994 | + public function _register_shortcode($shortcode_path = NULL) { |
|
| 995 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
| 996 | 996 | $shortcode_ext = '.shortcode.php'; |
| 997 | 997 | // make all separators match |
| 998 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
| 998 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
| 999 | 999 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1000 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
| 1000 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
| 1001 | 1001 | // grab shortcode file name from directory name and break apart at dots |
| 1002 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
| 1002 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
| 1003 | 1003 | // take first segment from file name pieces and remove class prefix if it exists |
| 1004 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
| 1004 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
| 1005 | 1005 | // sanitize shortcode directory name |
| 1006 | - $shortcode = sanitize_key( $shortcode ); |
|
| 1006 | + $shortcode = sanitize_key($shortcode); |
|
| 1007 | 1007 | // now we need to rebuild the shortcode path |
| 1008 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
| 1008 | + $shortcode_path = explode(DS, $shortcode_path); |
|
| 1009 | 1009 | // remove last segment |
| 1010 | - array_pop( $shortcode_path ); |
|
| 1010 | + array_pop($shortcode_path); |
|
| 1011 | 1011 | // glue it back together |
| 1012 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
| 1012 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
| 1013 | 1013 | } else { |
| 1014 | 1014 | // we need to generate the filename based off of the folder name |
| 1015 | 1015 | // grab and sanitize shortcode directory name |
| 1016 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
| 1017 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
| 1016 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
| 1017 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
| 1018 | 1018 | } |
| 1019 | 1019 | // create classname from shortcode directory or file name |
| 1020 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
| 1020 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
| 1021 | 1021 | // add class prefix |
| 1022 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1022 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1023 | 1023 | // does the shortcode exist ? |
| 1024 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
| 1024 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
| 1025 | 1025 | $msg = sprintf( |
| 1026 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
| 1026 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
| 1027 | 1027 | $shortcode_class, |
| 1028 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
| 1028 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
| 1029 | 1029 | ); |
| 1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1031 | 1031 | return FALSE; |
| 1032 | 1032 | } |
| 1033 | 1033 | // load the shortcode class file |
| 1034 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
| 1034 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
| 1035 | 1035 | // verify that class exists |
| 1036 | - if ( ! class_exists( $shortcode_class )) { |
|
| 1037 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
| 1038 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1036 | + if ( ! class_exists($shortcode_class)) { |
|
| 1037 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
| 1038 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1039 | 1039 | return FALSE; |
| 1040 | 1040 | } |
| 1041 | - $shortcode = strtoupper( $shortcode ); |
|
| 1041 | + $shortcode = strtoupper($shortcode); |
|
| 1042 | 1042 | // add to array of registered shortcodes |
| 1043 | - $this->registry->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
| 1043 | + $this->registry->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
| 1044 | 1044 | return TRUE; |
| 1045 | 1045 | } |
| 1046 | 1046 | |
@@ -1055,23 +1055,23 @@ discard block |
||
| 1055 | 1055 | */ |
| 1056 | 1056 | private function _register_modules() { |
| 1057 | 1057 | // grab list of installed modules |
| 1058 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
| 1058 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
| 1059 | 1059 | // filter list of modules to register |
| 1060 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
| 1060 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
| 1061 | 1061 | |
| 1062 | 1062 | |
| 1063 | - if ( ! empty( $modules_to_register ) ) { |
|
| 1063 | + if ( ! empty($modules_to_register)) { |
|
| 1064 | 1064 | // loop through folders |
| 1065 | - foreach ( $modules_to_register as $module_path ) { |
|
| 1065 | + foreach ($modules_to_register as $module_path) { |
|
| 1066 | 1066 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
| 1067 | - if ( $module_path !== EE_MODULES . 'zzz-copy-this-module-template' && $module_path !== EE_MODULES . 'gateways' ) { |
|
| 1067 | + if ($module_path !== EE_MODULES.'zzz-copy-this-module-template' && $module_path !== EE_MODULES.'gateways') { |
|
| 1068 | 1068 | // add to list of installed modules |
| 1069 | - $this->_register_module( $module_path ); |
|
| 1069 | + $this->_register_module($module_path); |
|
| 1070 | 1070 | } |
| 1071 | 1071 | } |
| 1072 | 1072 | } |
| 1073 | 1073 | // filter list of installed modules |
| 1074 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', $this->registry->modules ); |
|
| 1074 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', $this->registry->modules); |
|
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | |
@@ -1084,8 +1084,8 @@ discard block |
||
| 1084 | 1084 | * @param string $module_path - full path up to and including module folder |
| 1085 | 1085 | * @return bool |
| 1086 | 1086 | */ |
| 1087 | - public static function register_module( $module_path = NULL ) { |
|
| 1088 | - EE_Config::instance()->_register_module( $module_path ); |
|
| 1087 | + public static function register_module($module_path = NULL) { |
|
| 1088 | + EE_Config::instance()->_register_module($module_path); |
|
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | 1091 | |
@@ -1098,54 +1098,54 @@ discard block |
||
| 1098 | 1098 | * @param string $module_path - full path up to and including module folder |
| 1099 | 1099 | * @return bool |
| 1100 | 1100 | */ |
| 1101 | - public function _register_module( $module_path = NULL ) { |
|
| 1102 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
| 1101 | + public function _register_module($module_path = NULL) { |
|
| 1102 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
| 1103 | 1103 | $module_ext = '.module.php'; |
| 1104 | 1104 | // make all separators match |
| 1105 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
| 1105 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
| 1106 | 1106 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1107 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
| 1107 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
| 1108 | 1108 | // grab and shortcode file name from directory name and break apart at dots |
| 1109 | - $module_file = explode( '.', basename( $module_path )); |
|
| 1109 | + $module_file = explode('.', basename($module_path)); |
|
| 1110 | 1110 | // now we need to rebuild the shortcode path |
| 1111 | - $module_path = explode( DS, $module_path ); |
|
| 1111 | + $module_path = explode(DS, $module_path); |
|
| 1112 | 1112 | // remove last segment |
| 1113 | - array_pop( $module_path ); |
|
| 1113 | + array_pop($module_path); |
|
| 1114 | 1114 | // glue it back together |
| 1115 | - $module_path = implode( DS, $module_path ) . DS; |
|
| 1115 | + $module_path = implode(DS, $module_path).DS; |
|
| 1116 | 1116 | // take first segment from file name pieces and sanitize it |
| 1117 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
| 1117 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
| 1118 | 1118 | // ensure class prefix is added |
| 1119 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
| 1119 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
| 1120 | 1120 | } else { |
| 1121 | 1121 | // we need to generate the filename based off of the folder name |
| 1122 | 1122 | // grab and sanitize module name |
| 1123 | - $module = strtolower( basename( $module_path )); |
|
| 1124 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
| 1123 | + $module = strtolower(basename($module_path)); |
|
| 1124 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
| 1125 | 1125 | // like trailingslashit() |
| 1126 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
| 1126 | + $module_path = rtrim($module_path, DS).DS; |
|
| 1127 | 1127 | // create classname from module directory name |
| 1128 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
| 1128 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
| 1129 | 1129 | // add class prefix |
| 1130 | - $module_class = 'EED_' . $module; |
|
| 1130 | + $module_class = 'EED_'.$module; |
|
| 1131 | 1131 | } |
| 1132 | 1132 | // does the module exist ? |
| 1133 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
| 1134 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
| 1135 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1133 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
| 1134 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
| 1135 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1136 | 1136 | return FALSE; |
| 1137 | 1137 | } |
| 1138 | 1138 | // load the module class file |
| 1139 | - require_once( $module_path . $module_class . $module_ext ); |
|
| 1139 | + require_once($module_path.$module_class.$module_ext); |
|
| 1140 | 1140 | // verify that class exists |
| 1141 | - if ( ! class_exists( $module_class )) { |
|
| 1142 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
| 1143 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1141 | + if ( ! class_exists($module_class)) { |
|
| 1142 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
| 1143 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1144 | 1144 | return FALSE; |
| 1145 | 1145 | } |
| 1146 | 1146 | // add to array of registered modules |
| 1147 | - $this->registry->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
| 1148 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Config::instance()->registry->modules->{$module_class} ); |
|
| 1147 | + $this->registry->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
| 1148 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Config::instance()->registry->modules->{$module_class} ); |
|
| 1149 | 1149 | return TRUE; |
| 1150 | 1150 | } |
| 1151 | 1151 | |
@@ -1159,23 +1159,23 @@ discard block |
||
| 1159 | 1159 | */ |
| 1160 | 1160 | private function _initialize_shortcodes() { |
| 1161 | 1161 | // cycle thru shortcode folders |
| 1162 | - foreach ( $this->registry->shortcodes as $shortcode => $shortcode_path ) { |
|
| 1162 | + foreach ($this->registry->shortcodes as $shortcode => $shortcode_path) { |
|
| 1163 | 1163 | // add class prefix |
| 1164 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1164 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1165 | 1165 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1166 | 1166 | // which set hooks ? |
| 1167 | - if ( is_admin() ) { |
|
| 1167 | + if (is_admin()) { |
|
| 1168 | 1168 | // fire immediately |
| 1169 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
| 1169 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
| 1170 | 1170 | } else { |
| 1171 | 1171 | // delay until other systems are online |
| 1172 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
| 1172 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
| 1173 | 1173 | // convert classname to UPPERCASE and create WP shortcode. |
| 1174 | - $shortcode_tag = strtoupper( $shortcode ); |
|
| 1174 | + $shortcode_tag = strtoupper($shortcode); |
|
| 1175 | 1175 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
| 1176 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
| 1176 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
| 1177 | 1177 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
| 1178 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
| 1178 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
| 1179 | 1179 | } |
| 1180 | 1180 | } |
| 1181 | 1181 | } |
@@ -1192,15 +1192,15 @@ discard block |
||
| 1192 | 1192 | */ |
| 1193 | 1193 | private function _initialize_modules() { |
| 1194 | 1194 | // cycle thru shortcode folders |
| 1195 | - foreach ( $this->registry->modules as $module_class => $module_path ) { |
|
| 1195 | + foreach ($this->registry->modules as $module_class => $module_path) { |
|
| 1196 | 1196 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1197 | 1197 | // which set hooks ? |
| 1198 | - if ( is_admin() ) { |
|
| 1198 | + if (is_admin()) { |
|
| 1199 | 1199 | // fire immediately |
| 1200 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
| 1200 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
| 1201 | 1201 | } else { |
| 1202 | 1202 | // delay until other systems are online |
| 1203 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
| 1203 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
| 1204 | 1204 | } |
| 1205 | 1205 | } |
| 1206 | 1206 | } |
@@ -1218,26 +1218,26 @@ discard block |
||
| 1218 | 1218 | * @param string $key - url param key indicating a route is being called |
| 1219 | 1219 | * @return bool |
| 1220 | 1220 | */ |
| 1221 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
| 1222 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
| 1223 | - $module = str_replace( 'EED_', '', $module ); |
|
| 1224 | - $module_class = 'EED_' . $module; |
|
| 1225 | - if ( ! isset( EE_Config::instance()->registry->modules->{$module_class} )) { |
|
| 1226 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
| 1227 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1221 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
| 1222 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
| 1223 | + $module = str_replace('EED_', '', $module); |
|
| 1224 | + $module_class = 'EED_'.$module; |
|
| 1225 | + if ( ! isset(EE_Config::instance()->registry->modules->{$module_class} )) { |
|
| 1226 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
| 1227 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1228 | 1228 | return FALSE; |
| 1229 | 1229 | } |
| 1230 | - if ( empty( $route )) { |
|
| 1231 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
| 1232 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1230 | + if (empty($route)) { |
|
| 1231 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
| 1232 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1233 | 1233 | return FALSE; |
| 1234 | 1234 | } |
| 1235 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
| 1236 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
| 1237 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1235 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
| 1236 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
| 1237 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1238 | 1238 | return FALSE; |
| 1239 | 1239 | } |
| 1240 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
| 1240 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
| 1241 | 1241 | return TRUE; |
| 1242 | 1242 | } |
| 1243 | 1243 | |
@@ -1251,11 +1251,11 @@ discard block |
||
| 1251 | 1251 | * @param string $key - url param key indicating a route is being called |
| 1252 | 1252 | * @return string |
| 1253 | 1253 | */ |
| 1254 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
| 1255 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
| 1256 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
| 1257 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
| 1258 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
| 1254 | + public static function get_route($route = NULL, $key = 'ee') { |
|
| 1255 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
| 1256 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
| 1257 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
| 1258 | + return EE_Config::$_module_route_map[$key][$route]; |
|
| 1259 | 1259 | } |
| 1260 | 1260 | return NULL; |
| 1261 | 1261 | } |
@@ -1284,35 +1284,35 @@ discard block |
||
| 1284 | 1284 | * @param string $key - url param key indicating a route is being called |
| 1285 | 1285 | * @return bool |
| 1286 | 1286 | */ |
| 1287 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
| 1288 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
| 1289 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
| 1290 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
| 1291 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1287 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
| 1288 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
| 1289 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1290 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
| 1291 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1292 | 1292 | return FALSE; |
| 1293 | 1293 | } |
| 1294 | - if ( empty( $forward )) { |
|
| 1295 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
| 1296 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1294 | + if (empty($forward)) { |
|
| 1295 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
| 1296 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1297 | 1297 | return FALSE; |
| 1298 | 1298 | } |
| 1299 | - if ( is_array( $forward )) { |
|
| 1300 | - if ( ! isset( $forward[1] )) { |
|
| 1301 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
| 1302 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1299 | + if (is_array($forward)) { |
|
| 1300 | + if ( ! isset($forward[1])) { |
|
| 1301 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
| 1302 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1303 | 1303 | return FALSE; |
| 1304 | 1304 | } |
| 1305 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
| 1306 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
| 1307 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1305 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
| 1306 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
| 1307 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1308 | 1308 | return FALSE; |
| 1309 | 1309 | } |
| 1310 | - } else if ( ! function_exists( $forward )) { |
|
| 1311 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
| 1312 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1310 | + } else if ( ! function_exists($forward)) { |
|
| 1311 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
| 1312 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1313 | 1313 | return FALSE; |
| 1314 | 1314 | } |
| 1315 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
| 1315 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
| 1316 | 1316 | return TRUE; |
| 1317 | 1317 | } |
| 1318 | 1318 | |
@@ -1327,10 +1327,10 @@ discard block |
||
| 1327 | 1327 | * @param string $key - url param key indicating a route is being called |
| 1328 | 1328 | * @return string |
| 1329 | 1329 | */ |
| 1330 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
| 1331 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
| 1332 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
| 1333 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
| 1330 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
| 1331 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
| 1332 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
| 1333 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
| 1334 | 1334 | } |
| 1335 | 1335 | return NULL; |
| 1336 | 1336 | } |
@@ -1347,19 +1347,19 @@ discard block |
||
| 1347 | 1347 | * @param string $key - url param key indicating a route is being called |
| 1348 | 1348 | * @return bool |
| 1349 | 1349 | */ |
| 1350 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
| 1351 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
| 1352 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
| 1353 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
| 1354 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1350 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
| 1351 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
| 1352 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1353 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
| 1354 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1355 | 1355 | return FALSE; |
| 1356 | 1356 | } |
| 1357 | - if ( ! is_readable( $view )) { |
|
| 1358 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
| 1359 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1357 | + if ( ! is_readable($view)) { |
|
| 1358 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
| 1359 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1360 | 1360 | return FALSE; |
| 1361 | 1361 | } |
| 1362 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
| 1362 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
| 1363 | 1363 | return TRUE; |
| 1364 | 1364 | } |
| 1365 | 1365 | |
@@ -1376,10 +1376,10 @@ discard block |
||
| 1376 | 1376 | * @param string $key - url param key indicating a route is being called |
| 1377 | 1377 | * @return string |
| 1378 | 1378 | */ |
| 1379 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
| 1380 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
| 1381 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
| 1382 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
| 1379 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
| 1380 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
| 1381 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
| 1382 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
| 1383 | 1383 | } |
| 1384 | 1384 | return NULL; |
| 1385 | 1385 | } |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | |
| 1388 | 1388 | |
| 1389 | 1389 | public function shutdown() { |
| 1390 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
| 1390 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
| 1391 | 1391 | } |
| 1392 | 1392 | |
| 1393 | 1393 | |
@@ -1403,7 +1403,7 @@ discard block |
||
| 1403 | 1403 | * magic functions in use, except we'll allow them to magically set and get stuff... |
| 1404 | 1404 | * basically, they should just be well-defined stdClasses |
| 1405 | 1405 | */ |
| 1406 | -class EE_Config_Base{ |
|
| 1406 | +class EE_Config_Base { |
|
| 1407 | 1407 | |
| 1408 | 1408 | /** |
| 1409 | 1409 | * Utility function for escaping the value of a property and returning. |
@@ -1412,13 +1412,13 @@ discard block |
||
| 1412 | 1412 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
| 1413 | 1413 | * @throws \EE_Error |
| 1414 | 1414 | */ |
| 1415 | - public function get_pretty( $property ) { |
|
| 1416 | - if ( ! property_exists( $this, $property ) ) { |
|
| 1417 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
| 1415 | + public function get_pretty($property) { |
|
| 1416 | + if ( ! property_exists($this, $property)) { |
|
| 1417 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
| 1418 | 1418 | } |
| 1419 | 1419 | //just handling escaping of strings for now. |
| 1420 | - if ( is_string( $this->{$property} ) ) { |
|
| 1421 | - return stripslashes( $this->{$property} ); |
|
| 1420 | + if (is_string($this->{$property} )) { |
|
| 1421 | + return stripslashes($this->{$property} ); |
|
| 1422 | 1422 | } |
| 1423 | 1423 | return $this->{$property}; |
| 1424 | 1424 | } |
@@ -1427,19 +1427,19 @@ discard block |
||
| 1427 | 1427 | |
| 1428 | 1428 | public function populate() { |
| 1429 | 1429 | //grab defaults via a new instance of this class. |
| 1430 | - $class_name = get_class( $this ); |
|
| 1430 | + $class_name = get_class($this); |
|
| 1431 | 1431 | $defaults = new $class_name; |
| 1432 | 1432 | |
| 1433 | 1433 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
| 1434 | 1434 | //default from our $defaults object. |
| 1435 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
| 1436 | - if ( is_null( $this->{$property} ) ) { |
|
| 1435 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
| 1436 | + if (is_null($this->{$property} )) { |
|
| 1437 | 1437 | $this->{$property} = $value; |
| 1438 | 1438 | } |
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | 1441 | //cleanup |
| 1442 | - unset( $defaults ); |
|
| 1442 | + unset($defaults); |
|
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | 1445 | |
@@ -1531,12 +1531,12 @@ discard block |
||
| 1531 | 1531 | */ |
| 1532 | 1532 | public function __construct() { |
| 1533 | 1533 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
| 1534 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
| 1534 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
| 1535 | 1535 | // set default organization settings |
| 1536 | 1536 | $this->current_blog_id = get_current_blog_id(); |
| 1537 | 1537 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
| 1538 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
| 1539 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
| 1538 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
| 1539 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
| 1540 | 1540 | $this->post_shortcodes = array(); |
| 1541 | 1541 | $this->module_route_map = array(); |
| 1542 | 1542 | $this->module_forward_map = array(); |
@@ -1555,7 +1555,7 @@ discard block |
||
| 1555 | 1555 | $this->event_cpt_slug = __('events', 'event_espresso'); |
| 1556 | 1556 | |
| 1557 | 1557 | //ueip constant check |
| 1558 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
| 1558 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
| 1559 | 1559 | $this->ee_ueip_optin = FALSE; |
| 1560 | 1560 | $this->ee_ueip_has_notified = TRUE; |
| 1561 | 1561 | } |
@@ -1595,8 +1595,8 @@ discard block |
||
| 1595 | 1595 | * @return string |
| 1596 | 1596 | */ |
| 1597 | 1597 | public function reg_page_url() { |
| 1598 | - if ( ! $this->reg_page_url ) { |
|
| 1599 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
| 1598 | + if ( ! $this->reg_page_url) { |
|
| 1599 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
| 1600 | 1600 | } |
| 1601 | 1601 | return $this->reg_page_url; |
| 1602 | 1602 | } |
@@ -1609,12 +1609,12 @@ discard block |
||
| 1609 | 1609 | * @return string |
| 1610 | 1610 | */ |
| 1611 | 1611 | public function txn_page_url($query_args = array()) { |
| 1612 | - if ( ! $this->txn_page_url ) { |
|
| 1613 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
| 1612 | + if ( ! $this->txn_page_url) { |
|
| 1613 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
| 1614 | 1614 | } |
| 1615 | - if($query_args){ |
|
| 1616 | - return add_query_arg($query_args,$this->txn_page_url); |
|
| 1617 | - }else{ |
|
| 1615 | + if ($query_args) { |
|
| 1616 | + return add_query_arg($query_args, $this->txn_page_url); |
|
| 1617 | + } else { |
|
| 1618 | 1618 | return $this->txn_page_url; |
| 1619 | 1619 | } |
| 1620 | 1620 | } |
@@ -1626,12 +1626,12 @@ discard block |
||
| 1626 | 1626 | * @return string |
| 1627 | 1627 | */ |
| 1628 | 1628 | public function thank_you_page_url($query_args = array()) { |
| 1629 | - if ( ! $this->thank_you_page_url ) { |
|
| 1630 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
| 1629 | + if ( ! $this->thank_you_page_url) { |
|
| 1630 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
| 1631 | 1631 | } |
| 1632 | - if($query_args){ |
|
| 1633 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
| 1634 | - }else{ |
|
| 1632 | + if ($query_args) { |
|
| 1633 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
| 1634 | + } else { |
|
| 1635 | 1635 | return $this->thank_you_page_url; |
| 1636 | 1636 | } |
| 1637 | 1637 | } |
@@ -1642,8 +1642,8 @@ discard block |
||
| 1642 | 1642 | * @return string |
| 1643 | 1643 | */ |
| 1644 | 1644 | public function cancel_page_url() { |
| 1645 | - if ( ! $this->cancel_page_url ) { |
|
| 1646 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
| 1645 | + if ( ! $this->cancel_page_url) { |
|
| 1646 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
| 1647 | 1647 | } |
| 1648 | 1648 | return $this->cancel_page_url; |
| 1649 | 1649 | } |
@@ -1671,7 +1671,7 @@ discard block |
||
| 1671 | 1671 | //reset all url properties |
| 1672 | 1672 | $this->_reset_urls(); |
| 1673 | 1673 | //return what to save to db |
| 1674 | - return array_keys( get_object_vars( $this ) ); |
|
| 1674 | + return array_keys(get_object_vars($this)); |
|
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | 1677 | } |
@@ -1903,38 +1903,38 @@ discard block |
||
| 1903 | 1903 | * @param null $CNT_ISO |
| 1904 | 1904 | * @return \EE_Currency_Config |
| 1905 | 1905 | */ |
| 1906 | - public function __construct( $CNT_ISO = NULL ) { |
|
| 1906 | + public function __construct($CNT_ISO = NULL) { |
|
| 1907 | 1907 | |
| 1908 | 1908 | // get country code from organization settings or use default |
| 1909 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
| 1909 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
| 1910 | 1910 | // but override if requested |
| 1911 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
| 1911 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
| 1912 | 1912 | // 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 |
| 1913 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
| 1913 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
| 1914 | 1914 | // retrieve the country settings from the db, just in case they have been customized |
| 1915 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
| 1916 | - if ( $country instanceof EE_Country ) { |
|
| 1917 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 1918 | - $this->name = $country->currency_name_single(); // Dollar |
|
| 1919 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
| 1920 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 1921 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 1922 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1923 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1924 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1915 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
| 1916 | + if ($country instanceof EE_Country) { |
|
| 1917 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 1918 | + $this->name = $country->currency_name_single(); // Dollar |
|
| 1919 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
| 1920 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 1921 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 1922 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1923 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1924 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1925 | 1925 | } |
| 1926 | 1926 | } |
| 1927 | 1927 | // fallback to hardcoded defaults, in case the above failed |
| 1928 | - if ( empty( $this->code )) { |
|
| 1928 | + if (empty($this->code)) { |
|
| 1929 | 1929 | // set default currency settings |
| 1930 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 1931 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
| 1932 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
| 1933 | - $this->sign = '$'; // currency sign: $ |
|
| 1934 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
| 1935 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1936 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1937 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1930 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 1931 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
| 1932 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
| 1933 | + $this->sign = '$'; // currency sign: $ |
|
| 1934 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
| 1935 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1936 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1937 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1938 | 1938 | } |
| 1939 | 1939 | } |
| 1940 | 1940 | } |
@@ -2083,7 +2083,7 @@ discard block |
||
| 2083 | 2083 | * @since 4.8.8.rc.019 |
| 2084 | 2084 | */ |
| 2085 | 2085 | public function do_hooks() { |
| 2086 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
| 2086 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
| 2087 | 2087 | } |
| 2088 | 2088 | |
| 2089 | 2089 | |
@@ -2091,7 +2091,7 @@ discard block |
||
| 2091 | 2091 | * @return void |
| 2092 | 2092 | */ |
| 2093 | 2093 | public function set_default_reg_status_on_EEM_Event() { |
| 2094 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
| 2094 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
| 2095 | 2095 | } |
| 2096 | 2096 | |
| 2097 | 2097 | |
@@ -2196,10 +2196,10 @@ discard block |
||
| 2196 | 2196 | * @param bool $reset |
| 2197 | 2197 | * @return string |
| 2198 | 2198 | */ |
| 2199 | - public function log_file_name( $reset = FALSE ) { |
|
| 2200 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
| 2201 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
| 2202 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
| 2199 | + public function log_file_name($reset = FALSE) { |
|
| 2200 | + if (empty($this->log_file_name) || $reset) { |
|
| 2201 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
| 2202 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
| 2203 | 2203 | } |
| 2204 | 2204 | return $this->log_file_name; |
| 2205 | 2205 | } |
@@ -2211,10 +2211,10 @@ discard block |
||
| 2211 | 2211 | * @param bool $reset |
| 2212 | 2212 | * @return string |
| 2213 | 2213 | */ |
| 2214 | - public function debug_file_name( $reset = FALSE ) { |
|
| 2215 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
| 2216 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
| 2217 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
| 2214 | + public function debug_file_name($reset = FALSE) { |
|
| 2215 | + if (empty($this->debug_file_name) || $reset) { |
|
| 2216 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
| 2217 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
| 2218 | 2218 | } |
| 2219 | 2219 | return $this->debug_file_name; |
| 2220 | 2220 | } |
@@ -2387,21 +2387,21 @@ discard block |
||
| 2387 | 2387 | // set default map settings |
| 2388 | 2388 | $this->use_google_maps = TRUE; |
| 2389 | 2389 | // for event details pages (reg page) |
| 2390 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2391 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2392 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2393 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 2394 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 2395 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2396 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2390 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2391 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2392 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2393 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 2394 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 2395 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2396 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2397 | 2397 | // for event list pages |
| 2398 | - $this->event_list_map_width = 300; // ee_map_width |
|
| 2399 | - $this->event_list_map_height = 185; // ee_map_height |
|
| 2400 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2401 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 2402 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 2403 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2404 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2398 | + $this->event_list_map_width = 300; // ee_map_width |
|
| 2399 | + $this->event_list_map_height = 185; // ee_map_height |
|
| 2400 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2401 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 2402 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 2403 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2404 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2405 | 2405 | } |
| 2406 | 2406 | |
| 2407 | 2407 | } |
@@ -2412,7 +2412,7 @@ discard block |
||
| 2412 | 2412 | /** |
| 2413 | 2413 | * stores Events_Archive settings |
| 2414 | 2414 | */ |
| 2415 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
| 2415 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
| 2416 | 2416 | |
| 2417 | 2417 | public $display_status_banner; |
| 2418 | 2418 | public $display_description; |
@@ -2431,7 +2431,7 @@ discard block |
||
| 2431 | 2431 | /** |
| 2432 | 2432 | * class constructor |
| 2433 | 2433 | */ |
| 2434 | - public function __construct(){ |
|
| 2434 | + public function __construct() { |
|
| 2435 | 2435 | $this->display_status_banner = 0; |
| 2436 | 2436 | $this->display_description = 1; |
| 2437 | 2437 | $this->display_ticket_selector = 0; |
@@ -2451,7 +2451,7 @@ discard block |
||
| 2451 | 2451 | /** |
| 2452 | 2452 | * Stores Event_Single_Config settings |
| 2453 | 2453 | */ |
| 2454 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
| 2454 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
| 2455 | 2455 | |
| 2456 | 2456 | public $display_status_banner_single; |
| 2457 | 2457 | public $display_venue; |
@@ -2480,7 +2480,7 @@ discard block |
||
| 2480 | 2480 | /** |
| 2481 | 2481 | * Stores Ticket_Selector_Config settings |
| 2482 | 2482 | */ |
| 2483 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
| 2483 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
| 2484 | 2484 | public $show_ticket_sale_columns; |
| 2485 | 2485 | public $show_ticket_details; |
| 2486 | 2486 | public $show_expired_tickets; |
@@ -2534,7 +2534,7 @@ discard block |
||
| 2534 | 2534 | * @return void |
| 2535 | 2535 | */ |
| 2536 | 2536 | protected function _set_php_values() { |
| 2537 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
| 2537 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
| 2538 | 2538 | $this->php->version = phpversion(); |
| 2539 | 2539 | } |
| 2540 | 2540 | |
@@ -2553,9 +2553,9 @@ discard block |
||
| 2553 | 2553 | * @type string $msg Any message to be displayed. |
| 2554 | 2554 | * } |
| 2555 | 2555 | */ |
| 2556 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
| 2557 | - if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
| 2558 | - return sprintf( __('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
| 2556 | + public function max_input_vars_limit_check($input_count = 0) { |
|
| 2557 | + if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
| 2558 | + return sprintf(__('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
| 2559 | 2559 | } else { |
| 2560 | 2560 | return ''; |
| 2561 | 2561 | } |
@@ -2590,7 +2590,7 @@ discard block |
||
| 2590 | 2590 | * stores payment gateway info |
| 2591 | 2591 | * @deprecated |
| 2592 | 2592 | */ |
| 2593 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
| 2593 | +class EE_Gateway_Config extends EE_Config_Base { |
|
| 2594 | 2594 | |
| 2595 | 2595 | /** |
| 2596 | 2596 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2612,9 +2612,9 @@ discard block |
||
| 2612 | 2612 | * class constructor |
| 2613 | 2613 | * @deprecated |
| 2614 | 2614 | */ |
| 2615 | - public function __construct(){ |
|
| 2615 | + public function __construct() { |
|
| 2616 | 2616 | $this->payment_settings = array(); |
| 2617 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
| 2617 | + $this->active_gateways = array('Invoice' => FALSE); |
|
| 2618 | 2618 | } |
| 2619 | 2619 | } |
| 2620 | 2620 | |
@@ -276,6 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | 278 | * @param mixed string | EED_Module $module |
| 279 | + * @param string $module |
|
| 279 | 280 | */ |
| 280 | 281 | public function add_module( $module ) { |
| 281 | 282 | if ( $module instanceof EED_Module ) { |
@@ -953,7 +954,7 @@ discard block |
||
| 953 | 954 | * $this->LIB->{$class_name} ie: $this->LIB->Some_Class |
| 954 | 955 | * |
| 955 | 956 | * @access protected |
| 956 | - * @param object $class_obj |
|
| 957 | + * @param string|null $class_obj |
|
| 957 | 958 | * @param string $class_name |
| 958 | 959 | * @param string $class_prefix |
| 959 | 960 | * @param bool $from_db |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | * @param \EE_Dependency_Map $dependency_map |
| 179 | 179 | * @return \EE_Registry instance |
| 180 | 180 | */ |
| 181 | - public static function instance( \EE_Dependency_Map $dependency_map = null ) { |
|
| 181 | + public static function instance(\EE_Dependency_Map $dependency_map = null) { |
|
| 182 | 182 | // check if class object is instantiated |
| 183 | - if ( ! self::$_instance instanceof EE_Registry ) { |
|
| 184 | - self::$_instance = apply_filters( 'FHEE__EE_Registry__instance', new EE_Registry( $dependency_map ) ); |
|
| 183 | + if ( ! self::$_instance instanceof EE_Registry) { |
|
| 184 | + self::$_instance = apply_filters('FHEE__EE_Registry__instance', new EE_Registry($dependency_map)); |
|
| 185 | 185 | } |
| 186 | 186 | return self::$_instance; |
| 187 | 187 | } |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | * @param \EE_Dependency_Map $dependency_map |
| 197 | 197 | * @return \EE_Registry |
| 198 | 198 | */ |
| 199 | - protected function __construct( \EE_Dependency_Map $dependency_map ) { |
|
| 199 | + protected function __construct(\EE_Dependency_Map $dependency_map) { |
|
| 200 | 200 | $this->_dependency_map = $dependency_map; |
| 201 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
| 201 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -225,17 +225,17 @@ discard block |
||
| 225 | 225 | $this->modules = new stdClass(); |
| 226 | 226 | $this->shortcodes = new stdClass(); |
| 227 | 227 | $this->widgets = new stdClass(); |
| 228 | - $this->load_core( 'Base', array(), true ); |
|
| 228 | + $this->load_core('Base', array(), true); |
|
| 229 | 229 | // add our request and response objects to the cache |
| 230 | 230 | $this->_set_cached_class( |
| 231 | - $this->_dependency_map->class_loader( 'EE_Request' ), |
|
| 231 | + $this->_dependency_map->class_loader('EE_Request'), |
|
| 232 | 232 | 'EE_Request' |
| 233 | 233 | ); |
| 234 | 234 | $this->_set_cached_class( |
| 235 | - $this->_dependency_map->class_loader( 'EE_Response' ), |
|
| 235 | + $this->_dependency_map->class_loader('EE_Response'), |
|
| 236 | 236 | 'EE_Response' |
| 237 | 237 | ); |
| 238 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) ); |
|
| 238 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
@@ -248,10 +248,10 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | public function init() { |
| 250 | 250 | // Get current page protocol |
| 251 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
| 251 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
| 252 | 252 | // Output admin-ajax.php URL with same protocol as current page |
| 253 | - self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol ); |
|
| 254 | - self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false; |
|
| 253 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
| 254 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | |
@@ -262,14 +262,14 @@ discard block |
||
| 262 | 262 | * @return string |
| 263 | 263 | */ |
| 264 | 264 | public static function localize_i18n_js_strings() { |
| 265 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
| 266 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
| 267 | - if ( is_scalar( $value ) ) { |
|
| 268 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
| 265 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
| 266 | + foreach ($i18n_js_strings as $key => $value) { |
|
| 267 | + if (is_scalar($value)) { |
|
| 268 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
| 272 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | |
@@ -277,15 +277,15 @@ discard block |
||
| 277 | 277 | /** |
| 278 | 278 | * @param mixed string | EED_Module $module |
| 279 | 279 | */ |
| 280 | - public function add_module( $module ) { |
|
| 281 | - if ( $module instanceof EED_Module ) { |
|
| 282 | - $module_class = get_class( $module ); |
|
| 280 | + public function add_module($module) { |
|
| 281 | + if ($module instanceof EED_Module) { |
|
| 282 | + $module_class = get_class($module); |
|
| 283 | 283 | $this->modules->{$module_class} = $module; |
| 284 | 284 | } else { |
| 285 | - if ( ! class_exists( 'EE_Module_Request_Router' ) ) { |
|
| 286 | - $this->load_core( 'Module_Request_Router' ); |
|
| 285 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
| 286 | + $this->load_core('Module_Request_Router'); |
|
| 287 | 287 | } |
| 288 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
| 288 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | * @param string $module_name |
| 296 | 296 | * @return mixed EED_Module | NULL |
| 297 | 297 | */ |
| 298 | - public function get_module( $module_name = '' ) { |
|
| 299 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
| 298 | + public function get_module($module_name = '') { |
|
| 299 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | |
@@ -310,20 +310,20 @@ discard block |
||
| 310 | 310 | * @param bool $load_only |
| 311 | 311 | * @return mixed |
| 312 | 312 | */ |
| 313 | - public function load_core( $class_name, $arguments = array(), $load_only = false ) { |
|
| 313 | + public function load_core($class_name, $arguments = array(), $load_only = false) { |
|
| 314 | 314 | $core_paths = apply_filters( |
| 315 | 315 | 'FHEE__EE_Registry__load_core__core_paths', |
| 316 | 316 | array( |
| 317 | 317 | EE_CORE, |
| 318 | 318 | EE_ADMIN, |
| 319 | 319 | EE_CPTS, |
| 320 | - EE_CORE . 'data_migration_scripts' . DS, |
|
| 321 | - EE_CORE . 'request_stack' . DS, |
|
| 322 | - EE_CORE . 'middleware' . DS, |
|
| 320 | + EE_CORE.'data_migration_scripts'.DS, |
|
| 321 | + EE_CORE.'request_stack'.DS, |
|
| 322 | + EE_CORE.'middleware'.DS, |
|
| 323 | 323 | ) |
| 324 | 324 | ); |
| 325 | 325 | // retrieve instantiated class |
| 326 | - return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only ); |
|
| 326 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | |
@@ -337,15 +337,15 @@ discard block |
||
| 337 | 337 | * @param bool $load_only |
| 338 | 338 | * @return mixed |
| 339 | 339 | */ |
| 340 | - public function load_service( $class_name, $arguments = array(), $load_only = false ) { |
|
| 340 | + public function load_service($class_name, $arguments = array(), $load_only = false) { |
|
| 341 | 341 | $service_paths = apply_filters( |
| 342 | 342 | 'FHEE__EE_Registry__load_service__service_paths', |
| 343 | 343 | array( |
| 344 | - EE_CORE . 'services' . DS, |
|
| 344 | + EE_CORE.'services'.DS, |
|
| 345 | 345 | ) |
| 346 | 346 | ); |
| 347 | 347 | // retrieve instantiated class |
| 348 | - return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only ); |
|
| 348 | + return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | |
@@ -358,9 +358,9 @@ discard block |
||
| 358 | 358 | * @param mixed $arguments |
| 359 | 359 | * @return EE_Data_Migration_Script_Base |
| 360 | 360 | */ |
| 361 | - public function load_dms( $class_name, $arguments = array() ) { |
|
| 361 | + public function load_dms($class_name, $arguments = array()) { |
|
| 362 | 362 | // retrieve instantiated class |
| 363 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false ); |
|
| 363 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | |
@@ -375,14 +375,14 @@ discard block |
||
| 375 | 375 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
| 376 | 376 | * @return EE_Base_Class | bool |
| 377 | 377 | */ |
| 378 | - public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) { |
|
| 379 | - $paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array( |
|
| 378 | + public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) { |
|
| 379 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
| 380 | 380 | EE_CORE, |
| 381 | 381 | EE_CLASSES, |
| 382 | 382 | EE_BUSINESS |
| 383 | - ) ); |
|
| 383 | + )); |
|
| 384 | 384 | // retrieve instantiated class |
| 385 | - return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
| 385 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | |
@@ -395,11 +395,11 @@ discard block |
||
| 395 | 395 | * @param bool $load_only |
| 396 | 396 | * @return EEH_Base | bool |
| 397 | 397 | */ |
| 398 | - public function load_helper( $class_name, $arguments = array(), $load_only = true ) { |
|
| 398 | + public function load_helper($class_name, $arguments = array(), $load_only = true) { |
|
| 399 | 399 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
| 400 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) ); |
|
| 400 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
| 401 | 401 | // retrieve instantiated class |
| 402 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only ); |
|
| 402 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | |
@@ -414,16 +414,16 @@ discard block |
||
| 414 | 414 | * @param bool $cache whether to cache the object or not. |
| 415 | 415 | * @return mixed |
| 416 | 416 | */ |
| 417 | - public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) { |
|
| 417 | + public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) { |
|
| 418 | 418 | $paths = array( |
| 419 | 419 | EE_LIBRARIES, |
| 420 | - EE_LIBRARIES . 'messages' . DS, |
|
| 421 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
| 422 | - EE_LIBRARIES . 'qtips' . DS, |
|
| 423 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
| 420 | + EE_LIBRARIES.'messages'.DS, |
|
| 421 | + EE_LIBRARIES.'shortcodes'.DS, |
|
| 422 | + EE_LIBRARIES.'qtips'.DS, |
|
| 423 | + EE_LIBRARIES.'payment_methods'.DS, |
|
| 424 | 424 | ); |
| 425 | 425 | // retrieve instantiated class |
| 426 | - return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only ); |
|
| 426 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | |
@@ -436,13 +436,13 @@ discard block |
||
| 436 | 436 | * @param bool $load_only |
| 437 | 437 | * @return EEM_Base | bool |
| 438 | 438 | */ |
| 439 | - public function load_model( $class_name, $arguments = array(), $load_only = false ) { |
|
| 440 | - $paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array( |
|
| 439 | + public function load_model($class_name, $arguments = array(), $load_only = false) { |
|
| 440 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
| 441 | 441 | EE_MODELS, |
| 442 | 442 | EE_CORE |
| 443 | - ) ); |
|
| 443 | + )); |
|
| 444 | 444 | // retrieve instantiated class |
| 445 | - return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only ); |
|
| 445 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | |
@@ -455,15 +455,15 @@ discard block |
||
| 455 | 455 | * @param bool $load_only |
| 456 | 456 | * @return mixed | bool |
| 457 | 457 | */ |
| 458 | - public function load_model_class( $class_name, $arguments = array(), $load_only = true ) { |
|
| 458 | + public function load_model_class($class_name, $arguments = array(), $load_only = true) { |
|
| 459 | 459 | $paths = array( |
| 460 | - EE_MODELS . 'fields' . DS, |
|
| 461 | - EE_MODELS . 'helpers' . DS, |
|
| 462 | - EE_MODELS . 'relations' . DS, |
|
| 463 | - EE_MODELS . 'strategies' . DS |
|
| 460 | + EE_MODELS.'fields'.DS, |
|
| 461 | + EE_MODELS.'helpers'.DS, |
|
| 462 | + EE_MODELS.'relations'.DS, |
|
| 463 | + EE_MODELS.'strategies'.DS |
|
| 464 | 464 | ); |
| 465 | 465 | // retrieve instantiated class |
| 466 | - return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only ); |
|
| 466 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | |
@@ -473,8 +473,8 @@ discard block |
||
| 473 | 473 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
| 474 | 474 | * @return boolean |
| 475 | 475 | */ |
| 476 | - public function is_model_name( $model_name ) { |
|
| 477 | - return isset( $this->models[ $model_name ] ) ? true : false; |
|
| 476 | + public function is_model_name($model_name) { |
|
| 477 | + return isset($this->models[$model_name]) ? true : false; |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | |
@@ -489,9 +489,9 @@ discard block |
||
| 489 | 489 | * @param bool $load_only |
| 490 | 490 | * @return mixed |
| 491 | 491 | */ |
| 492 | - public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) { |
|
| 492 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) { |
|
| 493 | 493 | // retrieve instantiated class |
| 494 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only ); |
|
| 494 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | |
@@ -506,9 +506,9 @@ discard block |
||
| 506 | 506 | * @param bool $load_only |
| 507 | 507 | * @return EE_Addon |
| 508 | 508 | */ |
| 509 | - public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) { |
|
| 509 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) { |
|
| 510 | 510 | // retrieve instantiated class |
| 511 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only ); |
|
| 511 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | |
@@ -539,46 +539,46 @@ discard block |
||
| 539 | 539 | $load_only = false |
| 540 | 540 | ) { |
| 541 | 541 | // strip php file extension |
| 542 | - $class_name = str_replace( '.php', '', trim( $class_name ) ); |
|
| 542 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
| 543 | 543 | // does the class have a prefix ? |
| 544 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
| 544 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
| 545 | 545 | // make sure $class_prefix is uppercase |
| 546 | - $class_prefix = strtoupper( trim( $class_prefix ) ); |
|
| 546 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
| 547 | 547 | // add class prefix ONCE!!! |
| 548 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
| 548 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
| 549 | 549 | } |
| 550 | - $class_exists = class_exists( $class_name ); |
|
| 550 | + $class_exists = class_exists($class_name); |
|
| 551 | 551 | // if we're only loading the class and it already exists, then let's just return true immediately |
| 552 | - if ( $load_only && $class_exists ) { |
|
| 552 | + if ($load_only && $class_exists) { |
|
| 553 | 553 | return true; |
| 554 | 554 | } |
| 555 | 555 | // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection |
| 556 | 556 | // $cache is controlled by individual calls to separate Registry loader methods like load_class() |
| 557 | 557 | // $load_only is also controlled by individual calls to separate Registry loader methods like load_file() |
| 558 | - if ( $this->_cache_on && $cache && ! $load_only ) { |
|
| 558 | + if ($this->_cache_on && $cache && ! $load_only) { |
|
| 559 | 559 | // return object if it's already cached |
| 560 | - $cached_class = $this->_get_cached_class( $class_name, $class_prefix ); |
|
| 561 | - if ( $cached_class !== null ) { |
|
| 560 | + $cached_class = $this->_get_cached_class($class_name, $class_prefix); |
|
| 561 | + if ($cached_class !== null) { |
|
| 562 | 562 | return $cached_class; |
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | 565 | // if the class doesn't already exist.. then we need to try and find the file and load it |
| 566 | - if ( ! $class_exists ) { |
|
| 566 | + if ( ! $class_exists) { |
|
| 567 | 567 | // get full path to file |
| 568 | - $path = $this->_resolve_path( $class_name, $type, $file_paths ); |
|
| 568 | + $path = $this->_resolve_path($class_name, $type, $file_paths); |
|
| 569 | 569 | // load the file |
| 570 | - $loaded = $this->_require_file( $path, $class_name, $type, $file_paths ); |
|
| 570 | + $loaded = $this->_require_file($path, $class_name, $type, $file_paths); |
|
| 571 | 571 | // if loading failed, or we are only loading a file but NOT instantiating an object |
| 572 | - if ( ! $loaded || $load_only ) { |
|
| 572 | + if ( ! $loaded || $load_only) { |
|
| 573 | 573 | // return boolean if only loading, or null if an object was expected |
| 574 | 574 | return $load_only ? $loaded : null; |
| 575 | 575 | } |
| 576 | 576 | } |
| 577 | 577 | // instantiate the requested object |
| 578 | - $class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db ); |
|
| 579 | - if ( $this->_cache_on && $cache ) { |
|
| 578 | + $class_obj = $this->_create_object($class_name, $arguments, $type, $from_db); |
|
| 579 | + if ($this->_cache_on && $cache) { |
|
| 580 | 580 | // save it for later... kinda like gum { : $ |
| 581 | - $this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db ); |
|
| 581 | + $this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db); |
|
| 582 | 582 | } |
| 583 | 583 | $this->_cache_on = true; |
| 584 | 584 | return $class_obj; |
@@ -601,21 +601,21 @@ discard block |
||
| 601 | 601 | * @param string $class_prefix |
| 602 | 602 | * @return null|object |
| 603 | 603 | */ |
| 604 | - protected function _get_cached_class( $class_name, $class_prefix = '' ) { |
|
| 605 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
| 606 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
| 604 | + protected function _get_cached_class($class_name, $class_prefix = '') { |
|
| 605 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
| 606 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
| 607 | 607 | } else { |
| 608 | 608 | // have to specify something, but not anything that will conflict |
| 609 | 609 | $class_abbreviation = 'FANCY_BATMAN_PANTS'; |
| 610 | 610 | } |
| 611 | 611 | // check if class has already been loaded, and return it if it has been |
| 612 | - if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) { |
|
| 612 | + if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) { |
|
| 613 | 613 | return $this->{$class_abbreviation}; |
| 614 | - } else if ( isset ( $this->{$class_name} ) ) { |
|
| 614 | + } else if (isset ($this->{$class_name} )) { |
|
| 615 | 615 | return $this->{$class_name}; |
| 616 | - } else if ( isset ( $this->LIB->{$class_name} ) ) { |
|
| 616 | + } else if (isset ($this->LIB->{$class_name} )) { |
|
| 617 | 617 | return $this->LIB->{$class_name}; |
| 618 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) { |
|
| 618 | + } else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) { |
|
| 619 | 619 | return $this->addons->{$class_name}; |
| 620 | 620 | } |
| 621 | 621 | return null; |
@@ -636,20 +636,20 @@ discard block |
||
| 636 | 636 | * @param array $file_paths |
| 637 | 637 | * @return string | bool |
| 638 | 638 | */ |
| 639 | - protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) { |
|
| 639 | + protected function _resolve_path($class_name, $type = '', $file_paths = array()) { |
|
| 640 | 640 | // make sure $file_paths is an array |
| 641 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
| 641 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
| 642 | 642 | // cycle thru paths |
| 643 | - foreach ( $file_paths as $key => $file_path ) { |
|
| 643 | + foreach ($file_paths as $key => $file_path) { |
|
| 644 | 644 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
| 645 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
| 645 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
| 646 | 646 | // prep file type |
| 647 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
| 647 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
| 648 | 648 | // build full file path |
| 649 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
| 649 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
| 650 | 650 | //does the file exist and can be read ? |
| 651 | - if ( is_readable( $file_paths[ $key ] ) ) { |
|
| 652 | - return $file_paths[ $key ]; |
|
| 651 | + if (is_readable($file_paths[$key])) { |
|
| 652 | + return $file_paths[$key]; |
|
| 653 | 653 | } |
| 654 | 654 | } |
| 655 | 655 | return false; |
@@ -671,29 +671,29 @@ discard block |
||
| 671 | 671 | * @return boolean |
| 672 | 672 | * @throws \EE_Error |
| 673 | 673 | */ |
| 674 | - protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) { |
|
| 674 | + protected function _require_file($path, $class_name, $type = '', $file_paths = array()) { |
|
| 675 | 675 | // don't give up! you gotta... |
| 676 | 676 | try { |
| 677 | 677 | //does the file exist and can it be read ? |
| 678 | - if ( ! $path ) { |
|
| 678 | + if ( ! $path) { |
|
| 679 | 679 | // so sorry, can't find the file |
| 680 | - throw new EE_Error ( |
|
| 680 | + throw new EE_Error( |
|
| 681 | 681 | sprintf( |
| 682 | - __( 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso' ), |
|
| 683 | - trim( $type, '.' ), |
|
| 682 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
| 683 | + trim($type, '.'), |
|
| 684 | 684 | $class_name, |
| 685 | - '<br />' . implode( ',<br />', $file_paths ) |
|
| 685 | + '<br />'.implode(',<br />', $file_paths) |
|
| 686 | 686 | ) |
| 687 | 687 | ); |
| 688 | 688 | } |
| 689 | 689 | // get the file |
| 690 | - require_once( $path ); |
|
| 690 | + require_once($path); |
|
| 691 | 691 | // if the class isn't already declared somewhere |
| 692 | - if ( class_exists( $class_name, false ) === false ) { |
|
| 692 | + if (class_exists($class_name, false) === false) { |
|
| 693 | 693 | // so sorry, not a class |
| 694 | 694 | throw new EE_Error( |
| 695 | 695 | sprintf( |
| 696 | - __( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ), |
|
| 696 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
| 697 | 697 | $type, |
| 698 | 698 | $path, |
| 699 | 699 | $class_name |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | ); |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - } catch ( EE_Error $e ) { |
|
| 704 | + } catch (EE_Error $e) { |
|
| 705 | 705 | $e->get_error(); |
| 706 | 706 | return false; |
| 707 | 707 | } |
@@ -733,55 +733,55 @@ discard block |
||
| 733 | 733 | * @return null | object |
| 734 | 734 | * @throws \EE_Error |
| 735 | 735 | */ |
| 736 | - protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) { |
|
| 736 | + protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) { |
|
| 737 | 737 | $class_obj = null; |
| 738 | 738 | // don't give up! you gotta... |
| 739 | 739 | try { |
| 740 | 740 | // create reflection |
| 741 | - $reflector = $this->get_ReflectionClass( $class_name ); |
|
| 741 | + $reflector = $this->get_ReflectionClass($class_name); |
|
| 742 | 742 | // make sure arguments are an array |
| 743 | - $arguments = is_array( $arguments ) ? $arguments : array( $arguments ); |
|
| 743 | + $arguments = is_array($arguments) ? $arguments : array($arguments); |
|
| 744 | 744 | // and if arguments array is numerically and sequentially indexed, then we want it to remain as is, |
| 745 | 745 | // else wrap it in an additional array so that it doesn't get split into multiple parameters |
| 746 | - $arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments ) |
|
| 746 | + $arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments) |
|
| 747 | 747 | ? $arguments |
| 748 | - : array( $arguments ); |
|
| 748 | + : array($arguments); |
|
| 749 | 749 | // attempt to inject dependencies ? |
| 750 | - if ( $this->_dependency_map->has( $class_name ) ) { |
|
| 751 | - $arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments ); |
|
| 750 | + if ($this->_dependency_map->has($class_name)) { |
|
| 751 | + $arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments); |
|
| 752 | 752 | } |
| 753 | 753 | // instantiate the class and add to the LIB array for tracking |
| 754 | 754 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
| 755 | - if ( $reflector->getConstructor() === null || $reflector->isAbstract() ) { |
|
| 755 | + if ($reflector->getConstructor() === null || $reflector->isAbstract()) { |
|
| 756 | 756 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
| 757 | 757 | //$instantiation_mode = "no constructor"; |
| 758 | 758 | $class_obj = true; |
| 759 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
| 759 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
| 760 | 760 | //$instantiation_mode = "new_instance_from_db"; |
| 761 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
| 762 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
| 761 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
| 762 | + } else if (method_exists($class_name, 'new_instance')) { |
|
| 763 | 763 | //$instantiation_mode = "new_instance"; |
| 764 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
| 765 | - } else if ( method_exists( $class_name, 'instance' ) ) { |
|
| 764 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
| 765 | + } else if (method_exists($class_name, 'instance')) { |
|
| 766 | 766 | //$instantiation_mode = "instance"; |
| 767 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
| 768 | - } else if ( $reflector->isInstantiable() ) { |
|
| 767 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
| 768 | + } else if ($reflector->isInstantiable()) { |
|
| 769 | 769 | //$instantiation_mode = "isInstantiable"; |
| 770 | - $class_obj = $reflector->newInstanceArgs( $arguments ); |
|
| 770 | + $class_obj = $reflector->newInstanceArgs($arguments); |
|
| 771 | 771 | } else { |
| 772 | 772 | // heh ? something's not right ! |
| 773 | 773 | //$instantiation_mode = 'none'; |
| 774 | 774 | throw new EE_Error( |
| 775 | 775 | sprintf( |
| 776 | - __( 'The %s file %s could not be instantiated.', 'event_espresso' ), |
|
| 776 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
| 777 | 777 | $type, |
| 778 | 778 | $class_name |
| 779 | 779 | ) |
| 780 | 780 | ); |
| 781 | 781 | } |
| 782 | - } catch ( Exception $e ) { |
|
| 783 | - if ( ! $e instanceof EE_Error ) { |
|
| 784 | - $e = new EE_Error( $e->getMessage() ); |
|
| 782 | + } catch (Exception $e) { |
|
| 783 | + if ( ! $e instanceof EE_Error) { |
|
| 784 | + $e = new EE_Error($e->getMessage()); |
|
| 785 | 785 | } |
| 786 | 786 | $e->get_error(); |
| 787 | 787 | } |
@@ -795,8 +795,8 @@ discard block |
||
| 795 | 795 | * @param array $array |
| 796 | 796 | * @return bool |
| 797 | 797 | */ |
| 798 | - protected function _array_is_numerically_and_sequentially_indexed( array $array ) { |
|
| 799 | - return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true; |
|
| 798 | + protected function _array_is_numerically_and_sequentially_indexed(array $array) { |
|
| 799 | + return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true; |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | |
@@ -811,14 +811,14 @@ discard block |
||
| 811 | 811 | * @param string $class_name |
| 812 | 812 | * @return ReflectionClass |
| 813 | 813 | */ |
| 814 | - public function get_ReflectionClass( $class_name ) { |
|
| 814 | + public function get_ReflectionClass($class_name) { |
|
| 815 | 815 | if ( |
| 816 | - ! isset( $this->_reflectors[ $class_name ] ) |
|
| 817 | - || ! $this->_reflectors[ $class_name ] instanceof ReflectionClass |
|
| 816 | + ! isset($this->_reflectors[$class_name]) |
|
| 817 | + || ! $this->_reflectors[$class_name] instanceof ReflectionClass |
|
| 818 | 818 | ) { |
| 819 | - $this->_reflectors[ $class_name ] = new ReflectionClass( $class_name ); |
|
| 819 | + $this->_reflectors[$class_name] = new ReflectionClass($class_name); |
|
| 820 | 820 | } |
| 821 | - return $this->_reflectors[ $class_name ]; |
|
| 821 | + return $this->_reflectors[$class_name]; |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | |
@@ -843,48 +843,48 @@ discard block |
||
| 843 | 843 | * @param array $arguments |
| 844 | 844 | * @return array |
| 845 | 845 | */ |
| 846 | - protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) { |
|
| 846 | + protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) { |
|
| 847 | 847 | // let's examine the constructor |
| 848 | 848 | $constructor = $reflector->getConstructor(); |
| 849 | 849 | // whu? huh? nothing? |
| 850 | - if ( ! $constructor ) { |
|
| 850 | + if ( ! $constructor) { |
|
| 851 | 851 | return $arguments; |
| 852 | 852 | } |
| 853 | 853 | // get constructor parameters |
| 854 | 854 | $params = $constructor->getParameters(); |
| 855 | 855 | // and the keys for the incoming arguments array so that we can compare existing arguments with what is expected |
| 856 | - $argument_keys = array_keys( $arguments ); |
|
| 856 | + $argument_keys = array_keys($arguments); |
|
| 857 | 857 | // now loop thru all of the constructors expected parameters |
| 858 | - foreach ( $params as $index => $param ) { |
|
| 858 | + foreach ($params as $index => $param) { |
|
| 859 | 859 | // is this a dependency for a specific class ? |
| 860 | 860 | $param_class = $param->getClass() ? $param->getClass()->name : null; |
| 861 | 861 | // you want a piece of me ? |
| 862 | - if ( $param_class === 'EE_Registry' ) { |
|
| 863 | - $arguments[ $index ] = $this; |
|
| 862 | + if ($param_class === 'EE_Registry') { |
|
| 863 | + $arguments[$index] = $this; |
|
| 864 | 864 | } else if ( |
| 865 | 865 | // param is not even a class |
| 866 | - empty( $param_class ) |
|
| 866 | + empty($param_class) |
|
| 867 | 867 | // and something already exists in the incoming arguments for this param |
| 868 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
| 868 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
| 869 | 869 | ) { |
| 870 | 870 | // so let's skip this argument and move on to the next |
| 871 | 871 | continue; |
| 872 | 872 | } else if ( |
| 873 | 873 | // parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class |
| 874 | - ! empty( $param_class ) |
|
| 875 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
| 876 | - && $arguments[ $argument_keys[ $index ] ] instanceof $param_class |
|
| 874 | + ! empty($param_class) |
|
| 875 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
| 876 | + && $arguments[$argument_keys[$index]] instanceof $param_class |
|
| 877 | 877 | ) { |
| 878 | 878 | // skip this argument and move on to the next |
| 879 | 879 | continue; |
| 880 | 880 | } else if ( |
| 881 | 881 | // parameter is type hinted as a class, and should be injected |
| 882 | - ! empty( $param_class ) |
|
| 883 | - && $this->_dependency_map->has_dependency_for_class( $class_name, $param_class ) |
|
| 882 | + ! empty($param_class) |
|
| 883 | + && $this->_dependency_map->has_dependency_for_class($class_name, $param_class) |
|
| 884 | 884 | ) { |
| 885 | - $arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index ); |
|
| 885 | + $arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index); |
|
| 886 | 886 | } else { |
| 887 | - $arguments[ $index ] = $param->getDefaultValue(); |
|
| 887 | + $arguments[$index] = $param->getDefaultValue(); |
|
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | } |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | * @param mixed $index |
| 902 | 902 | * @return array |
| 903 | 903 | */ |
| 904 | - protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) { |
|
| 904 | + protected function _resolve_dependency($class_name, $param_class, $arguments, $index) { |
|
| 905 | 905 | $dependency = null; |
| 906 | 906 | // should dependency be loaded from cache ? |
| 907 | 907 | $cache_on = $this->_dependency_map->loading_strategy_for_class_dependency( |
@@ -911,30 +911,30 @@ discard block |
||
| 911 | 911 | : false; |
| 912 | 912 | // we might have a dependency... |
| 913 | 913 | // let's MAYBE try and find it in our cache if that's what's been requested |
| 914 | - $cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null; |
|
| 914 | + $cached_class = $cache_on ? $this->_get_cached_class($param_class) : null; |
|
| 915 | 915 | // and grab it if it exists |
| 916 | - if ( $cached_class instanceof $param_class ) { |
|
| 916 | + if ($cached_class instanceof $param_class) { |
|
| 917 | 917 | $dependency = $cached_class; |
| 918 | - } else if ( $param_class != $class_name ) { |
|
| 918 | + } else if ($param_class != $class_name) { |
|
| 919 | 919 | // obtain the loader method from the dependency map |
| 920 | - $loader = $this->_dependency_map->class_loader( $param_class ); |
|
| 920 | + $loader = $this->_dependency_map->class_loader($param_class); |
|
| 921 | 921 | // is loader a custom closure ? |
| 922 | - if ( $loader instanceof Closure ) { |
|
| 922 | + if ($loader instanceof Closure) { |
|
| 923 | 923 | $dependency = $loader(); |
| 924 | 924 | } else { |
| 925 | 925 | // set the cache on property for the recursive loading call |
| 926 | 926 | $this->_cache_on = $cache_on; |
| 927 | 927 | // if not, then let's try and load it via the registry |
| 928 | - $dependency = $this->{$loader}( $param_class ); |
|
| 928 | + $dependency = $this->{$loader}($param_class); |
|
| 929 | 929 | } |
| 930 | 930 | } |
| 931 | 931 | // did we successfully find the correct dependency ? |
| 932 | - if ( $dependency instanceof $param_class ) { |
|
| 932 | + if ($dependency instanceof $param_class) { |
|
| 933 | 933 | // then let's inject it into the incoming array of arguments at the correct location |
| 934 | - if ( isset( $argument_keys[ $index ] ) ) { |
|
| 935 | - $arguments[ $argument_keys[ $index ] ] = $dependency; |
|
| 934 | + if (isset($argument_keys[$index])) { |
|
| 935 | + $arguments[$argument_keys[$index]] = $dependency; |
|
| 936 | 936 | } else { |
| 937 | - $arguments[ $index ] = $dependency; |
|
| 937 | + $arguments[$index] = $dependency; |
|
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | return $arguments; |
@@ -959,16 +959,16 @@ discard block |
||
| 959 | 959 | * @param bool $from_db |
| 960 | 960 | * @return void |
| 961 | 961 | */ |
| 962 | - protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) { |
|
| 962 | + protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) { |
|
| 963 | 963 | // return newly instantiated class |
| 964 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
| 965 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
| 964 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
| 965 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
| 966 | 966 | $this->{$class_abbreviation} = $class_obj; |
| 967 | - } else if ( property_exists( $this, $class_name ) ) { |
|
| 967 | + } else if (property_exists($this, $class_name)) { |
|
| 968 | 968 | $this->{$class_name} = $class_obj; |
| 969 | - } else if ( $class_prefix == 'addon' ) { |
|
| 969 | + } else if ($class_prefix == 'addon') { |
|
| 970 | 970 | $this->addons->{$class_name} = $class_obj; |
| 971 | - } else if ( ! $from_db ) { |
|
| 971 | + } else if ( ! $from_db) { |
|
| 972 | 972 | $this->LIB->{$class_name} = $class_obj; |
| 973 | 973 | } |
| 974 | 974 | } |
@@ -985,12 +985,12 @@ discard block |
||
| 985 | 985 | * @param array $arguments |
| 986 | 986 | * @return object |
| 987 | 987 | */ |
| 988 | - public static function factory( $classname, $arguments = array() ) { |
|
| 989 | - $loader = self::instance()->_dependency_map->class_loader( $classname ); |
|
| 990 | - if ( $loader instanceof Closure ) { |
|
| 991 | - return $loader( $arguments ); |
|
| 992 | - } else if ( method_exists( EE_Registry::instance(), $loader ) ) { |
|
| 993 | - return EE_Registry::instance()->{$loader}( $classname, $arguments ); |
|
| 988 | + public static function factory($classname, $arguments = array()) { |
|
| 989 | + $loader = self::instance()->_dependency_map->class_loader($classname); |
|
| 990 | + if ($loader instanceof Closure) { |
|
| 991 | + return $loader($arguments); |
|
| 992 | + } else if (method_exists(EE_Registry::instance(), $loader)) { |
|
| 993 | + return EE_Registry::instance()->{$loader}($classname, $arguments); |
|
| 994 | 994 | } |
| 995 | 995 | return null; |
| 996 | 996 | } |
@@ -1003,9 +1003,9 @@ discard block |
||
| 1003 | 1003 | * @param string $name |
| 1004 | 1004 | * @return EE_Addon |
| 1005 | 1005 | */ |
| 1006 | - public function get_addon_by_name( $name ) { |
|
| 1007 | - foreach ( $this->addons as $addon ) { |
|
| 1008 | - if ( $addon->name() == $name ) { |
|
| 1006 | + public function get_addon_by_name($name) { |
|
| 1007 | + foreach ($this->addons as $addon) { |
|
| 1008 | + if ($addon->name() == $name) { |
|
| 1009 | 1009 | return $addon; |
| 1010 | 1010 | } |
| 1011 | 1011 | } |
@@ -1021,8 +1021,8 @@ discard block |
||
| 1021 | 1021 | */ |
| 1022 | 1022 | public function get_addons_by_name() { |
| 1023 | 1023 | $addons = array(); |
| 1024 | - foreach ( $this->addons as $addon ) { |
|
| 1025 | - $addons[ $addon->name() ] = $addon; |
|
| 1024 | + foreach ($this->addons as $addon) { |
|
| 1025 | + $addons[$addon->name()] = $addon; |
|
| 1026 | 1026 | } |
| 1027 | 1027 | return $addons; |
| 1028 | 1028 | } |
@@ -1037,14 +1037,14 @@ discard block |
||
| 1037 | 1037 | * @return \EEM_Base |
| 1038 | 1038 | * @throws \EE_Error |
| 1039 | 1039 | */ |
| 1040 | - public function reset_model( $model_name ) { |
|
| 1041 | - $model = $this->load_model( $model_name ); |
|
| 1042 | - $model_class_name = get_class( $model ); |
|
| 1040 | + public function reset_model($model_name) { |
|
| 1041 | + $model = $this->load_model($model_name); |
|
| 1042 | + $model_class_name = get_class($model); |
|
| 1043 | 1043 | //get that model reset it and make sure we nuke the old reference to it |
| 1044 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
| 1044 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
| 1045 | 1045 | $this->LIB->{$model_class_name} = $model::reset(); |
| 1046 | 1046 | } else { |
| 1047 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
| 1047 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
| 1048 | 1048 | } |
| 1049 | 1049 | return $this->LIB->{$model_class_name}; |
| 1050 | 1050 | } |
@@ -1062,17 +1062,17 @@ discard block |
||
| 1062 | 1062 | * currently reinstantiate the singletons at the moment) |
| 1063 | 1063 | * @return EE_Registry |
| 1064 | 1064 | */ |
| 1065 | - public static function reset( $hard = false, $reinstantiate = true ) { |
|
| 1065 | + public static function reset($hard = false, $reinstantiate = true) { |
|
| 1066 | 1066 | self::$_instance = null; |
| 1067 | - $instance = self::instance( EE_Dependency_Map::instance() ); |
|
| 1067 | + $instance = self::instance(EE_Dependency_Map::instance()); |
|
| 1068 | 1068 | $instance->initialize(); |
| 1069 | 1069 | EEH_Activation::reset(); |
| 1070 | 1070 | $instance->_cache_on = true; |
| 1071 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate, $instance ); |
|
| 1071 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate, $instance); |
|
| 1072 | 1072 | $instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset(); |
| 1073 | 1073 | $instance->LIB = new stdClass(); |
| 1074 | - foreach ( array_keys( $instance->non_abstract_db_models ) as $model_name ) { |
|
| 1075 | - $instance->reset_model( $model_name ); |
|
| 1074 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
| 1075 | + $instance->reset_model($model_name); |
|
| 1076 | 1076 | } |
| 1077 | 1077 | return $instance; |
| 1078 | 1078 | } |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | * @param $a |
| 1093 | 1093 | * @param $b |
| 1094 | 1094 | */ |
| 1095 | - final function __call( $a, $b ) { |
|
| 1095 | + final function __call($a, $b) { |
|
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | 1098 | |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | /** |
| 1101 | 1101 | * @param $a |
| 1102 | 1102 | */ |
| 1103 | - final function __get( $a ) { |
|
| 1103 | + final function __get($a) { |
|
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | |
@@ -1109,7 +1109,7 @@ discard block |
||
| 1109 | 1109 | * @param $a |
| 1110 | 1110 | * @param $b |
| 1111 | 1111 | */ |
| 1112 | - final function __set( $a, $b ) { |
|
| 1112 | + final function __set($a, $b) { |
|
| 1113 | 1113 | } |
| 1114 | 1114 | |
| 1115 | 1115 | |
@@ -1117,7 +1117,7 @@ discard block |
||
| 1117 | 1117 | /** |
| 1118 | 1118 | * @param $a |
| 1119 | 1119 | */ |
| 1120 | - final function __isset( $a ) { |
|
| 1120 | + final function __isset($a) { |
|
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | /** |
| 1126 | 1126 | * @param $a |
| 1127 | 1127 | */ |
| 1128 | - final function __unset( $a ) { |
|
| 1128 | + final function __unset($a) { |
|
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | 1131 | |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | * @param $a |
| 1173 | 1173 | * @param $b |
| 1174 | 1174 | */ |
| 1175 | - final static function __callStatic( $a, $b ) { |
|
| 1175 | + final static function __callStatic($a, $b) { |
|
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | 1178 | /** |
@@ -1181,9 +1181,9 @@ discard block |
||
| 1181 | 1181 | */ |
| 1182 | 1182 | public function cpt_models() { |
| 1183 | 1183 | $cpt_models = array(); |
| 1184 | - foreach( $this->non_abstract_db_models as $short_name => $classname ) { |
|
| 1185 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
| 1186 | - $cpt_models[ $short_name ] = $classname; |
|
| 1184 | + foreach ($this->non_abstract_db_models as $short_name => $classname) { |
|
| 1185 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
| 1186 | + $cpt_models[$short_name] = $classname; |
|
| 1187 | 1187 | } |
| 1188 | 1188 | } |
| 1189 | 1189 | return $cpt_models; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | /** |
| 6 | 6 | * |
@@ -65,27 +65,27 @@ discard block |
||
| 65 | 65 | * @param EE_Response $response |
| 66 | 66 | * @return EE_Response |
| 67 | 67 | */ |
| 68 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
| 68 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
| 69 | 69 | $this->request = $request; |
| 70 | 70 | $this->response = $response; |
| 71 | - do_action( 'AHEE__EE_Load_Espresso_Core__handle_request__start', $this ); |
|
| 71 | + do_action('AHEE__EE_Load_Espresso_Core__handle_request__start', $this); |
|
| 72 | 72 | // info about how to load classes required by other classes |
| 73 | 73 | $this->dependency_map = $this->_load_dependency_map(); |
| 74 | 74 | // central repository for classes |
| 75 | 75 | $this->registry = $this->_load_registry(); |
| 76 | - do_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', $this ); |
|
| 76 | + do_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', $this); |
|
| 77 | 77 | // PSR4 Autoloaders |
| 78 | - $this->registry->load_core( 'EE_Psr4AutoloaderInit' ); |
|
| 78 | + $this->registry->load_core('EE_Psr4AutoloaderInit'); |
|
| 79 | 79 | // workarounds for PHP < 5.3 |
| 80 | 80 | $this->_load_class_tools(); |
| 81 | 81 | // load interfaces |
| 82 | - espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' ); |
|
| 82 | + espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'); |
|
| 83 | 83 | // deprecated functions |
| 84 | - espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' ); |
|
| 84 | + espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php'); |
|
| 85 | 85 | // WP cron jobs |
| 86 | - $this->registry->load_core( 'Cron_Tasks' ); |
|
| 87 | - $this->registry->load_core( 'EE_Request_Handler' ); |
|
| 88 | - $this->registry->load_core( 'EE_System' ); |
|
| 86 | + $this->registry->load_core('Cron_Tasks'); |
|
| 87 | + $this->registry->load_core('EE_Request_Handler'); |
|
| 88 | + $this->registry->load_core('EE_System'); |
|
| 89 | 89 | |
| 90 | 90 | return $this->response; |
| 91 | 91 | } |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | * @throws \EE_Error |
| 116 | 116 | */ |
| 117 | 117 | public function dependency_map() { |
| 118 | - if ( ! $this->dependency_map instanceof EE_Dependency_Map ) { |
|
| 118 | + if ( ! $this->dependency_map instanceof EE_Dependency_Map) { |
|
| 119 | 119 | throw new EE_Error( |
| 120 | 120 | sprintf( |
| 121 | - __( 'Invalid EE_Dependency_Map: "%1$s"', 'event_espresso' ), |
|
| 122 | - print_r( $this->dependency_map, true ) |
|
| 121 | + __('Invalid EE_Dependency_Map: "%1$s"', 'event_espresso'), |
|
| 122 | + print_r($this->dependency_map, true) |
|
| 123 | 123 | ) |
| 124 | 124 | ); |
| 125 | 125 | } |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | * @throws \EE_Error |
| 134 | 134 | */ |
| 135 | 135 | public function registry() { |
| 136 | - if ( ! $this->registry instanceof EE_Registry ) { |
|
| 136 | + if ( ! $this->registry instanceof EE_Registry) { |
|
| 137 | 137 | throw new EE_Error( |
| 138 | 138 | sprintf( |
| 139 | - __( 'Invalid EE_Registry: "%1$s"', 'event_espresso' ), |
|
| 140 | - print_r( $this->registry, true ) |
|
| 139 | + __('Invalid EE_Registry: "%1$s"', 'event_espresso'), |
|
| 140 | + print_r($this->registry, true) |
|
| 141 | 141 | ) |
| 142 | 142 | ); |
| 143 | 143 | } |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | * @return EE_Dependency_Map |
| 154 | 154 | */ |
| 155 | 155 | private function _load_dependency_map() { |
| 156 | - if ( ! is_readable( EE_CORE . 'EE_Dependency_Map.core.php' ) ) { |
|
| 156 | + if ( ! is_readable(EE_CORE.'EE_Dependency_Map.core.php')) { |
|
| 157 | 157 | EE_Error::add_error( |
| 158 | - __( 'The EE_Dependency_Map core class could not be loaded.', 'event_espresso' ), |
|
| 158 | + __('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'), |
|
| 159 | 159 | __FILE__, __FUNCTION__, __LINE__ |
| 160 | 160 | ); |
| 161 | - wp_die( EE_Error::get_notices() ); |
|
| 161 | + wp_die(EE_Error::get_notices()); |
|
| 162 | 162 | } |
| 163 | - require_once( EE_CORE . 'EE_Dependency_Map.core.php' ); |
|
| 163 | + require_once(EE_CORE.'EE_Dependency_Map.core.php'); |
|
| 164 | 164 | return apply_filters( |
| 165 | 165 | 'FHEE__EE_Load_Espresso_Core___load_dependency_map', |
| 166 | - EE_Dependency_Map::instance( $this->request, $this->response ) |
|
| 166 | + EE_Dependency_Map::instance($this->request, $this->response) |
|
| 167 | 167 | ); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -176,17 +176,17 @@ discard block |
||
| 176 | 176 | * @return EE_Registry |
| 177 | 177 | */ |
| 178 | 178 | private function _load_registry() { |
| 179 | - if ( ! is_readable( EE_CORE . 'EE_Registry.core.php' )) { |
|
| 179 | + if ( ! is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
| 180 | 180 | EE_Error::add_error( |
| 181 | - __( 'The EE_Registry core class could not be loaded.', 'event_espresso' ), |
|
| 181 | + __('The EE_Registry core class could not be loaded.', 'event_espresso'), |
|
| 182 | 182 | __FILE__, __FUNCTION__, __LINE__ |
| 183 | 183 | ); |
| 184 | - wp_die( EE_Error::get_notices() ); |
|
| 184 | + wp_die(EE_Error::get_notices()); |
|
| 185 | 185 | } |
| 186 | - require_once( EE_CORE . 'EE_Registry.core.php' ); |
|
| 186 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
| 187 | 187 | return apply_filters( |
| 188 | 188 | 'FHEE__EE_Load_Espresso_Core___load_registry', |
| 189 | - EE_Registry::instance( $this->dependency_map ) |
|
| 189 | + EE_Registry::instance($this->dependency_map) |
|
| 190 | 190 | ); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | * @return void |
| 199 | 199 | */ |
| 200 | 200 | private function _load_class_tools() { |
| 201 | - if ( ! is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) { |
|
| 201 | + if ( ! is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
| 202 | 202 | EE_Error::add_error( |
| 203 | - __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ), |
|
| 203 | + __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'), |
|
| 204 | 204 | __FILE__, __FUNCTION__, __LINE__ |
| 205 | 205 | ); |
| 206 | 206 | } |
| 207 | - require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' ); |
|
| 207 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -218,9 +218,9 @@ discard block |
||
| 218 | 218 | * @param \EE_Request $request |
| 219 | 219 | * @param \EE_Response $response |
| 220 | 220 | */ |
| 221 | - public function handle_response( EE_Request $request, EE_Response $response ) { |
|
| 222 | - if ( $response->plugin_deactivated() ) { |
|
| 223 | - espresso_deactivate_plugin( EE_PLUGIN_BASENAME ); |
|
| 221 | + public function handle_response(EE_Request $request, EE_Response $response) { |
|
| 222 | + if ($response->plugin_deactivated()) { |
|
| 223 | + espresso_deactivate_plugin(EE_PLUGIN_BASENAME); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | * @param \EE_Request $request |
| 71 | 71 | * @param \EE_Response $response |
| 72 | 72 | */ |
| 73 | - protected function __construct( EE_Request $request, EE_Response $response ) { |
|
| 73 | + protected function __construct(EE_Request $request, EE_Response $response) { |
|
| 74 | 74 | $this->_request = $request; |
| 75 | 75 | $this->_response = $response; |
| 76 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
| 77 | - do_action( 'EE_Dependency_Map____construct' ); |
|
| 76 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
| 77 | + do_action('EE_Dependency_Map____construct'); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | * @param \EE_Response $response |
| 96 | 96 | * @return \EE_Dependency_Map instance |
| 97 | 97 | */ |
| 98 | - public static function instance( EE_Request $request = null, EE_Response $response = null ) { |
|
| 98 | + public static function instance(EE_Request $request = null, EE_Response $response = null) { |
|
| 99 | 99 | // check if class object is instantiated, and instantiated properly |
| 100 | - if ( ! self::$_instance instanceof EE_Dependency_Map ) { |
|
| 101 | - self::$_instance = new EE_Dependency_Map( $request, $response ); |
|
| 100 | + if ( ! self::$_instance instanceof EE_Dependency_Map) { |
|
| 101 | + self::$_instance = new EE_Dependency_Map($request, $response); |
|
| 102 | 102 | } |
| 103 | 103 | return self::$_instance; |
| 104 | 104 | } |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | * @param array $dependencies |
| 111 | 111 | * @return boolean |
| 112 | 112 | */ |
| 113 | - public static function register_dependencies( $class, $dependencies ) { |
|
| 114 | - if ( ! isset( self::$_instance->_dependency_map[ $class ] ) ) { |
|
| 115 | - self::$_instance->_dependency_map[ $class ] = (array)$dependencies; |
|
| 113 | + public static function register_dependencies($class, $dependencies) { |
|
| 114 | + if ( ! isset(self::$_instance->_dependency_map[$class])) { |
|
| 115 | + self::$_instance->_dependency_map[$class] = (array) $dependencies; |
|
| 116 | 116 | return true; |
| 117 | 117 | } |
| 118 | 118 | return false; |
@@ -126,18 +126,18 @@ discard block |
||
| 126 | 126 | * @return bool |
| 127 | 127 | * @throws \EE_Error |
| 128 | 128 | */ |
| 129 | - public static function register_class_loader( $class_name, $loader = 'load_core' ) { |
|
| 129 | + public static function register_class_loader($class_name, $loader = 'load_core') { |
|
| 130 | 130 | // check that loader method starts with "load_" and exists in EE_Registry |
| 131 | - if ( strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ) ) { |
|
| 131 | + if (strpos($loader, 'load_') !== 0 || ! method_exists('EE_Registry', $loader)) { |
|
| 132 | 132 | throw new EE_Error( |
| 133 | 133 | sprintf( |
| 134 | - __( '"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso' ), |
|
| 134 | + __('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'), |
|
| 135 | 135 | $loader |
| 136 | 136 | ) |
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | - if ( ! isset( self::$_instance->_class_loaders[ $class_name ] ) ) { |
|
| 140 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
| 139 | + if ( ! isset(self::$_instance->_class_loaders[$class_name])) { |
|
| 140 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
| 141 | 141 | return true; |
| 142 | 142 | } |
| 143 | 143 | return false; |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | * @param string $class_name |
| 161 | 161 | * @return boolean |
| 162 | 162 | */ |
| 163 | - public function has( $class_name = '' ) { |
|
| 164 | - return isset( $this->_dependency_map[ $class_name ] ) ? true : false; |
|
| 163 | + public function has($class_name = '') { |
|
| 164 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | * @param string $dependency |
| 174 | 174 | * @return bool |
| 175 | 175 | */ |
| 176 | - public function has_dependency_for_class( $class_name = '', $dependency = '' ) { |
|
| 177 | - return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] ) |
|
| 176 | + public function has_dependency_for_class($class_name = '', $dependency = '') { |
|
| 177 | + return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency]) |
|
| 178 | 178 | ? true |
| 179 | 179 | : false; |
| 180 | 180 | } |
@@ -188,9 +188,9 @@ discard block |
||
| 188 | 188 | * @param string $dependency |
| 189 | 189 | * @return int |
| 190 | 190 | */ |
| 191 | - public function loading_strategy_for_class_dependency( $class_name = '', $dependency = '' ) { |
|
| 192 | - return $this->has_dependency_for_class( $class_name, $dependency ) |
|
| 193 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
| 191 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') { |
|
| 192 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
| 193 | + ? $this->_dependency_map[$class_name][$dependency] |
|
| 194 | 194 | : EE_Dependency_Map::not_registered; |
| 195 | 195 | } |
| 196 | 196 | |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | * @param string $class_name |
| 201 | 201 | * @return string | Closure |
| 202 | 202 | */ |
| 203 | - public function class_loader( $class_name ) { |
|
| 204 | - return isset( $this->_class_loaders[ $class_name ] ) ? $this->_class_loaders[ $class_name ] : ''; |
|
| 203 | + public function class_loader($class_name) { |
|
| 204 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
@@ -326,13 +326,13 @@ discard block |
||
| 326 | 326 | $this->_class_loaders = array_merge( |
| 327 | 327 | $this->_class_loaders, |
| 328 | 328 | array( |
| 329 | - 'EE_Request' => function () use ( &$request ) { |
|
| 329 | + 'EE_Request' => function() use (&$request) { |
|
| 330 | 330 | return $request; |
| 331 | 331 | }, |
| 332 | - 'EE_Response' => function () use ( &$response ) { |
|
| 332 | + 'EE_Response' => function() use (&$response) { |
|
| 333 | 333 | return $response; |
| 334 | 334 | }, |
| 335 | - 'EE_Dependency_Map' => function () use ( &$dep_map ) { |
|
| 335 | + 'EE_Dependency_Map' => function() use (&$dep_map) { |
|
| 336 | 336 | return $dep_map; |
| 337 | 337 | }, |
| 338 | 338 | //load_core |
@@ -356,17 +356,17 @@ discard block |
||
| 356 | 356 | 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
| 357 | 357 | 'EE_Message_Template_Group_Collection' => 'load_lib', |
| 358 | 358 | 'EE_Messages_Generator' => function() { |
| 359 | - return EE_Registry::instance()->load_lib( 'Messages_Generator', array(), false, false ); |
|
| 359 | + return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false); |
|
| 360 | 360 | }, |
| 361 | - 'EE_Messages_Template_Defaults' => function( $arguments = array() ) { |
|
| 362 | - return EE_Registry::instance()->load_lib( 'Messages_Template_Defaults', $arguments, false, false ); |
|
| 361 | + 'EE_Messages_Template_Defaults' => function($arguments = array()) { |
|
| 362 | + return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false); |
|
| 363 | 363 | }, |
| 364 | 364 | //load_model |
| 365 | 365 | 'EEM_Message_Template_Group' => 'load_model', |
| 366 | 366 | 'EEM_Message_Template' => 'load_model', |
| 367 | 367 | //load_helper |
| 368 | 368 | 'EEH_Parse_Shortcodes' => function() { |
| 369 | - if ( EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ) ) { |
|
| 369 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
| 370 | 370 | return new EEH_Parse_Shortcodes(); |
| 371 | 371 | } |
| 372 | 372 | return null; |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
| 2 | 2 | /** |
| 3 | 3 | * Event Espresso |
| 4 | 4 | * |
@@ -75,37 +75,37 @@ discard block |
||
| 75 | 75 | $this->Request_Handler = $Request_Handler; |
| 76 | 76 | $this->Module_Request_Router = $Module_Request_Router; |
| 77 | 77 | // make sure template tags are loaded immediately so that themes don't break |
| 78 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
| 78 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
| 79 | 79 | // determine how to integrate WP_Query with the EE models |
| 80 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
| 80 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
| 81 | 81 | // load other resources and begin to actually run shortcodes and modules |
| 82 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
| 82 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
| 83 | 83 | // analyse the incoming WP request |
| 84 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
| 84 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
| 85 | 85 | // process any content shortcodes |
| 86 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
| 86 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
| 87 | 87 | // process request with module factory |
| 88 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
| 88 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
| 89 | 89 | // before headers sent |
| 90 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
| 90 | + add_action('wp', array($this, 'wp'), 5); |
|
| 91 | 91 | // load css and js |
| 92 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 ); |
|
| 92 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1); |
|
| 93 | 93 | // header |
| 94 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
| 95 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
| 94 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
| 95 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
| 96 | 96 | // display errors |
| 97 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
| 97 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
| 98 | 98 | // the content |
| 99 | 99 | // add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
| 100 | 100 | //exclude our private cpt comments |
| 101 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
| 101 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
| 102 | 102 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
| 103 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
| 103 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
| 104 | 104 | // action hook EE |
| 105 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
| 105 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
| 106 | 106 | // for checking that browser cookies are enabled |
| 107 | - if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) { |
|
| 108 | - setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' ); |
|
| 107 | + if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) { |
|
| 108 | + setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/'); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | * @return void |
| 142 | 142 | */ |
| 143 | 143 | public function load_espresso_template_tags() { |
| 144 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
| 145 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
| 144 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
| 145 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
| 158 | 158 | * @return array array of comment clauses with modifications. |
| 159 | 159 | */ |
| 160 | - public function filter_wp_comments( $clauses ) { |
|
| 160 | + public function filter_wp_comments($clauses) { |
|
| 161 | 161 | global $wpdb; |
| 162 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
| 162 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
| 163 | 163 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
| 164 | - foreach ( $cpts as $cpt => $details ) { |
|
| 165 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
| 164 | + foreach ($cpts as $cpt => $details) { |
|
| 165 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | return $clauses; |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | * @return void |
| 180 | 180 | */ |
| 181 | 181 | public function employ_CPT_Strategy() { |
| 182 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
| 183 | - $this->Registry->load_core( 'CPT_Strategy' ); |
|
| 182 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
| 183 | + $this->Registry->load_core('CPT_Strategy'); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | * @param string $url incoming url |
| 193 | 193 | * @return string final assembled url |
| 194 | 194 | */ |
| 195 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
| 196 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
| 197 | - $url = str_replace( 'http://', 'https://', $url ); |
|
| 195 | + public function maybe_force_admin_ajax_ssl($url) { |
|
| 196 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
| 197 | + $url = str_replace('http://', 'https://', $url); |
|
| 198 | 198 | } |
| 199 | 199 | return $url; |
| 200 | 200 | } |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | * @param WP $WP |
| 232 | 232 | * @return void |
| 233 | 233 | */ |
| 234 | - public function get_request( WP $WP ) { |
|
| 235 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
| 236 | - $this->Request_Handler->parse_request( $WP ); |
|
| 237 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
| 234 | + public function get_request(WP $WP) { |
|
| 235 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
| 236 | + $this->Request_Handler->parse_request($WP); |
|
| 237 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -248,24 +248,24 @@ discard block |
||
| 248 | 248 | * @param WP $WP |
| 249 | 249 | * @return void |
| 250 | 250 | */ |
| 251 | - public function _initialize_shortcodes( WP $WP ) { |
|
| 252 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
| 253 | - $this->Request_Handler->set_request_vars( $WP ); |
|
| 251 | + public function _initialize_shortcodes(WP $WP) { |
|
| 252 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
| 253 | + $this->Request_Handler->set_request_vars($WP); |
|
| 254 | 254 | // grab post_name from request |
| 255 | 255 | $current_post = apply_filters( |
| 256 | 256 | 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', |
| 257 | - $this->Request_Handler->get( 'post_name' ) |
|
| 257 | + $this->Request_Handler->get('post_name') |
|
| 258 | 258 | ); |
| 259 | - $show_on_front = get_option( 'show_on_front' ); |
|
| 259 | + $show_on_front = get_option('show_on_front'); |
|
| 260 | 260 | // if it's not set, then check if frontpage is blog |
| 261 | - if ( empty( $current_post ) ) { |
|
| 261 | + if (empty($current_post)) { |
|
| 262 | 262 | // yup.. this is the posts page, prepare to load all shortcode modules |
| 263 | 263 | $current_post = 'posts'; |
| 264 | 264 | // unless.. |
| 265 | - if ( $show_on_front === 'page' ) { |
|
| 265 | + if ($show_on_front === 'page') { |
|
| 266 | 266 | // some other page is set as the homepage |
| 267 | - $page_on_front = get_option( 'page_on_front' ); |
|
| 268 | - if ( $page_on_front ) { |
|
| 267 | + $page_on_front = get_option('page_on_front'); |
|
| 268 | + if ($page_on_front) { |
|
| 269 | 269 | // k now we need to find the post_name for this page |
| 270 | 270 | global $wpdb; |
| 271 | 271 | $page_on_front = $wpdb->get_var( |
@@ -282,16 +282,16 @@ discard block |
||
| 282 | 282 | // where are posts being displayed ? |
| 283 | 283 | $page_for_posts = EE_Config::get_page_for_posts(); |
| 284 | 284 | // in case $current_post is hierarchical like: /parent-page/current-page |
| 285 | - $current_post = basename( $current_post ); |
|
| 285 | + $current_post = basename($current_post); |
|
| 286 | 286 | // are we on a category page? |
| 287 | - $term_exists = is_array( term_exists( $current_post, 'category' ) ) || $this->_is_espresso_category( $WP ); |
|
| 287 | + $term_exists = is_array(term_exists($current_post, 'category')) || $this->_is_espresso_category($WP); |
|
| 288 | 288 | // make sure shortcodes are set |
| 289 | - if ( isset( $this->Registry->CFG->core->post_shortcodes )) { |
|
| 290 | - if ( ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
| 291 | - $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
| 289 | + if (isset($this->Registry->CFG->core->post_shortcodes)) { |
|
| 290 | + if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) { |
|
| 291 | + $this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
| 292 | 292 | } |
| 293 | 293 | // cycle thru all posts with shortcodes set |
| 294 | - foreach ( $this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
| 294 | + foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
| 295 | 295 | $this->_process_post_shortcodes( |
| 296 | 296 | $post_shortcodes, |
| 297 | 297 | $term_exists, |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | ); |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
| 305 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -313,11 +313,11 @@ discard block |
||
| 313 | 313 | * @param WP $WP |
| 314 | 314 | * @return bool |
| 315 | 315 | */ |
| 316 | - protected function _is_espresso_category( WP $WP ) { |
|
| 316 | + protected function _is_espresso_category(WP $WP) { |
|
| 317 | 317 | $taxonomies = EE_Register_CPTs::get_taxonomies(); |
| 318 | 318 | // $taxonomies = array_keys( $taxonomies ); |
| 319 | - foreach ( (array) $WP->query_vars as $query_var => $category ) { |
|
| 320 | - if ( isset( $taxonomies[ $query_var ] ) ) { |
|
| 319 | + foreach ((array) $WP->query_vars as $query_var => $category) { |
|
| 320 | + if (isset($taxonomies[$query_var])) { |
|
| 321 | 321 | return true; |
| 322 | 322 | } |
| 323 | 323 | } |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $page_for_posts, |
| 347 | 347 | $post_name, |
| 348 | 348 | $WP |
| 349 | - ){ |
|
| 349 | + ) { |
|
| 350 | 350 | static $processed = array(); |
| 351 | 351 | // filter shortcodes so |
| 352 | 352 | $post_shortcodes = (array) apply_filters( |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | $post_shortcodes |
| 355 | 355 | ); |
| 356 | 356 | // now cycle thru shortcodes... |
| 357 | - foreach ( $post_shortcodes as $shortcode_name => $post_id ) { |
|
| 357 | + foreach ($post_shortcodes as $shortcode_name => $post_id) { |
|
| 358 | 358 | if ( |
| 359 | 359 | // but IF... we have processed this shortcode already in this request |
| 360 | - isset( $processed[ $shortcode_name ] ) |
|
| 360 | + isset($processed[$shortcode_name]) |
|
| 361 | 361 | || ( |
| 362 | 362 | // or we're on a tag or category page |
| 363 | 363 | $term_exists |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | continue; |
| 378 | 378 | } |
| 379 | 379 | // are we on this page ? or on the blog page ? or an EE CPT category page ? |
| 380 | - if ( $current_post === $post_name || $term_exists ) { |
|
| 380 | + if ($current_post === $post_name || $term_exists) { |
|
| 381 | 381 | // maybe init the shortcode |
| 382 | 382 | if ( |
| 383 | 383 | $this->initialize_shortcode_if_active_on_page( |
@@ -389,18 +389,18 @@ discard block |
||
| 389 | 389 | $WP |
| 390 | 390 | ) |
| 391 | 391 | ) { |
| 392 | - $processed[ $shortcode_name ] = true; |
|
| 392 | + $processed[$shortcode_name] = true; |
|
| 393 | 393 | } |
| 394 | 394 | // if this is NOT the "Posts page" and we have a valid entry |
| 395 | 395 | // for the "Posts page" in our tracked post_shortcodes array |
| 396 | 396 | // but the shortcode is not being tracked for this page |
| 397 | 397 | } else if ( |
| 398 | 398 | $post_name !== $page_for_posts |
| 399 | - && isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) |
|
| 400 | - && ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_name ] ) |
|
| 399 | + && isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts]) |
|
| 400 | + && ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_name]) |
|
| 401 | 401 | ) { |
| 402 | 402 | // then remove the "fallback" shortcode processor |
| 403 | - remove_shortcode( $shortcode_name ); |
|
| 403 | + remove_shortcode($shortcode_name); |
|
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | } |
@@ -429,8 +429,8 @@ discard block |
||
| 429 | 429 | $WP |
| 430 | 430 | ) { |
| 431 | 431 | // verify shortcode is in list of registered shortcodes |
| 432 | - if ( ! isset( $this->Registry->shortcodes->{$shortcode_name} ) ) { |
|
| 433 | - if ( $current_post !== $page_for_posts && current_user_can( 'edit_post', $post_id ) ) { |
|
| 432 | + if ( ! isset($this->Registry->shortcodes->{$shortcode_name} )) { |
|
| 433 | + if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
| 434 | 434 | EE_Error::add_error( |
| 435 | 435 | sprintf( |
| 436 | 436 | __( |
@@ -443,9 +443,9 @@ discard block |
||
| 443 | 443 | __FUNCTION__, |
| 444 | 444 | __LINE__ |
| 445 | 445 | ); |
| 446 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
| 446 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
| 447 | 447 | } |
| 448 | - add_shortcode( $shortcode_name, array( 'EES_Shortcode', 'invalid_shortcode_processor' ) ); |
|
| 448 | + add_shortcode($shortcode_name, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
| 449 | 449 | return false; |
| 450 | 450 | } |
| 451 | 451 | // is this shortcode set: |
@@ -455,13 +455,13 @@ discard block |
||
| 455 | 455 | // for the WP "Posts" page (blog) ? |
| 456 | 456 | || $current_post === $page_for_posts |
| 457 | 457 | // exclusively for this post ? |
| 458 | - || isset( $this->Registry->CFG->core->post_shortcodes[ $current_post ] ) |
|
| 458 | + || isset($this->Registry->CFG->core->post_shortcodes[$current_post]) |
|
| 459 | 459 | ) { |
| 460 | 460 | // let's pause to reflect on this... |
| 461 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_name ); |
|
| 461 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_name); |
|
| 462 | 462 | // ensure that class is actually a shortcode |
| 463 | - if ( ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) ) { |
|
| 464 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) { |
|
| 463 | + if ( ! $sc_reflector->isSubclassOf('EES_Shortcode')) { |
|
| 464 | + if (defined('WP_DEBUG') && WP_DEBUG === true) { |
|
| 465 | 465 | EE_Error::add_error( |
| 466 | 466 | sprintf( |
| 467 | 467 | __( |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | __FUNCTION__, |
| 475 | 475 | __LINE__ |
| 476 | 476 | ); |
| 477 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
| 477 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
| 478 | 478 | } |
| 479 | 479 | return false; |
| 480 | 480 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | ) |
| 490 | 490 | ) { |
| 491 | 491 | // fire the shortcode class's run method, so that it can activate resources |
| 492 | - $this->Registry->shortcodes->{$shortcode_name}->run( $WP ); |
|
| 492 | + $this->Registry->shortcodes->{$shortcode_name}->run($WP); |
|
| 493 | 493 | } |
| 494 | 494 | return true; |
| 495 | 495 | } |
@@ -505,19 +505,19 @@ discard block |
||
| 505 | 505 | * @param WP_Query $WP_Query |
| 506 | 506 | * @return void |
| 507 | 507 | */ |
| 508 | - public function pre_get_posts( $WP_Query ) { |
|
| 508 | + public function pre_get_posts($WP_Query) { |
|
| 509 | 509 | // only load Module_Request_Router if this is the main query |
| 510 | 510 | if ( |
| 511 | 511 | $this->Module_Request_Router instanceof EE_Module_Request_Router |
| 512 | 512 | && $WP_Query->is_main_query() |
| 513 | 513 | ) { |
| 514 | 514 | // cycle thru module routes |
| 515 | - while ( $route = $this->Module_Request_Router->get_route( $WP_Query )) { |
|
| 515 | + while ($route = $this->Module_Request_Router->get_route($WP_Query)) { |
|
| 516 | 516 | // determine module and method for route |
| 517 | - $module = $this->Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
| 518 | - if( $module instanceof EED_Module ) { |
|
| 517 | + $module = $this->Module_Request_Router->resolve_route($route[0], $route[1]); |
|
| 518 | + if ($module instanceof EED_Module) { |
|
| 519 | 519 | // get registered view for route |
| 520 | - $this->_template_path = $this->Module_Request_Router->get_view( $route ); |
|
| 520 | + $this->_template_path = $this->Module_Request_Router->get_view($route); |
|
| 521 | 521 | // grab module name |
| 522 | 522 | $module_name = $module->module_name(); |
| 523 | 523 | // map the module to the module objects |
@@ -559,29 +559,29 @@ discard block |
||
| 559 | 559 | public function wp_enqueue_scripts() { |
| 560 | 560 | |
| 561 | 561 | // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_css', '__return_false' ); |
| 562 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
| 562 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
| 563 | 563 | |
| 564 | 564 | $this->Registry->CFG->template_settings->enable_default_style = TRUE; |
| 565 | 565 | //Load the ThemeRoller styles if enabled |
| 566 | - if ( isset( $this->Registry->CFG->template_settings->enable_default_style ) && $this->Registry->CFG->template_settings->enable_default_style ) { |
|
| 566 | + if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) { |
|
| 567 | 567 | |
| 568 | 568 | //Load custom style sheet if available |
| 569 | - if ( isset( $this->Registry->CFG->template_settings->custom_style_sheet )) { |
|
| 570 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
| 569 | + if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) { |
|
| 570 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
| 571 | 571 | wp_enqueue_style('espresso_custom_css'); |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
| 575 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
| 574 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
| 575 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
| 576 | 576 | } else { |
| 577 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
| 577 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
| 578 | 578 | } |
| 579 | 579 | wp_enqueue_style('espresso_default'); |
| 580 | 580 | |
| 581 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
| 582 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
| 581 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
| 582 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
| 583 | 583 | } else { |
| 584 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
| 584 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | } |
@@ -589,38 +589,38 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_js', '__return_false' ); |
| 592 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
| 592 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
| 593 | 593 | |
| 594 | - wp_enqueue_script( 'jquery' ); |
|
| 594 | + wp_enqueue_script('jquery'); |
|
| 595 | 595 | //let's make sure that all required scripts have been setup |
| 596 | - if ( function_exists( 'wp_script_is' ) && ! wp_script_is( 'jquery' )) { |
|
| 596 | + if (function_exists('wp_script_is') && ! wp_script_is('jquery')) { |
|
| 597 | 597 | $msg = sprintf( |
| 598 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
| 598 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
| 599 | 599 | '<em><br />', |
| 600 | 600 | '</em>' |
| 601 | 601 | ); |
| 602 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 602 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 603 | 603 | } |
| 604 | 604 | // load core js |
| 605 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 606 | - wp_enqueue_script( 'espresso_core' ); |
|
| 607 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
| 605 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 606 | + wp_enqueue_script('espresso_core'); |
|
| 607 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
| 608 | 608 | |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
| 612 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
| 612 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
| 613 | 613 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | |
| 617 | 617 | //accounting.js library |
| 618 | 618 | // @link http://josscrowcroft.github.io/accounting.js/ |
| 619 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
| 620 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
| 621 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 622 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
| 623 | - wp_enqueue_script( 'ee-accounting' ); |
|
| 619 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
| 620 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
| 621 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 622 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
| 623 | + wp_enqueue_script('ee-accounting'); |
|
| 624 | 624 | |
| 625 | 625 | $currency_config = array( |
| 626 | 626 | 'currency' => array( |
@@ -643,21 +643,21 @@ discard block |
||
| 643 | 643 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | - if ( ! function_exists( 'wp_head' )) { |
|
| 646 | + if ( ! function_exists('wp_head')) { |
|
| 647 | 647 | $msg = sprintf( |
| 648 | - __( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
| 648 | + __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
| 649 | 649 | '<em><br />', |
| 650 | 650 | '</em>' |
| 651 | 651 | ); |
| 652 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 652 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 653 | 653 | } |
| 654 | - if ( ! function_exists( 'wp_footer' )) { |
|
| 654 | + if ( ! function_exists('wp_footer')) { |
|
| 655 | 655 | $msg = sprintf( |
| 656 | - __( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
| 656 | + __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
| 657 | 657 | '<em><br />', |
| 658 | 658 | '</em>' |
| 659 | 659 | ); |
| 660 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 660 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | * @return void |
| 672 | 672 | */ |
| 673 | 673 | public function header_meta_tag() { |
| 674 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
| 674 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | |
@@ -712,10 +712,10 @@ discard block |
||
| 712 | 712 | */ |
| 713 | 713 | public function display_errors() { |
| 714 | 714 | static $shown_already = FALSE; |
| 715 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
| 715 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
| 716 | 716 | if ( |
| 717 | 717 | ! $shown_already |
| 718 | - && apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) |
|
| 718 | + && apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) |
|
| 719 | 719 | && is_main_query() |
| 720 | 720 | && ! is_feed() |
| 721 | 721 | && in_the_loop() |
@@ -723,9 +723,9 @@ discard block |
||
| 723 | 723 | ) { |
| 724 | 724 | echo EE_Error::get_notices(); |
| 725 | 725 | $shown_already = TRUE; |
| 726 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
| 726 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
| 727 | 727 | } |
| 728 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
| 728 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | |
@@ -740,12 +740,12 @@ discard block |
||
| 740 | 740 | * @param string $template_include_path |
| 741 | 741 | * @return string |
| 742 | 742 | */ |
| 743 | - public function template_include( $template_include_path = NULL ) { |
|
| 744 | - if ( $this->Request_Handler->is_espresso_page() ) { |
|
| 745 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
| 746 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
| 747 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
| 748 | - $this->_template = basename( $this->_template_path ); |
|
| 743 | + public function template_include($template_include_path = NULL) { |
|
| 744 | + if ($this->Request_Handler->is_espresso_page()) { |
|
| 745 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
| 746 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
| 747 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
| 748 | + $this->_template = basename($this->_template_path); |
|
| 749 | 749 | return $this->_template_path; |
| 750 | 750 | } |
| 751 | 751 | return $template_include_path; |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | * @param bool $with_path |
| 761 | 761 | * @return string |
| 762 | 762 | */ |
| 763 | - public function get_selected_template( $with_path = FALSE ) { |
|
| 763 | + public function get_selected_template($with_path = FALSE) { |
|
| 764 | 764 | return $with_path ? $this->_template_path : $this->_template; |
| 765 | 765 | } |
| 766 | 766 | |