@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | * @param \EE_Registry $registry |
133 | 133 | * @return \EE_Config instance |
134 | 134 | */ |
135 | - public static function instance( \EE_Registry $registry = null ) { |
|
135 | + public static function instance(\EE_Registry $registry = null) { |
|
136 | 136 | // check if class object is instantiated, and instantiated properly |
137 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
138 | - self::$_instance = new self( $registry ); |
|
137 | + if ( ! self::$_instance instanceof EE_Config) { |
|
138 | + self::$_instance = new self($registry); |
|
139 | 139 | } |
140 | 140 | return self::$_instance; |
141 | 141 | } |
@@ -153,22 +153,22 @@ discard block |
||
153 | 153 | * @param \EE_Registry $registry |
154 | 154 | * @return \EE_Config |
155 | 155 | */ |
156 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE, \EE_Registry $registry = null ){ |
|
157 | - if ( $hard_reset ) { |
|
156 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE, \EE_Registry $registry = null) { |
|
157 | + if ($hard_reset) { |
|
158 | 158 | self::$_instance->_config_option_names = array(); |
159 | 159 | self::$_instance->_initialize_config(); |
160 | 160 | self::$_instance->update_espresso_config(); |
161 | 161 | } |
162 | - if( self::$_instance instanceof EE_Config ){ |
|
162 | + if (self::$_instance instanceof EE_Config) { |
|
163 | 163 | self::$_instance->shutdown(); |
164 | 164 | } |
165 | 165 | self::$_instance = null; |
166 | 166 | //we don't need to reset the static properties imo because those should |
167 | 167 | //only change when a module is added or removed. Currently we don't |
168 | 168 | //support removing a module during a request when it previously existed |
169 | - if( $reinstantiate ){ |
|
170 | - return self::instance( $registry ); |
|
171 | - }else{ |
|
169 | + if ($reinstantiate) { |
|
170 | + return self::instance($registry); |
|
171 | + } else { |
|
172 | 172 | return NULL; |
173 | 173 | } |
174 | 174 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param \EE_Registry $registry |
183 | 183 | * @throws \EE_Error |
184 | 184 | */ |
185 | - private function __construct( \EE_Registry $registry ) { |
|
185 | + private function __construct(\EE_Registry $registry) { |
|
186 | 186 | // if ( ! did_action( 'AHEE__EE_System__load_core_configuration__begin' ) ) { |
187 | 187 | // throw new EE_Error( |
188 | 188 | // __( |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | // ) |
192 | 192 | // ); |
193 | 193 | // } |
194 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
195 | 195 | $this->registry = $registry; |
196 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
196 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
197 | 197 | // setup empty config classes |
198 | 198 | $this->_initialize_config(); |
199 | 199 | // load existing EE site settings |
@@ -201,15 +201,15 @@ discard block |
||
201 | 201 | // confirm everything loaded correctly and set filtered defaults if not |
202 | 202 | $this->_verify_config(); |
203 | 203 | // register shortcodes and modules |
204 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
204 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
205 | 205 | // initialize shortcodes and modules |
206 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
206 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
207 | 207 | // register widgets |
208 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
208 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
209 | 209 | // shutdown |
210 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
210 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
211 | 211 | // construct__end hook |
212 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
212 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
213 | 213 | // hardcoded hack |
214 | 214 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
215 | 215 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @return string current theme set. |
223 | 223 | */ |
224 | 224 | public static function get_current_theme() { |
225 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
225 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -256,30 +256,30 @@ discard block |
||
256 | 256 | */ |
257 | 257 | private function _load_core_config() { |
258 | 258 | // load_core_config__start hook |
259 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
259 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
260 | 260 | $espresso_config = $this->get_espresso_config(); |
261 | - foreach ( $espresso_config as $config => $settings ) { |
|
262 | - if ( $config === 'registry' ) { |
|
261 | + foreach ($espresso_config as $config => $settings) { |
|
262 | + if ($config === 'registry') { |
|
263 | 263 | continue; |
264 | 264 | } |
265 | 265 | // load_core_config__start hook |
266 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
267 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
268 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
266 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
267 | + if (is_object($settings) && property_exists($this, $config)) { |
|
268 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
269 | 269 | //call configs populate method to ensure any defaults are set for empty values. |
270 | - if ( method_exists( $settings, 'populate' ) ) { |
|
270 | + if (method_exists($settings, 'populate')) { |
|
271 | 271 | $this->{$config}->populate(); |
272 | 272 | } |
273 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
273 | + if (method_exists($settings, 'do_hooks')) { |
|
274 | 274 | $this->{$config}->do_hooks(); |
275 | 275 | } |
276 | 276 | } |
277 | 277 | } |
278 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
278 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
279 | 279 | $this->update_espresso_config(); |
280 | 280 | } |
281 | 281 | // load_core_config__end hook |
282 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
282 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -293,40 +293,40 @@ discard block |
||
293 | 293 | protected function _verify_config() { |
294 | 294 | |
295 | 295 | $this->core = $this->core instanceof EE_Core_Config |
296 | - ? $this->core : new EE_Core_Config(); |
|
297 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
296 | + ? $this->core : new EE_Core_Config(); |
|
297 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
298 | 298 | |
299 | 299 | $this->organization = $this->organization instanceof EE_Organization_Config |
300 | - ? $this->organization : new EE_Organization_Config(); |
|
301 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
300 | + ? $this->organization : new EE_Organization_Config(); |
|
301 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
302 | 302 | |
303 | 303 | $this->currency = $this->currency instanceof EE_Currency_Config |
304 | 304 | ? $this->currency : new EE_Currency_Config(); |
305 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
305 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
306 | 306 | |
307 | 307 | $this->registration = $this->registration instanceof EE_Registration_Config |
308 | 308 | ? $this->registration : new EE_Registration_Config(); |
309 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
309 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
310 | 310 | |
311 | 311 | $this->admin = $this->admin instanceof EE_Admin_Config |
312 | 312 | ? $this->admin : new EE_Admin_Config(); |
313 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
313 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
314 | 314 | |
315 | 315 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
316 | 316 | ? $this->template_settings : new EE_Template_Config(); |
317 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
317 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
318 | 318 | |
319 | 319 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
320 | 320 | ? $this->map_settings : new EE_Map_Config(); |
321 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
321 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
322 | 322 | |
323 | 323 | $this->environment = $this->environment instanceof EE_Environment_Config |
324 | 324 | ? $this->environment : new EE_Environment_Config(); |
325 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
325 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
326 | 326 | |
327 | 327 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
328 | 328 | ? $this->gateway : new EE_Gateway_Config(); |
329 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
329 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
330 | 330 | |
331 | 331 | } |
332 | 332 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function get_espresso_config() { |
342 | 342 | // grab espresso configuration |
343 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
343 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | * @param $old_value |
354 | 354 | * @param $value |
355 | 355 | */ |
356 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
356 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
357 | 357 | // make sure we're checking the ee config |
358 | - if ( $option == 'ee_config' ) { |
|
358 | + if ($option == 'ee_config') { |
|
359 | 359 | // run a loose comparison of the old value against the new value for type and properties, |
360 | 360 | // but NOT exact instance like WP update_option does |
361 | - if ( $value != $old_value ) { |
|
361 | + if ($value != $old_value) { |
|
362 | 362 | // if they are NOT the same, then remove the hook, |
363 | 363 | // which means the subsequent update results will be based solely on the update query results |
364 | 364 | // the reason we do this is because, as stated above, |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | // the string it sees in the db looks the same as the new one it has been passed!!! |
374 | 374 | // This results in the query returning an "affected rows" value of ZERO, |
375 | 375 | // which gets returned immediately by WP update_option and looks like an error. |
376 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
376 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | } |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | */ |
389 | 389 | protected function _reset_espresso_addon_config() { |
390 | 390 | $this->_config_option_names = array(); |
391 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
392 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
393 | - $config_class = get_class( $addon_config_obj ); |
|
394 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
395 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
391 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
392 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
393 | + $config_class = get_class($addon_config_obj); |
|
394 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
395 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
396 | 396 | } |
397 | 397 | $this->addons->{$addon_name} = NULL; |
398 | 398 | } |
@@ -408,21 +408,21 @@ discard block |
||
408 | 408 | * @param bool $add_error |
409 | 409 | * @return bool |
410 | 410 | */ |
411 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
411 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
412 | 412 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
413 | 413 | //$clone = clone( self::$_instance ); |
414 | 414 | //self::$_instance = NULL; |
415 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
415 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
416 | 416 | $this->_reset_espresso_addon_config(); |
417 | 417 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
418 | 418 | // but BEFORE the actual update occurs |
419 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
419 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
420 | 420 | // we don't want to save the registry property with the rest of the config, |
421 | 421 | // so save it to a local variable, then remove it |
422 | 422 | $registry = $this->registry; |
423 | 423 | $this->registry = null; |
424 | 424 | // now update "ee_config" |
425 | - $saved = update_option( 'ee_config', $this ); |
|
425 | + $saved = update_option('ee_config', $this); |
|
426 | 426 | // and restore the registry |
427 | 427 | $this->registry = $registry; |
428 | 428 | // Now if the update didn't save... check if the hook we just added still exists; |
@@ -435,25 +435,25 @@ discard block |
||
435 | 435 | // but just means no update occurred, so don't display an error to the user. |
436 | 436 | // BUT... if update_option returns FALSE, AND the hook is missing, |
437 | 437 | // then it means that something truly went wrong |
438 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
438 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
439 | 439 | // remove our action since we don't want it in the system anymore |
440 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
441 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
440 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
441 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
442 | 442 | //self::$_instance = $clone; |
443 | 443 | //unset( $clone ); |
444 | 444 | // if config remains the same or was updated successfully |
445 | - if ( $saved ) { |
|
446 | - if ( $add_success ) { |
|
445 | + if ($saved) { |
|
446 | + if ($add_success) { |
|
447 | 447 | EE_Error::add_success( |
448 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
448 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
449 | 449 | __FILE__, __FUNCTION__, __LINE__ |
450 | 450 | ); |
451 | 451 | } |
452 | 452 | return TRUE; |
453 | 453 | } else { |
454 | - if ( $add_error ) { |
|
454 | + if ($add_error) { |
|
455 | 455 | EE_Error::add_error( |
456 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
456 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
457 | 457 | __FILE__, __FUNCTION__, __LINE__ |
458 | 458 | ); |
459 | 459 | } |
@@ -479,20 +479,20 @@ discard block |
||
479 | 479 | $name = '', |
480 | 480 | $config_class = '', |
481 | 481 | $config_obj = NULL, |
482 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
482 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
483 | 483 | $display_errors = TRUE |
484 | 484 | ) { |
485 | 485 | try { |
486 | - foreach ( $tests_to_run as $test ) { |
|
487 | - switch ( $test ) { |
|
486 | + foreach ($tests_to_run as $test) { |
|
487 | + switch ($test) { |
|
488 | 488 | |
489 | 489 | // TEST #1 : check that section was set |
490 | 490 | case 1 : |
491 | - if ( empty( $section ) ) { |
|
492 | - if ( $display_errors ) { |
|
491 | + if (empty($section)) { |
|
492 | + if ($display_errors) { |
|
493 | 493 | throw new EE_Error( |
494 | 494 | sprintf( |
495 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
495 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
496 | 496 | $config_class |
497 | 497 | ) |
498 | 498 | ); |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | |
504 | 504 | // TEST #2 : check that settings section exists |
505 | 505 | case 2 : |
506 | - if ( ! isset( $this->{$section} ) ) { |
|
507 | - if ( $display_errors ) { |
|
506 | + if ( ! isset($this->{$section} )) { |
|
507 | + if ($display_errors) { |
|
508 | 508 | throw new EE_Error( |
509 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
510 | - $section ) |
|
509 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
510 | + $section) |
|
511 | 511 | ); |
512 | 512 | } |
513 | 513 | return false; |
@@ -517,12 +517,12 @@ discard block |
||
517 | 517 | // TEST #3 : check that section is the proper format |
518 | 518 | case 3 : |
519 | 519 | if ( |
520 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
520 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
521 | 521 | ) { |
522 | - if ( $display_errors ) { |
|
522 | + if ($display_errors) { |
|
523 | 523 | throw new EE_Error( |
524 | 524 | sprintf( |
525 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
525 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
526 | 526 | $section |
527 | 527 | ) |
528 | 528 | ); |
@@ -533,10 +533,10 @@ discard block |
||
533 | 533 | |
534 | 534 | // TEST #4 : check that config section name has been set |
535 | 535 | case 4 : |
536 | - if ( empty( $name ) ) { |
|
537 | - if ( $display_errors ) { |
|
536 | + if (empty($name)) { |
|
537 | + if ($display_errors) { |
|
538 | 538 | throw new EE_Error( |
539 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
539 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
540 | 540 | ); |
541 | 541 | } |
542 | 542 | return false; |
@@ -545,10 +545,10 @@ discard block |
||
545 | 545 | |
546 | 546 | // TEST #5 : check that a config class name has been set |
547 | 547 | case 5 : |
548 | - if ( empty( $config_class ) ) { |
|
549 | - if ( $display_errors ) { |
|
548 | + if (empty($config_class)) { |
|
549 | + if ($display_errors) { |
|
550 | 550 | throw new EE_Error( |
551 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
551 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
552 | 552 | ); |
553 | 553 | } |
554 | 554 | return false; |
@@ -557,11 +557,11 @@ discard block |
||
557 | 557 | |
558 | 558 | // TEST #6 : verify config class is accessible |
559 | 559 | case 6 : |
560 | - if ( ! class_exists( $config_class ) ) { |
|
561 | - if ( $display_errors ) { |
|
560 | + if ( ! class_exists($config_class)) { |
|
561 | + if ($display_errors) { |
|
562 | 562 | throw new EE_Error( |
563 | 563 | sprintf( |
564 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
564 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
565 | 565 | $config_class |
566 | 566 | ) |
567 | 567 | ); |
@@ -572,11 +572,11 @@ discard block |
||
572 | 572 | |
573 | 573 | // TEST #7 : check that config has even been set |
574 | 574 | case 7 : |
575 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
576 | - if ( $display_errors ) { |
|
575 | + if ( ! isset($this->{$section}->{$name} )) { |
|
576 | + if ($display_errors) { |
|
577 | 577 | throw new EE_Error( |
578 | 578 | sprintf( |
579 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
579 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
580 | 580 | $section, |
581 | 581 | $name |
582 | 582 | ) |
@@ -585,17 +585,17 @@ discard block |
||
585 | 585 | return false; |
586 | 586 | } else { |
587 | 587 | // and make sure it's not serialized |
588 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
588 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
589 | 589 | } |
590 | 590 | break; |
591 | 591 | |
592 | 592 | // TEST #8 : check that config is the requested type |
593 | 593 | case 8 : |
594 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
595 | - if ( $display_errors ) { |
|
594 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
595 | + if ($display_errors) { |
|
596 | 596 | throw new EE_Error( |
597 | 597 | sprintf( |
598 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
598 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
599 | 599 | $section, |
600 | 600 | $name, |
601 | 601 | $config_class |
@@ -608,12 +608,12 @@ discard block |
||
608 | 608 | |
609 | 609 | // TEST #9 : verify config object |
610 | 610 | case 9 : |
611 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
612 | - if ( $display_errors ) { |
|
611 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
612 | + if ($display_errors) { |
|
613 | 613 | throw new EE_Error( |
614 | 614 | sprintf( |
615 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
616 | - print_r( $config_obj, true ) |
|
615 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
616 | + print_r($config_obj, true) |
|
617 | 617 | ) |
618 | 618 | ); |
619 | 619 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
627 | - } catch( EE_Error $e ) { |
|
627 | + } catch (EE_Error $e) { |
|
628 | 628 | $e->get_error(); |
629 | 629 | } |
630 | 630 | // you have successfully run the gauntlet |
@@ -641,8 +641,8 @@ discard block |
||
641 | 641 | * @param string $name |
642 | 642 | * @return string |
643 | 643 | */ |
644 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
645 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
644 | + private function _generate_config_option_name($section = '', $name = '') { |
|
645 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @param string $name |
657 | 657 | * @return string |
658 | 658 | */ |
659 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
660 | - return ! empty( $config_class ) |
|
659 | + private function _set_config_class($config_class = '', $name = '') { |
|
660 | + return ! empty($config_class) |
|
661 | 661 | ? $config_class |
662 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
662 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | |
@@ -673,34 +673,34 @@ discard block |
||
673 | 673 | * @param EE_Config_Base $config_obj |
674 | 674 | * @return EE_Config_Base |
675 | 675 | */ |
676 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
676 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
677 | 677 | // ensure config class is set to something |
678 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
678 | + $config_class = $this->_set_config_class($config_class, $name); |
|
679 | 679 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
680 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
680 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
681 | 681 | return null; |
682 | 682 | } |
683 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
683 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
684 | 684 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
685 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
686 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
685 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
686 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
687 | 687 | } |
688 | 688 | // verify the incoming config object but suppress errors |
689 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
689 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
690 | 690 | $config_obj = new $config_class(); |
691 | 691 | } |
692 | - if ( get_option( $config_option_name ) ) { |
|
693 | - update_option( $config_option_name, $config_obj ); |
|
692 | + if (get_option($config_option_name)) { |
|
693 | + update_option($config_option_name, $config_obj); |
|
694 | 694 | $this->{$section}->{$name} = $config_obj; |
695 | 695 | return $this->{$section}->{$name}; |
696 | 696 | } else { |
697 | 697 | // create a wp-option for this config |
698 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
699 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
698 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
699 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
700 | 700 | return $this->{$section}->{$name}; |
701 | 701 | } else { |
702 | 702 | EE_Error::add_error( |
703 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
703 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
704 | 704 | __FILE__, __FUNCTION__, __LINE__ |
705 | 705 | ); |
706 | 706 | return null; |
@@ -721,37 +721,37 @@ discard block |
||
721 | 721 | * @param bool $throw_errors |
722 | 722 | * @return bool |
723 | 723 | */ |
724 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
725 | - $config_obj = maybe_unserialize( $config_obj ); |
|
724 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
725 | + $config_obj = maybe_unserialize($config_obj); |
|
726 | 726 | // get class name of the incoming object |
727 | - $config_class = get_class( $config_obj ); |
|
727 | + $config_class = get_class($config_obj); |
|
728 | 728 | // run tests 1-5 and 9 to verify config |
729 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
729 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
730 | 730 | return false; |
731 | 731 | } |
732 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
732 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
733 | 733 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
734 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
734 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
735 | 735 | // save new config to db |
736 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
736 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
737 | 737 | } else { |
738 | 738 | // first check if the record already exists |
739 | - $existing_config = get_option( $config_option_name ); |
|
740 | - $config_obj = serialize( $config_obj ); |
|
739 | + $existing_config = get_option($config_option_name); |
|
740 | + $config_obj = serialize($config_obj); |
|
741 | 741 | // just return if db record is already up to date |
742 | - if ( $existing_config == $config_obj ) { |
|
742 | + if ($existing_config == $config_obj) { |
|
743 | 743 | $this->{$section}->{$name} = $config_obj; |
744 | 744 | return true; |
745 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
745 | + } else if (update_option($config_option_name, $config_obj)) { |
|
746 | 746 | // update wp-option for this config class |
747 | 747 | $this->{$section}->{$name} = $config_obj; |
748 | 748 | return true; |
749 | - } elseif ( $throw_errors ) { |
|
749 | + } elseif ($throw_errors) { |
|
750 | 750 | EE_Error::add_error( |
751 | 751 | sprintf( |
752 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
752 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
753 | 753 | $config_class, |
754 | - 'EE_Config->' . $section . '->' . $name |
|
754 | + 'EE_Config->'.$section.'->'.$name |
|
755 | 755 | ), |
756 | 756 | __FILE__, __FUNCTION__, __LINE__ |
757 | 757 | ); |
@@ -771,34 +771,34 @@ discard block |
||
771 | 771 | * @param string $config_class |
772 | 772 | * @return mixed EE_Config_Base | NULL |
773 | 773 | */ |
774 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
774 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
775 | 775 | // ensure config class is set to something |
776 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
776 | + $config_class = $this->_set_config_class($config_class, $name); |
|
777 | 777 | // run tests 1-4, 6 and 7 to verify that all params have been set |
778 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
778 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
779 | 779 | return NULL; |
780 | 780 | } |
781 | 781 | // now test if the requested config object exists, but suppress errors |
782 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
782 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
783 | 783 | // config already exists, so pass it back |
784 | 784 | return $this->{$section}->{$name}; |
785 | 785 | } |
786 | 786 | // load config option from db if it exists |
787 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
787 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
788 | 788 | // verify the newly retrieved config object, but suppress errors |
789 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
789 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
790 | 790 | // config is good, so set it and pass it back |
791 | 791 | $this->{$section}->{$name} = $config_obj; |
792 | 792 | return $this->{$section}->{$name}; |
793 | 793 | } |
794 | 794 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
795 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
795 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
796 | 796 | // verify the newly created config object |
797 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
797 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
798 | 798 | return $this->{$section}->{$name}; |
799 | 799 | } else { |
800 | 800 | EE_Error::add_error( |
801 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
801 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
802 | 802 | __FILE__, __FUNCTION__, __LINE__ |
803 | 803 | ); |
804 | 804 | } |
@@ -813,9 +813,9 @@ discard block |
||
813 | 813 | * @param string $config_option_name |
814 | 814 | * @return mixed EE_Config_Base | FALSE |
815 | 815 | */ |
816 | - public function get_config_option( $config_option_name = '' ) { |
|
816 | + public function get_config_option($config_option_name = '') { |
|
817 | 817 | // retrieve the wp-option for this config class. |
818 | - return maybe_unserialize( get_option( $config_option_name )); |
|
818 | + return maybe_unserialize(get_option($config_option_name)); |
|
819 | 819 | } |
820 | 820 | |
821 | 821 | |
@@ -830,14 +830,14 @@ discard block |
||
830 | 830 | * @return string |
831 | 831 | */ |
832 | 832 | public static function get_page_for_posts() { |
833 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
834 | - if ( ! $page_for_posts ) { |
|
833 | + $page_for_posts = get_option('page_for_posts'); |
|
834 | + if ( ! $page_for_posts) { |
|
835 | 835 | return 'posts'; |
836 | 836 | } |
837 | 837 | /** @type WPDB $wpdb */ |
838 | 838 | global $wpdb; |
839 | 839 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
840 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
840 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | */ |
855 | 855 | public function register_shortcodes_and_modules() { |
856 | 856 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
857 | - $this->registry->shortcodes =$this->_register_shortcodes(); |
|
857 | + $this->registry->shortcodes = $this->_register_shortcodes(); |
|
858 | 858 | // allow modules to set hooks for the rest of the system |
859 | 859 | $this->registry->modules = $this->_register_modules(); |
860 | 860 | } |
@@ -886,21 +886,21 @@ discard block |
||
886 | 886 | public function widgets_init() { |
887 | 887 | //only init widgets on admin pages when not in complete maintenance, and |
888 | 888 | //on frontend when not in any maintenance mode |
889 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
889 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
890 | 890 | // grab list of installed widgets |
891 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
891 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
892 | 892 | // filter list of modules to register |
893 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
893 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
894 | 894 | |
895 | - if ( ! empty( $widgets_to_register ) ) { |
|
895 | + if ( ! empty($widgets_to_register)) { |
|
896 | 896 | // cycle thru widget folders |
897 | - foreach ( $widgets_to_register as $widget_path ) { |
|
897 | + foreach ($widgets_to_register as $widget_path) { |
|
898 | 898 | // add to list of installed widget modules |
899 | - EE_Config::register_ee_widget( $widget_path ); |
|
899 | + EE_Config::register_ee_widget($widget_path); |
|
900 | 900 | } |
901 | 901 | } |
902 | 902 | // filter list of installed modules |
903 | - $this->registry->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', $this->registry->widgets ); |
|
903 | + $this->registry->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', $this->registry->widgets); |
|
904 | 904 | } |
905 | 905 | } |
906 | 906 | |
@@ -913,54 +913,54 @@ discard block |
||
913 | 913 | * @param string $widget_path - full path up to and including widget folder |
914 | 914 | * @return void |
915 | 915 | */ |
916 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
917 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
916 | + public static function register_ee_widget($widget_path = NULL) { |
|
917 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
918 | 918 | $widget_ext = '.widget.php'; |
919 | 919 | // make all separators match |
920 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
920 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
921 | 921 | // does the file path INCLUDE the actual file name as part of the path ? |
922 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
922 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
923 | 923 | // grab and shortcode file name from directory name and break apart at dots |
924 | - $file_name = explode( '.', basename( $widget_path )); |
|
924 | + $file_name = explode('.', basename($widget_path)); |
|
925 | 925 | // take first segment from file name pieces and remove class prefix if it exists |
926 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
926 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
927 | 927 | // sanitize shortcode directory name |
928 | - $widget = sanitize_key( $widget ); |
|
928 | + $widget = sanitize_key($widget); |
|
929 | 929 | // now we need to rebuild the shortcode path |
930 | - $widget_path = explode( DS, $widget_path ); |
|
930 | + $widget_path = explode(DS, $widget_path); |
|
931 | 931 | // remove last segment |
932 | - array_pop( $widget_path ); |
|
932 | + array_pop($widget_path); |
|
933 | 933 | // glue it back together |
934 | - $widget_path = implode( DS, $widget_path ); |
|
934 | + $widget_path = implode(DS, $widget_path); |
|
935 | 935 | } else { |
936 | 936 | // grab and sanitize widget directory name |
937 | - $widget = sanitize_key( basename( $widget_path )); |
|
937 | + $widget = sanitize_key(basename($widget_path)); |
|
938 | 938 | } |
939 | 939 | // create classname from widget directory name |
940 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
940 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
941 | 941 | // add class prefix |
942 | - $widget_class = 'EEW_' . $widget; |
|
942 | + $widget_class = 'EEW_'.$widget; |
|
943 | 943 | // does the widget exist ? |
944 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
944 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
945 | 945 | $msg = sprintf( |
946 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
946 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
947 | 947 | $widget_class, |
948 | - $widget_path . DS . $widget_class . $widget_ext |
|
948 | + $widget_path.DS.$widget_class.$widget_ext |
|
949 | 949 | ); |
950 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
950 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
951 | 951 | return; |
952 | 952 | } |
953 | 953 | // load the widget class file |
954 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
954 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
955 | 955 | // verify that class exists |
956 | - if ( ! class_exists( $widget_class )) { |
|
957 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
958 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
956 | + if ( ! class_exists($widget_class)) { |
|
957 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
958 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
959 | 959 | return; |
960 | 960 | } |
961 | - register_widget( $widget_class ); |
|
961 | + register_widget($widget_class); |
|
962 | 962 | // add to array of registered widgets |
963 | - EE_Config::instance()->registry->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
963 | + EE_Config::instance()->registry->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | |
@@ -973,18 +973,18 @@ discard block |
||
973 | 973 | */ |
974 | 974 | private function _register_shortcodes() { |
975 | 975 | // grab list of installed shortcodes |
976 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
976 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
977 | 977 | // filter list of modules to register |
978 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
979 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
978 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
979 | + if ( ! empty($shortcodes_to_register)) { |
|
980 | 980 | // cycle thru shortcode folders |
981 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
981 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
982 | 982 | // add to list of installed shortcode modules |
983 | - $this->_register_shortcode( $shortcode_path ); |
|
983 | + $this->_register_shortcode($shortcode_path); |
|
984 | 984 | } |
985 | 985 | } |
986 | 986 | // filter list of installed modules |
987 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', $this->registry->shortcodes ); |
|
987 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', $this->registry->shortcodes); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | |
@@ -996,8 +996,8 @@ discard block |
||
996 | 996 | * @param string $shortcode_path - full path up to and including shortcode folder |
997 | 997 | * @return bool |
998 | 998 | */ |
999 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
1000 | - EE_Config::instance()->_register_shortcode( $shortcode_path ); |
|
999 | + public static function register_shortcode($shortcode_path = NULL) { |
|
1000 | + EE_Config::instance()->_register_shortcode($shortcode_path); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1009,56 +1009,56 @@ discard block |
||
1009 | 1009 | * @param string $shortcode_path - full path up to and including shortcode folder |
1010 | 1010 | * @return bool |
1011 | 1011 | */ |
1012 | - public function _register_shortcode( $shortcode_path = NULL ) { |
|
1013 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
1012 | + public function _register_shortcode($shortcode_path = NULL) { |
|
1013 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1014 | 1014 | $shortcode_ext = '.shortcode.php'; |
1015 | 1015 | // make all separators match |
1016 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1016 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1017 | 1017 | // does the file path INCLUDE the actual file name as part of the path ? |
1018 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
1018 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
1019 | 1019 | // grab shortcode file name from directory name and break apart at dots |
1020 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
1020 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1021 | 1021 | // take first segment from file name pieces and remove class prefix if it exists |
1022 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
1022 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
1023 | 1023 | // sanitize shortcode directory name |
1024 | - $shortcode = sanitize_key( $shortcode ); |
|
1024 | + $shortcode = sanitize_key($shortcode); |
|
1025 | 1025 | // now we need to rebuild the shortcode path |
1026 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1026 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1027 | 1027 | // remove last segment |
1028 | - array_pop( $shortcode_path ); |
|
1028 | + array_pop($shortcode_path); |
|
1029 | 1029 | // glue it back together |
1030 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1030 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1031 | 1031 | } else { |
1032 | 1032 | // we need to generate the filename based off of the folder name |
1033 | 1033 | // grab and sanitize shortcode directory name |
1034 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
1035 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1034 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1035 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1036 | 1036 | } |
1037 | 1037 | // create classname from shortcode directory or file name |
1038 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
1038 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1039 | 1039 | // add class prefix |
1040 | - $shortcode_class = 'EES_' . $shortcode; |
|
1040 | + $shortcode_class = 'EES_'.$shortcode; |
|
1041 | 1041 | // does the shortcode exist ? |
1042 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
1042 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1043 | 1043 | $msg = sprintf( |
1044 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
1044 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
1045 | 1045 | $shortcode_class, |
1046 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1046 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1047 | 1047 | ); |
1048 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1048 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1049 | 1049 | return FALSE; |
1050 | 1050 | } |
1051 | 1051 | // load the shortcode class file |
1052 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1052 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1053 | 1053 | // verify that class exists |
1054 | - if ( ! class_exists( $shortcode_class )) { |
|
1055 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
1056 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1054 | + if ( ! class_exists($shortcode_class)) { |
|
1055 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
1056 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1057 | 1057 | return FALSE; |
1058 | 1058 | } |
1059 | - $shortcode = strtoupper( $shortcode ); |
|
1059 | + $shortcode = strtoupper($shortcode); |
|
1060 | 1060 | // add to array of registered shortcodes |
1061 | - $this->registry->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1061 | + $this->registry->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1062 | 1062 | return TRUE; |
1063 | 1063 | } |
1064 | 1064 | |
@@ -1073,23 +1073,23 @@ discard block |
||
1073 | 1073 | */ |
1074 | 1074 | private function _register_modules() { |
1075 | 1075 | // grab list of installed modules |
1076 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1076 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1077 | 1077 | // filter list of modules to register |
1078 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
1078 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
1079 | 1079 | |
1080 | 1080 | |
1081 | - if ( ! empty( $modules_to_register ) ) { |
|
1081 | + if ( ! empty($modules_to_register)) { |
|
1082 | 1082 | // loop through folders |
1083 | - foreach ( $modules_to_register as $module_path ) { |
|
1083 | + foreach ($modules_to_register as $module_path) { |
|
1084 | 1084 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1085 | - if ( $module_path !== EE_MODULES . 'zzz-copy-this-module-template' && $module_path !== EE_MODULES . 'gateways' ) { |
|
1085 | + if ($module_path !== EE_MODULES.'zzz-copy-this-module-template' && $module_path !== EE_MODULES.'gateways') { |
|
1086 | 1086 | // add to list of installed modules |
1087 | - $this->_register_module( $module_path ); |
|
1087 | + $this->_register_module($module_path); |
|
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | } |
1091 | 1091 | // filter list of installed modules |
1092 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', $this->registry->modules ); |
|
1092 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', $this->registry->modules); |
|
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | |
@@ -1102,8 +1102,8 @@ discard block |
||
1102 | 1102 | * @param string $module_path - full path up to and including module folder |
1103 | 1103 | * @return bool |
1104 | 1104 | */ |
1105 | - public static function register_module( $module_path = NULL ) { |
|
1106 | - EE_Config::instance()->_register_module( $module_path ); |
|
1105 | + public static function register_module($module_path = NULL) { |
|
1106 | + EE_Config::instance()->_register_module($module_path); |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | |
@@ -1116,54 +1116,54 @@ discard block |
||
1116 | 1116 | * @param string $module_path - full path up to and including module folder |
1117 | 1117 | * @return bool |
1118 | 1118 | */ |
1119 | - public function _register_module( $module_path = NULL ) { |
|
1120 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1119 | + public function _register_module($module_path = NULL) { |
|
1120 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1121 | 1121 | $module_ext = '.module.php'; |
1122 | 1122 | // make all separators match |
1123 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1123 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1124 | 1124 | // does the file path INCLUDE the actual file name as part of the path ? |
1125 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1125 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1126 | 1126 | // grab and shortcode file name from directory name and break apart at dots |
1127 | - $module_file = explode( '.', basename( $module_path )); |
|
1127 | + $module_file = explode('.', basename($module_path)); |
|
1128 | 1128 | // now we need to rebuild the shortcode path |
1129 | - $module_path = explode( DS, $module_path ); |
|
1129 | + $module_path = explode(DS, $module_path); |
|
1130 | 1130 | // remove last segment |
1131 | - array_pop( $module_path ); |
|
1131 | + array_pop($module_path); |
|
1132 | 1132 | // glue it back together |
1133 | - $module_path = implode( DS, $module_path ) . DS; |
|
1133 | + $module_path = implode(DS, $module_path).DS; |
|
1134 | 1134 | // take first segment from file name pieces and sanitize it |
1135 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1135 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1136 | 1136 | // ensure class prefix is added |
1137 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1137 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1138 | 1138 | } else { |
1139 | 1139 | // we need to generate the filename based off of the folder name |
1140 | 1140 | // grab and sanitize module name |
1141 | - $module = strtolower( basename( $module_path )); |
|
1142 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1141 | + $module = strtolower(basename($module_path)); |
|
1142 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1143 | 1143 | // like trailingslashit() |
1144 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1144 | + $module_path = rtrim($module_path, DS).DS; |
|
1145 | 1145 | // create classname from module directory name |
1146 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1146 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1147 | 1147 | // add class prefix |
1148 | - $module_class = 'EED_' . $module; |
|
1148 | + $module_class = 'EED_'.$module; |
|
1149 | 1149 | } |
1150 | 1150 | // does the module exist ? |
1151 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1152 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1153 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1151 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1152 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1153 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1154 | 1154 | return FALSE; |
1155 | 1155 | } |
1156 | 1156 | // load the module class file |
1157 | - require_once( $module_path . $module_class . $module_ext ); |
|
1157 | + require_once($module_path.$module_class.$module_ext); |
|
1158 | 1158 | // verify that class exists |
1159 | - if ( ! class_exists( $module_class )) { |
|
1160 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1161 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1159 | + if ( ! class_exists($module_class)) { |
|
1160 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1161 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1162 | 1162 | return FALSE; |
1163 | 1163 | } |
1164 | 1164 | // add to array of registered modules |
1165 | - $this->registry->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1166 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Config::instance()->registry->modules->{$module_class} ); |
|
1165 | + $this->registry->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1166 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Config::instance()->registry->modules->{$module_class} ); |
|
1167 | 1167 | return TRUE; |
1168 | 1168 | } |
1169 | 1169 | |
@@ -1177,23 +1177,23 @@ discard block |
||
1177 | 1177 | */ |
1178 | 1178 | private function _initialize_shortcodes() { |
1179 | 1179 | // cycle thru shortcode folders |
1180 | - foreach ( $this->registry->shortcodes as $shortcode => $shortcode_path ) { |
|
1180 | + foreach ($this->registry->shortcodes as $shortcode => $shortcode_path) { |
|
1181 | 1181 | // add class prefix |
1182 | - $shortcode_class = 'EES_' . $shortcode; |
|
1182 | + $shortcode_class = 'EES_'.$shortcode; |
|
1183 | 1183 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1184 | 1184 | // which set hooks ? |
1185 | - if ( is_admin() ) { |
|
1185 | + if (is_admin()) { |
|
1186 | 1186 | // fire immediately |
1187 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1187 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1188 | 1188 | } else { |
1189 | 1189 | // delay until other systems are online |
1190 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1190 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1191 | 1191 | // convert classname to UPPERCASE and create WP shortcode. |
1192 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1192 | + $shortcode_tag = strtoupper($shortcode); |
|
1193 | 1193 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1194 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1194 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1195 | 1195 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1196 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1196 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | } |
@@ -1210,15 +1210,15 @@ discard block |
||
1210 | 1210 | */ |
1211 | 1211 | private function _initialize_modules() { |
1212 | 1212 | // cycle thru shortcode folders |
1213 | - foreach ( $this->registry->modules as $module_class => $module_path ) { |
|
1213 | + foreach ($this->registry->modules as $module_class => $module_path) { |
|
1214 | 1214 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1215 | 1215 | // which set hooks ? |
1216 | - if ( is_admin() ) { |
|
1216 | + if (is_admin()) { |
|
1217 | 1217 | // fire immediately |
1218 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1218 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1219 | 1219 | } else { |
1220 | 1220 | // delay until other systems are online |
1221 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1221 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1222 | 1222 | } |
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1236,26 +1236,26 @@ discard block |
||
1236 | 1236 | * @param string $key - url param key indicating a route is being called |
1237 | 1237 | * @return bool |
1238 | 1238 | */ |
1239 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1240 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1241 | - $module = str_replace( 'EED_', '', $module ); |
|
1242 | - $module_class = 'EED_' . $module; |
|
1243 | - if ( ! isset( EE_Config::instance()->registry->modules->{$module_class} )) { |
|
1244 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1245 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1239 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1240 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1241 | + $module = str_replace('EED_', '', $module); |
|
1242 | + $module_class = 'EED_'.$module; |
|
1243 | + if ( ! isset(EE_Config::instance()->registry->modules->{$module_class} )) { |
|
1244 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1245 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1246 | 1246 | return FALSE; |
1247 | 1247 | } |
1248 | - if ( empty( $route )) { |
|
1249 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1250 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1248 | + if (empty($route)) { |
|
1249 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1250 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1251 | 1251 | return FALSE; |
1252 | 1252 | } |
1253 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1254 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1255 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1253 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1254 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1255 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | return FALSE; |
1257 | 1257 | } |
1258 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1258 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1259 | 1259 | return TRUE; |
1260 | 1260 | } |
1261 | 1261 | |
@@ -1269,11 +1269,11 @@ discard block |
||
1269 | 1269 | * @param string $key - url param key indicating a route is being called |
1270 | 1270 | * @return string |
1271 | 1271 | */ |
1272 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1273 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1274 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1275 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1276 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1272 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1273 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1274 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1275 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1276 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1277 | 1277 | } |
1278 | 1278 | return NULL; |
1279 | 1279 | } |
@@ -1302,35 +1302,35 @@ discard block |
||
1302 | 1302 | * @param string $key - url param key indicating a route is being called |
1303 | 1303 | * @return bool |
1304 | 1304 | */ |
1305 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1306 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1307 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1308 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1309 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1305 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1306 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1307 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1308 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1309 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1310 | 1310 | return FALSE; |
1311 | 1311 | } |
1312 | - if ( empty( $forward )) { |
|
1313 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1314 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1312 | + if (empty($forward)) { |
|
1313 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1314 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1315 | 1315 | return FALSE; |
1316 | 1316 | } |
1317 | - if ( is_array( $forward )) { |
|
1318 | - if ( ! isset( $forward[1] )) { |
|
1319 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1320 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1317 | + if (is_array($forward)) { |
|
1318 | + if ( ! isset($forward[1])) { |
|
1319 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1320 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1321 | 1321 | return FALSE; |
1322 | 1322 | } |
1323 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1324 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1325 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1323 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1324 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1325 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1326 | 1326 | return FALSE; |
1327 | 1327 | } |
1328 | - } else if ( ! function_exists( $forward )) { |
|
1329 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1330 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1328 | + } else if ( ! function_exists($forward)) { |
|
1329 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1330 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } |
1333 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1333 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1334 | 1334 | return TRUE; |
1335 | 1335 | } |
1336 | 1336 | |
@@ -1345,10 +1345,10 @@ discard block |
||
1345 | 1345 | * @param string $key - url param key indicating a route is being called |
1346 | 1346 | * @return string |
1347 | 1347 | */ |
1348 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1349 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1350 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1351 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1348 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1349 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1350 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1351 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1352 | 1352 | } |
1353 | 1353 | return NULL; |
1354 | 1354 | } |
@@ -1365,19 +1365,19 @@ discard block |
||
1365 | 1365 | * @param string $key - url param key indicating a route is being called |
1366 | 1366 | * @return bool |
1367 | 1367 | */ |
1368 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1369 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1370 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1371 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1372 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1368 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1369 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1370 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1371 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1372 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1373 | 1373 | return FALSE; |
1374 | 1374 | } |
1375 | - if ( ! is_readable( $view )) { |
|
1376 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1377 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1375 | + if ( ! is_readable($view)) { |
|
1376 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1377 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1378 | 1378 | return FALSE; |
1379 | 1379 | } |
1380 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1380 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1381 | 1381 | return TRUE; |
1382 | 1382 | } |
1383 | 1383 | |
@@ -1394,10 +1394,10 @@ discard block |
||
1394 | 1394 | * @param string $key - url param key indicating a route is being called |
1395 | 1395 | * @return string |
1396 | 1396 | */ |
1397 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1398 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1399 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1400 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1397 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1398 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1399 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1400 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1401 | 1401 | } |
1402 | 1402 | return NULL; |
1403 | 1403 | } |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | |
1406 | 1406 | |
1407 | 1407 | public function shutdown() { |
1408 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1408 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1409 | 1409 | } |
1410 | 1410 | |
1411 | 1411 | |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1422 | 1422 | * basically, they should just be well-defined stdClasses |
1423 | 1423 | */ |
1424 | -class EE_Config_Base{ |
|
1424 | +class EE_Config_Base { |
|
1425 | 1425 | |
1426 | 1426 | /** |
1427 | 1427 | * Utility function for escaping the value of a property and returning. |
@@ -1430,13 +1430,13 @@ discard block |
||
1430 | 1430 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1431 | 1431 | * @throws \EE_Error |
1432 | 1432 | */ |
1433 | - public function get_pretty( $property ) { |
|
1434 | - if ( ! property_exists( $this, $property ) ) { |
|
1435 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1433 | + public function get_pretty($property) { |
|
1434 | + if ( ! property_exists($this, $property)) { |
|
1435 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1436 | 1436 | } |
1437 | 1437 | //just handling escaping of strings for now. |
1438 | - if ( is_string( $this->{$property} ) ) { |
|
1439 | - return stripslashes( $this->{$property} ); |
|
1438 | + if (is_string($this->{$property} )) { |
|
1439 | + return stripslashes($this->{$property} ); |
|
1440 | 1440 | } |
1441 | 1441 | return $this->{$property}; |
1442 | 1442 | } |
@@ -1445,19 +1445,19 @@ discard block |
||
1445 | 1445 | |
1446 | 1446 | public function populate() { |
1447 | 1447 | //grab defaults via a new instance of this class. |
1448 | - $class_name = get_class( $this ); |
|
1448 | + $class_name = get_class($this); |
|
1449 | 1449 | $defaults = new $class_name; |
1450 | 1450 | |
1451 | 1451 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1452 | 1452 | //default from our $defaults object. |
1453 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1454 | - if ( is_null( $this->{$property} ) ) { |
|
1453 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1454 | + if (is_null($this->{$property} )) { |
|
1455 | 1455 | $this->{$property} = $value; |
1456 | 1456 | } |
1457 | 1457 | } |
1458 | 1458 | |
1459 | 1459 | //cleanup |
1460 | - unset( $defaults ); |
|
1460 | + unset($defaults); |
|
1461 | 1461 | } |
1462 | 1462 | |
1463 | 1463 | |
@@ -1549,12 +1549,12 @@ discard block |
||
1549 | 1549 | */ |
1550 | 1550 | public function __construct() { |
1551 | 1551 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1552 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1552 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1553 | 1553 | // set default organization settings |
1554 | 1554 | $this->current_blog_id = get_current_blog_id(); |
1555 | 1555 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1556 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1557 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1556 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1557 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1558 | 1558 | $this->post_shortcodes = array(); |
1559 | 1559 | $this->module_route_map = array(); |
1560 | 1560 | $this->module_forward_map = array(); |
@@ -1573,7 +1573,7 @@ discard block |
||
1573 | 1573 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1574 | 1574 | |
1575 | 1575 | //ueip constant check |
1576 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1576 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1577 | 1577 | $this->ee_ueip_optin = FALSE; |
1578 | 1578 | $this->ee_ueip_has_notified = TRUE; |
1579 | 1579 | } |
@@ -1613,8 +1613,8 @@ discard block |
||
1613 | 1613 | * @return string |
1614 | 1614 | */ |
1615 | 1615 | public function reg_page_url() { |
1616 | - if ( ! $this->reg_page_url ) { |
|
1617 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1616 | + if ( ! $this->reg_page_url) { |
|
1617 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1618 | 1618 | } |
1619 | 1619 | return $this->reg_page_url; |
1620 | 1620 | } |
@@ -1627,12 +1627,12 @@ discard block |
||
1627 | 1627 | * @return string |
1628 | 1628 | */ |
1629 | 1629 | public function txn_page_url($query_args = array()) { |
1630 | - if ( ! $this->txn_page_url ) { |
|
1631 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1630 | + if ( ! $this->txn_page_url) { |
|
1631 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1632 | 1632 | } |
1633 | - if($query_args){ |
|
1634 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1635 | - }else{ |
|
1633 | + if ($query_args) { |
|
1634 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1635 | + } else { |
|
1636 | 1636 | return $this->txn_page_url; |
1637 | 1637 | } |
1638 | 1638 | } |
@@ -1644,12 +1644,12 @@ discard block |
||
1644 | 1644 | * @return string |
1645 | 1645 | */ |
1646 | 1646 | public function thank_you_page_url($query_args = array()) { |
1647 | - if ( ! $this->thank_you_page_url ) { |
|
1648 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1647 | + if ( ! $this->thank_you_page_url) { |
|
1648 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1649 | 1649 | } |
1650 | - if($query_args){ |
|
1651 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1652 | - }else{ |
|
1650 | + if ($query_args) { |
|
1651 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1652 | + } else { |
|
1653 | 1653 | return $this->thank_you_page_url; |
1654 | 1654 | } |
1655 | 1655 | } |
@@ -1660,8 +1660,8 @@ discard block |
||
1660 | 1660 | * @return string |
1661 | 1661 | */ |
1662 | 1662 | public function cancel_page_url() { |
1663 | - if ( ! $this->cancel_page_url ) { |
|
1664 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1663 | + if ( ! $this->cancel_page_url) { |
|
1664 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1665 | 1665 | } |
1666 | 1666 | return $this->cancel_page_url; |
1667 | 1667 | } |
@@ -1689,7 +1689,7 @@ discard block |
||
1689 | 1689 | //reset all url properties |
1690 | 1690 | $this->_reset_urls(); |
1691 | 1691 | //return what to save to db |
1692 | - return array_keys( get_object_vars( $this ) ); |
|
1692 | + return array_keys(get_object_vars($this)); |
|
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | } |
@@ -1921,38 +1921,38 @@ discard block |
||
1921 | 1921 | * @param null $CNT_ISO |
1922 | 1922 | * @return \EE_Currency_Config |
1923 | 1923 | */ |
1924 | - public function __construct( $CNT_ISO = NULL ) { |
|
1924 | + public function __construct($CNT_ISO = NULL) { |
|
1925 | 1925 | |
1926 | 1926 | // get country code from organization settings or use default |
1927 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1927 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1928 | 1928 | // but override if requested |
1929 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1929 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1930 | 1930 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
1931 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1931 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1932 | 1932 | // retrieve the country settings from the db, just in case they have been customized |
1933 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1934 | - if ( $country instanceof EE_Country ) { |
|
1935 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1936 | - $this->name = $country->currency_name_single(); // Dollar |
|
1937 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1938 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1939 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1940 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1941 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1942 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1933 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1934 | + if ($country instanceof EE_Country) { |
|
1935 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1936 | + $this->name = $country->currency_name_single(); // Dollar |
|
1937 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1938 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1939 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1940 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1941 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1942 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1943 | 1943 | } |
1944 | 1944 | } |
1945 | 1945 | // fallback to hardcoded defaults, in case the above failed |
1946 | - if ( empty( $this->code )) { |
|
1946 | + if (empty($this->code)) { |
|
1947 | 1947 | // set default currency settings |
1948 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1949 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1950 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1951 | - $this->sign = '$'; // currency sign: $ |
|
1952 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1953 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1954 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1955 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1948 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1949 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1950 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1951 | + $this->sign = '$'; // currency sign: $ |
|
1952 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1953 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1954 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1955 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1956 | 1956 | } |
1957 | 1957 | } |
1958 | 1958 | } |
@@ -2101,7 +2101,7 @@ discard block |
||
2101 | 2101 | * @since 4.8.8.rc.019 |
2102 | 2102 | */ |
2103 | 2103 | public function do_hooks() { |
2104 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2104 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2105 | 2105 | } |
2106 | 2106 | |
2107 | 2107 | |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | * @return void |
2110 | 2110 | */ |
2111 | 2111 | public function set_default_reg_status_on_EEM_Event() { |
2112 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2112 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2113 | 2113 | } |
2114 | 2114 | |
2115 | 2115 | |
@@ -2214,10 +2214,10 @@ discard block |
||
2214 | 2214 | * @param bool $reset |
2215 | 2215 | * @return string |
2216 | 2216 | */ |
2217 | - public function log_file_name( $reset = FALSE ) { |
|
2218 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2219 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2220 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2217 | + public function log_file_name($reset = FALSE) { |
|
2218 | + if (empty($this->log_file_name) || $reset) { |
|
2219 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2220 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2221 | 2221 | } |
2222 | 2222 | return $this->log_file_name; |
2223 | 2223 | } |
@@ -2229,10 +2229,10 @@ discard block |
||
2229 | 2229 | * @param bool $reset |
2230 | 2230 | * @return string |
2231 | 2231 | */ |
2232 | - public function debug_file_name( $reset = FALSE ) { |
|
2233 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2234 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2235 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2232 | + public function debug_file_name($reset = FALSE) { |
|
2233 | + if (empty($this->debug_file_name) || $reset) { |
|
2234 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2235 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2236 | 2236 | } |
2237 | 2237 | return $this->debug_file_name; |
2238 | 2238 | } |
@@ -2405,21 +2405,21 @@ discard block |
||
2405 | 2405 | // set default map settings |
2406 | 2406 | $this->use_google_maps = TRUE; |
2407 | 2407 | // for event details pages (reg page) |
2408 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2409 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2410 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2411 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2412 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2413 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2414 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2408 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2409 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2410 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2411 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2412 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2413 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2414 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2415 | 2415 | // for event list pages |
2416 | - $this->event_list_map_width = 300; // ee_map_width |
|
2417 | - $this->event_list_map_height = 185; // ee_map_height |
|
2418 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2419 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2420 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2421 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2422 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2416 | + $this->event_list_map_width = 300; // ee_map_width |
|
2417 | + $this->event_list_map_height = 185; // ee_map_height |
|
2418 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2419 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2420 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2421 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2422 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | } |
@@ -2430,7 +2430,7 @@ discard block |
||
2430 | 2430 | /** |
2431 | 2431 | * stores Events_Archive settings |
2432 | 2432 | */ |
2433 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2433 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2434 | 2434 | |
2435 | 2435 | public $display_status_banner; |
2436 | 2436 | public $display_description; |
@@ -2449,7 +2449,7 @@ discard block |
||
2449 | 2449 | /** |
2450 | 2450 | * class constructor |
2451 | 2451 | */ |
2452 | - public function __construct(){ |
|
2452 | + public function __construct() { |
|
2453 | 2453 | $this->display_status_banner = 0; |
2454 | 2454 | $this->display_description = 1; |
2455 | 2455 | $this->display_ticket_selector = 0; |
@@ -2469,7 +2469,7 @@ discard block |
||
2469 | 2469 | /** |
2470 | 2470 | * Stores Event_Single_Config settings |
2471 | 2471 | */ |
2472 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2472 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2473 | 2473 | |
2474 | 2474 | public $display_status_banner_single; |
2475 | 2475 | public $display_venue; |
@@ -2498,7 +2498,7 @@ discard block |
||
2498 | 2498 | /** |
2499 | 2499 | * Stores Ticket_Selector_Config settings |
2500 | 2500 | */ |
2501 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2501 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2502 | 2502 | public $show_ticket_sale_columns; |
2503 | 2503 | public $show_ticket_details; |
2504 | 2504 | public $show_expired_tickets; |
@@ -2552,7 +2552,7 @@ discard block |
||
2552 | 2552 | * @return void |
2553 | 2553 | */ |
2554 | 2554 | protected function _set_php_values() { |
2555 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2555 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2556 | 2556 | $this->php->version = phpversion(); |
2557 | 2557 | } |
2558 | 2558 | |
@@ -2571,9 +2571,9 @@ discard block |
||
2571 | 2571 | * @type string $msg Any message to be displayed. |
2572 | 2572 | * } |
2573 | 2573 | */ |
2574 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2575 | - if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2576 | - return sprintf( __('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
2574 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2575 | + if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2576 | + return sprintf(__('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
2577 | 2577 | } else { |
2578 | 2578 | return ''; |
2579 | 2579 | } |
@@ -2608,7 +2608,7 @@ discard block |
||
2608 | 2608 | * stores payment gateway info |
2609 | 2609 | * @deprecated |
2610 | 2610 | */ |
2611 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2611 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2612 | 2612 | |
2613 | 2613 | /** |
2614 | 2614 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2630,9 +2630,9 @@ discard block |
||
2630 | 2630 | * class constructor |
2631 | 2631 | * @deprecated |
2632 | 2632 | */ |
2633 | - public function __construct(){ |
|
2633 | + public function __construct() { |
|
2634 | 2634 | $this->payment_settings = array(); |
2635 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2635 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2636 | 2636 | } |
2637 | 2637 | } |
2638 | 2638 |