@@ -278,6 +278,7 @@ |
||
278 | 278 | |
279 | 279 | /** |
280 | 280 | * @param mixed string | EED_Module $module |
281 | + * @param string $module |
|
281 | 282 | */ |
282 | 283 | public function add_module( $module ) { |
283 | 284 | if ( $module instanceof EED_Module ) { |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | * @param \EE_Dependency_Map $dependency_map |
179 | 179 | * @return \EE_Registry instance |
180 | 180 | */ |
181 | - public static function instance( \EE_Dependency_Map $dependency_map = null ) { |
|
181 | + public static function instance(\EE_Dependency_Map $dependency_map = null) { |
|
182 | 182 | // check if class object is instantiated |
183 | - if ( ! self::$_instance instanceof EE_Registry ) { |
|
184 | - self::$_instance = new EE_Registry( $dependency_map ); |
|
183 | + if ( ! self::$_instance instanceof EE_Registry) { |
|
184 | + self::$_instance = new EE_Registry($dependency_map); |
|
185 | 185 | } |
186 | 186 | return self::$_instance; |
187 | 187 | } |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | * @param \EE_Dependency_Map $dependency_map |
197 | 197 | * @return \EE_Registry |
198 | 198 | */ |
199 | - protected function __construct( \EE_Dependency_Map $dependency_map ) { |
|
199 | + protected function __construct(\EE_Dependency_Map $dependency_map) { |
|
200 | 200 | $this->_dependency_map = $dependency_map; |
201 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
201 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -225,19 +225,19 @@ discard block |
||
225 | 225 | $this->modules = new StdClass(); |
226 | 226 | $this->shortcodes = new StdClass(); |
227 | 227 | $this->widgets = new StdClass(); |
228 | - $this->load_core( 'Base', array(), true ); |
|
228 | + $this->load_core('Base', array(), true); |
|
229 | 229 | // add our request and response objects to the cache |
230 | - $request_loader = $this->_dependency_map->class_loader( 'EE_Request' ); |
|
230 | + $request_loader = $this->_dependency_map->class_loader('EE_Request'); |
|
231 | 231 | $this->_set_cached_class( |
232 | 232 | $request_loader(), |
233 | 233 | 'EE_Request' |
234 | 234 | ); |
235 | - $response_loader = $this->_dependency_map->class_loader( 'EE_Response' ); |
|
235 | + $response_loader = $this->_dependency_map->class_loader('EE_Response'); |
|
236 | 236 | $this->_set_cached_class( |
237 | 237 | $response_loader(), |
238 | 238 | 'EE_Response' |
239 | 239 | ); |
240 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) ); |
|
240 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function init() { |
252 | 252 | // Get current page protocol |
253 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
253 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
254 | 254 | // Output admin-ajax.php URL with same protocol as current page |
255 | - self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol ); |
|
256 | - self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false; |
|
255 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
256 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * @return string |
265 | 265 | */ |
266 | 266 | public static function localize_i18n_js_strings() { |
267 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
268 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
269 | - if ( is_scalar( $value ) ) { |
|
270 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
267 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
268 | + foreach ($i18n_js_strings as $key => $value) { |
|
269 | + if (is_scalar($value)) { |
|
270 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
274 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -279,15 +279,15 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * @param mixed string | EED_Module $module |
281 | 281 | */ |
282 | - public function add_module( $module ) { |
|
283 | - if ( $module instanceof EED_Module ) { |
|
284 | - $module_class = get_class( $module ); |
|
282 | + public function add_module($module) { |
|
283 | + if ($module instanceof EED_Module) { |
|
284 | + $module_class = get_class($module); |
|
285 | 285 | $this->modules->{$module_class} = $module; |
286 | 286 | } else { |
287 | - if ( ! class_exists( 'EE_Module_Request_Router' ) ) { |
|
288 | - $this->load_core( 'Module_Request_Router' ); |
|
287 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
288 | + $this->load_core('Module_Request_Router'); |
|
289 | 289 | } |
290 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
290 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @param string $module_name |
298 | 298 | * @return mixed EED_Module | NULL |
299 | 299 | */ |
300 | - public function get_module( $module_name = '' ) { |
|
301 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
300 | + public function get_module($module_name = '') { |
|
301 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -312,20 +312,20 @@ discard block |
||
312 | 312 | * @param bool $load_only |
313 | 313 | * @return mixed |
314 | 314 | */ |
315 | - public function load_core( $class_name, $arguments = array(), $load_only = false ) { |
|
315 | + public function load_core($class_name, $arguments = array(), $load_only = false) { |
|
316 | 316 | $core_paths = apply_filters( |
317 | 317 | 'FHEE__EE_Registry__load_core__core_paths', |
318 | 318 | array( |
319 | 319 | EE_CORE, |
320 | 320 | EE_ADMIN, |
321 | 321 | EE_CPTS, |
322 | - EE_CORE . 'data_migration_scripts' . DS, |
|
323 | - EE_CORE . 'request_stack' . DS, |
|
324 | - EE_CORE . 'middleware' . DS, |
|
322 | + EE_CORE.'data_migration_scripts'.DS, |
|
323 | + EE_CORE.'request_stack'.DS, |
|
324 | + EE_CORE.'middleware'.DS, |
|
325 | 325 | ) |
326 | 326 | ); |
327 | 327 | // retrieve instantiated class |
328 | - return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only ); |
|
328 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -339,15 +339,15 @@ discard block |
||
339 | 339 | * @param bool $load_only |
340 | 340 | * @return mixed |
341 | 341 | */ |
342 | - public function load_service( $class_name, $arguments = array(), $load_only = false ) { |
|
342 | + public function load_service($class_name, $arguments = array(), $load_only = false) { |
|
343 | 343 | $service_paths = apply_filters( |
344 | 344 | 'FHEE__EE_Registry__load_service__service_paths', |
345 | 345 | array( |
346 | - EE_CORE . 'services' . DS, |
|
346 | + EE_CORE.'services'.DS, |
|
347 | 347 | ) |
348 | 348 | ); |
349 | 349 | // retrieve instantiated class |
350 | - return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only ); |
|
350 | + return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | * @param mixed $arguments |
361 | 361 | * @return EE_Data_Migration_Script_Base |
362 | 362 | */ |
363 | - public function load_dms( $class_name, $arguments = array() ) { |
|
363 | + public function load_dms($class_name, $arguments = array()) { |
|
364 | 364 | // retrieve instantiated class |
365 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false ); |
|
365 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
378 | 378 | * @return EE_Base_Class | bool |
379 | 379 | */ |
380 | - public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) { |
|
381 | - $paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array( |
|
380 | + public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) { |
|
381 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
382 | 382 | EE_CORE, |
383 | 383 | EE_CLASSES, |
384 | 384 | EE_BUSINESS |
385 | - ) ); |
|
385 | + )); |
|
386 | 386 | // retrieve instantiated class |
387 | - return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
387 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -397,11 +397,11 @@ discard block |
||
397 | 397 | * @param bool $load_only |
398 | 398 | * @return EEH_Base | bool |
399 | 399 | */ |
400 | - public function load_helper( $class_name, $arguments = array(), $load_only = true ) { |
|
400 | + public function load_helper($class_name, $arguments = array(), $load_only = true) { |
|
401 | 401 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
402 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) ); |
|
402 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
403 | 403 | // retrieve instantiated class |
404 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only ); |
|
404 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | * @param bool $cache whether to cache the object or not. |
417 | 417 | * @return mixed |
418 | 418 | */ |
419 | - public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) { |
|
419 | + public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) { |
|
420 | 420 | $paths = array( |
421 | 421 | EE_LIBRARIES, |
422 | - EE_LIBRARIES . 'messages' . DS, |
|
423 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
424 | - EE_LIBRARIES . 'qtips' . DS, |
|
425 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
422 | + EE_LIBRARIES.'messages'.DS, |
|
423 | + EE_LIBRARIES.'shortcodes'.DS, |
|
424 | + EE_LIBRARIES.'qtips'.DS, |
|
425 | + EE_LIBRARIES.'payment_methods'.DS, |
|
426 | 426 | ); |
427 | 427 | // retrieve instantiated class |
428 | - return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only ); |
|
428 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | * @param bool $load_only |
439 | 439 | * @return EEM_Base | bool |
440 | 440 | */ |
441 | - public function load_model( $class_name, $arguments = array(), $load_only = false ) { |
|
442 | - $paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array( |
|
441 | + public function load_model($class_name, $arguments = array(), $load_only = false) { |
|
442 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
443 | 443 | EE_MODELS, |
444 | 444 | EE_CORE |
445 | - ) ); |
|
445 | + )); |
|
446 | 446 | // retrieve instantiated class |
447 | - return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only ); |
|
447 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | |
@@ -457,15 +457,15 @@ discard block |
||
457 | 457 | * @param bool $load_only |
458 | 458 | * @return mixed | bool |
459 | 459 | */ |
460 | - public function load_model_class( $class_name, $arguments = array(), $load_only = true ) { |
|
460 | + public function load_model_class($class_name, $arguments = array(), $load_only = true) { |
|
461 | 461 | $paths = array( |
462 | - EE_MODELS . 'fields' . DS, |
|
463 | - EE_MODELS . 'helpers' . DS, |
|
464 | - EE_MODELS . 'relations' . DS, |
|
465 | - EE_MODELS . 'strategies' . DS |
|
462 | + EE_MODELS.'fields'.DS, |
|
463 | + EE_MODELS.'helpers'.DS, |
|
464 | + EE_MODELS.'relations'.DS, |
|
465 | + EE_MODELS.'strategies'.DS |
|
466 | 466 | ); |
467 | 467 | // retrieve instantiated class |
468 | - return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only ); |
|
468 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
476 | 476 | * @return boolean |
477 | 477 | */ |
478 | - public function is_model_name( $model_name ) { |
|
479 | - return isset( $this->models[ $model_name ] ) ? true : false; |
|
478 | + public function is_model_name($model_name) { |
|
479 | + return isset($this->models[$model_name]) ? true : false; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | * @param bool $load_only |
492 | 492 | * @return mixed |
493 | 493 | */ |
494 | - public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) { |
|
494 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) { |
|
495 | 495 | // retrieve instantiated class |
496 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only ); |
|
496 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | * @param bool $load_only |
509 | 509 | * @return EE_Addon |
510 | 510 | */ |
511 | - public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) { |
|
511 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) { |
|
512 | 512 | // retrieve instantiated class |
513 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only ); |
|
513 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | |
@@ -541,46 +541,46 @@ discard block |
||
541 | 541 | $load_only = false |
542 | 542 | ) { |
543 | 543 | // strip php file extension |
544 | - $class_name = str_replace( '.php', '', trim( $class_name ) ); |
|
544 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
545 | 545 | // does the class have a prefix ? |
546 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
546 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
547 | 547 | // make sure $class_prefix is uppercase |
548 | - $class_prefix = strtoupper( trim( $class_prefix ) ); |
|
548 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
549 | 549 | // add class prefix ONCE!!! |
550 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
550 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
551 | 551 | } |
552 | - $class_exists = class_exists( $class_name ); |
|
552 | + $class_exists = class_exists($class_name); |
|
553 | 553 | // if we're only loading the class and it already exists, then let's just return true immediately |
554 | - if ( $load_only && $class_exists ) { |
|
554 | + if ($load_only && $class_exists) { |
|
555 | 555 | return true; |
556 | 556 | } |
557 | 557 | // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection |
558 | 558 | // $cache is controlled by individual calls to separate Registry loader methods like load_class() |
559 | 559 | // $load_only is also controlled by individual calls to separate Registry loader methods like load_file() |
560 | - if ( $this->_cache_on && $cache && ! $load_only ) { |
|
560 | + if ($this->_cache_on && $cache && ! $load_only) { |
|
561 | 561 | // return object if it's already cached |
562 | - $cached_class = $this->_get_cached_class( $class_name, $class_prefix ); |
|
563 | - if ( $cached_class !== null ) { |
|
562 | + $cached_class = $this->_get_cached_class($class_name, $class_prefix); |
|
563 | + if ($cached_class !== null) { |
|
564 | 564 | return $cached_class; |
565 | 565 | } |
566 | 566 | } |
567 | 567 | // if the class doesn't already exist.. then we need to try and find the file and load it |
568 | - if ( ! $class_exists ) { |
|
568 | + if ( ! $class_exists) { |
|
569 | 569 | // get full path to file |
570 | - $path = $this->_resolve_path( $class_name, $type, $file_paths ); |
|
570 | + $path = $this->_resolve_path($class_name, $type, $file_paths); |
|
571 | 571 | // load the file |
572 | - $loaded = $this->_require_file( $path, $class_name, $type, $file_paths ); |
|
572 | + $loaded = $this->_require_file($path, $class_name, $type, $file_paths); |
|
573 | 573 | // if loading failed, or we are only loading a file but NOT instantiating an object |
574 | - if ( ! $loaded || $load_only ) { |
|
574 | + if ( ! $loaded || $load_only) { |
|
575 | 575 | // return boolean if only loading, or null if an object was expected |
576 | 576 | return $load_only ? $loaded : null; |
577 | 577 | } |
578 | 578 | } |
579 | 579 | // instantiate the requested object |
580 | - $class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db ); |
|
581 | - if ( $this->_cache_on && $cache ) { |
|
580 | + $class_obj = $this->_create_object($class_name, $arguments, $type, $from_db); |
|
581 | + if ($this->_cache_on && $cache) { |
|
582 | 582 | // save it for later... kinda like gum { : $ |
583 | - $this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db ); |
|
583 | + $this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db); |
|
584 | 584 | } |
585 | 585 | $this->_cache_on = true; |
586 | 586 | return $class_obj; |
@@ -603,21 +603,21 @@ discard block |
||
603 | 603 | * @param string $class_prefix |
604 | 604 | * @return null|object |
605 | 605 | */ |
606 | - protected function _get_cached_class( $class_name, $class_prefix = '' ) { |
|
607 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
608 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
606 | + protected function _get_cached_class($class_name, $class_prefix = '') { |
|
607 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
608 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
609 | 609 | } else { |
610 | 610 | // have to specify something, but not anything that will conflict |
611 | 611 | $class_abbreviation = 'FANCY_BATMAN_PANTS'; |
612 | 612 | } |
613 | 613 | // check if class has already been loaded, and return it if it has been |
614 | - if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) { |
|
614 | + if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) { |
|
615 | 615 | return $this->{$class_abbreviation}; |
616 | - } else if ( isset ( $this->{$class_name} ) ) { |
|
616 | + } else if (isset ($this->{$class_name} )) { |
|
617 | 617 | return $this->{$class_name}; |
618 | - } else if ( isset ( $this->LIB->{$class_name} ) ) { |
|
618 | + } else if (isset ($this->LIB->{$class_name} )) { |
|
619 | 619 | return $this->LIB->{$class_name}; |
620 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) { |
|
620 | + } else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) { |
|
621 | 621 | return $this->addons->{$class_name}; |
622 | 622 | } |
623 | 623 | return null; |
@@ -638,20 +638,20 @@ discard block |
||
638 | 638 | * @param array $file_paths |
639 | 639 | * @return string | bool |
640 | 640 | */ |
641 | - protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) { |
|
641 | + protected function _resolve_path($class_name, $type = '', $file_paths = array()) { |
|
642 | 642 | // make sure $file_paths is an array |
643 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
643 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
644 | 644 | // cycle thru paths |
645 | - foreach ( $file_paths as $key => $file_path ) { |
|
645 | + foreach ($file_paths as $key => $file_path) { |
|
646 | 646 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
647 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
647 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
648 | 648 | // prep file type |
649 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
649 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
650 | 650 | // build full file path |
651 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
651 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
652 | 652 | //does the file exist and can be read ? |
653 | - if ( is_readable( $file_paths[ $key ] ) ) { |
|
654 | - return $file_paths[ $key ]; |
|
653 | + if (is_readable($file_paths[$key])) { |
|
654 | + return $file_paths[$key]; |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | return false; |
@@ -673,29 +673,29 @@ discard block |
||
673 | 673 | * @return boolean |
674 | 674 | * @throws \EE_Error |
675 | 675 | */ |
676 | - protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) { |
|
676 | + protected function _require_file($path, $class_name, $type = '', $file_paths = array()) { |
|
677 | 677 | // don't give up! you gotta... |
678 | 678 | try { |
679 | 679 | //does the file exist and can it be read ? |
680 | - if ( ! $path ) { |
|
680 | + if ( ! $path) { |
|
681 | 681 | // so sorry, can't find the file |
682 | - throw new EE_Error ( |
|
682 | + throw new EE_Error( |
|
683 | 683 | sprintf( |
684 | - __( 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso' ), |
|
685 | - trim( $type, '.' ), |
|
684 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
685 | + trim($type, '.'), |
|
686 | 686 | $class_name, |
687 | - '<br />' . implode( ',<br />', $file_paths ) |
|
687 | + '<br />'.implode(',<br />', $file_paths) |
|
688 | 688 | ) |
689 | 689 | ); |
690 | 690 | } |
691 | 691 | // get the file |
692 | - require_once( $path ); |
|
692 | + require_once($path); |
|
693 | 693 | // if the class isn't already declared somewhere |
694 | - if ( class_exists( $class_name, false ) === false ) { |
|
694 | + if (class_exists($class_name, false) === false) { |
|
695 | 695 | // so sorry, not a class |
696 | 696 | throw new EE_Error( |
697 | 697 | sprintf( |
698 | - __( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ), |
|
698 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
699 | 699 | $type, |
700 | 700 | $path, |
701 | 701 | $class_name |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | ); |
704 | 704 | } |
705 | 705 | |
706 | - } catch ( EE_Error $e ) { |
|
706 | + } catch (EE_Error $e) { |
|
707 | 707 | $e->get_error(); |
708 | 708 | return false; |
709 | 709 | } |
@@ -735,55 +735,55 @@ discard block |
||
735 | 735 | * @return null | object |
736 | 736 | * @throws \EE_Error |
737 | 737 | */ |
738 | - protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) { |
|
738 | + protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) { |
|
739 | 739 | $class_obj = null; |
740 | 740 | // don't give up! you gotta... |
741 | 741 | try { |
742 | 742 | // create reflection |
743 | - $reflector = $this->get_ReflectionClass( $class_name ); |
|
743 | + $reflector = $this->get_ReflectionClass($class_name); |
|
744 | 744 | // make sure arguments are an array |
745 | - $arguments = is_array( $arguments ) ? $arguments : array( $arguments ); |
|
745 | + $arguments = is_array($arguments) ? $arguments : array($arguments); |
|
746 | 746 | // and if arguments array is numerically and sequentially indexed, then we want it to remain as is, |
747 | 747 | // else wrap it in an additional array so that it doesn't get split into multiple parameters |
748 | - $arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments ) |
|
748 | + $arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments) |
|
749 | 749 | ? $arguments |
750 | - : array( $arguments ); |
|
750 | + : array($arguments); |
|
751 | 751 | // attempt to inject dependencies ? |
752 | - if ( $this->_dependency_map->has( $class_name ) ) { |
|
753 | - $arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments ); |
|
752 | + if ($this->_dependency_map->has($class_name)) { |
|
753 | + $arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments); |
|
754 | 754 | } |
755 | 755 | // instantiate the class and add to the LIB array for tracking |
756 | 756 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
757 | - if ( $reflector->getConstructor() === null || $reflector->isAbstract() ) { |
|
757 | + if ($reflector->getConstructor() === null || $reflector->isAbstract()) { |
|
758 | 758 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
759 | 759 | //$instantiation_mode = "no constructor"; |
760 | 760 | $class_obj = true; |
761 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
761 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
762 | 762 | //$instantiation_mode = "new_instance_from_db"; |
763 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
764 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
763 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
764 | + } else if (method_exists($class_name, 'new_instance')) { |
|
765 | 765 | //$instantiation_mode = "new_instance"; |
766 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
767 | - } else if ( method_exists( $class_name, 'instance' ) ) { |
|
766 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
767 | + } else if (method_exists($class_name, 'instance')) { |
|
768 | 768 | //$instantiation_mode = "instance"; |
769 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
770 | - } else if ( $reflector->isInstantiable() ) { |
|
769 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
770 | + } else if ($reflector->isInstantiable()) { |
|
771 | 771 | //$instantiation_mode = "isInstantiable"; |
772 | - $class_obj = $reflector->newInstanceArgs( $arguments ); |
|
772 | + $class_obj = $reflector->newInstanceArgs($arguments); |
|
773 | 773 | } else { |
774 | 774 | // heh ? something's not right ! |
775 | 775 | //$instantiation_mode = 'none'; |
776 | 776 | throw new EE_Error( |
777 | 777 | sprintf( |
778 | - __( 'The %s file %s could not be instantiated.', 'event_espresso' ), |
|
778 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
779 | 779 | $type, |
780 | 780 | $class_name |
781 | 781 | ) |
782 | 782 | ); |
783 | 783 | } |
784 | - } catch ( Exception $e ) { |
|
785 | - if ( ! $e instanceof EE_Error ) { |
|
786 | - $e = new EE_Error( $e->getMessage() ); |
|
784 | + } catch (Exception $e) { |
|
785 | + if ( ! $e instanceof EE_Error) { |
|
786 | + $e = new EE_Error($e->getMessage()); |
|
787 | 787 | } |
788 | 788 | $e->get_error(); |
789 | 789 | } |
@@ -797,8 +797,8 @@ discard block |
||
797 | 797 | * @param array $array |
798 | 798 | * @return bool |
799 | 799 | */ |
800 | - protected function _array_is_numerically_and_sequentially_indexed( array $array ) { |
|
801 | - return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true; |
|
800 | + protected function _array_is_numerically_and_sequentially_indexed(array $array) { |
|
801 | + return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true; |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | |
@@ -813,14 +813,14 @@ discard block |
||
813 | 813 | * @param string $class_name |
814 | 814 | * @return ReflectionClass |
815 | 815 | */ |
816 | - public function get_ReflectionClass( $class_name ) { |
|
816 | + public function get_ReflectionClass($class_name) { |
|
817 | 817 | if ( |
818 | - ! isset( $this->_reflectors[ $class_name ] ) |
|
819 | - || ! $this->_reflectors[ $class_name ] instanceof ReflectionClass |
|
818 | + ! isset($this->_reflectors[$class_name]) |
|
819 | + || ! $this->_reflectors[$class_name] instanceof ReflectionClass |
|
820 | 820 | ) { |
821 | - $this->_reflectors[ $class_name ] = new ReflectionClass( $class_name ); |
|
821 | + $this->_reflectors[$class_name] = new ReflectionClass($class_name); |
|
822 | 822 | } |
823 | - return $this->_reflectors[ $class_name ]; |
|
823 | + return $this->_reflectors[$class_name]; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -845,45 +845,45 @@ discard block |
||
845 | 845 | * @param array $arguments |
846 | 846 | * @return array |
847 | 847 | */ |
848 | - protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) { |
|
848 | + protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) { |
|
849 | 849 | // let's examine the constructor |
850 | 850 | $constructor = $reflector->getConstructor(); |
851 | 851 | // whu? huh? nothing? |
852 | - if ( ! $constructor ) { |
|
852 | + if ( ! $constructor) { |
|
853 | 853 | return $arguments; |
854 | 854 | } |
855 | 855 | // get constructor parameters |
856 | 856 | $params = $constructor->getParameters(); |
857 | 857 | // and the keys for the incoming arguments array so that we can compare existing arguments with what is expected |
858 | - $argument_keys = array_keys( $arguments ); |
|
858 | + $argument_keys = array_keys($arguments); |
|
859 | 859 | // now loop thru all of the constructors expected parameters |
860 | - foreach ( $params as $index => $param ) { |
|
860 | + foreach ($params as $index => $param) { |
|
861 | 861 | // is this a dependency for a specific class ? |
862 | 862 | $param_class = $param->getClass() ? $param->getClass()->name : null; |
863 | 863 | if ( |
864 | 864 | // param is not even a class |
865 | - empty( $param_class ) |
|
865 | + empty($param_class) |
|
866 | 866 | // and something already exists in the incoming arguments for this param |
867 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
867 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
868 | 868 | ) { |
869 | 869 | // so let's skip this argument and move on to the next |
870 | 870 | continue; |
871 | 871 | } else if ( |
872 | 872 | // parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class |
873 | - ! empty( $param_class ) |
|
874 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
875 | - && $arguments[ $argument_keys[ $index ] ] instanceof $param_class |
|
873 | + ! empty($param_class) |
|
874 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
875 | + && $arguments[$argument_keys[$index]] instanceof $param_class |
|
876 | 876 | ) { |
877 | 877 | // skip this argument and move on to the next |
878 | 878 | continue; |
879 | 879 | } else if ( |
880 | 880 | // parameter is type hinted as a class, and should be injected |
881 | - ! empty( $param_class ) |
|
882 | - && $this->_dependency_map->has_dependency_for_class( $class_name, $param_class ) |
|
881 | + ! empty($param_class) |
|
882 | + && $this->_dependency_map->has_dependency_for_class($class_name, $param_class) |
|
883 | 883 | ) { |
884 | - $arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index ); |
|
884 | + $arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index); |
|
885 | 885 | } else { |
886 | - $arguments[ $index ] = $param->getDefaultValue(); |
|
886 | + $arguments[$index] = $param->getDefaultValue(); |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | } |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | * @param mixed $index |
901 | 901 | * @return array |
902 | 902 | */ |
903 | - protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) { |
|
903 | + protected function _resolve_dependency($class_name, $param_class, $arguments, $index) { |
|
904 | 904 | $dependency = null; |
905 | 905 | // should dependency be loaded from cache ? |
906 | 906 | $cache_on = $this->_dependency_map->loading_strategy_for_class_dependency( |
@@ -910,30 +910,30 @@ discard block |
||
910 | 910 | : false; |
911 | 911 | // we might have a dependency... |
912 | 912 | // let's MAYBE try and find it in our cache if that's what's been requested |
913 | - $cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null; |
|
913 | + $cached_class = $cache_on ? $this->_get_cached_class($param_class) : null; |
|
914 | 914 | // and grab it if it exists |
915 | - if ( $cached_class instanceof $param_class ) { |
|
915 | + if ($cached_class instanceof $param_class) { |
|
916 | 916 | $dependency = $cached_class; |
917 | - } else if ( $param_class != $class_name ) { |
|
917 | + } else if ($param_class != $class_name) { |
|
918 | 918 | // obtain the loader method from the dependency map |
919 | - $loader = $this->_dependency_map->class_loader( $param_class ); |
|
919 | + $loader = $this->_dependency_map->class_loader($param_class); |
|
920 | 920 | // is loader a custom closure ? |
921 | - if ( $loader instanceof Closure ) { |
|
921 | + if ($loader instanceof Closure) { |
|
922 | 922 | $dependency = $loader(); |
923 | 923 | } else { |
924 | 924 | // set the cache on property for the recursive loading call |
925 | 925 | $this->_cache_on = $cache_on; |
926 | 926 | // if not, then let's try and load it via the registry |
927 | - $dependency = $this->{$loader}( $param_class ); |
|
927 | + $dependency = $this->{$loader}($param_class); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | // did we successfully find the correct dependency ? |
931 | - if ( $dependency instanceof $param_class ) { |
|
931 | + if ($dependency instanceof $param_class) { |
|
932 | 932 | // then let's inject it into the incoming array of arguments at the correct location |
933 | - if ( isset( $argument_keys[ $index ] ) ) { |
|
934 | - $arguments[ $argument_keys[ $index ] ] = $dependency; |
|
933 | + if (isset($argument_keys[$index])) { |
|
934 | + $arguments[$argument_keys[$index]] = $dependency; |
|
935 | 935 | } else { |
936 | - $arguments[ $index ] = $dependency; |
|
936 | + $arguments[$index] = $dependency; |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | return $arguments; |
@@ -958,16 +958,16 @@ discard block |
||
958 | 958 | * @param bool $from_db |
959 | 959 | * @return void |
960 | 960 | */ |
961 | - protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) { |
|
961 | + protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) { |
|
962 | 962 | // return newly instantiated class |
963 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
964 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
963 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
964 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
965 | 965 | $this->{$class_abbreviation} = $class_obj; |
966 | - } else if ( property_exists( $this, $class_name ) ) { |
|
966 | + } else if (property_exists($this, $class_name)) { |
|
967 | 967 | $this->{$class_name} = $class_obj; |
968 | - } else if ( $class_prefix == 'addon' ) { |
|
968 | + } else if ($class_prefix == 'addon') { |
|
969 | 969 | $this->addons->{$class_name} = $class_obj; |
970 | - } else if ( ! $from_db ) { |
|
970 | + } else if ( ! $from_db) { |
|
971 | 971 | $this->LIB->{$class_name} = $class_obj; |
972 | 972 | } |
973 | 973 | } |
@@ -984,12 +984,12 @@ discard block |
||
984 | 984 | * @param array $arguments |
985 | 985 | * @return object |
986 | 986 | */ |
987 | - public static function factory( $classname, $arguments = array() ) { |
|
988 | - $loader = self::instance()->_dependency_map->class_loader( $classname ); |
|
989 | - if ( $loader instanceof Closure ) { |
|
990 | - return $loader( $arguments ); |
|
991 | - } else if ( method_exists( EE_Registry::instance(), $loader ) ) { |
|
992 | - return EE_Registry::instance()->{$loader}( $classname, $arguments ); |
|
987 | + public static function factory($classname, $arguments = array()) { |
|
988 | + $loader = self::instance()->_dependency_map->class_loader($classname); |
|
989 | + if ($loader instanceof Closure) { |
|
990 | + return $loader($arguments); |
|
991 | + } else if (method_exists(EE_Registry::instance(), $loader)) { |
|
992 | + return EE_Registry::instance()->{$loader}($classname, $arguments); |
|
993 | 993 | } |
994 | 994 | return null; |
995 | 995 | } |
@@ -1002,9 +1002,9 @@ discard block |
||
1002 | 1002 | * @param string $name |
1003 | 1003 | * @return EE_Addon |
1004 | 1004 | */ |
1005 | - public function get_addon_by_name( $name ) { |
|
1006 | - foreach ( $this->addons as $addon ) { |
|
1007 | - if ( $addon->name() == $name ) { |
|
1005 | + public function get_addon_by_name($name) { |
|
1006 | + foreach ($this->addons as $addon) { |
|
1007 | + if ($addon->name() == $name) { |
|
1008 | 1008 | return $addon; |
1009 | 1009 | } |
1010 | 1010 | } |
@@ -1020,8 +1020,8 @@ discard block |
||
1020 | 1020 | */ |
1021 | 1021 | public function get_addons_by_name() { |
1022 | 1022 | $addons = array(); |
1023 | - foreach ( $this->addons as $addon ) { |
|
1024 | - $addons[ $addon->name() ] = $addon; |
|
1023 | + foreach ($this->addons as $addon) { |
|
1024 | + $addons[$addon->name()] = $addon; |
|
1025 | 1025 | } |
1026 | 1026 | return $addons; |
1027 | 1027 | } |
@@ -1036,14 +1036,14 @@ discard block |
||
1036 | 1036 | * @return \EEM_Base |
1037 | 1037 | * @throws \EE_Error |
1038 | 1038 | */ |
1039 | - public function reset_model( $model_name ) { |
|
1040 | - $model = $this->load_model( $model_name ); |
|
1041 | - $model_class_name = get_class( $model ); |
|
1039 | + public function reset_model($model_name) { |
|
1040 | + $model = $this->load_model($model_name); |
|
1041 | + $model_class_name = get_class($model); |
|
1042 | 1042 | //get that model reset it and make sure we nuke the old reference to it |
1043 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
1043 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
1044 | 1044 | $this->LIB->{$model_class_name} = $model::reset(); |
1045 | 1045 | } else { |
1046 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
1046 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
1047 | 1047 | } |
1048 | 1048 | return $this->LIB->{$model_class_name}; |
1049 | 1049 | } |
@@ -1061,15 +1061,15 @@ discard block |
||
1061 | 1061 | * currently reinstantiate the singletons at the moment) |
1062 | 1062 | * @return EE_Registry |
1063 | 1063 | */ |
1064 | - public static function reset( $hard = false, $reinstantiate = true ) { |
|
1064 | + public static function reset($hard = false, $reinstantiate = true) { |
|
1065 | 1065 | $instance = self::instance(); |
1066 | 1066 | EEH_Activation::reset(); |
1067 | 1067 | $instance->_cache_on = true; |
1068 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
1068 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
1069 | 1069 | $instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset(); |
1070 | 1070 | $instance->LIB = new stdClass(); |
1071 | - foreach ( array_keys( $instance->non_abstract_db_models ) as $model_name ) { |
|
1072 | - $instance->reset_model( $model_name ); |
|
1071 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
1072 | + $instance->reset_model($model_name); |
|
1073 | 1073 | } |
1074 | 1074 | return $instance; |
1075 | 1075 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | * @param $a |
1090 | 1090 | * @param $b |
1091 | 1091 | */ |
1092 | - final function __call( $a, $b ) { |
|
1092 | + final function __call($a, $b) { |
|
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | /** |
1098 | 1098 | * @param $a |
1099 | 1099 | */ |
1100 | - final function __get( $a ) { |
|
1100 | + final function __get($a) { |
|
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | * @param $a |
1107 | 1107 | * @param $b |
1108 | 1108 | */ |
1109 | - final function __set( $a, $b ) { |
|
1109 | + final function __set($a, $b) { |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | /** |
1115 | 1115 | * @param $a |
1116 | 1116 | */ |
1117 | - final function __isset( $a ) { |
|
1117 | + final function __isset($a) { |
|
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | /** |
1123 | 1123 | * @param $a |
1124 | 1124 | */ |
1125 | - final function __unset( $a ) { |
|
1125 | + final function __unset($a) { |
|
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | * @param $a |
1170 | 1170 | * @param $b |
1171 | 1171 | */ |
1172 | - final static function __callStatic( $a, $b ) { |
|
1172 | + final static function __callStatic($a, $b) { |
|
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | /** |
@@ -1178,9 +1178,9 @@ discard block |
||
1178 | 1178 | */ |
1179 | 1179 | public function cpt_models() { |
1180 | 1180 | $cpt_models = array(); |
1181 | - foreach( $this->non_abstract_db_models as $short_name => $classname ) { |
|
1182 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
1183 | - $cpt_models[ $short_name ] = $classname; |
|
1181 | + foreach ($this->non_abstract_db_models as $short_name => $classname) { |
|
1182 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
1183 | + $cpt_models[$short_name] = $classname; |
|
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | return $cpt_models; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * remove param |
352 | 352 | * |
353 | 353 | * @access public |
354 | - * @param $key |
|
354 | + * @param string $key |
|
355 | 355 | * @return void |
356 | 356 | */ |
357 | 357 | public function un_set( $key ) { |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * add_output |
392 | 392 | * |
393 | 393 | * @access public |
394 | - * @param $string |
|
394 | + * @param string $string |
|
395 | 395 | * @return void |
396 | 396 | */ |
397 | 397 | public function add_output( $string ) { |
@@ -456,14 +456,14 @@ discard block |
||
456 | 456 | |
457 | 457 | |
458 | 458 | /** |
459 | - * @return bool |
|
459 | + * @return boolean|null |
|
460 | 460 | */ |
461 | 461 | public function __clone() {} |
462 | 462 | |
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
466 | - * @return bool |
|
466 | + * @return boolean|null |
|
467 | 467 | */ |
468 | 468 | public function __wakeup() {} |
469 | 469 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * class EE_Request_Handler |
4 | 4 | * |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * @param EE_Request $request |
51 | 51 | * @return \EE_Request_Handler |
52 | 52 | */ |
53 | - public function __construct( EE_Request $request ) { |
|
53 | + public function __construct(EE_Request $request) { |
|
54 | 54 | // grab request vars |
55 | 55 | $this->_params = $request->params(); |
56 | 56 | // AJAX ??? |
57 | - $this->ajax = defined( 'DOING_AJAX' ) && DOING_AJAX ? true : false; |
|
58 | - $this->front_ajax = defined( 'EE_FRONT_AJAX' ) && EE_FRONT_AJAX ? true : false; |
|
59 | - do_action( 'AHEE__EE_Request_Handler__construct__complete' ); |
|
57 | + $this->ajax = defined('DOING_AJAX') && DOING_AJAX ? true : false; |
|
58 | + $this->front_ajax = defined('EE_FRONT_AJAX') && EE_FRONT_AJAX ? true : false; |
|
59 | + do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param WP $wp |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function parse_request( $wp = null ) { |
|
71 | + public function parse_request($wp = null) { |
|
72 | 72 | //if somebody forgot to provide us with WP, that's ok because its global |
73 | - if ( ! $wp instanceof WP ) { |
|
73 | + if ( ! $wp instanceof WP) { |
|
74 | 74 | global $wp; |
75 | 75 | } |
76 | - $this->set_request_vars( $wp ); |
|
76 | + $this->set_request_vars($wp); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | * @param WP $wp |
86 | 86 | * @return void |
87 | 87 | */ |
88 | - public function set_request_vars( $wp = null ) { |
|
89 | - if ( ! is_admin() ) { |
|
88 | + public function set_request_vars($wp = null) { |
|
89 | + if ( ! is_admin()) { |
|
90 | 90 | // set request post_id |
91 | - $this->set( 'post_id', $this->get_post_id_from_request( $wp )); |
|
91 | + $this->set('post_id', $this->get_post_id_from_request($wp)); |
|
92 | 92 | // set request post name |
93 | - $this->set( 'post_name', $this->get_post_name_from_request( $wp )); |
|
93 | + $this->set('post_name', $this->get_post_name_from_request($wp)); |
|
94 | 94 | // set request post_type |
95 | - $this->set( 'post_type', $this->get_post_type_from_request( $wp )); |
|
95 | + $this->set('post_type', $this->get_post_type_from_request($wp)); |
|
96 | 96 | // true or false ? is this page being used by EE ? |
97 | 97 | $this->set_espresso_page(); |
98 | 98 | } |
@@ -107,19 +107,19 @@ discard block |
||
107 | 107 | * @param WP $wp |
108 | 108 | * @return int |
109 | 109 | */ |
110 | - public function get_post_id_from_request( $wp = null ) { |
|
111 | - if ( ! $wp instanceof WP ){ |
|
110 | + public function get_post_id_from_request($wp = null) { |
|
111 | + if ( ! $wp instanceof WP) { |
|
112 | 112 | global $wp; |
113 | 113 | } |
114 | 114 | $post_id = null; |
115 | - if ( isset( $wp->query_vars['p'] )) { |
|
115 | + if (isset($wp->query_vars['p'])) { |
|
116 | 116 | $post_id = $wp->query_vars['p']; |
117 | 117 | } |
118 | - if ( ! $post_id && isset( $wp->query_vars['page_id'] )) { |
|
118 | + if ( ! $post_id && isset($wp->query_vars['page_id'])) { |
|
119 | 119 | $post_id = $wp->query_vars['page_id']; |
120 | 120 | } |
121 | - if ( ! $post_id && isset( $wp->request ) && is_numeric( basename( $wp->request ))) { |
|
122 | - $post_id = basename( $wp->request ); |
|
121 | + if ( ! $post_id && isset($wp->request) && is_numeric(basename($wp->request))) { |
|
122 | + $post_id = basename($wp->request); |
|
123 | 123 | } |
124 | 124 | return $post_id; |
125 | 125 | } |
@@ -133,35 +133,35 @@ discard block |
||
133 | 133 | * @param WP $wp |
134 | 134 | * @return string |
135 | 135 | */ |
136 | - public function get_post_name_from_request( $wp = null ) { |
|
137 | - if ( ! $wp instanceof WP ){ |
|
136 | + public function get_post_name_from_request($wp = null) { |
|
137 | + if ( ! $wp instanceof WP) { |
|
138 | 138 | global $wp; |
139 | 139 | } |
140 | 140 | $post_name = null; |
141 | - if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) { |
|
141 | + if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) { |
|
142 | 142 | $post_name = $wp->query_vars['name']; |
143 | 143 | } |
144 | - if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) { |
|
144 | + if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
145 | 145 | $post_name = $wp->query_vars['pagename']; |
146 | 146 | } |
147 | - if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) { |
|
148 | - $possible_post_name = basename( $wp->request ); |
|
149 | - if ( ! is_numeric( $possible_post_name )) { |
|
147 | + if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) { |
|
148 | + $possible_post_name = basename($wp->request); |
|
149 | + if ( ! is_numeric($possible_post_name)) { |
|
150 | 150 | /** @type WPDB $wpdb */ |
151 | 151 | global $wpdb; |
152 | 152 | $SQL = "SELECT ID from $wpdb->posts WHERE post_status='publish' AND post_name=%s"; |
153 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name )); |
|
154 | - if ( $possible_post_name ) { |
|
153 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name)); |
|
154 | + if ($possible_post_name) { |
|
155 | 155 | $post_name = $possible_post_name; |
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
159 | - if ( ! $post_name && $this->get( 'post_id' )) { |
|
159 | + if ( ! $post_name && $this->get('post_id')) { |
|
160 | 160 | /** @type WPDB $wpdb */ |
161 | 161 | global $wpdb; |
162 | 162 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_status='publish' AND ID=%d"; |
163 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' ))); |
|
164 | - if( $possible_post_name ) { |
|
163 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id'))); |
|
164 | + if ($possible_post_name) { |
|
165 | 165 | $post_name = $possible_post_name; |
166 | 166 | } |
167 | 167 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * @param WP $wp |
178 | 178 | * @return mixed |
179 | 179 | */ |
180 | - public function get_post_type_from_request( $wp = null ) { |
|
181 | - if ( ! $wp instanceof WP ){ |
|
180 | + public function get_post_type_from_request($wp = null) { |
|
181 | + if ( ! $wp instanceof WP) { |
|
182 | 182 | global $wp; |
183 | 183 | } |
184 | - return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null; |
|
184 | + return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -191,18 +191,18 @@ discard block |
||
191 | 191 | * @param WP $wp |
192 | 192 | * @return bool|string|void |
193 | 193 | */ |
194 | - public function get_current_page_permalink( $wp = null ) { |
|
195 | - $post_id = $this->get_post_id_from_request( $wp ); |
|
196 | - if ( $post_id ) { |
|
197 | - $current_page_permalink = get_permalink( $post_id ); |
|
194 | + public function get_current_page_permalink($wp = null) { |
|
195 | + $post_id = $this->get_post_id_from_request($wp); |
|
196 | + if ($post_id) { |
|
197 | + $current_page_permalink = get_permalink($post_id); |
|
198 | 198 | } else { |
199 | - if ( ! $wp instanceof WP ) { |
|
199 | + if ( ! $wp instanceof WP) { |
|
200 | 200 | global $wp; |
201 | 201 | } |
202 | - if ( $wp->request ) { |
|
203 | - $current_page_permalink = site_url( $wp->request ); |
|
202 | + if ($wp->request) { |
|
203 | + $current_page_permalink = site_url($wp->request); |
|
204 | 204 | } else { |
205 | - $current_page_permalink = esc_url( site_url( $_SERVER[ 'REQUEST_URI' ] ) ); |
|
205 | + $current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI'])); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | return $current_page_permalink; |
@@ -219,41 +219,41 @@ discard block |
||
219 | 219 | public function test_for_espresso_page() { |
220 | 220 | global $wp; |
221 | 221 | /** @type EE_CPT_Strategy $EE_CPT_Strategy */ |
222 | - $EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
222 | + $EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy'); |
|
223 | 223 | $espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies(); |
224 | - if ( is_array( $espresso_CPT_taxonomies ) ) { |
|
225 | - foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) { |
|
226 | - if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) { |
|
224 | + if (is_array($espresso_CPT_taxonomies)) { |
|
225 | + foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) { |
|
226 | + if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) { |
|
227 | 227 | return true; |
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
231 | 231 | // load espresso CPT endpoints |
232 | 232 | $espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints(); |
233 | - $post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints ); |
|
234 | - $post_types = (array)$this->get( 'post_type' ); |
|
235 | - foreach ( $post_types as $post_type ) { |
|
233 | + $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints); |
|
234 | + $post_types = (array) $this->get('post_type'); |
|
235 | + foreach ($post_types as $post_type) { |
|
236 | 236 | // was a post name passed ? |
237 | - if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) { |
|
237 | + if (isset($post_type_CPT_endpoints[$post_type])) { |
|
238 | 238 | // kk we know this is an espresso page, but is it a specific post ? |
239 | - if ( ! $this->get( 'post_name' ) ) { |
|
239 | + if ( ! $this->get('post_name')) { |
|
240 | 240 | // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events |
241 | - $post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null; |
|
241 | + $post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null; |
|
242 | 242 | // if the post type matches on of our then set the endpoint |
243 | - if ( $post_name ) { |
|
244 | - $this->set( 'post_name', $post_name ); |
|
243 | + if ($post_name) { |
|
244 | + $this->set('post_name', $post_name); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | return true; |
248 | 248 | } |
249 | 249 | } |
250 | - if ( $this->get( 'post_name' )) { |
|
250 | + if ($this->get('post_name')) { |
|
251 | 251 | // load all pages using espresso shortcodes |
252 | - $post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
252 | + $post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
253 | 253 | // make sure core pages are included |
254 | - $espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes ); |
|
254 | + $espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes); |
|
255 | 255 | // was a post name passed ? |
256 | - if ( isset( $espresso_pages[ $this->get( 'post_name' ) ] )) { |
|
256 | + if (isset($espresso_pages[$this->get('post_name')])) { |
|
257 | 257 | return true; |
258 | 258 | } |
259 | 259 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param null|bool $value |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | - public function set_espresso_page( $value = null ) { |
|
272 | + public function set_espresso_page($value = null) { |
|
273 | 273 | $value = $value ? $value : $this->test_for_espresso_page(); |
274 | 274 | $this->_params['is_espresso_page'] = $value; |
275 | 275 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @return mixed |
284 | 284 | */ |
285 | 285 | public function is_espresso_page() { |
286 | - return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false; |
|
286 | + return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | * @param bool $override_ee |
308 | 308 | * @return void |
309 | 309 | */ |
310 | - public function set( $key, $value, $override_ee = false ) { |
|
310 | + public function set($key, $value, $override_ee = false) { |
|
311 | 311 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
312 | 312 | if ( |
313 | 313 | $key !== 'ee' || |
314 | - ( $key === 'ee' && empty( $this->_params['ee'] )) |
|
315 | - || ( $key === 'ee' && ! empty( $this->_params['ee'] ) && $override_ee ) |
|
314 | + ($key === 'ee' && empty($this->_params['ee'])) |
|
315 | + || ($key === 'ee' && ! empty($this->_params['ee']) && $override_ee) |
|
316 | 316 | ) { |
317 | - $this->_params[ $key ] = $value; |
|
317 | + $this->_params[$key] = $value; |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * @param null $default |
329 | 329 | * @return mixed |
330 | 330 | */ |
331 | - public function get( $key, $default = null ) { |
|
332 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
331 | + public function get($key, $default = null) { |
|
332 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * @param $key |
342 | 342 | * @return boolean |
343 | 343 | */ |
344 | - public function is_set( $key ) { |
|
345 | - return isset( $this->_params[ $key ] ) ? true : false; |
|
344 | + public function is_set($key) { |
|
345 | + return isset($this->_params[$key]) ? true : false; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param $key |
355 | 355 | * @return void |
356 | 356 | */ |
357 | - public function un_set( $key ) { |
|
358 | - unset( $this->_params[ $key ] ); |
|
357 | + public function un_set($key) { |
|
358 | + unset($this->_params[$key]); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | * @param $value |
369 | 369 | * @return void |
370 | 370 | */ |
371 | - public function set_notice( $key, $value ) { |
|
372 | - $this->_notice[ $key ] = $value; |
|
371 | + public function set_notice($key, $value) { |
|
372 | + $this->_notice[$key] = $value; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | * @param $key |
382 | 382 | * @return mixed |
383 | 383 | */ |
384 | - public function get_notice( $key ) { |
|
385 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null; |
|
384 | + public function get_notice($key) { |
|
385 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : null; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * @param $string |
395 | 395 | * @return void |
396 | 396 | */ |
397 | - public function add_output( $string ) { |
|
397 | + public function add_output($string) { |
|
398 | 398 | $this->_output .= $string; |
399 | 399 | } |
400 | 400 | |
@@ -416,8 +416,8 @@ discard block |
||
416 | 416 | * @param $item |
417 | 417 | * @param $key |
418 | 418 | */ |
419 | - public function sanitize_text_field_for_array_walk( &$item, &$key ) { |
|
420 | - $item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item ); |
|
419 | + public function sanitize_text_field_for_array_walk(&$item, &$key) { |
|
420 | + $item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @param $b |
428 | 428 | * @return bool |
429 | 429 | */ |
430 | - public function __set($a,$b) { return false; } |
|
430 | + public function __set($a, $b) { return false; } |
|
431 | 431 | |
432 | 432 | |
433 | 433 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * |
@@ -65,26 +65,26 @@ discard block |
||
65 | 65 | * @param EE_Response $response |
66 | 66 | * @return EE_Response |
67 | 67 | */ |
68 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
68 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
69 | 69 | $this->request = $request; |
70 | 70 | $this->response = $response; |
71 | 71 | // info about how to load classes required by other classes |
72 | 72 | $this->dependency_map = $this->_load_dependency_map(); |
73 | 73 | // central repository for classes |
74 | 74 | $this->registry = $this->_load_registry(); |
75 | - do_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading' ); |
|
75 | + do_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading'); |
|
76 | 76 | // PSR4 Autoloaders |
77 | - $this->registry->load_core( 'EE_Psr4AutoloaderInit' ); |
|
77 | + $this->registry->load_core('EE_Psr4AutoloaderInit'); |
|
78 | 78 | // workarounds for PHP < 5.3 |
79 | 79 | $this->_load_class_tools(); |
80 | 80 | // load interfaces |
81 | - espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' ); |
|
81 | + espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'); |
|
82 | 82 | // deprecated functions |
83 | - espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' ); |
|
83 | + espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php'); |
|
84 | 84 | // WP cron jobs |
85 | - $this->registry->load_core( 'Cron_Tasks' ); |
|
86 | - $this->registry->load_core( 'EE_Request_Handler' ); |
|
87 | - $this->registry->load_core( 'EE_System' ); |
|
85 | + $this->registry->load_core('Cron_Tasks'); |
|
86 | + $this->registry->load_core('EE_Request_Handler'); |
|
87 | + $this->registry->load_core('EE_System'); |
|
88 | 88 | |
89 | 89 | return $this->response; |
90 | 90 | } |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @throws \EE_Error |
115 | 115 | */ |
116 | 116 | public function dependency_map() { |
117 | - if ( ! $this->dependency_map instanceof EE_Dependency_Map ) { |
|
117 | + if ( ! $this->dependency_map instanceof EE_Dependency_Map) { |
|
118 | 118 | throw new EE_Error( |
119 | 119 | sprintf( |
120 | - __( 'Invalid EE_Dependency_Map: "%1$s"', 'event_espresso' ), |
|
121 | - print_r( $this->dependency_map, true ) |
|
120 | + __('Invalid EE_Dependency_Map: "%1$s"', 'event_espresso'), |
|
121 | + print_r($this->dependency_map, true) |
|
122 | 122 | ) |
123 | 123 | ); |
124 | 124 | } |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | * @throws \EE_Error |
133 | 133 | */ |
134 | 134 | public function registry() { |
135 | - if ( ! $this->registry instanceof EE_Registry ) { |
|
135 | + if ( ! $this->registry instanceof EE_Registry) { |
|
136 | 136 | throw new EE_Error( |
137 | 137 | sprintf( |
138 | - __( 'Invalid EE_Registry: "%1$s"', 'event_espresso' ), |
|
139 | - print_r( $this->registry, true ) |
|
138 | + __('Invalid EE_Registry: "%1$s"', 'event_espresso'), |
|
139 | + print_r($this->registry, true) |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | } |
@@ -152,15 +152,15 @@ discard block |
||
152 | 152 | * @return EE_Dependency_Map |
153 | 153 | */ |
154 | 154 | private function _load_dependency_map() { |
155 | - if ( ! is_readable( EE_CORE . 'EE_Dependency_Map.core.php' ) ) { |
|
155 | + if ( ! is_readable(EE_CORE.'EE_Dependency_Map.core.php')) { |
|
156 | 156 | EE_Error::add_error( |
157 | - __( 'The EE_Dependency_Map core class could not be loaded.', 'event_espresso' ), |
|
157 | + __('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'), |
|
158 | 158 | __FILE__, __FUNCTION__, __LINE__ |
159 | 159 | ); |
160 | - wp_die( EE_Error::get_notices() ); |
|
160 | + wp_die(EE_Error::get_notices()); |
|
161 | 161 | } |
162 | - require_once( EE_CORE . 'EE_Dependency_Map.core.php' ); |
|
163 | - return EE_Dependency_Map::instance( $this->request, $this->response ); |
|
162 | + require_once(EE_CORE.'EE_Dependency_Map.core.php'); |
|
163 | + return EE_Dependency_Map::instance($this->request, $this->response); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -172,15 +172,15 @@ discard block |
||
172 | 172 | * @return EE_Registry |
173 | 173 | */ |
174 | 174 | private function _load_registry() { |
175 | - if ( ! is_readable( EE_CORE . 'EE_Registry.core.php' )) { |
|
175 | + if ( ! is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
176 | 176 | EE_Error::add_error( |
177 | - __( 'The EE_Registry core class could not be loaded.', 'event_espresso' ), |
|
177 | + __('The EE_Registry core class could not be loaded.', 'event_espresso'), |
|
178 | 178 | __FILE__, __FUNCTION__, __LINE__ |
179 | 179 | ); |
180 | - wp_die( EE_Error::get_notices() ); |
|
180 | + wp_die(EE_Error::get_notices()); |
|
181 | 181 | } |
182 | - require_once( EE_CORE . 'EE_Registry.core.php' ); |
|
183 | - return EE_Registry::instance( $this->dependency_map ); |
|
182 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
183 | + return EE_Registry::instance($this->dependency_map); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | * @return void |
192 | 192 | */ |
193 | 193 | private function _load_class_tools() { |
194 | - if ( ! is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) { |
|
194 | + if ( ! is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
195 | 195 | EE_Error::add_error( |
196 | - __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ), |
|
196 | + __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'), |
|
197 | 197 | __FILE__, __FUNCTION__, __LINE__ |
198 | 198 | ); |
199 | 199 | } |
200 | - require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' ); |
|
200 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | * @param \EE_Request $request |
212 | 212 | * @param \EE_Response $response |
213 | 213 | */ |
214 | - public function handle_response( EE_Request $request, EE_Response $response ) { |
|
214 | + public function handle_response(EE_Request $request, EE_Response $response) { |
|
215 | 215 | //\EEH_Debug_Tools::printr( __FUNCTION__, __CLASS__, __FILE__, __LINE__, 2 ); |
216 | 216 | //EEH_Debug_Tools::printr( $request, '$request', __FILE__, __LINE__ ); |
217 | 217 | //EEH_Debug_Tools::printr( $response, '$response', __FILE__, __LINE__ ); |
218 | 218 | //die(); |
219 | - if ( $response->plugin_deactivated() ) { |
|
220 | - espresso_deactivate_plugin( EE_PLUGIN_BASENAME ); |
|
219 | + if ($response->plugin_deactivated()) { |
|
220 | + espresso_deactivate_plugin(EE_PLUGIN_BASENAME); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | public static function set_hooks() { |
94 | - add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 ); |
|
94 | + add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -104,22 +104,22 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public static function set_hooks_admin() { |
106 | 106 | // AJAX for IPN monitoring |
107 | - add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 ); |
|
107 | + add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3); |
|
108 | 108 | add_filter( |
109 | 109 | 'heartbeat_nopriv_received', |
110 | - array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), |
|
110 | + array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), |
|
111 | 111 | 10, |
112 | 112 | 3 |
113 | 113 | ); |
114 | 114 | add_action( |
115 | 115 | 'wp_ajax_espresso_resend_reg_confirmation_email', |
116 | - array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), |
|
116 | + array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), |
|
117 | 117 | 10, |
118 | 118 | 2 |
119 | 119 | ); |
120 | 120 | add_action( |
121 | 121 | 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', |
122 | - array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), |
|
122 | + array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), |
|
123 | 123 | 10, |
124 | 124 | 2 |
125 | 125 | ); |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @return void |
135 | 135 | */ |
136 | 136 | public static function set_definitions() { |
137 | - define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
138 | - define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ ) ) . 'templates' . DS ); |
|
137 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
138 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | * @return EE_Transaction |
148 | 148 | */ |
149 | 149 | public function get_txn() { |
150 | - if ( $this->_current_txn instanceof EE_Transaction ) { |
|
150 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
151 | 151 | return $this->_current_txn; |
152 | 152 | } |
153 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
154 | - if ( ! $TXN_model instanceof EEM_Transaction ) { |
|
153 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
154 | + if ( ! $TXN_model instanceof EEM_Transaction) { |
|
155 | 155 | EE_Error::add_error( |
156 | - __( 'The transaction model could not be established.', 'event_espresso' ), |
|
156 | + __('The transaction model could not be established.', 'event_espresso'), |
|
157 | 157 | __FILE__, |
158 | 158 | __FUNCTION__, |
159 | 159 | __LINE__ |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | return null; |
162 | 162 | } |
163 | 163 | //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
164 | - $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link ); |
|
164 | + $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
165 | 165 | // verify TXN |
166 | - if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) { |
|
166 | + if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
167 | 167 | EE_Error::add_error( |
168 | 168 | __( |
169 | 169 | 'No transaction information could be retrieved or the transaction data is not of the correct type.', |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | * @param int $since |
188 | 188 | * @return mixed array of EE_Payment || FALSE |
189 | 189 | */ |
190 | - public function get_txn_payments( $since = 0 ) { |
|
191 | - if ( ! $this->get_txn() ) { |
|
190 | + public function get_txn_payments($since = 0) { |
|
191 | + if ( ! $this->get_txn()) { |
|
192 | 192 | return false; |
193 | 193 | } |
194 | - $args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' ) ); |
|
195 | - if ( $since > 0 ) { |
|
196 | - $args[0] = array( 'PAY_timestamp' => array( '>', $since ) ); |
|
194 | + $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
195 | + if ($since > 0) { |
|
196 | + $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
197 | 197 | } |
198 | 198 | // get array of payments with most recent first |
199 | - return $this->_current_txn->payments( $args ); |
|
199 | + return $this->_current_txn->payments($args); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | * @return void |
209 | 209 | */ |
210 | 210 | private function _get_reg_url_link() { |
211 | - if ( ! empty( $this->_reg_url_link ) ) { |
|
211 | + if ( ! empty($this->_reg_url_link)) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | 214 | // only do thank you page stuff if we have a REG_url_link in the url |
215 | - if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' ) ) { |
|
215 | + if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
216 | 216 | EE_Error::add_error( |
217 | 217 | __( |
218 | 218 | 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | return; |
226 | 226 | } |
227 | 227 | // check for reg_url_link |
228 | - $this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' ); |
|
228 | + $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * @param string $reg_url_link |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function set_reg_url_link( $reg_url_link = null ) { |
|
241 | - $this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link; |
|
240 | + public function set_reg_url_link($reg_url_link = null) { |
|
241 | + $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -251,28 +251,28 @@ discard block |
||
251 | 251 | * @param WP $WP |
252 | 252 | * @return void |
253 | 253 | */ |
254 | - public function run( WP $WP ) { |
|
254 | + public function run(WP $WP) { |
|
255 | 255 | // remove site_url() from thank you page URL |
256 | - $thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) ); |
|
256 | + $thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url())); |
|
257 | 257 | // remove other non-essential details from URL |
258 | - $thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' ); |
|
258 | + $thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/'); |
|
259 | 259 | // ensure this shortcode doesn't trigger on anything BUT the thank you page |
260 | - if ( isset( $WP->request ) && trim( $WP->request, '/' ) !== $thank_you_page_URL ) { |
|
260 | + if (isset($WP->request) && trim($WP->request, '/') !== $thank_you_page_URL) { |
|
261 | 261 | return; |
262 | 262 | } else if ( |
263 | - isset( $WP->query_vars['page_id'] ) |
|
264 | - && (int)$WP->query_vars['page_id'] !== (int)EE_Registry::instance()->CFG->core->thank_you_page_id |
|
263 | + isset($WP->query_vars['page_id']) |
|
264 | + && (int) $WP->query_vars['page_id'] !== (int) EE_Registry::instance()->CFG->core->thank_you_page_id |
|
265 | 265 | ) { |
266 | 266 | return; |
267 | 267 | } |
268 | 268 | $this->_get_reg_url_link(); |
269 | 269 | // resend_reg_confirmation_email ? |
270 | - if ( EE_Registry::instance()->REQ->is_set( 'resend' ) ) { |
|
270 | + if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
271 | 271 | EES_Espresso_Thank_You::resend_reg_confirmation_email(); |
272 | 272 | } |
273 | 273 | // load assets |
274 | - add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 ); |
|
275 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
274 | + add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
275 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
276 | 276 | $this->_translate_strings(); |
277 | 277 | } |
278 | 278 | |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | public function load_js() { |
327 | 327 | wp_register_script( |
328 | 328 | 'thank_you_page', |
329 | - THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
330 | - array( 'espresso_core', 'heartbeat' ), |
|
329 | + THANK_YOU_ASSETS_URL.'thank_you_page.js', |
|
330 | + array('espresso_core', 'heartbeat'), |
|
331 | 331 | EVENT_ESPRESSO_VERSION, |
332 | 332 | true |
333 | 333 | ); |
334 | - wp_enqueue_script( 'thank_you_page' ); |
|
334 | + wp_enqueue_script('thank_you_page'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function init() { |
347 | 347 | $this->_get_reg_url_link(); |
348 | - if ( ! $this->get_txn() ) { |
|
348 | + if ( ! $this->get_txn()) { |
|
349 | 349 | echo EEH_HTML::div( |
350 | - EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) . |
|
350 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', ''). |
|
351 | 351 | sprintf( |
352 | 352 | __( |
353 | 353 | 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | return null; |
362 | 362 | } |
363 | 363 | // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
364 | - if ( $this->_current_txn->status_ID() === EEM_Transaction::failed_status_code ) { |
|
365 | - $this->_current_txn->set_status( EEM_Transaction::incomplete_status_code ); |
|
364 | + if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) { |
|
365 | + $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
366 | 366 | $this->_current_txn->save(); |
367 | 367 | } |
368 | 368 | $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration |
@@ -375,15 +375,15 @@ discard block |
||
375 | 375 | ); |
376 | 376 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
377 | 377 | // txn status ? |
378 | - if ( $this->_current_txn->is_completed() ) { |
|
378 | + if ($this->_current_txn->is_completed()) { |
|
379 | 379 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
380 | 380 | } else if ( |
381 | 381 | $this->_current_txn->is_incomplete() |
382 | - && ( $this->_primary_registrant->is_approved() |
|
383 | - || $this->_primary_registrant->is_pending_payment() ) |
|
382 | + && ($this->_primary_registrant->is_approved() |
|
383 | + || $this->_primary_registrant->is_pending_payment()) |
|
384 | 384 | ) { |
385 | 385 | $this->_show_try_pay_again_link = true; |
386 | - } else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) { |
|
386 | + } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
387 | 387 | // its pending |
388 | 388 | $this->_show_try_pay_again_link = isset( |
389 | 389 | EE_Registry::instance()->CFG->registration->show_pending_payment_options |
@@ -409,21 +409,21 @@ discard block |
||
409 | 409 | } |
410 | 410 | // link to SPCO |
411 | 411 | $revisit_spco_url = add_query_arg( |
412 | - array( 'ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link ), |
|
412 | + array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link), |
|
413 | 413 | EE_Registry::instance()->CFG->core->reg_page_url() |
414 | 414 | ); |
415 | 415 | // link to SPCO payment_options |
416 | 416 | $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration |
417 | 417 | ? $this->_primary_registrant->payment_overview_url() |
418 | 418 | : add_query_arg( |
419 | - array( 'step' => 'payment_options' ), |
|
419 | + array('step' => 'payment_options'), |
|
420 | 420 | $revisit_spco_url |
421 | 421 | ); |
422 | 422 | // link to SPCO attendee_information |
423 | 423 | $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration |
424 | 424 | ? $this->_primary_registrant->edit_attendee_information_url() |
425 | 425 | : false; |
426 | - do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn ); |
|
426 | + do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn); |
|
427 | 427 | // set no cache headers and constants |
428 | 428 | EE_System::do_not_cache(); |
429 | 429 | } |
@@ -438,15 +438,15 @@ discard block |
||
438 | 438 | * @return string |
439 | 439 | * @throws \EE_Error |
440 | 440 | */ |
441 | - public function process_shortcode( $attributes = array() ) { |
|
441 | + public function process_shortcode($attributes = array()) { |
|
442 | 442 | $this->init(); |
443 | - if ( ! $this->_current_txn instanceof EE_Transaction ) { |
|
443 | + if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
444 | 444 | return EE_Error::get_notices(); |
445 | 445 | } |
446 | 446 | //EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 'EE_Transaction: ' . $this->_current_txn->ID() ); |
447 | 447 | // link to receipt |
448 | - $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' ); |
|
449 | - if ( ! empty( $template_args['TXN_receipt_url'] ) ) { |
|
448 | + $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
449 | + if ( ! empty($template_args['TXN_receipt_url'])) { |
|
450 | 450 | $template_args['order_conf_desc'] = __( |
451 | 451 | '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', |
452 | 452 | 'event_espresso' |
@@ -458,13 +458,13 @@ discard block |
||
458 | 458 | ); |
459 | 459 | } |
460 | 460 | $template_args['transaction'] = $this->_current_txn; |
461 | - $template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', false ); |
|
462 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' ) ); |
|
463 | - if ( $this->_is_primary && ! $this->_current_txn->is_free() ) { |
|
464 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' ) ); |
|
461 | + $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false); |
|
462 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
463 | + if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
464 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
465 | 465 | } |
466 | 466 | return EEH_Template::locate_template( |
467 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
467 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', |
|
468 | 468 | $template_args, |
469 | 469 | true, |
470 | 470 | true |
@@ -485,15 +485,15 @@ discard block |
||
485 | 485 | * @return array |
486 | 486 | * @throws \EE_Error |
487 | 487 | */ |
488 | - public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) { |
|
488 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) { |
|
489 | 489 | // does this heartbeat contain our data ? |
490 | - if ( ! isset( $data['espresso_thank_you_page'] ) ) { |
|
490 | + if ( ! isset($data['espresso_thank_you_page'])) { |
|
491 | 491 | return $response; |
492 | 492 | } |
493 | 493 | // check for reg_url_link in the incoming heartbeat data |
494 | - if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] ) ) { |
|
494 | + if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
495 | 495 | $response['espresso_thank_you_page'] = array( |
496 | - 'errors' => ! empty( $notices['errors'] ) |
|
496 | + 'errors' => ! empty($notices['errors']) |
|
497 | 497 | ? $notices['errors'] |
498 | 498 | : __( |
499 | 499 | 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
@@ -508,15 +508,15 @@ discard block |
||
508 | 508 | EES_Espresso_Thank_You::set_definitions(); |
509 | 509 | /** @var $espresso_thank_you_page EES_Espresso_Thank_You */ |
510 | 510 | $espresso_thank_you_page = EES_Espresso_Thank_You::instance(); |
511 | - $espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] ); |
|
511 | + $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
512 | 512 | $espresso_thank_you_page->init(); |
513 | 513 | //get TXN |
514 | 514 | $TXN = $espresso_thank_you_page->get_txn(); |
515 | 515 | // no TXN? then get out |
516 | - if ( ! $TXN instanceof EE_Transaction ) { |
|
516 | + if ( ! $TXN instanceof EE_Transaction) { |
|
517 | 517 | $notices = EE_Error::get_notices(); |
518 | 518 | $response['espresso_thank_you_page'] = array( |
519 | - 'errors' => ! empty( $notices['errors'] ) |
|
519 | + 'errors' => ! empty($notices['errors']) |
|
520 | 520 | ? $notices['errors'] |
521 | 521 | : sprintf( |
522 | 522 | __( |
@@ -529,13 +529,13 @@ discard block |
||
529 | 529 | return $response; |
530 | 530 | } |
531 | 531 | // grab transient of TXN's status |
532 | - $txn_status = isset( $data['espresso_thank_you_page']['txn_status'] ) |
|
532 | + $txn_status = isset($data['espresso_thank_you_page']['txn_status']) |
|
533 | 533 | ? $data['espresso_thank_you_page']['txn_status'] |
534 | 534 | : null; |
535 | 535 | // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
536 | - if ( $txn_status !== $TXN->status_ID() ) { |
|
536 | + if ($txn_status !== $TXN->status_ID()) { |
|
537 | 537 | // switch between two possible basic outcomes |
538 | - switch ( $TXN->status_ID() ) { |
|
538 | + switch ($TXN->status_ID()) { |
|
539 | 539 | // TXN has been updated in some way |
540 | 540 | case EEM_Transaction::overpaid_status_code: |
541 | 541 | case EEM_Transaction::complete_status_code: |
@@ -550,25 +550,25 @@ discard block |
||
550 | 550 | case EEM_Transaction::failed_status_code: |
551 | 551 | default: |
552 | 552 | // keep on waiting... |
553 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
553 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
554 | 554 | } |
555 | 555 | // or is the TXN still failed (never been updated) ??? |
556 | - } else if ( $TXN->failed() ) { |
|
556 | + } else if ($TXN->failed()) { |
|
557 | 557 | // keep on waiting... |
558 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
558 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
559 | 559 | } |
560 | 560 | // TXN is happening so let's get the payments now |
561 | 561 | // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
562 | - $since = isset( $data['espresso_thank_you_page']['get_payments_since'] ) |
|
562 | + $since = isset($data['espresso_thank_you_page']['get_payments_since']) |
|
563 | 563 | ? $data['espresso_thank_you_page']['get_payments_since'] |
564 | 564 | : 0; |
565 | 565 | // then check for payments |
566 | - $payments = $espresso_thank_you_page->get_txn_payments( $since ); |
|
566 | + $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
567 | 567 | // has a payment been processed ? |
568 | - if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) { |
|
569 | - if ( $since ) { |
|
568 | + if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
569 | + if ($since) { |
|
570 | 570 | $response['espresso_thank_you_page'] = array( |
571 | - 'new_payments' => $espresso_thank_you_page->get_new_payments( $payments ), |
|
571 | + 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
572 | 572 | 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
573 | 573 | 'txn_status' => $TXN->status_ID() |
574 | 574 | ); |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
595 | 595 | * @return array |
596 | 596 | */ |
597 | - private function _update_server_wait_time( $thank_you_page_data = array() ) { |
|
597 | + private function _update_server_wait_time($thank_you_page_data = array()) { |
|
598 | 598 | $response['espresso_thank_you_page'] = array( |
599 | - 'still_waiting' => isset( $thank_you_page_data['initial_access'] ) |
|
599 | + 'still_waiting' => isset($thank_you_page_data['initial_access']) |
|
600 | 600 | ? time() - $thank_you_page_data['initial_access'] |
601 | 601 | : 0, |
602 | 602 | 'txn_status' => $this->_current_txn->status_ID() |
@@ -621,17 +621,17 @@ discard block |
||
621 | 621 | $template_args['is_primary'] = $this->_is_primary; |
622 | 622 | $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
623 | 623 | $template_args['resend_reg_confirmation_url'] = add_query_arg( |
624 | - array( 'token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true' ), |
|
624 | + array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
625 | 625 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
626 | 626 | ); |
627 | 627 | // verify template arguments |
628 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
628 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
629 | 629 | EEH_Template_Validator::verify_isnt_null( |
630 | 630 | $template_args['SPCO_attendee_information_url'], |
631 | 631 | '$SPCO_attendee_information_url' |
632 | 632 | ); |
633 | 633 | echo EEH_Template::locate_template( |
634 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
634 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', |
|
635 | 635 | $template_args, |
636 | 636 | true, |
637 | 637 | true |
@@ -644,16 +644,16 @@ discard block |
||
644 | 644 | * resend_reg_confirmation_email |
645 | 645 | */ |
646 | 646 | public static function resend_reg_confirmation_email() { |
647 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
648 | - $reg_url_link = EE_Registry::instance()->REQ->get( 'token' ); |
|
647 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
648 | + $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
649 | 649 | // was a REG_ID passed ? |
650 | - if ( $reg_url_link ) { |
|
651 | - $registration = EE_Registry::instance()->load_model( 'Registration' )->get_one( |
|
652 | - array( array( 'REG_url_link' => $reg_url_link ) ) |
|
650 | + if ($reg_url_link) { |
|
651 | + $registration = EE_Registry::instance()->load_model('Registration')->get_one( |
|
652 | + array(array('REG_url_link' => $reg_url_link)) |
|
653 | 653 | ); |
654 | - if ( $registration instanceof EE_Registration ) { |
|
654 | + if ($registration instanceof EE_Registration) { |
|
655 | 655 | // resend email |
656 | - EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() ) ); |
|
656 | + EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
657 | 657 | } else { |
658 | 658 | EE_Error::add_error( |
659 | 659 | __( |
@@ -677,16 +677,16 @@ discard block |
||
677 | 677 | ); |
678 | 678 | } |
679 | 679 | // request sent via AJAX ? |
680 | - if ( EE_FRONT_AJAX ) { |
|
681 | - echo json_encode( EE_Error::get_notices( false ) ); |
|
680 | + if (EE_FRONT_AJAX) { |
|
681 | + echo json_encode(EE_Error::get_notices(false)); |
|
682 | 682 | die(); |
683 | 683 | // or was JS disabled ? |
684 | 684 | } else { |
685 | 685 | // save errors so that they get picked up on the next request |
686 | - EE_Error::get_notices( true, true ); |
|
686 | + EE_Error::get_notices(true, true); |
|
687 | 687 | wp_safe_redirect( |
688 | 688 | add_query_arg( |
689 | - array( 'e_reg_url_link' => $reg_url_link ), |
|
689 | + array('e_reg_url_link' => $reg_url_link), |
|
690 | 690 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
691 | 691 | ) |
692 | 692 | ); |
@@ -702,26 +702,26 @@ discard block |
||
702 | 702 | * @return void |
703 | 703 | */ |
704 | 704 | public function get_ajax_content() { |
705 | - if ( ! $this->get_txn() ) { |
|
705 | + if ( ! $this->get_txn()) { |
|
706 | 706 | return; |
707 | 707 | } |
708 | 708 | // first determine which event(s) require pre-approval or not |
709 | 709 | $events = array(); |
710 | 710 | $events_requiring_pre_approval = array(); |
711 | - foreach ( $this->_current_txn->registrations() as $registration ) { |
|
712 | - if ( $registration instanceof EE_Registration ) { |
|
711 | + foreach ($this->_current_txn->registrations() as $registration) { |
|
712 | + if ($registration instanceof EE_Registration) { |
|
713 | 713 | $event = $registration->event(); |
714 | - if ( $event instanceof EE_Event ) { |
|
715 | - if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) { |
|
716 | - $events_requiring_pre_approval[ $event->ID() ] = $event; |
|
714 | + if ($event instanceof EE_Event) { |
|
715 | + if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
716 | + $events_requiring_pre_approval[$event->ID()] = $event; |
|
717 | 717 | } else { |
718 | - $events[ $event->ID() ] = $event; |
|
718 | + $events[$event->ID()] = $event; |
|
719 | 719 | } |
720 | 720 | } |
721 | 721 | } |
722 | 722 | } |
723 | - $this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval ); |
|
724 | - $this->display_details_for_events( $events ); |
|
723 | + $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
724 | + $this->display_details_for_events($events); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | * @param EE_Event[] $events |
734 | 734 | * @return string |
735 | 735 | */ |
736 | - public function display_details_for_events( $events = array() ) { |
|
737 | - if ( ! empty( $events ) ) { |
|
736 | + public function display_details_for_events($events = array()) { |
|
737 | + if ( ! empty($events)) { |
|
738 | 738 | ?> |
739 | 739 | <div id="espresso-thank-you-page-ajax-content-dv"> |
740 | 740 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | 'event_espresso' |
747 | 747 | ); ?></span> |
748 | 748 | </div> |
749 | - <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?> |
|
749 | + <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
|
750 | 750 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
751 | 751 | <?php echo apply_filters( |
752 | 752 | 'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | ); ?> |
758 | 758 | <br/> |
759 | 759 | <span class="jst-rght ee-block small-text lt-grey-text"> |
760 | - <?php _e( 'current wait time ', 'event_espresso' ); ?> |
|
760 | + <?php _e('current wait time ', 'event_espresso'); ?> |
|
761 | 761 | <span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span> |
762 | 762 | </p> |
763 | 763 | <?php endif; ?> |
@@ -777,11 +777,11 @@ discard block |
||
777 | 777 | * @param EE_Event[] $events |
778 | 778 | * @return string |
779 | 779 | */ |
780 | - public function display_details_for_events_requiring_pre_approval( $events = array() ) { |
|
781 | - if ( ! empty( $events ) ) { |
|
780 | + public function display_details_for_events_requiring_pre_approval($events = array()) { |
|
781 | + if ( ! empty($events)) { |
|
782 | 782 | ?> |
783 | 783 | <div id="espresso-thank-you-page-not-approved-message-dv"> |
784 | - <h4 class="orange-text"><?php _e( 'Important Notice:', 'event_espresso' ); ?></h4> |
|
784 | + <h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4> |
|
785 | 785 | <p id="events-requiring-pre-approval-pg" class="small-text"> |
786 | 786 | <?php echo apply_filters( |
787 | 787 | 'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message', |
@@ -792,8 +792,8 @@ discard block |
||
792 | 792 | ); ?> |
793 | 793 | </p> |
794 | 794 | <ul class="events-requiring-pre-approval-ul"> |
795 | - <?php foreach ( $events as $event ) { |
|
796 | - if ( $event instanceof EE_Event ) { |
|
795 | + <?php foreach ($events as $event) { |
|
796 | + if ($event instanceof EE_Event) { |
|
797 | 797 | echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', |
798 | 798 | $event->name(), |
799 | 799 | '</li>'; |
@@ -820,12 +820,12 @@ discard block |
||
820 | 820 | $template_args = array(); |
821 | 821 | $template_args['transaction'] = $this->_current_txn; |
822 | 822 | $template_args['reg_url_link'] = $this->_reg_url_link; |
823 | - $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( true ); |
|
823 | + $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true); |
|
824 | 824 | // link to SPCO payment_options |
825 | 825 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
826 | 826 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
827 | 827 | // verify template arguments |
828 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
828 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
829 | 829 | EEH_Template_Validator::verify_isnt_null( |
830 | 830 | $template_args['show_try_pay_again_link'], |
831 | 831 | '$show_try_pay_again_link' |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | '$SPCO_payment_options_url' |
836 | 836 | ); |
837 | 837 | return EEH_Template::locate_template( |
838 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
838 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', |
|
839 | 839 | $template_args, |
840 | 840 | true, |
841 | 841 | true |
@@ -852,9 +852,9 @@ discard block |
||
852 | 852 | * @return string |
853 | 853 | * @throws \EE_Error |
854 | 854 | */ |
855 | - public function get_payment_row_html( $payment = null ) { |
|
855 | + public function get_payment_row_html($payment = null) { |
|
856 | 856 | $html = ''; |
857 | - if ( $payment instanceof EE_Payment ) { |
|
857 | + if ($payment instanceof EE_Payment) { |
|
858 | 858 | if ( |
859 | 859 | $payment->payment_method() instanceof EE_Payment_Method |
860 | 860 | && $payment->status() === EEM_Payment::status_id_failed |
@@ -863,31 +863,31 @@ discard block |
||
863 | 863 | // considering the registrant has made it to the Thank You page, |
864 | 864 | // any failed payments may actually be pending and the IPN is just slow |
865 | 865 | // so let's |
866 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
866 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
867 | 867 | } |
868 | 868 | $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
869 | - ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' |
|
869 | + ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>' |
|
870 | 870 | : ''; |
871 | 871 | $html .= ' |
872 | 872 | <tr> |
873 | 873 | <td> |
874 | - ' . $payment->timestamp() . ' |
|
874 | + ' . $payment->timestamp().' |
|
875 | 875 | </td> |
876 | 876 | <td> |
877 | 877 | ' . ( |
878 | 878 | $payment->payment_method() instanceof EE_Payment_Method |
879 | 879 | ? $payment->payment_method()->name() |
880 | - : __( 'Unknown', 'event_espresso' ) |
|
881 | - ) . ' |
|
880 | + : __('Unknown', 'event_espresso') |
|
881 | + ).' |
|
882 | 882 | </td> |
883 | 883 | <td class="jst-rght"> |
884 | - ' . EEH_Template::format_currency( $payment->amount() ) . ' |
|
884 | + ' . EEH_Template::format_currency($payment->amount()).' |
|
885 | 885 | </td> |
886 | 886 | <td class="jst-rght" style="line-height:1;"> |
887 | - ' . $payment->pretty_status( true ) . $payment_declined_msg . ' |
|
887 | + ' . $payment->pretty_status(true).$payment_declined_msg.' |
|
888 | 888 | </td> |
889 | 889 | </tr>'; |
890 | - do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment ); |
|
890 | + do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
891 | 891 | } |
892 | 892 | return $html; |
893 | 893 | } |
@@ -902,14 +902,14 @@ discard block |
||
902 | 902 | * @return string |
903 | 903 | * @throws \EE_Error |
904 | 904 | */ |
905 | - public function get_payment_details( $payments = array() ) { |
|
905 | + public function get_payment_details($payments = array()) { |
|
906 | 906 | //prepare variables for displaying |
907 | 907 | $template_args = array(); |
908 | 908 | $template_args['transaction'] = $this->_current_txn; |
909 | 909 | $template_args['reg_url_link'] = $this->_reg_url_link; |
910 | 910 | $template_args['payments'] = array(); |
911 | - foreach ( $payments as $payment ) { |
|
912 | - $template_args['payments'][] = $this->get_payment_row_html( $payment ); |
|
911 | + foreach ($payments as $payment) { |
|
912 | + $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
913 | 913 | } |
914 | 914 | //create a hacky payment object, but dont save it |
915 | 915 | $payment = EE_Payment::new_instance( |
@@ -922,8 +922,8 @@ discard block |
||
922 | 922 | ) |
923 | 923 | ); |
924 | 924 | $payment_method = $this->_current_txn->payment_method(); |
925 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
926 | - $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content( $payment ); |
|
925 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
926 | + $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
927 | 927 | } else { |
928 | 928 | $template_args['gateway_content'] = ''; |
929 | 929 | } |
@@ -931,19 +931,19 @@ discard block |
||
931 | 931 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
932 | 932 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
933 | 933 | // verify template arguments |
934 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
935 | - EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' ); |
|
934 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
935 | + EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
936 | 936 | EEH_Template_Validator::verify_isnt_null( |
937 | 937 | $template_args['show_try_pay_again_link'], |
938 | 938 | '$show_try_pay_again_link' |
939 | 939 | ); |
940 | - EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content' ); |
|
940 | + EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
941 | 941 | EEH_Template_Validator::verify_isnt_null( |
942 | 942 | $template_args['SPCO_payment_options_url'], |
943 | 943 | '$SPCO_payment_options_url' |
944 | 944 | ); |
945 | 945 | return EEH_Template::locate_template( |
946 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
946 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', |
|
947 | 947 | $template_args, |
948 | 948 | true, |
949 | 949 | true |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | * @return string |
961 | 961 | * @throws \EE_Error |
962 | 962 | */ |
963 | - public function get_new_payments( $payments = array() ) { |
|
963 | + public function get_new_payments($payments = array()) { |
|
964 | 964 | $payments_html = ''; |
965 | 965 | //prepare variables for displaying |
966 | - foreach ( $payments as $payment ) { |
|
967 | - $payments_html .= $this->get_payment_row_html( $payment ); |
|
966 | + foreach ($payments as $payment) { |
|
967 | + $payments_html .= $this->get_payment_row_html($payment); |
|
968 | 968 | } |
969 | 969 | return $payments_html; |
970 | 970 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
43 | 43 | } |
44 | 44 | throw new EE_Validation_Error( $validation_error_message, 'float_only' ); |
45 | - }else{ |
|
45 | + } else{ |
|
46 | 46 | return floatval($normalized_value); |
47 | 47 | } |
48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function unnormalize($normalized_value) { |
56 | 56 | if( empty( $normalized_value ) ){ |
57 | 57 | return '0.00'; |
58 | - }else{ |
|
58 | + } else{ |
|
59 | 59 | return "$normalized_value"; |
60 | 60 | } |
61 | 61 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * Class EE_Payment_Method_Manager |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function instance() { |
37 | 37 | // check if class object is instantiated, and instantiated properly |
38 | - if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) { |
|
38 | + if ( ! self::$_instance instanceof EE_Payment_Method_Manager) { |
|
39 | 39 | self::$_instance = new self(); |
40 | 40 | } |
41 | 41 | EE_Registry::instance()->load_lib('PMT_Base'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * Resets the instance and returns a new one |
47 | 47 | * @return EE_Payment_Method_Manager |
48 | 48 | */ |
49 | - public static function reset(){ |
|
49 | + public static function reset() { |
|
50 | 50 | self::$_instance = NULL; |
51 | 51 | return self::instance(); |
52 | 52 | } |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | * or just re-use the PMTs we found last time we checked during this request (if |
58 | 58 | * we have not yet checked during this request, then we need to check anyways) |
59 | 59 | */ |
60 | - public function maybe_register_payment_methods( $force_recheck = FALSE ){ |
|
61 | - if( ! $this->_payment_method_types || $force_recheck ){ |
|
60 | + public function maybe_register_payment_methods($force_recheck = FALSE) { |
|
61 | + if ( ! $this->_payment_method_types || $force_recheck) { |
|
62 | 62 | $this->_register_payment_methods(); |
63 | 63 | //if in admin lets ensure caps are set. |
64 | - if ( is_admin() ) { |
|
65 | - add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) ); |
|
64 | + if (is_admin()) { |
|
65 | + add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps')); |
|
66 | 66 | EE_Registry::instance()->CAP->init_caps(); |
67 | 67 | } |
68 | 68 | } |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function _register_payment_methods() { |
77 | 77 | // grab list of installed modules |
78 | - $pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
78 | + $pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
79 | 79 | // filter list of modules to register |
80 | - $pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register ); |
|
80 | + $pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register); |
|
81 | 81 | |
82 | 82 | // loop through folders |
83 | - foreach ( $pm_to_register as $pm_path ) { |
|
84 | - $this->register_payment_method( $pm_path ); |
|
83 | + foreach ($pm_to_register as $pm_path) { |
|
84 | + $this->register_payment_method($pm_path); |
|
85 | 85 | } |
86 | - do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' ); |
|
86 | + do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods'); |
|
87 | 87 | // filter list of installed modules |
88 | 88 | //keep them organized alphabetically by the payment method type's name |
89 | - ksort( $this->_payment_method_types ); |
|
90 | - return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types ); |
|
89 | + ksort($this->_payment_method_types); |
|
90 | + return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,35 +99,35 @@ discard block |
||
99 | 99 | * @param string $payment_method_path - full path up to and including payment method folder |
100 | 100 | * @return boolean |
101 | 101 | */ |
102 | - public function register_payment_method( $payment_method_path = '' ) { |
|
103 | - do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path ); |
|
102 | + public function register_payment_method($payment_method_path = '') { |
|
103 | + do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path); |
|
104 | 104 | $module_ext = '.pm.php'; |
105 | 105 | // make all separators match |
106 | - $payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS ); |
|
106 | + $payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS); |
|
107 | 107 | // grab and sanitize module name |
108 | - $module_dir = basename( $payment_method_path ); |
|
108 | + $module_dir = basename($payment_method_path); |
|
109 | 109 | // create classname from module directory name |
110 | - $module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir )); |
|
110 | + $module = str_replace(' ', '_', str_replace('_', ' ', $module_dir)); |
|
111 | 111 | // add class prefix |
112 | - $module_class = 'EE_PMT_' . $module; |
|
112 | + $module_class = 'EE_PMT_'.$module; |
|
113 | 113 | // does the module exist ? |
114 | - if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) { |
|
115 | - $msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
116 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
114 | + if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) { |
|
115 | + $msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
116 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
117 | 117 | return FALSE; |
118 | 118 | } |
119 | - if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); } |
|
119 | + if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); } |
|
120 | 120 | // load the module class file |
121 | - require_once( $payment_method_path . DS . $module_class . $module_ext ); |
|
122 | - if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); } |
|
121 | + require_once($payment_method_path.DS.$module_class.$module_ext); |
|
122 | + if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); } |
|
123 | 123 | // verify that class exists |
124 | - if ( ! class_exists( $module_class )) { |
|
125 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
124 | + if ( ! class_exists($module_class)) { |
|
125 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
127 | 127 | return FALSE; |
128 | 128 | } |
129 | 129 | // add to array of registered modules |
130 | - $this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext; |
|
130 | + $this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext; |
|
131 | 131 | return TRUE; |
132 | 132 | } |
133 | 133 | /** |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
137 | 137 | * @return boolean |
138 | 138 | */ |
139 | - public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){ |
|
139 | + public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) { |
|
140 | 140 | if ( |
141 | 141 | $force_recheck |
142 | - || ! is_array( $this->_payment_method_types ) |
|
143 | - || ! isset( $this->_payment_method_types[$payment_method_name] ) |
|
142 | + || ! is_array($this->_payment_method_types) |
|
143 | + || ! isset($this->_payment_method_types[$payment_method_name]) |
|
144 | 144 | ) { |
145 | 145 | $this->maybe_register_payment_methods($force_recheck); |
146 | 146 | } |
147 | - if(isset($this->_payment_method_types[$payment_method_name])){ |
|
147 | + if (isset($this->_payment_method_types[$payment_method_name])) { |
|
148 | 148 | require_once($this->_payment_method_types[$payment_method_name]); |
149 | 149 | return true; |
150 | - }else{ |
|
150 | + } else { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | } |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
159 | 159 | * @return array |
160 | 160 | */ |
161 | - public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){ |
|
161 | + public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) { |
|
162 | 162 | $this->maybe_register_payment_methods($force_recheck); |
163 | - if($with_prefixes){ |
|
163 | + if ($with_prefixes) { |
|
164 | 164 | $classnames = array_keys($this->_payment_method_types); |
165 | 165 | $payment_methods = array(); |
166 | - foreach($classnames as $classname){ |
|
166 | + foreach ($classnames as $classname) { |
|
167 | 167 | $payment_methods[] = $this->payment_method_class_from_type($classname); |
168 | 168 | } |
169 | 169 | return $payment_methods; |
170 | - }else{ |
|
170 | + } else { |
|
171 | 171 | return array_keys($this->_payment_method_types); |
172 | 172 | } |
173 | 173 | } |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
178 | 178 | * @return EE_PMT_Base[] |
179 | 179 | */ |
180 | - public function payment_method_types( $force_recheck = FALSE ){ |
|
180 | + public function payment_method_types($force_recheck = FALSE) { |
|
181 | 181 | $this->maybe_register_payment_methods($force_recheck); |
182 | 182 | $pmt_objs = array(); |
183 | - foreach($this->payment_method_type_names(true) as $classname){ |
|
183 | + foreach ($this->payment_method_type_names(true) as $classname) { |
|
184 | 184 | $pmt_objs[] = new $classname; |
185 | 185 | } |
186 | 186 | return $pmt_objs; |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | * @param string $classname |
193 | 193 | * @return string |
194 | 194 | */ |
195 | - public function payment_method_type_sans_class_prefix($classname){ |
|
196 | - return str_replace( "EE_PMT_", "", $classname ); |
|
195 | + public function payment_method_type_sans_class_prefix($classname) { |
|
196 | + return str_replace("EE_PMT_", "", $classname); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param string $type |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function payment_method_class_from_type($type){ |
|
204 | + public function payment_method_class_from_type($type) { |
|
205 | 205 | $this->maybe_register_payment_methods(); |
206 | 206 | return "EE_PMT_".$type; |
207 | 207 | } |
@@ -215,39 +215,39 @@ discard block |
||
215 | 215 | * @return \EE_Payment_Method |
216 | 216 | * @throws \EE_Error |
217 | 217 | */ |
218 | - public function activate_a_payment_method_of_type( $payment_method_type ){ |
|
218 | + public function activate_a_payment_method_of_type($payment_method_type) { |
|
219 | 219 | $payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type); |
220 | - if( ! $payment_method instanceof EE_Payment_Method ){ |
|
220 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
221 | 221 | $pm_type_class = $this->payment_method_class_from_type($payment_method_type); |
222 | - if(class_exists($pm_type_class)){ |
|
222 | + if (class_exists($pm_type_class)) { |
|
223 | 223 | /** @var $pm_type_obj EE_PMT_Base */ |
224 | 224 | $pm_type_obj = new $pm_type_class; |
225 | 225 | $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name()); |
226 | - if( ! $payment_method){ |
|
227 | - $payment_method = $this->create_payment_method_of_type( $pm_type_obj ); |
|
226 | + if ( ! $payment_method) { |
|
227 | + $payment_method = $this->create_payment_method_of_type($pm_type_obj); |
|
228 | 228 | } |
229 | - $payment_method->set_type( $payment_method_type ); |
|
230 | - $this->initialize_payment_method( $payment_method ); |
|
229 | + $payment_method->set_type($payment_method_type); |
|
230 | + $this->initialize_payment_method($payment_method); |
|
231 | 231 | } else { |
232 | 232 | throw new EE_Error( |
233 | 233 | sprintf( |
234 | - __( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'), |
|
234 | + __('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'), |
|
235 | 235 | $pm_type_class ) |
236 | 236 | ); |
237 | 237 | } |
238 | 238 | } |
239 | 239 | $payment_method->set_active(); |
240 | 240 | $payment_method->save(); |
241 | - $this->set_usable_currencies_on_payment_method( $payment_method ); |
|
242 | - if( $payment_method->type() === 'Invoice' ){ |
|
241 | + $this->set_usable_currencies_on_payment_method($payment_method); |
|
242 | + if ($payment_method->type() === 'Invoice') { |
|
243 | 243 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
244 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
245 | - $message_resource_manager->ensure_message_type_is_active( 'invoice', 'html' ); |
|
246 | - $message_resource_manager->ensure_messenger_is_active( 'pdf' ); |
|
244 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
245 | + $message_resource_manager->ensure_message_type_is_active('invoice', 'html'); |
|
246 | + $message_resource_manager->ensure_messenger_is_active('pdf'); |
|
247 | 247 | EE_Error::add_attention( |
248 | 248 | sprintf( |
249 | - __( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ), |
|
250 | - '<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">', |
|
249 | + __('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'), |
|
250 | + '<a href="'.admin_url('admin.php?page=espresso_messages').'">', |
|
251 | 251 | '</a>' |
252 | 252 | ) |
253 | 253 | ); |
@@ -265,17 +265,17 @@ discard block |
||
265 | 265 | * @return EE_Payment_Method |
266 | 266 | * @throws \EE_Error |
267 | 267 | */ |
268 | - public function create_payment_method_of_type( $pm_type_obj ) { |
|
268 | + public function create_payment_method_of_type($pm_type_obj) { |
|
269 | 269 | global $current_user; |
270 | 270 | $payment_method = EE_Payment_Method::new_instance( |
271 | 271 | array( |
272 | 272 | 'PMD_type' => $pm_type_obj->system_name(), |
273 | 273 | 'PMD_name' => $pm_type_obj->pretty_name(), |
274 | 274 | 'PMD_admin_name' => $pm_type_obj->pretty_name(), |
275 | - 'PMD_slug' => $pm_type_obj->system_name(),//automatically converted to slug |
|
275 | + 'PMD_slug' => $pm_type_obj->system_name(), //automatically converted to slug |
|
276 | 276 | 'PMD_wp_user' => $current_user->ID, |
277 | 277 | 'PMD_order' => EEM_Payment_Method::instance()->count( |
278 | - array( array( 'PMD_type' => array( '!=', 'Admin_Only' ))) |
|
278 | + array(array('PMD_type' => array('!=', 'Admin_Only'))) |
|
279 | 279 | ) * 10, |
280 | 280 | ) |
281 | 281 | ); |
@@ -291,21 +291,21 @@ discard block |
||
291 | 291 | * @return EE_Payment_Method |
292 | 292 | * @throws \EE_Error |
293 | 293 | */ |
294 | - public function initialize_payment_method( $payment_method ) { |
|
294 | + public function initialize_payment_method($payment_method) { |
|
295 | 295 | $pm_type_obj = $payment_method->type_obj(); |
296 | - $payment_method->set_description( $pm_type_obj->default_description() ); |
|
297 | - if( ! $payment_method->button_url() ){ |
|
298 | - $payment_method->set_button_url( $pm_type_obj->default_button_url() ); |
|
296 | + $payment_method->set_description($pm_type_obj->default_description()); |
|
297 | + if ( ! $payment_method->button_url()) { |
|
298 | + $payment_method->set_button_url($pm_type_obj->default_button_url()); |
|
299 | 299 | } |
300 | 300 | //now add setup its default extra meta properties |
301 | 301 | $extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs(); |
302 | - if ( ! empty( $extra_metas ) ) { |
|
302 | + if ( ! empty($extra_metas)) { |
|
303 | 303 | //verify the payment method has an ID before adding extra meta |
304 | - if ( ! $payment_method->ID() ) { |
|
304 | + if ( ! $payment_method->ID()) { |
|
305 | 305 | $payment_method->save(); |
306 | 306 | } |
307 | - foreach ( $extra_metas as $meta_name => $input ) { |
|
308 | - $payment_method->update_extra_meta( $meta_name, $input->raw_value() ); |
|
307 | + foreach ($extra_metas as $meta_name => $input) { |
|
308 | + $payment_method->update_extra_meta($meta_name, $input->raw_value()); |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | return $payment_method; |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | * @return EE_Payment_Method |
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | - public function set_usable_currencies_on_payment_method( $payment_method ) { |
|
324 | - foreach($payment_method->get_all_usable_currencies() as $currency_obj){ |
|
323 | + public function set_usable_currencies_on_payment_method($payment_method) { |
|
324 | + foreach ($payment_method->get_all_usable_currencies() as $currency_obj) { |
|
325 | 325 | $payment_method->_add_relation_to($currency_obj, 'Currency'); |
326 | 326 | } |
327 | 327 | return $payment_method; |
@@ -339,19 +339,19 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @return int count of rows updated. |
341 | 341 | */ |
342 | - public function deactivate_payment_method( $payment_method_slug ) { |
|
342 | + public function deactivate_payment_method($payment_method_slug) { |
|
343 | 343 | EE_Log::instance()->log( |
344 | 344 | __FILE__, |
345 | 345 | __FUNCTION__, |
346 | 346 | sprintf( |
347 | - __( 'Payment method with slug %1$s is being deactivated by site admin', 'event_espresso' ), |
|
347 | + __('Payment method with slug %1$s is being deactivated by site admin', 'event_espresso'), |
|
348 | 348 | $payment_method_slug |
349 | 349 | ), |
350 | 350 | 'payment_method_change' |
351 | 351 | ); |
352 | 352 | $count_updated = EEM_Payment_Method::instance()->update( |
353 | - array( 'PMD_scope' => array() ), |
|
354 | - array( array( 'PMD_slug' => $payment_method_slug ) ) |
|
353 | + array('PMD_scope' => array()), |
|
354 | + array(array('PMD_slug' => $payment_method_slug)) |
|
355 | 355 | ); |
356 | 356 | return $count_updated; |
357 | 357 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @param array $caps capabilities being filtered |
366 | 366 | * @return array |
367 | 367 | */ |
368 | - public function add_payment_method_caps( $caps ) { |
|
368 | + public function add_payment_method_caps($caps) { |
|
369 | 369 | /* add dynamic caps from payment methods |
370 | 370 | * at the time of writing, october 20 2014, these are the caps added: |
371 | 371 | * ee_payment_method_admin_only |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * their related capability automatically added too, so long as they are |
381 | 381 | * registered properly using EE_Register_Payment_Method::register() |
382 | 382 | */ |
383 | - foreach( $this->payment_method_types() as $payment_method_type_obj ){ |
|
383 | + foreach ($this->payment_method_types() as $payment_method_type_obj) { |
|
384 | 384 | $caps['administrator'][] = $payment_method_type_obj->cap_name(); |
385 | 385 | } |
386 | 386 | return $caps; |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
3 | 3 | /** |
4 | 4 | * Event Espresso |
5 | 5 | * |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * ------------------------------------------------------------------------ |
25 | 25 | */ |
26 | -class EE_Payment_Method extends EE_Base_Class{ |
|
26 | +class EE_Payment_Method extends EE_Base_Class { |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Payment Method type object, which has all the info about this type of payment method, |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @return EE_Payment_Method |
40 | 40 | * @throws \EE_Error |
41 | 41 | */ |
42 | - public static function new_instance( $props_n_values = array()) { |
|
43 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
44 | - return $has_object ? $has_object : new self( $props_n_values, FALSE ); |
|
42 | + public static function new_instance($props_n_values = array()) { |
|
43 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
44 | + return $has_object ? $has_object : new self($props_n_values, FALSE); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @return EE_Payment_Method |
52 | 52 | * @throws \EE_Error |
53 | 53 | */ |
54 | - public static function new_instance_from_db ( $props_n_values = array()) { |
|
55 | - return new self( $props_n_values, TRUE ); |
|
54 | + public static function new_instance_from_db($props_n_values = array()) { |
|
55 | + return new self($props_n_values, TRUE); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return boolean |
82 | 82 | */ |
83 | 83 | public function active() { |
84 | - return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()),$this->scope()); |
|
84 | + return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()), $this->scope()); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @throws \EE_Error |
94 | 94 | */ |
95 | - public function set_active(){ |
|
95 | + public function set_active() { |
|
96 | 96 | $default_scopes = array(EEM_Payment_Method::scope_cart); |
97 | - if($this->type_obj() && |
|
98 | - $this->type_obj()->payment_occurs() === EE_PMT_Base::offline){ |
|
97 | + if ($this->type_obj() && |
|
98 | + $this->type_obj()->payment_occurs() === EE_PMT_Base::offline) { |
|
99 | 99 | $default_scopes[] = EEM_Payment_Method::scope_admin; |
100 | 100 | } |
101 | 101 | $this->set_scope($default_scopes); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * Makes this payment method apply to NO scopes at all. DOES NOT SAVE it. |
108 | 108 | */ |
109 | - public function deactivate(){ |
|
109 | + public function deactivate() { |
|
110 | 110 | $this->set_scope(array()); |
111 | 111 | } |
112 | 112 | |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @param mixed $field_value |
298 | 298 | * @param boolean $use_default |
299 | 299 | */ |
300 | - public function set( $field_name, $field_value, $use_default = FALSE ){ |
|
301 | - if( $field_name === 'PMD_type' ){ |
|
300 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
301 | + if ($field_name === 'PMD_type') { |
|
302 | 302 | //the type has probably changed, so forget about its old type object |
303 | 303 | $this->_type_obj = NULL; |
304 | 304 | } |
@@ -372,26 +372,26 @@ discard block |
||
372 | 372 | * @return EE_PMT_Base |
373 | 373 | * @throws EE_Error |
374 | 374 | */ |
375 | - public function type_obj(){ |
|
376 | - if( ! $this->_type_obj ) { |
|
377 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
378 | - if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $this->type() )) { |
|
379 | - $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type( $this->type() ); |
|
380 | - if ( ! class_exists( $class_name )) { |
|
375 | + public function type_obj() { |
|
376 | + if ( ! $this->_type_obj) { |
|
377 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
378 | + if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($this->type())) { |
|
379 | + $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type($this->type()); |
|
380 | + if ( ! class_exists($class_name)) { |
|
381 | 381 | throw new EE_Error( |
382 | 382 | sprintf( |
383 | - __( 'An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', 'event_espresso' ), |
|
383 | + __('An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', 'event_espresso'), |
|
384 | 384 | $class_name, |
385 | 385 | '<br />', |
386 | - '<a href="' . admin_url('plugins.php') . '">', |
|
386 | + '<a href="'.admin_url('plugins.php').'">', |
|
387 | 387 | '</a>' |
388 | 388 | ) |
389 | 389 | ); |
390 | 390 | } |
391 | - $r = new ReflectionClass( $class_name ); |
|
392 | - $this->_type_obj = $r->newInstanceArgs( array( $this )); |
|
391 | + $r = new ReflectionClass($class_name); |
|
392 | + $this->_type_obj = $r->newInstanceArgs(array($this)); |
|
393 | 393 | } else { |
394 | - throw new EE_Error( sprintf( __( 'A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso' ), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names() ) ) ); |
|
394 | + throw new EE_Error(sprintf(__('A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso'), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names()))); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | return $this->_type_obj; |
@@ -404,18 +404,18 @@ discard block |
||
404 | 404 | * and the extra meta. Mostly used for passing off ot gateways. * |
405 | 405 | * @return array |
406 | 406 | */ |
407 | - public function settings_array(){ |
|
407 | + public function settings_array() { |
|
408 | 408 | $fields = $this->model_field_array(); |
409 | 409 | $extra_meta = $this->all_extra_meta_array(); |
410 | 410 | //remove the model's prefix from the fields |
411 | 411 | $combined_settings_array = array(); |
412 | - foreach($fields as $key => $value){ |
|
413 | - if(strpos($key, 'PMD_')===0){ |
|
412 | + foreach ($fields as $key => $value) { |
|
413 | + if (strpos($key, 'PMD_') === 0) { |
|
414 | 414 | $key_sans_model_prefix = str_replace('PMD_', '', $key); |
415 | 415 | $combined_settings_array [$key_sans_model_prefix] = $value; |
416 | 416 | } |
417 | 417 | } |
418 | - $combined_settings_array = array_merge( $extra_meta,$combined_settings_array ); |
|
418 | + $combined_settings_array = array_merge($extra_meta, $combined_settings_array); |
|
419 | 419 | return $combined_settings_array; |
420 | 420 | } |
421 | 421 | |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | * @return string of HTML for displaying the button |
430 | 430 | * @throws \EE_Error |
431 | 431 | */ |
432 | - public function button_html( $url = '', $css_class = '' ){ |
|
432 | + public function button_html($url = '', $css_class = '') { |
|
433 | 433 | $payment_occurs = $this->type_obj()->payment_occurs(); |
434 | 434 | return ' |
435 | - <div id="' . $this->slug() . '-payment-option-dv" class="'. $payment_occurs .'-payment-gateway reg-page-payment-option-dv' . $css_class . '"> |
|
436 | - <a id="payment-gateway-button-' . $this->slug() . '" class="reg-page-payment-option-lnk" rel="' . $this->slug() . '" href="' . $url . '" > |
|
437 | - <img src="' . $this->button_url() . '" alt="' . sprintf( esc_attr__( 'Pay using %s', 'event_espresso' ), $this->get_pretty('PMD_name','form_input') ) . '" /> |
|
435 | + <div id="' . $this->slug().'-payment-option-dv" class="'.$payment_occurs.'-payment-gateway reg-page-payment-option-dv'.$css_class.'"> |
|
436 | + <a id="payment-gateway-button-' . $this->slug().'" class="reg-page-payment-option-lnk" rel="'.$this->slug().'" href="'.$url.'" > |
|
437 | + <img src="' . $this->button_url().'" alt="'.sprintf(esc_attr__('Pay using %s', 'event_espresso'), $this->get_pretty('PMD_name', 'form_input')).'" /> |
|
438 | 438 | </a> |
439 | 439 | </div> |
440 | 440 | '; |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | * @return EE_Currency[] |
450 | 450 | * @throws \EE_Error |
451 | 451 | */ |
452 | - public function get_all_usable_currencies(){ |
|
452 | + public function get_all_usable_currencies() { |
|
453 | 453 | return EEM_Currency::instance()->get_all_currencies_usable_by($this->type_obj()); |
454 | 454 | } |
455 | 455 | |
@@ -462,9 +462,9 @@ discard block |
||
462 | 462 | * @return boolean |
463 | 463 | * @throws \EE_Error |
464 | 464 | */ |
465 | - public function usable_for_currency( $currency_code ) { |
|
466 | - foreach( $this->get_all_usable_currencies() as $currency_obj ) { |
|
467 | - if( $currency_obj->ID() === $currency_code ){ |
|
465 | + public function usable_for_currency($currency_code) { |
|
466 | + foreach ($this->get_all_usable_currencies() as $currency_obj) { |
|
467 | + if ($currency_obj->ID() === $currency_code) { |
|
468 | 468 | return TRUE; |
469 | 469 | } |
470 | 470 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @return bool |
480 | 480 | * @throws \EE_Error |
481 | 481 | */ |
482 | - public function is_on_site(){ |
|
482 | + public function is_on_site() { |
|
483 | 483 | return $this->type_obj()->payment_occurs() === EE_PMT_Base::onsite; |
484 | 484 | } |
485 | 485 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @return bool |
492 | 492 | * @throws \EE_Error |
493 | 493 | */ |
494 | - public function is_off_site(){ |
|
494 | + public function is_off_site() { |
|
495 | 495 | return $this->type_obj()->payment_occurs() === EE_PMT_Base::offsite; |
496 | 496 | } |
497 | 497 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @return bool |
504 | 504 | * @throws \EE_Error |
505 | 505 | */ |
506 | - public function is_off_line(){ |
|
506 | + public function is_off_line() { |
|
507 | 507 | return $this->type_obj()->payment_occurs() === EE_PMT_Base::offline; |
508 | 508 | } |
509 | 509 | |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | * to load the required classes, and don't need them at the time of unserialization |
514 | 514 | * @return array |
515 | 515 | */ |
516 | - public function __sleep(){ |
|
517 | - $properties = get_object_vars( $this ); |
|
518 | - unset( $properties[ '_type_obj' ] ); |
|
519 | - return array_keys( $properties ); |
|
516 | + public function __sleep() { |
|
517 | + $properties = get_object_vars($this); |
|
518 | + unset($properties['_type_obj']); |
|
519 | + return array_keys($properties); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -528,17 +528,17 @@ discard block |
||
528 | 528 | * @return int @see EE_Base_Class::save() |
529 | 529 | * @throws \EE_Error |
530 | 530 | */ |
531 | - public function save( $set_cols_n_values = array() ) { |
|
532 | - $results = parent::save( $set_cols_n_values ); |
|
533 | - if( $this->get_original( 'PMD_scope' ) !== $this->get( 'PMD_scope' ) ) { |
|
531 | + public function save($set_cols_n_values = array()) { |
|
532 | + $results = parent::save($set_cols_n_values); |
|
533 | + if ($this->get_original('PMD_scope') !== $this->get('PMD_scope')) { |
|
534 | 534 | EE_Log::instance()->log( |
535 | 535 | __FILE__, |
536 | 536 | __FUNCTION__, |
537 | 537 | sprintf( |
538 | - __( 'Set new scope on payment method %1$s to %2$s from %3$s on URL %4$s', 'event_espresso' ), |
|
538 | + __('Set new scope on payment method %1$s to %2$s from %3$s on URL %4$s', 'event_espresso'), |
|
539 | 539 | $this->name(), |
540 | - serialize( $this->get_original( 'PMD_scope' ) ), |
|
541 | - serialize( $this->get( 'PMD_scope' ) ), |
|
540 | + serialize($this->get_original('PMD_scope')), |
|
541 | + serialize($this->get('PMD_scope')), |
|
542 | 542 | EE_Registry::instance()->REQ->get_current_page_permalink() |
543 | 543 | ), |
544 | 544 | 'payment_method_change' |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Select_Input |
4 | 4 | * |
@@ -10,22 +10,22 @@ discard block |
||
10 | 10 | * @since 4.6 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Select_Input extends EE_Form_Input_With_Options_Base{ |
|
13 | +class EE_Select_Input extends EE_Form_Input_With_Options_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param array $answer_options |
17 | 17 | * @param array $input_settings |
18 | 18 | */ |
19 | - public function __construct( $answer_options, $input_settings = array() ) { |
|
20 | - $this->_set_display_strategy( new EE_Select_Display_Strategy( $answer_options ) ); |
|
19 | + public function __construct($answer_options, $input_settings = array()) { |
|
20 | + $this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options)); |
|
21 | 21 | $this->_add_validation_strategy( |
22 | 22 | new EE_Enum_Validation_Strategy( |
23 | - isset( $input_settings['validation_error_message'] ) |
|
23 | + isset($input_settings['validation_error_message']) |
|
24 | 24 | ? $input_settings['validation_error_message'] |
25 | 25 | : null |
26 | 26 | ) |
27 | 27 | ); |
28 | - parent::__construct( $answer_options, $input_settings ); |
|
28 | + parent::__construct($answer_options, $input_settings); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Array describing conditions necessary to make the input required. |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @param string $validation_error_message |
25 | 25 | * @param array $requirement_conditions |
26 | 26 | */ |
27 | - public function __construct( $validation_error_message = null, $requirement_conditions = array() ) { |
|
28 | - if( ! $validation_error_message ){ |
|
27 | + public function __construct($validation_error_message = null, $requirement_conditions = array()) { |
|
28 | + if ( ! $validation_error_message) { |
|
29 | 29 | $validation_error_message = __("This field is required.", "event_espresso"); |
30 | 30 | } |
31 | - $this->set_requirement_conditions( $requirement_conditions ); |
|
32 | - parent::__construct( $validation_error_message ); |
|
31 | + $this->set_requirement_conditions($requirement_conditions); |
|
32 | + parent::__construct($validation_error_message); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @throws \EE_Validation_Error |
45 | 45 | */ |
46 | 46 | public function validate($normalized_value) { |
47 | - if( |
|
47 | + if ( |
|
48 | 48 | ( |
49 | 49 | $normalized_value === '' |
50 | 50 | || $normalized_value === null |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | ) |
53 | 53 | && $this->_input_is_required_server_side() |
54 | 54 | ) { |
55 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
56 | - }else{ |
|
55 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
56 | + } else { |
|
57 | 57 | return true; |
58 | 58 | } |
59 | 59 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return array |
65 | 65 | * @throws \EE_Error |
66 | 66 | */ |
67 | - public function get_jquery_validation_rule_array(){ |
|
67 | + public function get_jquery_validation_rule_array() { |
|
68 | 68 | return array( |
69 | 69 | 'required'=> $this->_get_jquery_requirement_value(), |
70 | 70 | 'messages' => array( |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param array $requirement_conditions |
84 | 84 | */ |
85 | - public function set_requirement_conditions( $requirement_conditions ) { |
|
85 | + public function set_requirement_conditions($requirement_conditions) { |
|
86 | 86 | $this->requirement_conditions = (array) $requirement_conditions; |
87 | 87 | } |
88 | 88 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | protected function _get_jquery_requirement_value() { |
109 | 109 | $requirement_value = ''; |
110 | 110 | $conditions = $this->get_requirement_conditions(); |
111 | - if( ! is_array( $conditions ) ){ |
|
111 | + if ( ! is_array($conditions)) { |
|
112 | 112 | EE_Error::throw_exception_if_debugging( |
113 | 113 | sprintf( |
114 | - __( 'Input requirement conditions must be an array. You provided %1$s', 'event_espresso' ), |
|
114 | + __('Input requirement conditions must be an array. You provided %1$s', 'event_espresso'), |
|
115 | 115 | $this->_input->name() |
116 | 116 | ), |
117 | 117 | __FILE__, |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | ); |
121 | 121 | return true; |
122 | 122 | } |
123 | - if( count( $conditions ) > 1 ) { |
|
123 | + if (count($conditions) > 1) { |
|
124 | 124 | EE_Error::throw_exception_if_debugging( |
125 | 125 | sprintf( |
126 | - __( 'Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso' ), |
|
126 | + __('Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso'), |
|
127 | 127 | $this->_input->name() |
128 | 128 | ), |
129 | 129 | __FILE__, |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | __LINE__ |
132 | 132 | ); |
133 | 133 | } |
134 | - foreach( $conditions as $input_path => $op_and_value ) { |
|
135 | - $input = $this->_input->find_section_from_path( $input_path ); |
|
136 | - if( ! $input instanceof EE_Form_Input_Base ) { |
|
134 | + foreach ($conditions as $input_path => $op_and_value) { |
|
135 | + $input = $this->_input->find_section_from_path($input_path); |
|
136 | + if ( ! $input instanceof EE_Form_Input_Base) { |
|
137 | 137 | EE_Error::throw_exception_if_debugging( |
138 | 138 | sprintf( |
139 | - __( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
139 | + __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
140 | 140 | $this->_input->name(), |
141 | 141 | $input_path |
142 | 142 | ), |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | ); |
147 | 147 | return false; |
148 | 148 | } |
149 | - list( $op, $value ) = $this->_validate_op_and_value( $op_and_value ); |
|
149 | + list($op, $value) = $this->_validate_op_and_value($op_and_value); |
|
150 | 150 | //ok now the jquery dependency expression depends on the input's display strategy. |
151 | - if( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy ) { |
|
151 | + if ( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) { |
|
152 | 152 | EE_Error::throw_exception_if_debugging( |
153 | 153 | sprintf( |
154 | - __( 'Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso' ), |
|
154 | + __('Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso'), |
|
155 | 155 | $input->name(), |
156 | - get_class( $input->get_display_strategy() ), |
|
156 | + get_class($input->get_display_strategy()), |
|
157 | 157 | $this->_input->name() |
158 | 158 | ), |
159 | 159 | __FILE__, |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | __LINE__ |
162 | 162 | ); |
163 | 163 | } |
164 | - $requirement_value = $input->html_id( true ) . ' option[value="' . $value . '"]:selected'; |
|
164 | + $requirement_value = $input->html_id(true).' option[value="'.$value.'"]:selected'; |
|
165 | 165 | } |
166 | 166 | return $requirement_value; |
167 | 167 | } |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | protected function _input_is_required_server_side() { |
180 | 180 | $meets_all_requirements = true; |
181 | 181 | $conditions = $this->get_requirement_conditions(); |
182 | - foreach( $conditions as $input_path => $op_and_value ) { |
|
183 | - $input = $this->_input->find_section_from_path( $input_path ); |
|
184 | - if( ! $input instanceof EE_Form_Input_Base ) { |
|
182 | + foreach ($conditions as $input_path => $op_and_value) { |
|
183 | + $input = $this->_input->find_section_from_path($input_path); |
|
184 | + if ( ! $input instanceof EE_Form_Input_Base) { |
|
185 | 185 | EE_Error::throw_exception_if_debugging( |
186 | 186 | sprintf( |
187 | - __( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
187 | + __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
188 | 188 | $this->_input->name(), |
189 | 189 | $input_path |
190 | 190 | ), |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | ); |
195 | 195 | return false; |
196 | 196 | } |
197 | - list( $op, $value ) = $this->_validate_op_and_value( $op_and_value ); |
|
198 | - switch( $op ) { |
|
197 | + list($op, $value) = $this->_validate_op_and_value($op_and_value); |
|
198 | + switch ($op) { |
|
199 | 199 | case '=': |
200 | 200 | default: |
201 | 201 | $meets_all_requirements = $input->normalized_value() === $value; |
202 | 202 | } |
203 | - if( ! $meets_all_requirements ) { |
|
203 | + if ( ! $meets_all_requirements) { |
|
204 | 204 | break; |
205 | 205 | } |
206 | 206 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * @return array |
218 | 218 | * @throws \EE_Error |
219 | 219 | */ |
220 | - protected function _validate_op_and_value( $op_and_value ) { |
|
221 | - if( ! isset( $op_and_value[ 0 ], $op_and_value[ 1 ] ) ) { |
|
220 | + protected function _validate_op_and_value($op_and_value) { |
|
221 | + if ( ! isset($op_and_value[0], $op_and_value[1])) { |
|
222 | 222 | EE_Error::throw_exception_if_debugging( |
223 | 223 | sprintf( |
224 | - __( 'Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso' ), |
|
224 | + __('Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso'), |
|
225 | 225 | $this->_input->name() |
226 | 226 | ), |
227 | 227 | __FILE__, |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | __LINE__ |
230 | 230 | ); |
231 | 231 | } |
232 | - $operator = $op_and_value[ 0 ]; |
|
233 | - $value = (string) $op_and_value[ 1 ]; |
|
234 | - if( $operator !== '=' ) { |
|
232 | + $operator = $op_and_value[0]; |
|
233 | + $value = (string) $op_and_value[1]; |
|
234 | + if ($operator !== '=') { |
|
235 | 235 | EE_Error::throw_exception_if_debugging( |
236 | 236 | sprintf( |
237 | - __( 'Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso' ), |
|
237 | + __('Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso'), |
|
238 | 238 | $this->_input->name() |
239 | 239 | ), |
240 | 240 | __FILE__, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | __LINE__ |
243 | 243 | ); |
244 | 244 | } |
245 | - return array( $operator, $value ); |
|
245 | + return array($operator, $value); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param null $validation_error_message |
24 | 24 | */ |
25 | - public function __construct( $validation_error_message = null ) { |
|
25 | + public function __construct($validation_error_message = null) { |
|
26 | 26 | $this->_validation_error_message = $validation_error_message === null |
27 | - ? __( 'Input invalid', 'event_espresso' ) |
|
27 | + ? __('Input invalid', 'event_espresso') |
|
28 | 28 | : $validation_error_message; |
29 | 29 | parent::__construct(); |
30 | 30 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * this validation strategy is the 'required' validation strategy, |
42 | 42 | * most should be OK with a null, empty string, etc) |
43 | 43 | */ |
44 | - public function validate( $normalized_value ) { |
|
44 | + public function validate($normalized_value) { |
|
45 | 45 | //by default, the validation strategy does no validation. this should be implemented |
46 | 46 | } |
47 | 47 |