@@ -23,15 +23,15 @@ |
||
23 | 23 | public function __construct() |
24 | 24 | { |
25 | 25 | do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
26 | - if (! defined('REG_PG_SLUG')) { |
|
26 | + if ( ! defined('REG_PG_SLUG')) { |
|
27 | 27 | define('REG_PG_SLUG', 'espresso_registrations'); |
28 | 28 | define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
29 | - define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
30 | - define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
31 | - define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
32 | - define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
33 | - define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
34 | - define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
29 | + define('REG_ADMIN', EE_ADMIN_PAGES.'registrations/'); |
|
30 | + define('REG_ADMIN_URL', admin_url('admin.php?page='.REG_PG_SLUG)); |
|
31 | + define('REG_ASSETS_PATH', REG_ADMIN.'assets/'); |
|
32 | + define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL.'registrations/assets/'); |
|
33 | + define('REG_TEMPLATE_PATH', REG_ADMIN.'templates/'); |
|
34 | + define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'registrations/templates/'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | parent::__construct(); |
@@ -13,50 +13,50 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * constructor |
|
18 | - * |
|
19 | - * @Constructor |
|
20 | - * @access public |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function __construct() |
|
24 | - { |
|
25 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
26 | - if (! defined('REG_PG_SLUG')) { |
|
27 | - define('REG_PG_SLUG', 'espresso_registrations'); |
|
28 | - define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
|
29 | - define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
30 | - define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
31 | - define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
32 | - define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
33 | - define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
34 | - define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
35 | - } |
|
36 | - |
|
37 | - parent::__construct(); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - protected function _set_init_properties() |
|
42 | - { |
|
43 | - $this->label = esc_html__('Registrations Overview', 'event_espresso'); |
|
44 | - } |
|
45 | - |
|
46 | - |
|
47 | - protected function _set_menu_map() |
|
48 | - { |
|
49 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
50 | - array( |
|
51 | - 'menu_group' => 'main', |
|
52 | - 'menu_order' => 40, |
|
53 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
54 | - 'parent_slug' => 'espresso_events', |
|
55 | - 'menu_slug' => REG_PG_SLUG, |
|
56 | - 'menu_label' => esc_html__('Registrations', 'event_espresso'), |
|
57 | - 'capability' => 'ee_read_registrations', |
|
58 | - 'admin_init_page' => $this, |
|
59 | - ) |
|
60 | - ); |
|
61 | - } |
|
16 | + /** |
|
17 | + * constructor |
|
18 | + * |
|
19 | + * @Constructor |
|
20 | + * @access public |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function __construct() |
|
24 | + { |
|
25 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
26 | + if (! defined('REG_PG_SLUG')) { |
|
27 | + define('REG_PG_SLUG', 'espresso_registrations'); |
|
28 | + define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
|
29 | + define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
30 | + define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
31 | + define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
32 | + define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
33 | + define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
34 | + define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
35 | + } |
|
36 | + |
|
37 | + parent::__construct(); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + protected function _set_init_properties() |
|
42 | + { |
|
43 | + $this->label = esc_html__('Registrations Overview', 'event_espresso'); |
|
44 | + } |
|
45 | + |
|
46 | + |
|
47 | + protected function _set_menu_map() |
|
48 | + { |
|
49 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
50 | + array( |
|
51 | + 'menu_group' => 'main', |
|
52 | + 'menu_order' => 40, |
|
53 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
54 | + 'parent_slug' => 'espresso_events', |
|
55 | + 'menu_slug' => REG_PG_SLUG, |
|
56 | + 'menu_label' => esc_html__('Registrations', 'event_espresso'), |
|
57 | + 'capability' => 'ee_read_registrations', |
|
58 | + 'admin_init_page' => $this, |
|
59 | + ) |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | } |
@@ -15,89 +15,89 @@ |
||
15 | 15 | class EE_PMT_Paypal_Express extends EE_PMT_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * EE_PMT_Paypal_Express constructor. |
|
20 | - */ |
|
21 | - public function __construct($pm_instance = null) |
|
22 | - { |
|
23 | - require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php'); |
|
24 | - $this->_gateway = new EEG_Paypal_Express(); |
|
18 | + /** |
|
19 | + * EE_PMT_Paypal_Express constructor. |
|
20 | + */ |
|
21 | + public function __construct($pm_instance = null) |
|
22 | + { |
|
23 | + require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php'); |
|
24 | + $this->_gateway = new EEG_Paypal_Express(); |
|
25 | 25 | |
26 | - $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso'); |
|
27 | - $this->_template_path = $this->file_folder() . 'templates/'; |
|
28 | - $this->_default_description = esc_html__( |
|
29 | - // @codingStandardsIgnoreStart |
|
30 | - 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', |
|
31 | - // @codingStandardsIgnoreEnd |
|
32 | - 'event_espresso' |
|
33 | - ); |
|
34 | - $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png'; |
|
26 | + $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso'); |
|
27 | + $this->_template_path = $this->file_folder() . 'templates/'; |
|
28 | + $this->_default_description = esc_html__( |
|
29 | + // @codingStandardsIgnoreStart |
|
30 | + 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', |
|
31 | + // @codingStandardsIgnoreEnd |
|
32 | + 'event_espresso' |
|
33 | + ); |
|
34 | + $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png'; |
|
35 | 35 | |
36 | - parent::__construct($pm_instance); |
|
37 | - } |
|
36 | + parent::__construct($pm_instance); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * Adds the help tab. |
|
42 | - * |
|
43 | - * @see EE_PMT_Base::help_tabs_config() |
|
44 | - * @return array |
|
45 | - */ |
|
46 | - public function help_tabs_config() |
|
47 | - { |
|
48 | - return array( |
|
49 | - $this->get_help_tab_name() => array( |
|
50 | - 'title' => esc_html__('PayPal Express Settings', 'event_espresso'), |
|
51 | - 'filename' => 'payment_methods_overview_paypal_express' |
|
52 | - ) |
|
53 | - ); |
|
54 | - } |
|
40 | + /** |
|
41 | + * Adds the help tab. |
|
42 | + * |
|
43 | + * @see EE_PMT_Base::help_tabs_config() |
|
44 | + * @return array |
|
45 | + */ |
|
46 | + public function help_tabs_config() |
|
47 | + { |
|
48 | + return array( |
|
49 | + $this->get_help_tab_name() => array( |
|
50 | + 'title' => esc_html__('PayPal Express Settings', 'event_espresso'), |
|
51 | + 'filename' => 'payment_methods_overview_paypal_express' |
|
52 | + ) |
|
53 | + ); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * Gets the form for all the settings related to this payment method type. |
|
59 | - * |
|
60 | - * @return EE_Payment_Method_Form |
|
61 | - */ |
|
62 | - public function generate_new_settings_form() |
|
63 | - { |
|
64 | - return new SettingsForm(array(), $this->get_help_tab_link()); |
|
65 | - } |
|
57 | + /** |
|
58 | + * Gets the form for all the settings related to this payment method type. |
|
59 | + * |
|
60 | + * @return EE_Payment_Method_Form |
|
61 | + */ |
|
62 | + public function generate_new_settings_form() |
|
63 | + { |
|
64 | + return new SettingsForm(array(), $this->get_help_tab_link()); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * Creates a billing form for this payment method type. |
|
70 | - * |
|
71 | - * @param \EE_Transaction $transaction |
|
72 | - * @return \EE_Billing_Info_Form |
|
73 | - */ |
|
74 | - public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
75 | - { |
|
76 | - if ($this->_pm_instance->debug_mode()) { |
|
77 | - $form = new EE_Billing_Info_Form( |
|
78 | - $this->_pm_instance, |
|
79 | - array( |
|
80 | - 'name' => 'paypal_express_Info_Form', |
|
81 | - 'subsections' => array( |
|
82 | - 'paypal_express_debug_info' => new EE_Form_Section_Proper( |
|
83 | - array( |
|
84 | - 'layout_strategy' => new EE_Template_Layout( |
|
85 | - array( |
|
86 | - 'layout_template_file' => $this->_template_path |
|
87 | - . 'paypal_express_debug_info.template.php', |
|
88 | - 'template_args' => array( |
|
89 | - 'debug_mode' => $this->_pm_instance->debug_mode() |
|
90 | - ) |
|
91 | - ) |
|
92 | - ) |
|
93 | - ) |
|
94 | - ) |
|
95 | - ) |
|
96 | - ) |
|
97 | - ); |
|
98 | - return $form; |
|
99 | - } |
|
68 | + /** |
|
69 | + * Creates a billing form for this payment method type. |
|
70 | + * |
|
71 | + * @param \EE_Transaction $transaction |
|
72 | + * @return \EE_Billing_Info_Form |
|
73 | + */ |
|
74 | + public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
75 | + { |
|
76 | + if ($this->_pm_instance->debug_mode()) { |
|
77 | + $form = new EE_Billing_Info_Form( |
|
78 | + $this->_pm_instance, |
|
79 | + array( |
|
80 | + 'name' => 'paypal_express_Info_Form', |
|
81 | + 'subsections' => array( |
|
82 | + 'paypal_express_debug_info' => new EE_Form_Section_Proper( |
|
83 | + array( |
|
84 | + 'layout_strategy' => new EE_Template_Layout( |
|
85 | + array( |
|
86 | + 'layout_template_file' => $this->_template_path |
|
87 | + . 'paypal_express_debug_info.template.php', |
|
88 | + 'template_args' => array( |
|
89 | + 'debug_mode' => $this->_pm_instance->debug_mode() |
|
90 | + ) |
|
91 | + ) |
|
92 | + ) |
|
93 | + ) |
|
94 | + ) |
|
95 | + ) |
|
96 | + ) |
|
97 | + ); |
|
98 | + return $form; |
|
99 | + } |
|
100 | 100 | |
101 | - return false; |
|
102 | - } |
|
101 | + return false; |
|
102 | + } |
|
103 | 103 | } |
@@ -20,18 +20,18 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct($pm_instance = null) |
22 | 22 | { |
23 | - require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php'); |
|
23 | + require_once($this->file_folder().'EEG_Paypal_Express.gateway.php'); |
|
24 | 24 | $this->_gateway = new EEG_Paypal_Express(); |
25 | 25 | |
26 | 26 | $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso'); |
27 | - $this->_template_path = $this->file_folder() . 'templates/'; |
|
27 | + $this->_template_path = $this->file_folder().'templates/'; |
|
28 | 28 | $this->_default_description = esc_html__( |
29 | 29 | // @codingStandardsIgnoreStart |
30 | 30 | 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', |
31 | 31 | // @codingStandardsIgnoreEnd |
32 | 32 | 'event_espresso' |
33 | 33 | ); |
34 | - $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png'; |
|
34 | + $this->_default_button_url = $this->file_url().'lib/paypal-express-checkout-logo-gold-160.png'; |
|
35 | 35 | |
36 | 36 | parent::__construct($pm_instance); |
37 | 37 | } |
@@ -6,22 +6,22 @@ discard block |
||
6 | 6 | */ |
7 | 7 | function espresso_load_error_handling() |
8 | 8 | { |
9 | - static $error_handling_loaded = false; |
|
10 | - if ($error_handling_loaded) { |
|
11 | - return; |
|
12 | - } |
|
13 | - // load debugging tools |
|
14 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
15 | - require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
16 | - \EEH_Debug_Tools::instance(); |
|
17 | - } |
|
18 | - // load error handling |
|
19 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
20 | - require_once EE_CORE . 'EE_Error.core.php'; |
|
21 | - } else { |
|
22 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
23 | - } |
|
24 | - $error_handling_loaded = true; |
|
9 | + static $error_handling_loaded = false; |
|
10 | + if ($error_handling_loaded) { |
|
11 | + return; |
|
12 | + } |
|
13 | + // load debugging tools |
|
14 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
15 | + require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
16 | + \EEH_Debug_Tools::instance(); |
|
17 | + } |
|
18 | + // load error handling |
|
19 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
20 | + require_once EE_CORE . 'EE_Error.core.php'; |
|
21 | + } else { |
|
22 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
23 | + } |
|
24 | + $error_handling_loaded = true; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function espresso_load_required($classname, $full_path_to_file) |
37 | 37 | { |
38 | - if (is_readable($full_path_to_file)) { |
|
39 | - require_once $full_path_to_file; |
|
40 | - } else { |
|
41 | - throw new \EE_Error( |
|
42 | - sprintf( |
|
43 | - esc_html__( |
|
44 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
45 | - 'event_espresso' |
|
46 | - ), |
|
47 | - $classname |
|
48 | - ) |
|
49 | - ); |
|
50 | - } |
|
38 | + if (is_readable($full_path_to_file)) { |
|
39 | + require_once $full_path_to_file; |
|
40 | + } else { |
|
41 | + throw new \EE_Error( |
|
42 | + sprintf( |
|
43 | + esc_html__( |
|
44 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
45 | + 'event_espresso' |
|
46 | + ), |
|
47 | + $classname |
|
48 | + ) |
|
49 | + ); |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -66,52 +66,52 @@ discard block |
||
66 | 66 | */ |
67 | 67 | function bootstrap_espresso() |
68 | 68 | { |
69 | - require_once __DIR__ . '/espresso_definitions.php'; |
|
70 | - try { |
|
71 | - espresso_load_error_handling(); |
|
72 | - // include WordPress shims for functions introduced in later versions of WordPress |
|
73 | - espresso_load_required( |
|
74 | - '', |
|
75 | - EE_CORE . 'wordpress-shims.php' |
|
76 | - ); |
|
77 | - espresso_load_required( |
|
78 | - '', |
|
79 | - EE_CORE . 'third-party-compatibility.php' |
|
80 | - ); |
|
81 | - espresso_load_required( |
|
82 | - 'EEH_Base', |
|
83 | - EE_CORE . 'helpers/EEH_Base.helper.php' |
|
84 | - ); |
|
85 | - espresso_load_required( |
|
86 | - 'EEH_File', |
|
87 | - EE_CORE . 'interfaces/EEHI_File.interface.php' |
|
88 | - ); |
|
89 | - espresso_load_required( |
|
90 | - 'EEH_File', |
|
91 | - EE_CORE . 'helpers/EEH_File.helper.php' |
|
92 | - ); |
|
93 | - espresso_load_required( |
|
94 | - 'EEH_Array', |
|
95 | - EE_CORE . 'helpers/EEH_Array.helper.php' |
|
96 | - ); |
|
97 | - espresso_load_required( |
|
98 | - 'EE_Base', |
|
99 | - EE_CORE . 'EE_Base.core.php' |
|
100 | - ); |
|
101 | - // instantiate and configure PSR4 autoloader |
|
102 | - espresso_load_required( |
|
103 | - 'Psr4Autoloader', |
|
104 | - EE_CORE . 'Psr4Autoloader.php' |
|
105 | - ); |
|
106 | - espresso_load_required( |
|
107 | - 'EE_Psr4AutoloaderInit', |
|
108 | - EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
109 | - ); |
|
110 | - $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
111 | - $AutoloaderInit->initializeAutoloader(); |
|
112 | - new EventEspresso\core\services\bootstrap\BootstrapCore(); |
|
113 | - } catch (Exception $e) { |
|
114 | - require_once EE_CORE . 'exceptions/ExceptionStackTraceDisplay.php'; |
|
115 | - new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
116 | - } |
|
69 | + require_once __DIR__ . '/espresso_definitions.php'; |
|
70 | + try { |
|
71 | + espresso_load_error_handling(); |
|
72 | + // include WordPress shims for functions introduced in later versions of WordPress |
|
73 | + espresso_load_required( |
|
74 | + '', |
|
75 | + EE_CORE . 'wordpress-shims.php' |
|
76 | + ); |
|
77 | + espresso_load_required( |
|
78 | + '', |
|
79 | + EE_CORE . 'third-party-compatibility.php' |
|
80 | + ); |
|
81 | + espresso_load_required( |
|
82 | + 'EEH_Base', |
|
83 | + EE_CORE . 'helpers/EEH_Base.helper.php' |
|
84 | + ); |
|
85 | + espresso_load_required( |
|
86 | + 'EEH_File', |
|
87 | + EE_CORE . 'interfaces/EEHI_File.interface.php' |
|
88 | + ); |
|
89 | + espresso_load_required( |
|
90 | + 'EEH_File', |
|
91 | + EE_CORE . 'helpers/EEH_File.helper.php' |
|
92 | + ); |
|
93 | + espresso_load_required( |
|
94 | + 'EEH_Array', |
|
95 | + EE_CORE . 'helpers/EEH_Array.helper.php' |
|
96 | + ); |
|
97 | + espresso_load_required( |
|
98 | + 'EE_Base', |
|
99 | + EE_CORE . 'EE_Base.core.php' |
|
100 | + ); |
|
101 | + // instantiate and configure PSR4 autoloader |
|
102 | + espresso_load_required( |
|
103 | + 'Psr4Autoloader', |
|
104 | + EE_CORE . 'Psr4Autoloader.php' |
|
105 | + ); |
|
106 | + espresso_load_required( |
|
107 | + 'EE_Psr4AutoloaderInit', |
|
108 | + EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
109 | + ); |
|
110 | + $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
111 | + $AutoloaderInit->initializeAutoloader(); |
|
112 | + new EventEspresso\core\services\bootstrap\BootstrapCore(); |
|
113 | + } catch (Exception $e) { |
|
114 | + require_once EE_CORE . 'exceptions/ExceptionStackTraceDisplay.php'; |
|
115 | + new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
116 | + } |
|
117 | 117 | } |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | return; |
12 | 12 | } |
13 | 13 | // load debugging tools |
14 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
15 | - require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
14 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
15 | + require_once EE_HELPERS.'EEH_Debug_Tools.helper.php'; |
|
16 | 16 | \EEH_Debug_Tools::instance(); |
17 | 17 | } |
18 | 18 | // load error handling |
19 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
20 | - require_once EE_CORE . 'EE_Error.core.php'; |
|
19 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
20 | + require_once EE_CORE.'EE_Error.core.php'; |
|
21 | 21 | } else { |
22 | 22 | wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
23 | 23 | } |
@@ -66,52 +66,52 @@ discard block |
||
66 | 66 | */ |
67 | 67 | function bootstrap_espresso() |
68 | 68 | { |
69 | - require_once __DIR__ . '/espresso_definitions.php'; |
|
69 | + require_once __DIR__.'/espresso_definitions.php'; |
|
70 | 70 | try { |
71 | 71 | espresso_load_error_handling(); |
72 | 72 | // include WordPress shims for functions introduced in later versions of WordPress |
73 | 73 | espresso_load_required( |
74 | 74 | '', |
75 | - EE_CORE . 'wordpress-shims.php' |
|
75 | + EE_CORE.'wordpress-shims.php' |
|
76 | 76 | ); |
77 | 77 | espresso_load_required( |
78 | 78 | '', |
79 | - EE_CORE . 'third-party-compatibility.php' |
|
79 | + EE_CORE.'third-party-compatibility.php' |
|
80 | 80 | ); |
81 | 81 | espresso_load_required( |
82 | 82 | 'EEH_Base', |
83 | - EE_CORE . 'helpers/EEH_Base.helper.php' |
|
83 | + EE_CORE.'helpers/EEH_Base.helper.php' |
|
84 | 84 | ); |
85 | 85 | espresso_load_required( |
86 | 86 | 'EEH_File', |
87 | - EE_CORE . 'interfaces/EEHI_File.interface.php' |
|
87 | + EE_CORE.'interfaces/EEHI_File.interface.php' |
|
88 | 88 | ); |
89 | 89 | espresso_load_required( |
90 | 90 | 'EEH_File', |
91 | - EE_CORE . 'helpers/EEH_File.helper.php' |
|
91 | + EE_CORE.'helpers/EEH_File.helper.php' |
|
92 | 92 | ); |
93 | 93 | espresso_load_required( |
94 | 94 | 'EEH_Array', |
95 | - EE_CORE . 'helpers/EEH_Array.helper.php' |
|
95 | + EE_CORE.'helpers/EEH_Array.helper.php' |
|
96 | 96 | ); |
97 | 97 | espresso_load_required( |
98 | 98 | 'EE_Base', |
99 | - EE_CORE . 'EE_Base.core.php' |
|
99 | + EE_CORE.'EE_Base.core.php' |
|
100 | 100 | ); |
101 | 101 | // instantiate and configure PSR4 autoloader |
102 | 102 | espresso_load_required( |
103 | 103 | 'Psr4Autoloader', |
104 | - EE_CORE . 'Psr4Autoloader.php' |
|
104 | + EE_CORE.'Psr4Autoloader.php' |
|
105 | 105 | ); |
106 | 106 | espresso_load_required( |
107 | 107 | 'EE_Psr4AutoloaderInit', |
108 | - EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
108 | + EE_CORE.'EE_Psr4AutoloaderInit.core.php' |
|
109 | 109 | ); |
110 | 110 | $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
111 | 111 | $AutoloaderInit->initializeAutoloader(); |
112 | 112 | new EventEspresso\core\services\bootstrap\BootstrapCore(); |
113 | 113 | } catch (Exception $e) { |
114 | - require_once EE_CORE . 'exceptions/ExceptionStackTraceDisplay.php'; |
|
114 | + require_once EE_CORE.'exceptions/ExceptionStackTraceDisplay.php'; |
|
115 | 115 | new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
116 | 116 | } |
117 | 117 | } |
@@ -18,156 +18,156 @@ |
||
18 | 18 | class FqcnLocator extends Locator |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var array $FQCNs |
|
23 | - */ |
|
24 | - protected $FQCNs = array(); |
|
25 | - |
|
26 | - /** |
|
27 | - * @var array $namespaces |
|
28 | - */ |
|
29 | - protected $namespaces = array(); |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * @access protected |
|
34 | - * @param string $namespace |
|
35 | - * @param string $namespace_base_dir |
|
36 | - * @throws InvalidDataTypeException |
|
37 | - */ |
|
38 | - protected function setNamespace($namespace, $namespace_base_dir) |
|
39 | - { |
|
40 | - if (! is_string($namespace)) { |
|
41 | - throw new InvalidDataTypeException('$namespace', $namespace, 'string'); |
|
42 | - } |
|
43 | - if (! is_string($namespace_base_dir)) { |
|
44 | - throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string'); |
|
45 | - } |
|
46 | - $this->namespaces[ $namespace ] = $namespace_base_dir; |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * @access public |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function getFQCNs() |
|
55 | - { |
|
56 | - return $this->FQCNs; |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * @access public |
|
62 | - * @return int |
|
63 | - */ |
|
64 | - public function count() |
|
65 | - { |
|
66 | - return count($this->FQCNs); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * given a valid namespace, will find all files that match the provided mask |
|
72 | - * |
|
73 | - * @access public |
|
74 | - * @param string|array $namespaces |
|
75 | - * @return array |
|
76 | - * @throws InvalidClassException |
|
77 | - * @throws InvalidDataTypeException |
|
78 | - */ |
|
79 | - public function locate($namespaces) |
|
80 | - { |
|
81 | - if (! (is_string($namespaces) || is_array($namespaces))) { |
|
82 | - throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array'); |
|
83 | - } |
|
84 | - foreach ((array) $namespaces as $namespace) { |
|
85 | - foreach ($this->findFQCNsByNamespace($namespace) as $key => $file) { |
|
86 | - $this->FQCNs[ $key ] = $file; |
|
87 | - } |
|
88 | - } |
|
89 | - return $this->FQCNs; |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * given a partial namespace, will find all files in that folder |
|
95 | - * ** PLZ NOTE ** |
|
96 | - * This assumes that all files within the specified folder should be loaded |
|
97 | - * |
|
98 | - * @access protected |
|
99 | - * @param string $partial_namespace |
|
100 | - * @return array |
|
101 | - * @throws InvalidClassException |
|
102 | - * @throws InvalidDataTypeException |
|
103 | - */ |
|
104 | - protected function findFQCNsByNamespace($partial_namespace) |
|
105 | - { |
|
106 | - $iterator = new FilesystemIterator( |
|
107 | - $this->getDirectoryFromPartialNamespace($partial_namespace) |
|
108 | - ); |
|
109 | - $iterator->setFlags(FilesystemIterator::CURRENT_AS_FILEINFO); |
|
110 | - $iterator->setFlags(FilesystemIterator::UNIX_PATHS); |
|
111 | - if (iterator_count($iterator) === 0) { |
|
112 | - return array(); |
|
113 | - } |
|
114 | - foreach ($iterator as $file) { |
|
115 | - if ($file->isFile() && $file->getExtension() === 'php') { |
|
116 | - $file = $file->getPath() . '/' . $file->getBasename('.php'); |
|
117 | - foreach ($this->namespaces as $namespace => $base_dir) { |
|
118 | - $namespace .= Psr4Autoloader::NS; |
|
119 | - if (strpos($file, $base_dir) === 0) { |
|
120 | - $this->FQCNs[] = Psr4Autoloader::NS . str_replace( |
|
121 | - array($base_dir, '/'), |
|
122 | - array($namespace, Psr4Autoloader::NS), |
|
123 | - $file |
|
124 | - ); |
|
125 | - } |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
129 | - return $this->FQCNs; |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * getDirectoryFromPartialNamespace |
|
135 | - * |
|
136 | - * @access protected |
|
137 | - * @param string $partial_namespace almost fully qualified class name ? |
|
138 | - * @return string |
|
139 | - * @throws InvalidDataTypeException |
|
140 | - * @throws InvalidClassException |
|
141 | - */ |
|
142 | - protected function getDirectoryFromPartialNamespace($partial_namespace) |
|
143 | - { |
|
144 | - if (empty($partial_namespace)) { |
|
145 | - throw new InvalidClassException($partial_namespace); |
|
146 | - } |
|
147 | - // load our PSR-4 Autoloader so we can get the list of registered namespaces from it |
|
148 | - $psr4_loader = \EE_Psr4AutoloaderInit::psr4_loader(); |
|
149 | - // breakup the incoming namespace into segments so we can loop thru them |
|
150 | - $namespace_segments = explode(Psr4Autoloader::NS, trim($partial_namespace, Psr4Autoloader::NS)); |
|
151 | - // we're only interested in the Vendor and secondary base, so pull those from the array |
|
152 | - $vendor_base = array_slice($namespace_segments, 0, 2); |
|
153 | - $namespace = $prefix = null; |
|
154 | - while (! empty($vendor_base)) { |
|
155 | - $namespace = implode(Psr4Autoloader::NS, $vendor_base); |
|
156 | - // check if there's a base directory registered for that namespace |
|
157 | - $prefix = $psr4_loader->prefixes($namespace . Psr4Autoloader::NS); |
|
158 | - if (! empty($prefix) && ! empty($prefix[0])) { |
|
159 | - // found one! |
|
160 | - break; |
|
161 | - } |
|
162 | - // remove base and try vendor only portion of namespace |
|
163 | - array_pop($vendor_base); |
|
164 | - } |
|
165 | - // nope? then the incoming namespace is invalid |
|
166 | - if (empty($prefix) || empty($prefix[0])) { |
|
167 | - throw new InvalidClassException($partial_namespace); |
|
168 | - } |
|
169 | - $this->setNamespace($namespace, $prefix[0]); |
|
170 | - // but if it's good, add that base directory to the rest of the path, and return it |
|
171 | - return $prefix[0] . implode('/', array_diff($namespace_segments, $vendor_base)) . '/'; |
|
172 | - } |
|
21 | + /** |
|
22 | + * @var array $FQCNs |
|
23 | + */ |
|
24 | + protected $FQCNs = array(); |
|
25 | + |
|
26 | + /** |
|
27 | + * @var array $namespaces |
|
28 | + */ |
|
29 | + protected $namespaces = array(); |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * @access protected |
|
34 | + * @param string $namespace |
|
35 | + * @param string $namespace_base_dir |
|
36 | + * @throws InvalidDataTypeException |
|
37 | + */ |
|
38 | + protected function setNamespace($namespace, $namespace_base_dir) |
|
39 | + { |
|
40 | + if (! is_string($namespace)) { |
|
41 | + throw new InvalidDataTypeException('$namespace', $namespace, 'string'); |
|
42 | + } |
|
43 | + if (! is_string($namespace_base_dir)) { |
|
44 | + throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string'); |
|
45 | + } |
|
46 | + $this->namespaces[ $namespace ] = $namespace_base_dir; |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * @access public |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function getFQCNs() |
|
55 | + { |
|
56 | + return $this->FQCNs; |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * @access public |
|
62 | + * @return int |
|
63 | + */ |
|
64 | + public function count() |
|
65 | + { |
|
66 | + return count($this->FQCNs); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * given a valid namespace, will find all files that match the provided mask |
|
72 | + * |
|
73 | + * @access public |
|
74 | + * @param string|array $namespaces |
|
75 | + * @return array |
|
76 | + * @throws InvalidClassException |
|
77 | + * @throws InvalidDataTypeException |
|
78 | + */ |
|
79 | + public function locate($namespaces) |
|
80 | + { |
|
81 | + if (! (is_string($namespaces) || is_array($namespaces))) { |
|
82 | + throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array'); |
|
83 | + } |
|
84 | + foreach ((array) $namespaces as $namespace) { |
|
85 | + foreach ($this->findFQCNsByNamespace($namespace) as $key => $file) { |
|
86 | + $this->FQCNs[ $key ] = $file; |
|
87 | + } |
|
88 | + } |
|
89 | + return $this->FQCNs; |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * given a partial namespace, will find all files in that folder |
|
95 | + * ** PLZ NOTE ** |
|
96 | + * This assumes that all files within the specified folder should be loaded |
|
97 | + * |
|
98 | + * @access protected |
|
99 | + * @param string $partial_namespace |
|
100 | + * @return array |
|
101 | + * @throws InvalidClassException |
|
102 | + * @throws InvalidDataTypeException |
|
103 | + */ |
|
104 | + protected function findFQCNsByNamespace($partial_namespace) |
|
105 | + { |
|
106 | + $iterator = new FilesystemIterator( |
|
107 | + $this->getDirectoryFromPartialNamespace($partial_namespace) |
|
108 | + ); |
|
109 | + $iterator->setFlags(FilesystemIterator::CURRENT_AS_FILEINFO); |
|
110 | + $iterator->setFlags(FilesystemIterator::UNIX_PATHS); |
|
111 | + if (iterator_count($iterator) === 0) { |
|
112 | + return array(); |
|
113 | + } |
|
114 | + foreach ($iterator as $file) { |
|
115 | + if ($file->isFile() && $file->getExtension() === 'php') { |
|
116 | + $file = $file->getPath() . '/' . $file->getBasename('.php'); |
|
117 | + foreach ($this->namespaces as $namespace => $base_dir) { |
|
118 | + $namespace .= Psr4Autoloader::NS; |
|
119 | + if (strpos($file, $base_dir) === 0) { |
|
120 | + $this->FQCNs[] = Psr4Autoloader::NS . str_replace( |
|
121 | + array($base_dir, '/'), |
|
122 | + array($namespace, Psr4Autoloader::NS), |
|
123 | + $file |
|
124 | + ); |
|
125 | + } |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | + return $this->FQCNs; |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * getDirectoryFromPartialNamespace |
|
135 | + * |
|
136 | + * @access protected |
|
137 | + * @param string $partial_namespace almost fully qualified class name ? |
|
138 | + * @return string |
|
139 | + * @throws InvalidDataTypeException |
|
140 | + * @throws InvalidClassException |
|
141 | + */ |
|
142 | + protected function getDirectoryFromPartialNamespace($partial_namespace) |
|
143 | + { |
|
144 | + if (empty($partial_namespace)) { |
|
145 | + throw new InvalidClassException($partial_namespace); |
|
146 | + } |
|
147 | + // load our PSR-4 Autoloader so we can get the list of registered namespaces from it |
|
148 | + $psr4_loader = \EE_Psr4AutoloaderInit::psr4_loader(); |
|
149 | + // breakup the incoming namespace into segments so we can loop thru them |
|
150 | + $namespace_segments = explode(Psr4Autoloader::NS, trim($partial_namespace, Psr4Autoloader::NS)); |
|
151 | + // we're only interested in the Vendor and secondary base, so pull those from the array |
|
152 | + $vendor_base = array_slice($namespace_segments, 0, 2); |
|
153 | + $namespace = $prefix = null; |
|
154 | + while (! empty($vendor_base)) { |
|
155 | + $namespace = implode(Psr4Autoloader::NS, $vendor_base); |
|
156 | + // check if there's a base directory registered for that namespace |
|
157 | + $prefix = $psr4_loader->prefixes($namespace . Psr4Autoloader::NS); |
|
158 | + if (! empty($prefix) && ! empty($prefix[0])) { |
|
159 | + // found one! |
|
160 | + break; |
|
161 | + } |
|
162 | + // remove base and try vendor only portion of namespace |
|
163 | + array_pop($vendor_base); |
|
164 | + } |
|
165 | + // nope? then the incoming namespace is invalid |
|
166 | + if (empty($prefix) || empty($prefix[0])) { |
|
167 | + throw new InvalidClassException($partial_namespace); |
|
168 | + } |
|
169 | + $this->setNamespace($namespace, $prefix[0]); |
|
170 | + // but if it's good, add that base directory to the rest of the path, and return it |
|
171 | + return $prefix[0] . implode('/', array_diff($namespace_segments, $vendor_base)) . '/'; |
|
172 | + } |
|
173 | 173 | } |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function setNamespace($namespace, $namespace_base_dir) |
39 | 39 | { |
40 | - if (! is_string($namespace)) { |
|
40 | + if ( ! is_string($namespace)) { |
|
41 | 41 | throw new InvalidDataTypeException('$namespace', $namespace, 'string'); |
42 | 42 | } |
43 | - if (! is_string($namespace_base_dir)) { |
|
43 | + if ( ! is_string($namespace_base_dir)) { |
|
44 | 44 | throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string'); |
45 | 45 | } |
46 | - $this->namespaces[ $namespace ] = $namespace_base_dir; |
|
46 | + $this->namespaces[$namespace] = $namespace_base_dir; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function locate($namespaces) |
80 | 80 | { |
81 | - if (! (is_string($namespaces) || is_array($namespaces))) { |
|
81 | + if ( ! (is_string($namespaces) || is_array($namespaces))) { |
|
82 | 82 | throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array'); |
83 | 83 | } |
84 | 84 | foreach ((array) $namespaces as $namespace) { |
85 | 85 | foreach ($this->findFQCNsByNamespace($namespace) as $key => $file) { |
86 | - $this->FQCNs[ $key ] = $file; |
|
86 | + $this->FQCNs[$key] = $file; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | return $this->FQCNs; |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | } |
114 | 114 | foreach ($iterator as $file) { |
115 | 115 | if ($file->isFile() && $file->getExtension() === 'php') { |
116 | - $file = $file->getPath() . '/' . $file->getBasename('.php'); |
|
116 | + $file = $file->getPath().'/'.$file->getBasename('.php'); |
|
117 | 117 | foreach ($this->namespaces as $namespace => $base_dir) { |
118 | 118 | $namespace .= Psr4Autoloader::NS; |
119 | 119 | if (strpos($file, $base_dir) === 0) { |
120 | - $this->FQCNs[] = Psr4Autoloader::NS . str_replace( |
|
120 | + $this->FQCNs[] = Psr4Autoloader::NS.str_replace( |
|
121 | 121 | array($base_dir, '/'), |
122 | 122 | array($namespace, Psr4Autoloader::NS), |
123 | 123 | $file |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | // we're only interested in the Vendor and secondary base, so pull those from the array |
152 | 152 | $vendor_base = array_slice($namespace_segments, 0, 2); |
153 | 153 | $namespace = $prefix = null; |
154 | - while (! empty($vendor_base)) { |
|
154 | + while ( ! empty($vendor_base)) { |
|
155 | 155 | $namespace = implode(Psr4Autoloader::NS, $vendor_base); |
156 | 156 | // check if there's a base directory registered for that namespace |
157 | - $prefix = $psr4_loader->prefixes($namespace . Psr4Autoloader::NS); |
|
158 | - if (! empty($prefix) && ! empty($prefix[0])) { |
|
157 | + $prefix = $psr4_loader->prefixes($namespace.Psr4Autoloader::NS); |
|
158 | + if ( ! empty($prefix) && ! empty($prefix[0])) { |
|
159 | 159 | // found one! |
160 | 160 | break; |
161 | 161 | } |
@@ -168,6 +168,6 @@ discard block |
||
168 | 168 | } |
169 | 169 | $this->setNamespace($namespace, $prefix[0]); |
170 | 170 | // but if it's good, add that base directory to the rest of the path, and return it |
171 | - return $prefix[0] . implode('/', array_diff($namespace_segments, $vendor_base)) . '/'; |
|
171 | + return $prefix[0].implode('/', array_diff($namespace_segments, $vendor_base)).'/'; |
|
172 | 172 | } |
173 | 173 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | { |
91 | 91 | espresso_load_required( |
92 | 92 | 'EE_Request', |
93 | - EE_CORE . 'request_stack/EE_Request.core.php' |
|
93 | + EE_CORE.'request_stack/EE_Request.core.php' |
|
94 | 94 | ); |
95 | 95 | $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
96 | 96 | $this->legacy_request->setRequest($this->request); |
@@ -29,84 +29,84 @@ |
||
29 | 29 | class BootstrapRequestResponseObjects |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * @type LegacyRequestInterface $legacy_request |
|
34 | - */ |
|
35 | - protected $legacy_request; |
|
32 | + /** |
|
33 | + * @type LegacyRequestInterface $legacy_request |
|
34 | + */ |
|
35 | + protected $legacy_request; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @type LoaderInterface $loader |
|
39 | - */ |
|
40 | - protected $loader; |
|
37 | + /** |
|
38 | + * @type LoaderInterface $loader |
|
39 | + */ |
|
40 | + protected $loader; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var RequestInterface $request |
|
44 | - */ |
|
45 | - protected $request; |
|
42 | + /** |
|
43 | + * @var RequestInterface $request |
|
44 | + */ |
|
45 | + protected $request; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @var ResponseInterface $response |
|
49 | - */ |
|
50 | - protected $response; |
|
47 | + /** |
|
48 | + * @var ResponseInterface $response |
|
49 | + */ |
|
50 | + protected $response; |
|
51 | 51 | |
52 | 52 | |
53 | - /** |
|
54 | - * BootstrapRequestResponseObjects constructor. |
|
55 | - * |
|
56 | - * @param LoaderInterface $loader |
|
57 | - */ |
|
58 | - public function __construct(LoaderInterface $loader) |
|
59 | - { |
|
60 | - $this->loader = $loader; |
|
61 | - } |
|
53 | + /** |
|
54 | + * BootstrapRequestResponseObjects constructor. |
|
55 | + * |
|
56 | + * @param LoaderInterface $loader |
|
57 | + */ |
|
58 | + public function __construct(LoaderInterface $loader) |
|
59 | + { |
|
60 | + $this->loader = $loader; |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * @return void |
|
66 | - */ |
|
67 | - public function buildRequestResponse() |
|
68 | - { |
|
69 | - $request_params = new RequestParams(new RequestSanitizer()); |
|
70 | - $server_params = new ServerParams(new ServerSanitizer()); |
|
71 | - // load our Request and Response objects |
|
72 | - $this->request = new Request($request_params, $server_params); |
|
73 | - $this->response = new Response(); |
|
74 | - $this->loader->share(RequestParams::class, $request_params); |
|
75 | - $this->loader->share(ServerParams::class, $server_params); |
|
76 | - } |
|
64 | + /** |
|
65 | + * @return void |
|
66 | + */ |
|
67 | + public function buildRequestResponse() |
|
68 | + { |
|
69 | + $request_params = new RequestParams(new RequestSanitizer()); |
|
70 | + $server_params = new ServerParams(new ServerSanitizer()); |
|
71 | + // load our Request and Response objects |
|
72 | + $this->request = new Request($request_params, $server_params); |
|
73 | + $this->response = new Response(); |
|
74 | + $this->loader->share(RequestParams::class, $request_params); |
|
75 | + $this->loader->share(ServerParams::class, $server_params); |
|
76 | + } |
|
77 | 77 | |
78 | 78 | |
79 | - /** |
|
80 | - * @return void |
|
81 | - * @throws InvalidArgumentException |
|
82 | - */ |
|
83 | - public function shareRequestResponse() |
|
84 | - { |
|
85 | - $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
86 | - $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
87 | - EE_Dependency_Map::instance()->setRequest($this->request); |
|
88 | - EE_Dependency_Map::instance()->setResponse($this->response); |
|
89 | - } |
|
79 | + /** |
|
80 | + * @return void |
|
81 | + * @throws InvalidArgumentException |
|
82 | + */ |
|
83 | + public function shareRequestResponse() |
|
84 | + { |
|
85 | + $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
86 | + $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
87 | + EE_Dependency_Map::instance()->setRequest($this->request); |
|
88 | + EE_Dependency_Map::instance()->setResponse($this->response); |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | - /** |
|
93 | - * @return void |
|
94 | - * @throws InvalidArgumentException |
|
95 | - * @throws EE_Error |
|
96 | - */ |
|
97 | - public function setupLegacyRequest() |
|
98 | - { |
|
99 | - espresso_load_required( |
|
100 | - 'EE_Request', |
|
101 | - EE_CORE . 'request_stack/EE_Request.core.php' |
|
102 | - ); |
|
103 | - $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
104 | - $this->legacy_request->setRequest($this->request); |
|
105 | - $this->legacy_request->admin = $this->request->isAdmin(); |
|
106 | - $this->legacy_request->ajax = $this->request->isAjax(); |
|
107 | - $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
108 | - EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
109 | - $this->loader->share('EE_Request', $this->legacy_request); |
|
110 | - $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
111 | - } |
|
92 | + /** |
|
93 | + * @return void |
|
94 | + * @throws InvalidArgumentException |
|
95 | + * @throws EE_Error |
|
96 | + */ |
|
97 | + public function setupLegacyRequest() |
|
98 | + { |
|
99 | + espresso_load_required( |
|
100 | + 'EE_Request', |
|
101 | + EE_CORE . 'request_stack/EE_Request.core.php' |
|
102 | + ); |
|
103 | + $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
104 | + $this->legacy_request->setRequest($this->request); |
|
105 | + $this->legacy_request->admin = $this->request->isAdmin(); |
|
106 | + $this->legacy_request->ajax = $this->request->isAjax(); |
|
107 | + $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
108 | + EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
109 | + $this->loader->share('EE_Request', $this->legacy_request); |
|
110 | + $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
111 | + } |
|
112 | 112 | } |
@@ -47,225 +47,225 @@ |
||
47 | 47 | class BootstrapCore |
48 | 48 | { |
49 | 49 | |
50 | - /** |
|
51 | - * @type LoaderInterface $loader |
|
52 | - */ |
|
53 | - private $loader; |
|
50 | + /** |
|
51 | + * @type LoaderInterface $loader |
|
52 | + */ |
|
53 | + private $loader; |
|
54 | 54 | |
55 | - /** |
|
56 | - * @var RequestInterface $request |
|
57 | - */ |
|
58 | - protected $request; |
|
55 | + /** |
|
56 | + * @var RequestInterface $request |
|
57 | + */ |
|
58 | + protected $request; |
|
59 | 59 | |
60 | - /** |
|
61 | - * @var ResponseInterface $response |
|
62 | - */ |
|
63 | - protected $response; |
|
60 | + /** |
|
61 | + * @var ResponseInterface $response |
|
62 | + */ |
|
63 | + protected $response; |
|
64 | 64 | |
65 | - /** |
|
66 | - * @var RequestStackBuilder $request_stack_builder |
|
67 | - */ |
|
68 | - protected $request_stack_builder; |
|
65 | + /** |
|
66 | + * @var RequestStackBuilder $request_stack_builder |
|
67 | + */ |
|
68 | + protected $request_stack_builder; |
|
69 | 69 | |
70 | - /** |
|
71 | - * @var RequestStack $request_stack |
|
72 | - */ |
|
73 | - protected $request_stack; |
|
70 | + /** |
|
71 | + * @var RequestStack $request_stack |
|
72 | + */ |
|
73 | + protected $request_stack; |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * BootstrapCore constructor. |
|
78 | - */ |
|
79 | - public function __construct() |
|
80 | - { |
|
81 | - do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
82 | - // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
83 | - add_action('plugins_loaded', array($this, 'initialize'), 0); |
|
84 | - } |
|
76 | + /** |
|
77 | + * BootstrapCore constructor. |
|
78 | + */ |
|
79 | + public function __construct() |
|
80 | + { |
|
81 | + do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
82 | + // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
83 | + add_action('plugins_loaded', array($this, 'initialize'), 0); |
|
84 | + } |
|
85 | 85 | |
86 | 86 | |
87 | - /** |
|
88 | - * @throws DomainException |
|
89 | - * @throws EE_Error |
|
90 | - * @throws Exception |
|
91 | - * @throws InvalidArgumentException |
|
92 | - * @throws InvalidClassException |
|
93 | - * @throws InvalidDataTypeException |
|
94 | - * @throws InvalidFilePathException |
|
95 | - * @throws InvalidInterfaceException |
|
96 | - * @throws InvalidRequestStackMiddlewareException |
|
97 | - * @throws OutOfBoundsException |
|
98 | - * @throws ReflectionException |
|
99 | - */ |
|
100 | - public function initialize() |
|
101 | - { |
|
102 | - $this->bootstrapDependencyInjectionContainer(); |
|
103 | - $this->bootstrapDomain(); |
|
104 | - $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
105 | - add_action( |
|
106 | - 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
107 | - array($bootstrap_request, 'setupLegacyRequest') |
|
108 | - ); |
|
109 | - $this->runRequestStack(); |
|
110 | - } |
|
87 | + /** |
|
88 | + * @throws DomainException |
|
89 | + * @throws EE_Error |
|
90 | + * @throws Exception |
|
91 | + * @throws InvalidArgumentException |
|
92 | + * @throws InvalidClassException |
|
93 | + * @throws InvalidDataTypeException |
|
94 | + * @throws InvalidFilePathException |
|
95 | + * @throws InvalidInterfaceException |
|
96 | + * @throws InvalidRequestStackMiddlewareException |
|
97 | + * @throws OutOfBoundsException |
|
98 | + * @throws ReflectionException |
|
99 | + */ |
|
100 | + public function initialize() |
|
101 | + { |
|
102 | + $this->bootstrapDependencyInjectionContainer(); |
|
103 | + $this->bootstrapDomain(); |
|
104 | + $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
105 | + add_action( |
|
106 | + 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
107 | + array($bootstrap_request, 'setupLegacyRequest') |
|
108 | + ); |
|
109 | + $this->runRequestStack(); |
|
110 | + } |
|
111 | 111 | |
112 | 112 | |
113 | - /** |
|
114 | - * @throws ReflectionException |
|
115 | - * @throws EE_Error |
|
116 | - * @throws InvalidArgumentException |
|
117 | - * @throws InvalidDataTypeException |
|
118 | - * @throws InvalidInterfaceException |
|
119 | - * @throws OutOfBoundsException |
|
120 | - */ |
|
121 | - private function bootstrapDependencyInjectionContainer() |
|
122 | - { |
|
123 | - $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
124 | - $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
125 | - $bootstrap_di->buildLoader(); |
|
126 | - $registry = $bootstrap_di->getRegistry(); |
|
127 | - $dependency_map = $bootstrap_di->getDependencyMap(); |
|
128 | - $dependency_map->initialize(); |
|
129 | - $registry->initialize(); |
|
130 | - $this->loader = $bootstrap_di->getLoader(); |
|
131 | - } |
|
113 | + /** |
|
114 | + * @throws ReflectionException |
|
115 | + * @throws EE_Error |
|
116 | + * @throws InvalidArgumentException |
|
117 | + * @throws InvalidDataTypeException |
|
118 | + * @throws InvalidInterfaceException |
|
119 | + * @throws OutOfBoundsException |
|
120 | + */ |
|
121 | + private function bootstrapDependencyInjectionContainer() |
|
122 | + { |
|
123 | + $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
124 | + $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
125 | + $bootstrap_di->buildLoader(); |
|
126 | + $registry = $bootstrap_di->getRegistry(); |
|
127 | + $dependency_map = $bootstrap_di->getDependencyMap(); |
|
128 | + $dependency_map->initialize(); |
|
129 | + $registry->initialize(); |
|
130 | + $this->loader = $bootstrap_di->getLoader(); |
|
131 | + } |
|
132 | 132 | |
133 | 133 | |
134 | - /** |
|
135 | - * configures the Domain object for core |
|
136 | - * |
|
137 | - * @return void |
|
138 | - * @throws DomainException |
|
139 | - * @throws InvalidArgumentException |
|
140 | - * @throws InvalidDataTypeException |
|
141 | - * @throws InvalidClassException |
|
142 | - * @throws InvalidFilePathException |
|
143 | - * @throws InvalidInterfaceException |
|
144 | - */ |
|
145 | - private function bootstrapDomain() |
|
146 | - { |
|
147 | - DomainFactory::getEventEspressoCoreDomain(); |
|
148 | - } |
|
134 | + /** |
|
135 | + * configures the Domain object for core |
|
136 | + * |
|
137 | + * @return void |
|
138 | + * @throws DomainException |
|
139 | + * @throws InvalidArgumentException |
|
140 | + * @throws InvalidDataTypeException |
|
141 | + * @throws InvalidClassException |
|
142 | + * @throws InvalidFilePathException |
|
143 | + * @throws InvalidInterfaceException |
|
144 | + */ |
|
145 | + private function bootstrapDomain() |
|
146 | + { |
|
147 | + DomainFactory::getEventEspressoCoreDomain(); |
|
148 | + } |
|
149 | 149 | |
150 | 150 | |
151 | - /** |
|
152 | - * sets up the request and response objects |
|
153 | - * |
|
154 | - * @return BootstrapRequestResponseObjects |
|
155 | - * @throws InvalidArgumentException |
|
156 | - */ |
|
157 | - private function bootstrapRequestResponseObjects() |
|
158 | - { |
|
159 | - /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
160 | - $bootstrap_request = $this->loader->getShared( |
|
161 | - 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
162 | - array($this->loader) |
|
163 | - ); |
|
164 | - $bootstrap_request->buildRequestResponse(); |
|
165 | - $bootstrap_request->shareRequestResponse(); |
|
166 | - $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
167 | - $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
168 | - return $bootstrap_request; |
|
169 | - } |
|
151 | + /** |
|
152 | + * sets up the request and response objects |
|
153 | + * |
|
154 | + * @return BootstrapRequestResponseObjects |
|
155 | + * @throws InvalidArgumentException |
|
156 | + */ |
|
157 | + private function bootstrapRequestResponseObjects() |
|
158 | + { |
|
159 | + /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
160 | + $bootstrap_request = $this->loader->getShared( |
|
161 | + 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
162 | + array($this->loader) |
|
163 | + ); |
|
164 | + $bootstrap_request->buildRequestResponse(); |
|
165 | + $bootstrap_request->shareRequestResponse(); |
|
166 | + $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
167 | + $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
168 | + return $bootstrap_request; |
|
169 | + } |
|
170 | 170 | |
171 | 171 | |
172 | - /** |
|
173 | - * run_request_stack |
|
174 | - * construct request stack and run middleware apps |
|
175 | - * |
|
176 | - * @throws EE_Error |
|
177 | - * @throws Exception |
|
178 | - */ |
|
179 | - public function runRequestStack() |
|
180 | - { |
|
181 | - $this->loadAutoloader(); |
|
182 | - $this->setAutoloadersForRequiredFiles(); |
|
183 | - $this->request_stack_builder = $this->buildRequestStack(); |
|
184 | - $this->request_stack = $this->request_stack_builder->resolve( |
|
185 | - new RequestStackCoreApp() |
|
186 | - ); |
|
187 | - $this->request_stack->handleRequest($this->request, $this->response); |
|
188 | - $this->request_stack->handleResponse(); |
|
189 | - } |
|
172 | + /** |
|
173 | + * run_request_stack |
|
174 | + * construct request stack and run middleware apps |
|
175 | + * |
|
176 | + * @throws EE_Error |
|
177 | + * @throws Exception |
|
178 | + */ |
|
179 | + public function runRequestStack() |
|
180 | + { |
|
181 | + $this->loadAutoloader(); |
|
182 | + $this->setAutoloadersForRequiredFiles(); |
|
183 | + $this->request_stack_builder = $this->buildRequestStack(); |
|
184 | + $this->request_stack = $this->request_stack_builder->resolve( |
|
185 | + new RequestStackCoreApp() |
|
186 | + ); |
|
187 | + $this->request_stack->handleRequest($this->request, $this->response); |
|
188 | + $this->request_stack->handleResponse(); |
|
189 | + } |
|
190 | 190 | |
191 | 191 | |
192 | - /** |
|
193 | - * load_autoloader |
|
194 | - * |
|
195 | - * @throws EE_Error |
|
196 | - */ |
|
197 | - protected function loadAutoloader() |
|
198 | - { |
|
199 | - // load interfaces |
|
200 | - espresso_load_required( |
|
201 | - 'EEH_Autoloader', |
|
202 | - EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
203 | - ); |
|
204 | - EEH_Autoloader::instance(); |
|
205 | - } |
|
192 | + /** |
|
193 | + * load_autoloader |
|
194 | + * |
|
195 | + * @throws EE_Error |
|
196 | + */ |
|
197 | + protected function loadAutoloader() |
|
198 | + { |
|
199 | + // load interfaces |
|
200 | + espresso_load_required( |
|
201 | + 'EEH_Autoloader', |
|
202 | + EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
203 | + ); |
|
204 | + EEH_Autoloader::instance(); |
|
205 | + } |
|
206 | 206 | |
207 | 207 | |
208 | - /** |
|
209 | - * load_required_files |
|
210 | - * |
|
211 | - * @throws EE_Error |
|
212 | - */ |
|
213 | - protected function setAutoloadersForRequiredFiles() |
|
214 | - { |
|
215 | - // load interfaces |
|
216 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
217 | - // load helpers |
|
218 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
219 | - // register legacy request stack classes just in case |
|
220 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
221 | - // register legacy middleware classes just in case |
|
222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
223 | - } |
|
208 | + /** |
|
209 | + * load_required_files |
|
210 | + * |
|
211 | + * @throws EE_Error |
|
212 | + */ |
|
213 | + protected function setAutoloadersForRequiredFiles() |
|
214 | + { |
|
215 | + // load interfaces |
|
216 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
217 | + // load helpers |
|
218 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
219 | + // register legacy request stack classes just in case |
|
220 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
221 | + // register legacy middleware classes just in case |
|
222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
223 | + } |
|
224 | 224 | |
225 | 225 | |
226 | - /** |
|
227 | - * build_request_stack |
|
228 | - * |
|
229 | - * @return RequestStackBuilder |
|
230 | - */ |
|
231 | - public function buildRequestStack() |
|
232 | - { |
|
233 | - $request_stack_builder = new RequestStackBuilder($this->loader); |
|
234 | - /** |
|
235 | - * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
236 | - * so items at the beginning of the final middleware stack will run last. |
|
237 | - * First parameter is the middleware classname, second is an array of arguments |
|
238 | - */ |
|
239 | - $stack_apps = apply_filters( |
|
240 | - 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
241 | - array( |
|
242 | - // first in last out |
|
243 | - 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
244 | - 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
245 | - 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
246 | - 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
247 | - // last in first out |
|
248 | - 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
249 | - ) |
|
250 | - ); |
|
251 | - // legacy filter for backwards compatibility |
|
252 | - $stack_apps = apply_filters( |
|
253 | - 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
254 | - $stack_apps |
|
255 | - ); |
|
256 | - // load middleware onto stack : FILO (First In Last Out) |
|
257 | - // items at the beginning of the $stack_apps array will run last |
|
258 | - foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
259 | - $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
260 | - } |
|
261 | - // finally, we'll add this on its own because we need it to always be part of the stack |
|
262 | - // and we also need it to always run first because the rest of the system relies on it |
|
263 | - $request_stack_builder->push( |
|
264 | - array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
265 | - ); |
|
266 | - return apply_filters( |
|
267 | - 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
268 | - $request_stack_builder |
|
269 | - ); |
|
270 | - } |
|
226 | + /** |
|
227 | + * build_request_stack |
|
228 | + * |
|
229 | + * @return RequestStackBuilder |
|
230 | + */ |
|
231 | + public function buildRequestStack() |
|
232 | + { |
|
233 | + $request_stack_builder = new RequestStackBuilder($this->loader); |
|
234 | + /** |
|
235 | + * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
236 | + * so items at the beginning of the final middleware stack will run last. |
|
237 | + * First parameter is the middleware classname, second is an array of arguments |
|
238 | + */ |
|
239 | + $stack_apps = apply_filters( |
|
240 | + 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
241 | + array( |
|
242 | + // first in last out |
|
243 | + 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
244 | + 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
245 | + 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
246 | + 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
247 | + // last in first out |
|
248 | + 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
249 | + ) |
|
250 | + ); |
|
251 | + // legacy filter for backwards compatibility |
|
252 | + $stack_apps = apply_filters( |
|
253 | + 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
254 | + $stack_apps |
|
255 | + ); |
|
256 | + // load middleware onto stack : FILO (First In Last Out) |
|
257 | + // items at the beginning of the $stack_apps array will run last |
|
258 | + foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
259 | + $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
260 | + } |
|
261 | + // finally, we'll add this on its own because we need it to always be part of the stack |
|
262 | + // and we also need it to always run first because the rest of the system relies on it |
|
263 | + $request_stack_builder->push( |
|
264 | + array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
265 | + ); |
|
266 | + return apply_filters( |
|
267 | + 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
268 | + $request_stack_builder |
|
269 | + ); |
|
270 | + } |
|
271 | 271 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | // load interfaces |
200 | 200 | espresso_load_required( |
201 | 201 | 'EEH_Autoloader', |
202 | - EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
202 | + EE_CORE.'helpers/EEH_Autoloader.helper.php' |
|
203 | 203 | ); |
204 | 204 | EEH_Autoloader::instance(); |
205 | 205 | } |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | protected function setAutoloadersForRequiredFiles() |
214 | 214 | { |
215 | 215 | // load interfaces |
216 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
216 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces', true); |
|
217 | 217 | // load helpers |
218 | 218 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
219 | 219 | // register legacy request stack classes just in case |
220 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
220 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack/'); |
|
221 | 221 | // register legacy middleware classes just in case |
222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware/'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 |
@@ -20,192 +20,192 @@ |
||
20 | 20 | class OpenCoffeeShop |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var CoffeeShop $CoffeeShop |
|
25 | - */ |
|
26 | - private $CoffeeShop; |
|
23 | + /** |
|
24 | + * @var CoffeeShop $CoffeeShop |
|
25 | + */ |
|
26 | + private $CoffeeShop; |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * OpenCoffeeShop constructor |
|
31 | - * |
|
32 | - * @throws InvalidInterfaceException |
|
33 | - */ |
|
34 | - public function __construct() |
|
35 | - { |
|
36 | - // instantiate the DI container |
|
37 | - $this->CoffeeShop = new CoffeeShop(); |
|
38 | - } |
|
29 | + /** |
|
30 | + * OpenCoffeeShop constructor |
|
31 | + * |
|
32 | + * @throws InvalidInterfaceException |
|
33 | + */ |
|
34 | + public function __construct() |
|
35 | + { |
|
36 | + // instantiate the DI container |
|
37 | + $this->CoffeeShop = new CoffeeShop(); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
42 | - /** |
|
43 | - * @return CoffeeShop |
|
44 | - */ |
|
45 | - public function CoffeeShop() |
|
46 | - { |
|
47 | - return $this->CoffeeShop; |
|
48 | - } |
|
41 | + // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
42 | + /** |
|
43 | + * @return CoffeeShop |
|
44 | + */ |
|
45 | + public function CoffeeShop() |
|
46 | + { |
|
47 | + return $this->CoffeeShop; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * configure coffee makers which control the different kinds of brews |
|
53 | - * ( shared services, new factory objects, etc ) |
|
54 | - * |
|
55 | - * @throws InvalidEntityException |
|
56 | - */ |
|
57 | - public function setupCoffeeMakers() |
|
58 | - { |
|
59 | - // create a dependency injector class for resolving class constructor arguments |
|
60 | - $DependencyInjector = new DependencyInjector( |
|
61 | - $this->CoffeeShop, |
|
62 | - new \EEH_Array() |
|
63 | - ); |
|
64 | - // and some coffeemakers, one for creating new instances |
|
65 | - $this->CoffeeShop->addCoffeeMaker( |
|
66 | - new NewCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
67 | - CoffeeMaker::BREW_NEW |
|
68 | - ); |
|
69 | - // one for shared services |
|
70 | - $this->CoffeeShop->addCoffeeMaker( |
|
71 | - new SharedCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
72 | - CoffeeMaker::BREW_SHARED |
|
73 | - ); |
|
74 | - // and one for classes that only get loaded |
|
75 | - $this->CoffeeShop->addCoffeeMaker( |
|
76 | - new LoadOnlyCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
77 | - CoffeeMaker::BREW_LOAD_ONLY |
|
78 | - ); |
|
79 | - } |
|
51 | + /** |
|
52 | + * configure coffee makers which control the different kinds of brews |
|
53 | + * ( shared services, new factory objects, etc ) |
|
54 | + * |
|
55 | + * @throws InvalidEntityException |
|
56 | + */ |
|
57 | + public function setupCoffeeMakers() |
|
58 | + { |
|
59 | + // create a dependency injector class for resolving class constructor arguments |
|
60 | + $DependencyInjector = new DependencyInjector( |
|
61 | + $this->CoffeeShop, |
|
62 | + new \EEH_Array() |
|
63 | + ); |
|
64 | + // and some coffeemakers, one for creating new instances |
|
65 | + $this->CoffeeShop->addCoffeeMaker( |
|
66 | + new NewCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
67 | + CoffeeMaker::BREW_NEW |
|
68 | + ); |
|
69 | + // one for shared services |
|
70 | + $this->CoffeeShop->addCoffeeMaker( |
|
71 | + new SharedCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
72 | + CoffeeMaker::BREW_SHARED |
|
73 | + ); |
|
74 | + // and one for classes that only get loaded |
|
75 | + $this->CoffeeShop->addCoffeeMaker( |
|
76 | + new LoadOnlyCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
77 | + CoffeeMaker::BREW_LOAD_ONLY |
|
78 | + ); |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | - /** |
|
83 | - * Recipes define how to load legacy classes |
|
84 | - * |
|
85 | - * @throws InvalidIdentifierException |
|
86 | - */ |
|
87 | - public function addRecipes() |
|
88 | - { |
|
89 | - // add default recipe, which should handle loading for most PSR-4 compatible classes |
|
90 | - // as long as they are not type hinting for interfaces |
|
91 | - $this->CoffeeShop->addRecipe( |
|
92 | - new Recipe( |
|
93 | - Recipe::DEFAULT_ID |
|
94 | - ) |
|
95 | - ); |
|
96 | - // PSR-4 compatible class with aliases |
|
97 | - $this->CoffeeShop->addRecipe( |
|
98 | - new Recipe( |
|
99 | - 'CommandHandlerManager', |
|
100 | - 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
101 | - array( |
|
102 | - 'CommandHandlerManagerInterface', |
|
103 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
104 | - ), |
|
105 | - array(), |
|
106 | - CoffeeMaker::BREW_SHARED |
|
107 | - ) |
|
108 | - ); |
|
109 | - // PSR-4 compatible class with aliases, which dependency on CommandHandlerManager |
|
110 | - $this->CoffeeShop->addRecipe( |
|
111 | - new Recipe( |
|
112 | - 'CommandBus', |
|
113 | - 'EventEspresso\core\services\commands\CommandBus', |
|
114 | - array( |
|
115 | - 'CommandBusInterface', |
|
116 | - 'EventEspresso\core\services\commands\CommandBusInterface', |
|
117 | - ), |
|
118 | - array(), |
|
119 | - CoffeeMaker::BREW_SHARED |
|
120 | - ) |
|
121 | - ); |
|
122 | - // LEGACY classes that are NOT compatible with PSR-4 autoloading, and so must specify a filepath |
|
123 | - // add a wildcard recipe for loading legacy core interfaces |
|
124 | - $this->CoffeeShop->addRecipe( |
|
125 | - new Recipe( |
|
126 | - 'EEI_*', |
|
127 | - '', |
|
128 | - array(), |
|
129 | - array(), |
|
130 | - CoffeeMaker::BREW_LOAD_ONLY, |
|
131 | - array( |
|
132 | - EE_INTERFACES . '*.php', |
|
133 | - EE_INTERFACES . '*.interfaces.php', |
|
134 | - ) |
|
135 | - ) |
|
136 | - ); |
|
137 | - // add a wildcard recipe for loading models |
|
138 | - $this->CoffeeShop->addRecipe( |
|
139 | - new Recipe( |
|
140 | - 'EEM_*', |
|
141 | - '', |
|
142 | - array(), |
|
143 | - array(), |
|
144 | - CoffeeMaker::BREW_SHARED, |
|
145 | - EE_MODELS . '*.model.php' |
|
146 | - ) |
|
147 | - ); |
|
148 | - // add a wildcard recipe for loading core classes |
|
149 | - $this->CoffeeShop->addRecipe( |
|
150 | - new Recipe( |
|
151 | - 'EE_*', |
|
152 | - '', |
|
153 | - array(), |
|
154 | - array(), |
|
155 | - CoffeeMaker::BREW_SHARED, |
|
156 | - array( |
|
157 | - EE_CORE . '*.core.php', |
|
158 | - EE_ADMIN . '*.core.php', |
|
159 | - EE_CPTS . '*.core.php', |
|
160 | - EE_CORE . 'data_migration_scripts/*.core.php', |
|
161 | - ) |
|
162 | - ) |
|
163 | - ); |
|
164 | - // load admin page parent class |
|
165 | - $this->CoffeeShop->addRecipe( |
|
166 | - new Recipe( |
|
167 | - 'EE_Admin_Page*', |
|
168 | - '', |
|
169 | - array(), |
|
170 | - array(), |
|
171 | - CoffeeMaker::BREW_LOAD_ONLY, |
|
172 | - array(EE_ADMIN . '*.core.php') |
|
173 | - ) |
|
174 | - ); |
|
175 | - // add a wildcard recipe for loading core classes |
|
176 | - // $this->CoffeeShop->addRecipe( |
|
177 | - // new Recipe( |
|
178 | - // '*_Admin_Page', |
|
179 | - // '', |
|
180 | - // array(), |
|
181 | - // array(), |
|
182 | - // CoffeeMaker::BREW_SHARED, |
|
183 | - // array( |
|
184 | - // EE_ADMIN_PAGES . 'transactions/*.core.php', |
|
185 | - // ) |
|
186 | - // ) |
|
187 | - // ); |
|
188 | - } |
|
82 | + /** |
|
83 | + * Recipes define how to load legacy classes |
|
84 | + * |
|
85 | + * @throws InvalidIdentifierException |
|
86 | + */ |
|
87 | + public function addRecipes() |
|
88 | + { |
|
89 | + // add default recipe, which should handle loading for most PSR-4 compatible classes |
|
90 | + // as long as they are not type hinting for interfaces |
|
91 | + $this->CoffeeShop->addRecipe( |
|
92 | + new Recipe( |
|
93 | + Recipe::DEFAULT_ID |
|
94 | + ) |
|
95 | + ); |
|
96 | + // PSR-4 compatible class with aliases |
|
97 | + $this->CoffeeShop->addRecipe( |
|
98 | + new Recipe( |
|
99 | + 'CommandHandlerManager', |
|
100 | + 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
101 | + array( |
|
102 | + 'CommandHandlerManagerInterface', |
|
103 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
104 | + ), |
|
105 | + array(), |
|
106 | + CoffeeMaker::BREW_SHARED |
|
107 | + ) |
|
108 | + ); |
|
109 | + // PSR-4 compatible class with aliases, which dependency on CommandHandlerManager |
|
110 | + $this->CoffeeShop->addRecipe( |
|
111 | + new Recipe( |
|
112 | + 'CommandBus', |
|
113 | + 'EventEspresso\core\services\commands\CommandBus', |
|
114 | + array( |
|
115 | + 'CommandBusInterface', |
|
116 | + 'EventEspresso\core\services\commands\CommandBusInterface', |
|
117 | + ), |
|
118 | + array(), |
|
119 | + CoffeeMaker::BREW_SHARED |
|
120 | + ) |
|
121 | + ); |
|
122 | + // LEGACY classes that are NOT compatible with PSR-4 autoloading, and so must specify a filepath |
|
123 | + // add a wildcard recipe for loading legacy core interfaces |
|
124 | + $this->CoffeeShop->addRecipe( |
|
125 | + new Recipe( |
|
126 | + 'EEI_*', |
|
127 | + '', |
|
128 | + array(), |
|
129 | + array(), |
|
130 | + CoffeeMaker::BREW_LOAD_ONLY, |
|
131 | + array( |
|
132 | + EE_INTERFACES . '*.php', |
|
133 | + EE_INTERFACES . '*.interfaces.php', |
|
134 | + ) |
|
135 | + ) |
|
136 | + ); |
|
137 | + // add a wildcard recipe for loading models |
|
138 | + $this->CoffeeShop->addRecipe( |
|
139 | + new Recipe( |
|
140 | + 'EEM_*', |
|
141 | + '', |
|
142 | + array(), |
|
143 | + array(), |
|
144 | + CoffeeMaker::BREW_SHARED, |
|
145 | + EE_MODELS . '*.model.php' |
|
146 | + ) |
|
147 | + ); |
|
148 | + // add a wildcard recipe for loading core classes |
|
149 | + $this->CoffeeShop->addRecipe( |
|
150 | + new Recipe( |
|
151 | + 'EE_*', |
|
152 | + '', |
|
153 | + array(), |
|
154 | + array(), |
|
155 | + CoffeeMaker::BREW_SHARED, |
|
156 | + array( |
|
157 | + EE_CORE . '*.core.php', |
|
158 | + EE_ADMIN . '*.core.php', |
|
159 | + EE_CPTS . '*.core.php', |
|
160 | + EE_CORE . 'data_migration_scripts/*.core.php', |
|
161 | + ) |
|
162 | + ) |
|
163 | + ); |
|
164 | + // load admin page parent class |
|
165 | + $this->CoffeeShop->addRecipe( |
|
166 | + new Recipe( |
|
167 | + 'EE_Admin_Page*', |
|
168 | + '', |
|
169 | + array(), |
|
170 | + array(), |
|
171 | + CoffeeMaker::BREW_LOAD_ONLY, |
|
172 | + array(EE_ADMIN . '*.core.php') |
|
173 | + ) |
|
174 | + ); |
|
175 | + // add a wildcard recipe for loading core classes |
|
176 | + // $this->CoffeeShop->addRecipe( |
|
177 | + // new Recipe( |
|
178 | + // '*_Admin_Page', |
|
179 | + // '', |
|
180 | + // array(), |
|
181 | + // array(), |
|
182 | + // CoffeeMaker::BREW_SHARED, |
|
183 | + // array( |
|
184 | + // EE_ADMIN_PAGES . 'transactions/*.core.php', |
|
185 | + // ) |
|
186 | + // ) |
|
187 | + // ); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | - /** |
|
192 | - * bootstrap EE and the request stack |
|
193 | - * |
|
194 | - * @throws ServiceNotFoundException |
|
195 | - * @throws InvalidClassException |
|
196 | - * @throws InvalidDataTypeException |
|
197 | - * @throws InvalidIdentifierException |
|
198 | - * @throws exceptions\ServiceExistsException |
|
199 | - * @throws OutOfBoundsException |
|
200 | - * @throws exceptions\InstantiationException |
|
201 | - */ |
|
202 | - public function firstBrew() |
|
203 | - { |
|
204 | - $this->CoffeeShop->brew( |
|
205 | - 'EventEspresso\core\services\request\Request', |
|
206 | - array($_GET, $_POST, $_COOKIE, $_SERVER) |
|
207 | - ); |
|
208 | - $this->CoffeeShop->brew('EventEspresso\core\services\request\Response'); |
|
209 | - $this->CoffeeShop->brew('EE_Bootstrap'); |
|
210 | - } |
|
191 | + /** |
|
192 | + * bootstrap EE and the request stack |
|
193 | + * |
|
194 | + * @throws ServiceNotFoundException |
|
195 | + * @throws InvalidClassException |
|
196 | + * @throws InvalidDataTypeException |
|
197 | + * @throws InvalidIdentifierException |
|
198 | + * @throws exceptions\ServiceExistsException |
|
199 | + * @throws OutOfBoundsException |
|
200 | + * @throws exceptions\InstantiationException |
|
201 | + */ |
|
202 | + public function firstBrew() |
|
203 | + { |
|
204 | + $this->CoffeeShop->brew( |
|
205 | + 'EventEspresso\core\services\request\Request', |
|
206 | + array($_GET, $_POST, $_COOKIE, $_SERVER) |
|
207 | + ); |
|
208 | + $this->CoffeeShop->brew('EventEspresso\core\services\request\Response'); |
|
209 | + $this->CoffeeShop->brew('EE_Bootstrap'); |
|
210 | + } |
|
211 | 211 | } |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | array(), |
130 | 130 | CoffeeMaker::BREW_LOAD_ONLY, |
131 | 131 | array( |
132 | - EE_INTERFACES . '*.php', |
|
133 | - EE_INTERFACES . '*.interfaces.php', |
|
132 | + EE_INTERFACES.'*.php', |
|
133 | + EE_INTERFACES.'*.interfaces.php', |
|
134 | 134 | ) |
135 | 135 | ) |
136 | 136 | ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | array(), |
143 | 143 | array(), |
144 | 144 | CoffeeMaker::BREW_SHARED, |
145 | - EE_MODELS . '*.model.php' |
|
145 | + EE_MODELS.'*.model.php' |
|
146 | 146 | ) |
147 | 147 | ); |
148 | 148 | // add a wildcard recipe for loading core classes |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | array(), |
155 | 155 | CoffeeMaker::BREW_SHARED, |
156 | 156 | array( |
157 | - EE_CORE . '*.core.php', |
|
158 | - EE_ADMIN . '*.core.php', |
|
159 | - EE_CPTS . '*.core.php', |
|
160 | - EE_CORE . 'data_migration_scripts/*.core.php', |
|
157 | + EE_CORE.'*.core.php', |
|
158 | + EE_ADMIN.'*.core.php', |
|
159 | + EE_CPTS.'*.core.php', |
|
160 | + EE_CORE.'data_migration_scripts/*.core.php', |
|
161 | 161 | ) |
162 | 162 | ) |
163 | 163 | ); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | array(), |
170 | 170 | array(), |
171 | 171 | CoffeeMaker::BREW_LOAD_ONLY, |
172 | - array(EE_ADMIN . '*.core.php') |
|
172 | + array(EE_ADMIN.'*.core.php') |
|
173 | 173 | ) |
174 | 174 | ); |
175 | 175 | // add a wildcard recipe for loading core classes |
@@ -15,94 +15,94 @@ |
||
15 | 15 | */ |
16 | 16 | class LicenseService |
17 | 17 | { |
18 | - /** |
|
19 | - * @var Config |
|
20 | - */ |
|
21 | - private $config; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @var Stats |
|
26 | - */ |
|
27 | - private $stats_collection; |
|
28 | - |
|
29 | - public function __construct(Stats $stats_collection, Config $config) |
|
30 | - { |
|
31 | - $this->config = $config; |
|
32 | - $this->stats_collection = $stats_collection; |
|
33 | - $this->loadPueClient(); |
|
34 | - } |
|
35 | - |
|
36 | - private function loadPueClient() |
|
37 | - { |
|
38 | - // PUE Auto Upgrades stuff |
|
39 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
40 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
41 | - |
|
42 | - // $options needs to be an array with the included keys as listed. |
|
43 | - $options = array( |
|
44 | - // 'optionName' => '', //(optional) - used as the reference for saving update information in the |
|
45 | - // clients options table. Will be automatically set if left blank. |
|
46 | - 'apikey' => $this->config->siteLicenseKey(), |
|
47 | - // (required), you will need to obtain the apikey that the client gets from your site and |
|
48 | - // then saves in their sites options table (see 'getting an api-key' below) |
|
49 | - 'lang_domain' => $this->config->i18nDomain(), |
|
50 | - // (optional) - put here whatever reference you are using for the localization of your plugin (if it's |
|
51 | - // localized). That way strings in this file will be included in the translation for your plugin. |
|
52 | - 'checkPeriod' => $this->config->checkPeriod(), |
|
53 | - // (optional) - use this parameter to indicate how often you want the client's install to ping your |
|
54 | - // server for update checks. The integer indicates hours. If you don't include this parameter it will |
|
55 | - // default to 12 hours. |
|
56 | - 'option_key' => $this->config->optionKey(), |
|
57 | - // this is what is used to reference the api_key in your plugin options. PUE uses this to trigger |
|
58 | - // updating your information message whenever this option_key is modified. |
|
59 | - 'options_page_slug' => $this->config->optionsPageSlug(), |
|
60 | - 'plugin_basename' => EE_PLUGIN_BASENAME, |
|
61 | - 'use_wp_update' => true, |
|
62 | - // if TRUE then you want FREE versions of the plugin to be updated from WP |
|
63 | - 'extra_stats' => $this->stats_collection->statsCallback(), |
|
64 | - 'turn_on_notices_saved' => true, |
|
65 | - ); |
|
66 | - // initiate the class and start the plugin update engine! |
|
67 | - new PluginUpdateEngineChecker( |
|
68 | - $this->config->hostServerUrl(), |
|
69 | - $this->config->pluginSlug(), |
|
70 | - $options |
|
71 | - ); |
|
72 | - } |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * This is a handy helper method for retrieving whether there is an update available for the given plugin. |
|
78 | - * |
|
79 | - * @param string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to |
|
80 | - * identify plugins. Defaults to core update |
|
81 | - * @return boolean True if update available, false if not. |
|
82 | - */ |
|
83 | - public static function isUpdateAvailable($basename = '') |
|
84 | - { |
|
85 | - $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
86 | - |
|
87 | - $update = false; |
|
88 | - |
|
89 | - // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
90 | - $folder = '/' . dirname($basename); |
|
91 | - |
|
92 | - $plugins = get_plugins($folder); |
|
93 | - $current = get_site_transient('update_plugins'); |
|
94 | - |
|
95 | - foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
96 | - if (isset($current->response['plugin_file'])) { |
|
97 | - $update = true; |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - // it's possible that there is an update but an invalid site-license-key is in use |
|
102 | - if (get_site_option('pue_json_error_' . $basename)) { |
|
103 | - $update = true; |
|
104 | - } |
|
105 | - |
|
106 | - return $update; |
|
107 | - } |
|
18 | + /** |
|
19 | + * @var Config |
|
20 | + */ |
|
21 | + private $config; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @var Stats |
|
26 | + */ |
|
27 | + private $stats_collection; |
|
28 | + |
|
29 | + public function __construct(Stats $stats_collection, Config $config) |
|
30 | + { |
|
31 | + $this->config = $config; |
|
32 | + $this->stats_collection = $stats_collection; |
|
33 | + $this->loadPueClient(); |
|
34 | + } |
|
35 | + |
|
36 | + private function loadPueClient() |
|
37 | + { |
|
38 | + // PUE Auto Upgrades stuff |
|
39 | + if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
40 | + require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
41 | + |
|
42 | + // $options needs to be an array with the included keys as listed. |
|
43 | + $options = array( |
|
44 | + // 'optionName' => '', //(optional) - used as the reference for saving update information in the |
|
45 | + // clients options table. Will be automatically set if left blank. |
|
46 | + 'apikey' => $this->config->siteLicenseKey(), |
|
47 | + // (required), you will need to obtain the apikey that the client gets from your site and |
|
48 | + // then saves in their sites options table (see 'getting an api-key' below) |
|
49 | + 'lang_domain' => $this->config->i18nDomain(), |
|
50 | + // (optional) - put here whatever reference you are using for the localization of your plugin (if it's |
|
51 | + // localized). That way strings in this file will be included in the translation for your plugin. |
|
52 | + 'checkPeriod' => $this->config->checkPeriod(), |
|
53 | + // (optional) - use this parameter to indicate how often you want the client's install to ping your |
|
54 | + // server for update checks. The integer indicates hours. If you don't include this parameter it will |
|
55 | + // default to 12 hours. |
|
56 | + 'option_key' => $this->config->optionKey(), |
|
57 | + // this is what is used to reference the api_key in your plugin options. PUE uses this to trigger |
|
58 | + // updating your information message whenever this option_key is modified. |
|
59 | + 'options_page_slug' => $this->config->optionsPageSlug(), |
|
60 | + 'plugin_basename' => EE_PLUGIN_BASENAME, |
|
61 | + 'use_wp_update' => true, |
|
62 | + // if TRUE then you want FREE versions of the plugin to be updated from WP |
|
63 | + 'extra_stats' => $this->stats_collection->statsCallback(), |
|
64 | + 'turn_on_notices_saved' => true, |
|
65 | + ); |
|
66 | + // initiate the class and start the plugin update engine! |
|
67 | + new PluginUpdateEngineChecker( |
|
68 | + $this->config->hostServerUrl(), |
|
69 | + $this->config->pluginSlug(), |
|
70 | + $options |
|
71 | + ); |
|
72 | + } |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * This is a handy helper method for retrieving whether there is an update available for the given plugin. |
|
78 | + * |
|
79 | + * @param string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to |
|
80 | + * identify plugins. Defaults to core update |
|
81 | + * @return boolean True if update available, false if not. |
|
82 | + */ |
|
83 | + public static function isUpdateAvailable($basename = '') |
|
84 | + { |
|
85 | + $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
86 | + |
|
87 | + $update = false; |
|
88 | + |
|
89 | + // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
90 | + $folder = '/' . dirname($basename); |
|
91 | + |
|
92 | + $plugins = get_plugins($folder); |
|
93 | + $current = get_site_transient('update_plugins'); |
|
94 | + |
|
95 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
96 | + if (isset($current->response['plugin_file'])) { |
|
97 | + $update = true; |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + // it's possible that there is an update but an invalid site-license-key is in use |
|
102 | + if (get_site_option('pue_json_error_' . $basename)) { |
|
103 | + $update = true; |
|
104 | + } |
|
105 | + |
|
106 | + return $update; |
|
107 | + } |
|
108 | 108 | } |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | private function loadPueClient() |
37 | 37 | { |
38 | 38 | // PUE Auto Upgrades stuff |
39 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
40 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
39 | + if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { // include the file |
|
40 | + require_once(EE_THIRD_PARTY.'pue/pue-client.php'); |
|
41 | 41 | |
42 | 42 | // $options needs to be an array with the included keys as listed. |
43 | 43 | $options = array( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $update = false; |
88 | 88 | |
89 | 89 | // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
90 | - $folder = '/' . dirname($basename); |
|
90 | + $folder = '/'.dirname($basename); |
|
91 | 91 | |
92 | 92 | $plugins = get_plugins($folder); |
93 | 93 | $current = get_site_transient('update_plugins'); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // it's possible that there is an update but an invalid site-license-key is in use |
102 | - if (get_site_option('pue_json_error_' . $basename)) { |
|
102 | + if (get_site_option('pue_json_error_'.$basename)) { |
|
103 | 103 | $update = true; |
104 | 104 | } |
105 | 105 |
@@ -16,29 +16,29 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * used for setting up css and js required for the display strategy |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function enqueueStylesAndScripts() |
|
25 | - { |
|
26 | - // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
|
27 | - wp_enqueue_style( |
|
28 | - 'ee_progress_steps_display_number_bubbles', |
|
29 | - plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
30 | - ); |
|
31 | - } |
|
19 | + /** |
|
20 | + * used for setting up css and js required for the display strategy |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function enqueueStylesAndScripts() |
|
25 | + { |
|
26 | + // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
|
27 | + wp_enqueue_style( |
|
28 | + 'ee_progress_steps_display_number_bubbles', |
|
29 | + plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * loads and returns a full server path to the template used for the display strategy |
|
36 | - * |
|
37 | - * @return string |
|
38 | - */ |
|
39 | - public function getTemplate() |
|
40 | - { |
|
41 | - // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
|
42 | - return __DIR__ . '/number_bubbles.template.php'; |
|
43 | - } |
|
34 | + /** |
|
35 | + * loads and returns a full server path to the template used for the display strategy |
|
36 | + * |
|
37 | + * @return string |
|
38 | + */ |
|
39 | + public function getTemplate() |
|
40 | + { |
|
41 | + // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
|
42 | + return __DIR__ . '/number_bubbles.template.php'; |
|
43 | + } |
|
44 | 44 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
27 | 27 | wp_enqueue_style( |
28 | 28 | 'ee_progress_steps_display_number_bubbles', |
29 | - plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
29 | + plugin_dir_url(__FILE__).'number_bubbles.css' |
|
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
@@ -39,6 +39,6 @@ discard block |
||
39 | 39 | public function getTemplate() |
40 | 40 | { |
41 | 41 | // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
42 | - return __DIR__ . '/number_bubbles.template.php'; |
|
42 | + return __DIR__.'/number_bubbles.template.php'; |
|
43 | 43 | } |
44 | 44 | } |