@@ -4,8 +4,8 @@ |
||
4 | 4 | <p><strong><?php esc_html_e('Add New Default Price', 'event_espresso'); ?></strong></p> |
5 | 5 | <p> |
6 | 6 | <?php printf( |
7 | - esc_html__('This page allows you to create a new default price for %s.', 'event_espresso'), |
|
8 | - Domain::brandName() |
|
7 | + esc_html__('This page allows you to create a new default price for %s.', 'event_espresso'), |
|
8 | + Domain::brandName() |
|
9 | 9 | ); ?> |
10 | 10 | </p> |
11 | 11 | <ul> |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $this->loader->getShared( |
60 | 60 | 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
61 | 61 | ); |
62 | - } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
62 | + } elseif ($screenID === 'front' && ! empty($heartbeat_data[self::RESPONSE_KEY_THANK_YOU_PAGE])) { |
|
63 | 63 | $this->loader->getShared( |
64 | 64 | 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
65 | 65 | ); |
@@ -16,52 +16,52 @@ |
||
16 | 16 | */ |
17 | 17 | class WordpressHeartbeat |
18 | 18 | { |
19 | - const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page'; |
|
19 | + const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page'; |
|
20 | 20 | |
21 | - /** |
|
22 | - * @var LoaderInterface $loader |
|
23 | - */ |
|
24 | - protected $loader; |
|
21 | + /** |
|
22 | + * @var LoaderInterface $loader |
|
23 | + */ |
|
24 | + protected $loader; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var RequestInterface $request |
|
28 | - */ |
|
29 | - protected $request; |
|
26 | + /** |
|
27 | + * @var RequestInterface $request |
|
28 | + */ |
|
29 | + protected $request; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * WordpressHeartbeat constructor. |
|
34 | - * |
|
35 | - * @param LoaderInterface $loader |
|
36 | - * @param RequestInterface $request |
|
37 | - */ |
|
38 | - public function __construct( |
|
39 | - LoaderInterface $loader, |
|
40 | - RequestInterface $request |
|
41 | - ) { |
|
42 | - $this->loader = $loader; |
|
43 | - $this->request = $request; |
|
44 | - do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this); |
|
45 | - add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes')); |
|
46 | - } |
|
32 | + /** |
|
33 | + * WordpressHeartbeat constructor. |
|
34 | + * |
|
35 | + * @param LoaderInterface $loader |
|
36 | + * @param RequestInterface $request |
|
37 | + */ |
|
38 | + public function __construct( |
|
39 | + LoaderInterface $loader, |
|
40 | + RequestInterface $request |
|
41 | + ) { |
|
42 | + $this->loader = $loader; |
|
43 | + $this->request = $request; |
|
44 | + do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this); |
|
45 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes')); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * @since 4.9.76.p |
|
51 | - * @throws InvalidClassException |
|
52 | - */ |
|
53 | - public function resolveRoutes() |
|
54 | - { |
|
55 | - $screenID = $this->request->getRequestParam('screen_id'); |
|
56 | - $heartbeat_data = $this->request->getRequestParam('data', [], 'string', true); |
|
57 | - if ($screenID === 'espresso_events') { |
|
58 | - $this->loader->getShared( |
|
59 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
|
60 | - ); |
|
61 | - } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
62 | - $this->loader->getShared( |
|
63 | - 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
|
64 | - ); |
|
65 | - } |
|
66 | - } |
|
49 | + /** |
|
50 | + * @since 4.9.76.p |
|
51 | + * @throws InvalidClassException |
|
52 | + */ |
|
53 | + public function resolveRoutes() |
|
54 | + { |
|
55 | + $screenID = $this->request->getRequestParam('screen_id'); |
|
56 | + $heartbeat_data = $this->request->getRequestParam('data', [], 'string', true); |
|
57 | + if ($screenID === 'espresso_events') { |
|
58 | + $this->loader->getShared( |
|
59 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
|
60 | + ); |
|
61 | + } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
62 | + $this->loader->getShared( |
|
63 | + 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
|
64 | + ); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | } |
@@ -7,24 +7,24 @@ |
||
7 | 7 | * ACF compatibility |
8 | 8 | */ |
9 | 9 | add_action( |
10 | - 'plugins_loaded', |
|
11 | - function () { |
|
12 | - if (function_exists('acf_include')) { |
|
13 | - add_filter( |
|
14 | - 'acf/get_post_types', |
|
15 | - function ($post_types, $args) { |
|
16 | - if (! empty($args['show_ui'])) { |
|
17 | - $ee_post_types = get_post_types(array('show_ee_ui' => 1)); |
|
18 | - $ee_post_types = array_keys($ee_post_types); |
|
19 | - $post_types = array_merge($post_types, $ee_post_types); |
|
20 | - $post_types = array_unique($post_types); |
|
21 | - } |
|
22 | - return $post_types; |
|
23 | - }, |
|
24 | - 10, |
|
25 | - 2 |
|
26 | - ); |
|
27 | - } |
|
28 | - }, |
|
29 | - 100 |
|
10 | + 'plugins_loaded', |
|
11 | + function () { |
|
12 | + if (function_exists('acf_include')) { |
|
13 | + add_filter( |
|
14 | + 'acf/get_post_types', |
|
15 | + function ($post_types, $args) { |
|
16 | + if (! empty($args['show_ui'])) { |
|
17 | + $ee_post_types = get_post_types(array('show_ee_ui' => 1)); |
|
18 | + $ee_post_types = array_keys($ee_post_types); |
|
19 | + $post_types = array_merge($post_types, $ee_post_types); |
|
20 | + $post_types = array_unique($post_types); |
|
21 | + } |
|
22 | + return $post_types; |
|
23 | + }, |
|
24 | + 10, |
|
25 | + 2 |
|
26 | + ); |
|
27 | + } |
|
28 | + }, |
|
29 | + 100 |
|
30 | 30 | ); |
@@ -8,12 +8,12 @@ |
||
8 | 8 | */ |
9 | 9 | add_action( |
10 | 10 | 'plugins_loaded', |
11 | - function () { |
|
11 | + function() { |
|
12 | 12 | if (function_exists('acf_include')) { |
13 | 13 | add_filter( |
14 | 14 | 'acf/get_post_types', |
15 | - function ($post_types, $args) { |
|
16 | - if (! empty($args['show_ui'])) { |
|
15 | + function($post_types, $args) { |
|
16 | + if ( ! empty($args['show_ui'])) { |
|
17 | 17 | $ee_post_types = get_post_types(array('show_ee_ui' => 1)); |
18 | 18 | $ee_post_types = array_keys($ee_post_types); |
19 | 19 | $post_types = array_merge($post_types, $ee_post_types); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | if (isset($input_settings['value_field_name'])) { |
38 | 38 | $this->valueFieldName = $input_settings['value_field_name']; |
39 | - if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) { |
|
39 | + if ( ! EEM_State::instance()->has_field((string) $this->valueFieldName())) { |
|
40 | 40 | throw new InvalidArgumentException( |
41 | 41 | sprintf( |
42 | 42 | esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'), |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this |
54 | 54 | ); |
55 | 55 | $input_settings['html_class'] = isset($input_settings['html_class']) |
56 | - ? $input_settings['html_class'] . ' ee-state-select-js' |
|
56 | + ? $input_settings['html_class'].' ee-state-select-js' |
|
57 | 57 | : 'ee-state-select-js'; |
58 | 58 | parent::__construct($state_options, $input_settings); |
59 | 59 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function get_state_answer_options($state_options = null) |
84 | 84 | { |
85 | 85 | // if passed something that is NOT an array |
86 | - if (! is_array($state_options) || empty($state_options)) { |
|
86 | + if ( ! is_array($state_options) || empty($state_options)) { |
|
87 | 87 | // get possibly cached list of states |
88 | 88 | $states = EEM_State::instance()->get_all_active_states(); |
89 | 89 | } |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | $states = $state_options; |
92 | 92 | $state_options = array(); |
93 | 93 | } |
94 | - if (! empty($states)) { |
|
94 | + if ( ! empty($states)) { |
|
95 | 95 | // set the default |
96 | 96 | $state_options[''][''] = ''; |
97 | 97 | foreach ($states as $state) { |
98 | 98 | if ($state instanceof EE_State) { |
99 | - $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name(); |
|
99 | + $state_options[$state->country()->name()][$state->get($this->valueFieldName())] = $state->name(); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
@@ -12,94 +12,94 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_State_Select_Input extends EE_Select_Input |
14 | 14 | { |
15 | - /** |
|
16 | - * @var string the name of the EE_State field to use for option values in the HTML form input. |
|
17 | - */ |
|
18 | - protected $valueFieldName; |
|
15 | + /** |
|
16 | + * @var string the name of the EE_State field to use for option values in the HTML form input. |
|
17 | + */ |
|
18 | + protected $valueFieldName; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @param EE_State[]|array|null $state_options. If a flat array of string is provided, |
|
22 | - * $input_settings['value_field_name'] is ignored. If an array of states is passed, that field will be used for |
|
23 | - * the keys (which will become the option values). If null or empty is passed, all active states will be used, |
|
24 | - * and $input_settings['value_field_name'] will again be used. * |
|
25 | - * @param array $input_settings same as parent, but also { |
|
26 | - * @type string $value_field_name the name of the field to use |
|
27 | - * for the HTML option values, ie, `STA_ID`, `STA_abbrev`, or `STA_name`. |
|
28 | - * } |
|
29 | - * @throws EE_Error |
|
30 | - * @throws InvalidArgumentException |
|
31 | - * @throws InvalidDataTypeException |
|
32 | - * @throws InvalidInterfaceException |
|
33 | - * @throws ReflectionException |
|
34 | - */ |
|
35 | - public function __construct($state_options, $input_settings = array()) |
|
36 | - { |
|
37 | - if (isset($input_settings['value_field_name'])) { |
|
38 | - $this->valueFieldName = $input_settings['value_field_name']; |
|
39 | - if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) { |
|
40 | - throw new InvalidArgumentException( |
|
41 | - sprintf( |
|
42 | - esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'), |
|
43 | - $this->valueFieldName() |
|
44 | - ) |
|
45 | - ); |
|
46 | - } |
|
47 | - } else { |
|
48 | - $this->valueFieldName = 'STA_ID'; |
|
49 | - } |
|
50 | - $state_options = apply_filters( |
|
51 | - 'FHEE__EE_State_Select_Input____construct__state_options', |
|
52 | - $this->get_state_answer_options($state_options), |
|
53 | - $this |
|
54 | - ); |
|
55 | - $input_settings['html_class'] = isset($input_settings['html_class']) |
|
56 | - ? $input_settings['html_class'] . ' ee-state-select-js' |
|
57 | - : 'ee-state-select-js'; |
|
58 | - parent::__construct($state_options, $input_settings); |
|
59 | - } |
|
20 | + /** |
|
21 | + * @param EE_State[]|array|null $state_options. If a flat array of string is provided, |
|
22 | + * $input_settings['value_field_name'] is ignored. If an array of states is passed, that field will be used for |
|
23 | + * the keys (which will become the option values). If null or empty is passed, all active states will be used, |
|
24 | + * and $input_settings['value_field_name'] will again be used. * |
|
25 | + * @param array $input_settings same as parent, but also { |
|
26 | + * @type string $value_field_name the name of the field to use |
|
27 | + * for the HTML option values, ie, `STA_ID`, `STA_abbrev`, or `STA_name`. |
|
28 | + * } |
|
29 | + * @throws EE_Error |
|
30 | + * @throws InvalidArgumentException |
|
31 | + * @throws InvalidDataTypeException |
|
32 | + * @throws InvalidInterfaceException |
|
33 | + * @throws ReflectionException |
|
34 | + */ |
|
35 | + public function __construct($state_options, $input_settings = array()) |
|
36 | + { |
|
37 | + if (isset($input_settings['value_field_name'])) { |
|
38 | + $this->valueFieldName = $input_settings['value_field_name']; |
|
39 | + if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) { |
|
40 | + throw new InvalidArgumentException( |
|
41 | + sprintf( |
|
42 | + esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'), |
|
43 | + $this->valueFieldName() |
|
44 | + ) |
|
45 | + ); |
|
46 | + } |
|
47 | + } else { |
|
48 | + $this->valueFieldName = 'STA_ID'; |
|
49 | + } |
|
50 | + $state_options = apply_filters( |
|
51 | + 'FHEE__EE_State_Select_Input____construct__state_options', |
|
52 | + $this->get_state_answer_options($state_options), |
|
53 | + $this |
|
54 | + ); |
|
55 | + $input_settings['html_class'] = isset($input_settings['html_class']) |
|
56 | + ? $input_settings['html_class'] . ' ee-state-select-js' |
|
57 | + : 'ee-state-select-js'; |
|
58 | + parent::__construct($state_options, $input_settings); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Returns the name of the state field used for the HTML option values. |
|
63 | - * @since 4.10.0.p |
|
64 | - * @return string |
|
65 | - */ |
|
66 | - public function valueFieldName() |
|
67 | - { |
|
68 | - return $this->valueFieldName; |
|
69 | - } |
|
61 | + /** |
|
62 | + * Returns the name of the state field used for the HTML option values. |
|
63 | + * @since 4.10.0.p |
|
64 | + * @return string |
|
65 | + */ |
|
66 | + public function valueFieldName() |
|
67 | + { |
|
68 | + return $this->valueFieldName; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * get_state_answer_options |
|
74 | - * |
|
75 | - * @param array $state_options |
|
76 | - * @return array |
|
77 | - * @throws EE_Error |
|
78 | - * @throws InvalidArgumentException |
|
79 | - * @throws ReflectionException |
|
80 | - * @throws InvalidDataTypeException |
|
81 | - * @throws InvalidInterfaceException |
|
82 | - */ |
|
83 | - public function get_state_answer_options($state_options = null) |
|
84 | - { |
|
85 | - // if passed something that is NOT an array |
|
86 | - if (! is_array($state_options) || empty($state_options)) { |
|
87 | - // get possibly cached list of states |
|
88 | - $states = EEM_State::instance()->get_all_active_states(); |
|
89 | - } |
|
90 | - if (is_array($state_options) && reset($state_options) instanceof EE_State) { |
|
91 | - $states = $state_options; |
|
92 | - $state_options = array(); |
|
93 | - } |
|
94 | - if (! empty($states)) { |
|
95 | - // set the default |
|
96 | - $state_options[''][''] = ''; |
|
97 | - foreach ($states as $state) { |
|
98 | - if ($state instanceof EE_State) { |
|
99 | - $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name(); |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
103 | - return $state_options; |
|
104 | - } |
|
72 | + /** |
|
73 | + * get_state_answer_options |
|
74 | + * |
|
75 | + * @param array $state_options |
|
76 | + * @return array |
|
77 | + * @throws EE_Error |
|
78 | + * @throws InvalidArgumentException |
|
79 | + * @throws ReflectionException |
|
80 | + * @throws InvalidDataTypeException |
|
81 | + * @throws InvalidInterfaceException |
|
82 | + */ |
|
83 | + public function get_state_answer_options($state_options = null) |
|
84 | + { |
|
85 | + // if passed something that is NOT an array |
|
86 | + if (! is_array($state_options) || empty($state_options)) { |
|
87 | + // get possibly cached list of states |
|
88 | + $states = EEM_State::instance()->get_all_active_states(); |
|
89 | + } |
|
90 | + if (is_array($state_options) && reset($state_options) instanceof EE_State) { |
|
91 | + $states = $state_options; |
|
92 | + $state_options = array(); |
|
93 | + } |
|
94 | + if (! empty($states)) { |
|
95 | + // set the default |
|
96 | + $state_options[''][''] = ''; |
|
97 | + foreach ($states as $state) { |
|
98 | + if ($state instanceof EE_State) { |
|
99 | + $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name(); |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | + return $state_options; |
|
104 | + } |
|
105 | 105 | } |
@@ -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(); |
@@ -11,48 +11,48 @@ |
||
11 | 11 | */ |
12 | 12 | class Registrations_Admin_Page_Init extends EE_Admin_Page_CPT_Init |
13 | 13 | { |
14 | - /** |
|
15 | - * constructor |
|
16 | - * |
|
17 | - * @Constructor |
|
18 | - * @access public |
|
19 | - * @return void |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
24 | - if (! defined('REG_PG_SLUG')) { |
|
25 | - define('REG_PG_SLUG', 'espresso_registrations'); |
|
26 | - define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
|
27 | - define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
28 | - define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
29 | - define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
30 | - define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
31 | - define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
32 | - define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
33 | - } |
|
14 | + /** |
|
15 | + * constructor |
|
16 | + * |
|
17 | + * @Constructor |
|
18 | + * @access public |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
24 | + if (! defined('REG_PG_SLUG')) { |
|
25 | + define('REG_PG_SLUG', 'espresso_registrations'); |
|
26 | + define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
|
27 | + define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
28 | + define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
29 | + define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
30 | + define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
31 | + define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
32 | + define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
33 | + } |
|
34 | 34 | |
35 | - parent::__construct(); |
|
36 | - } |
|
35 | + parent::__construct(); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - protected function _set_init_properties() |
|
40 | - { |
|
41 | - $this->label = esc_html__('Registrations Overview', 'event_espresso'); |
|
42 | - } |
|
39 | + protected function _set_init_properties() |
|
40 | + { |
|
41 | + $this->label = esc_html__('Registrations Overview', 'event_espresso'); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - public function getMenuProperties(): array |
|
46 | - { |
|
47 | - return [ |
|
48 | - 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
49 | - 'menu_group' => 'main', |
|
50 | - 'menu_order' => 40, |
|
51 | - 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
52 | - 'parent_slug' => 'espresso_events', |
|
53 | - 'menu_slug' => REG_PG_SLUG, |
|
54 | - 'menu_label' => esc_html__('Registrations', 'event_espresso'), |
|
55 | - 'capability' => 'ee_read_registrations', |
|
56 | - ]; |
|
57 | - } |
|
45 | + public function getMenuProperties(): array |
|
46 | + { |
|
47 | + return [ |
|
48 | + 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
49 | + 'menu_group' => 'main', |
|
50 | + 'menu_order' => 40, |
|
51 | + 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
52 | + 'parent_slug' => 'espresso_events', |
|
53 | + 'menu_slug' => REG_PG_SLUG, |
|
54 | + 'menu_label' => esc_html__('Registrations', 'event_espresso'), |
|
55 | + 'capability' => 'ee_read_registrations', |
|
56 | + ]; |
|
57 | + } |
|
58 | 58 | } |
@@ -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 | } |
@@ -14,89 +14,89 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_PMT_Paypal_Express extends EE_PMT_Base |
16 | 16 | { |
17 | - /** |
|
18 | - * EE_PMT_Paypal_Express constructor. |
|
19 | - */ |
|
20 | - public function __construct($pm_instance = null) |
|
21 | - { |
|
22 | - require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php'); |
|
23 | - $this->_gateway = new EEG_Paypal_Express(); |
|
17 | + /** |
|
18 | + * EE_PMT_Paypal_Express constructor. |
|
19 | + */ |
|
20 | + public function __construct($pm_instance = null) |
|
21 | + { |
|
22 | + require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php'); |
|
23 | + $this->_gateway = new EEG_Paypal_Express(); |
|
24 | 24 | |
25 | - $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso'); |
|
26 | - $this->_template_path = $this->file_folder() . 'templates/'; |
|
27 | - $this->_default_description = esc_html__( |
|
28 | - // @codingStandardsIgnoreStart |
|
29 | - 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', |
|
30 | - // @codingStandardsIgnoreEnd |
|
31 | - 'event_espresso' |
|
32 | - ); |
|
33 | - $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png'; |
|
25 | + $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso'); |
|
26 | + $this->_template_path = $this->file_folder() . 'templates/'; |
|
27 | + $this->_default_description = esc_html__( |
|
28 | + // @codingStandardsIgnoreStart |
|
29 | + 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', |
|
30 | + // @codingStandardsIgnoreEnd |
|
31 | + 'event_espresso' |
|
32 | + ); |
|
33 | + $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png'; |
|
34 | 34 | |
35 | - parent::__construct($pm_instance); |
|
36 | - } |
|
35 | + parent::__construct($pm_instance); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * Adds the help tab. |
|
41 | - * |
|
42 | - * @see EE_PMT_Base::help_tabs_config() |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function help_tabs_config() |
|
46 | - { |
|
47 | - return array( |
|
48 | - $this->get_help_tab_name() => array( |
|
49 | - 'title' => esc_html__('PayPal Express Settings', 'event_espresso'), |
|
50 | - 'filename' => 'payment_methods_overview_paypal_express' |
|
51 | - ) |
|
52 | - ); |
|
53 | - } |
|
39 | + /** |
|
40 | + * Adds the help tab. |
|
41 | + * |
|
42 | + * @see EE_PMT_Base::help_tabs_config() |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function help_tabs_config() |
|
46 | + { |
|
47 | + return array( |
|
48 | + $this->get_help_tab_name() => array( |
|
49 | + 'title' => esc_html__('PayPal Express Settings', 'event_espresso'), |
|
50 | + 'filename' => 'payment_methods_overview_paypal_express' |
|
51 | + ) |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Gets the form for all the settings related to this payment method type. |
|
58 | - * |
|
59 | - * @return EE_Payment_Method_Form |
|
60 | - */ |
|
61 | - public function generate_new_settings_form() |
|
62 | - { |
|
63 | - return new SettingsForm(array(), $this->get_help_tab_link()); |
|
64 | - } |
|
56 | + /** |
|
57 | + * Gets the form for all the settings related to this payment method type. |
|
58 | + * |
|
59 | + * @return EE_Payment_Method_Form |
|
60 | + */ |
|
61 | + public function generate_new_settings_form() |
|
62 | + { |
|
63 | + return new SettingsForm(array(), $this->get_help_tab_link()); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * Creates a billing form for this payment method type. |
|
69 | - * |
|
70 | - * @param \EE_Transaction $transaction |
|
71 | - * @return \EE_Billing_Info_Form |
|
72 | - */ |
|
73 | - public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
74 | - { |
|
75 | - if ($this->_pm_instance->debug_mode()) { |
|
76 | - $form = new EE_Billing_Info_Form( |
|
77 | - $this->_pm_instance, |
|
78 | - array( |
|
79 | - 'name' => 'paypal_express_Info_Form', |
|
80 | - 'subsections' => array( |
|
81 | - 'paypal_express_debug_info' => new EE_Form_Section_Proper( |
|
82 | - array( |
|
83 | - 'layout_strategy' => new EE_Template_Layout( |
|
84 | - array( |
|
85 | - 'layout_template_file' => $this->_template_path |
|
86 | - . 'paypal_express_debug_info.template.php', |
|
87 | - 'template_args' => array( |
|
88 | - 'debug_mode' => $this->_pm_instance->debug_mode() |
|
89 | - ) |
|
90 | - ) |
|
91 | - ) |
|
92 | - ) |
|
93 | - ) |
|
94 | - ) |
|
95 | - ) |
|
96 | - ); |
|
97 | - return $form; |
|
98 | - } |
|
67 | + /** |
|
68 | + * Creates a billing form for this payment method type. |
|
69 | + * |
|
70 | + * @param \EE_Transaction $transaction |
|
71 | + * @return \EE_Billing_Info_Form |
|
72 | + */ |
|
73 | + public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
74 | + { |
|
75 | + if ($this->_pm_instance->debug_mode()) { |
|
76 | + $form = new EE_Billing_Info_Form( |
|
77 | + $this->_pm_instance, |
|
78 | + array( |
|
79 | + 'name' => 'paypal_express_Info_Form', |
|
80 | + 'subsections' => array( |
|
81 | + 'paypal_express_debug_info' => new EE_Form_Section_Proper( |
|
82 | + array( |
|
83 | + 'layout_strategy' => new EE_Template_Layout( |
|
84 | + array( |
|
85 | + 'layout_template_file' => $this->_template_path |
|
86 | + . 'paypal_express_debug_info.template.php', |
|
87 | + 'template_args' => array( |
|
88 | + 'debug_mode' => $this->_pm_instance->debug_mode() |
|
89 | + ) |
|
90 | + ) |
|
91 | + ) |
|
92 | + ) |
|
93 | + ) |
|
94 | + ) |
|
95 | + ) |
|
96 | + ); |
|
97 | + return $form; |
|
98 | + } |
|
99 | 99 | |
100 | - return false; |
|
101 | - } |
|
100 | + return false; |
|
101 | + } |
|
102 | 102 | } |
@@ -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 | } |
@@ -17,156 +17,156 @@ |
||
17 | 17 | */ |
18 | 18 | class FqcnLocator extends Locator |
19 | 19 | { |
20 | - /** |
|
21 | - * @var array $FQCNs |
|
22 | - */ |
|
23 | - protected $FQCNs = array(); |
|
24 | - |
|
25 | - /** |
|
26 | - * @var array $namespaces |
|
27 | - */ |
|
28 | - protected $namespaces = array(); |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * @access protected |
|
33 | - * @param string $namespace |
|
34 | - * @param string $namespace_base_dir |
|
35 | - * @throws InvalidDataTypeException |
|
36 | - */ |
|
37 | - protected function setNamespace($namespace, $namespace_base_dir) |
|
38 | - { |
|
39 | - if (! is_string($namespace)) { |
|
40 | - throw new InvalidDataTypeException('$namespace', $namespace, 'string'); |
|
41 | - } |
|
42 | - if (! is_string($namespace_base_dir)) { |
|
43 | - throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string'); |
|
44 | - } |
|
45 | - $this->namespaces[ $namespace ] = $namespace_base_dir; |
|
46 | - } |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * @access public |
|
51 | - * @return array |
|
52 | - */ |
|
53 | - public function getFQCNs() |
|
54 | - { |
|
55 | - return $this->FQCNs; |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * @access public |
|
61 | - * @return int |
|
62 | - */ |
|
63 | - public function count() |
|
64 | - { |
|
65 | - return count($this->FQCNs); |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * given a valid namespace, will find all files that match the provided mask |
|
71 | - * |
|
72 | - * @access public |
|
73 | - * @param string|array $namespaces |
|
74 | - * @return array |
|
75 | - * @throws InvalidClassException |
|
76 | - * @throws InvalidDataTypeException |
|
77 | - */ |
|
78 | - public function locate($namespaces) |
|
79 | - { |
|
80 | - if (! (is_string($namespaces) || is_array($namespaces))) { |
|
81 | - throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array'); |
|
82 | - } |
|
83 | - foreach ((array) $namespaces as $namespace) { |
|
84 | - foreach ($this->findFQCNsByNamespace($namespace) as $key => $file) { |
|
85 | - $this->FQCNs[ $key ] = $file; |
|
86 | - } |
|
87 | - } |
|
88 | - return $this->FQCNs; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * given a partial namespace, will find all files in that folder |
|
94 | - * ** PLZ NOTE ** |
|
95 | - * This assumes that all files within the specified folder should be loaded |
|
96 | - * |
|
97 | - * @access protected |
|
98 | - * @param string $partial_namespace |
|
99 | - * @return array |
|
100 | - * @throws InvalidClassException |
|
101 | - * @throws InvalidDataTypeException |
|
102 | - */ |
|
103 | - protected function findFQCNsByNamespace($partial_namespace) |
|
104 | - { |
|
105 | - $iterator = new FilesystemIterator( |
|
106 | - $this->getDirectoryFromPartialNamespace($partial_namespace) |
|
107 | - ); |
|
108 | - $iterator->setFlags(FilesystemIterator::CURRENT_AS_FILEINFO); |
|
109 | - $iterator->setFlags(FilesystemIterator::UNIX_PATHS); |
|
110 | - if (iterator_count($iterator) === 0) { |
|
111 | - return array(); |
|
112 | - } |
|
113 | - foreach ($iterator as $file) { |
|
114 | - if ($file->isFile() && $file->getExtension() === 'php') { |
|
115 | - $file = $file->getPath() . '/' . $file->getBasename('.php'); |
|
116 | - foreach ($this->namespaces as $namespace => $base_dir) { |
|
117 | - $namespace .= Psr4Autoloader::NS; |
|
118 | - if (strpos($file, $base_dir) === 0) { |
|
119 | - $this->FQCNs[] = Psr4Autoloader::NS . str_replace( |
|
120 | - array($base_dir, '/'), |
|
121 | - array($namespace, Psr4Autoloader::NS), |
|
122 | - $file |
|
123 | - ); |
|
124 | - } |
|
125 | - } |
|
126 | - } |
|
127 | - } |
|
128 | - return $this->FQCNs; |
|
129 | - } |
|
130 | - |
|
131 | - |
|
132 | - /** |
|
133 | - * getDirectoryFromPartialNamespace |
|
134 | - * |
|
135 | - * @access protected |
|
136 | - * @param string $partial_namespace almost fully qualified class name ? |
|
137 | - * @return string |
|
138 | - * @throws InvalidDataTypeException |
|
139 | - * @throws InvalidClassException |
|
140 | - */ |
|
141 | - protected function getDirectoryFromPartialNamespace($partial_namespace) |
|
142 | - { |
|
143 | - if (empty($partial_namespace)) { |
|
144 | - throw new InvalidClassException($partial_namespace); |
|
145 | - } |
|
146 | - // load our PSR-4 Autoloader so we can get the list of registered namespaces from it |
|
147 | - $psr4_loader = \EE_Psr4AutoloaderInit::psr4_loader(); |
|
148 | - // breakup the incoming namespace into segments so we can loop thru them |
|
149 | - $namespace_segments = explode(Psr4Autoloader::NS, trim($partial_namespace, Psr4Autoloader::NS)); |
|
150 | - // we're only interested in the Vendor and secondary base, so pull those from the array |
|
151 | - $vendor_base = array_slice($namespace_segments, 0, 2); |
|
152 | - $namespace = $prefix = null; |
|
153 | - while (! empty($vendor_base)) { |
|
154 | - $namespace = implode(Psr4Autoloader::NS, $vendor_base); |
|
155 | - // check if there's a base directory registered for that namespace |
|
156 | - $prefix = $psr4_loader->prefixes($namespace . Psr4Autoloader::NS); |
|
157 | - if (! empty($prefix) && ! empty($prefix[0])) { |
|
158 | - // found one! |
|
159 | - break; |
|
160 | - } |
|
161 | - // remove base and try vendor only portion of namespace |
|
162 | - array_pop($vendor_base); |
|
163 | - } |
|
164 | - // nope? then the incoming namespace is invalid |
|
165 | - if (empty($prefix) || empty($prefix[0])) { |
|
166 | - throw new InvalidClassException($partial_namespace); |
|
167 | - } |
|
168 | - $this->setNamespace($namespace, $prefix[0]); |
|
169 | - // but if it's good, add that base directory to the rest of the path, and return it |
|
170 | - return $prefix[0] . implode('/', array_diff($namespace_segments, $vendor_base)) . '/'; |
|
171 | - } |
|
20 | + /** |
|
21 | + * @var array $FQCNs |
|
22 | + */ |
|
23 | + protected $FQCNs = array(); |
|
24 | + |
|
25 | + /** |
|
26 | + * @var array $namespaces |
|
27 | + */ |
|
28 | + protected $namespaces = array(); |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * @access protected |
|
33 | + * @param string $namespace |
|
34 | + * @param string $namespace_base_dir |
|
35 | + * @throws InvalidDataTypeException |
|
36 | + */ |
|
37 | + protected function setNamespace($namespace, $namespace_base_dir) |
|
38 | + { |
|
39 | + if (! is_string($namespace)) { |
|
40 | + throw new InvalidDataTypeException('$namespace', $namespace, 'string'); |
|
41 | + } |
|
42 | + if (! is_string($namespace_base_dir)) { |
|
43 | + throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string'); |
|
44 | + } |
|
45 | + $this->namespaces[ $namespace ] = $namespace_base_dir; |
|
46 | + } |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * @access public |
|
51 | + * @return array |
|
52 | + */ |
|
53 | + public function getFQCNs() |
|
54 | + { |
|
55 | + return $this->FQCNs; |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * @access public |
|
61 | + * @return int |
|
62 | + */ |
|
63 | + public function count() |
|
64 | + { |
|
65 | + return count($this->FQCNs); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * given a valid namespace, will find all files that match the provided mask |
|
71 | + * |
|
72 | + * @access public |
|
73 | + * @param string|array $namespaces |
|
74 | + * @return array |
|
75 | + * @throws InvalidClassException |
|
76 | + * @throws InvalidDataTypeException |
|
77 | + */ |
|
78 | + public function locate($namespaces) |
|
79 | + { |
|
80 | + if (! (is_string($namespaces) || is_array($namespaces))) { |
|
81 | + throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array'); |
|
82 | + } |
|
83 | + foreach ((array) $namespaces as $namespace) { |
|
84 | + foreach ($this->findFQCNsByNamespace($namespace) as $key => $file) { |
|
85 | + $this->FQCNs[ $key ] = $file; |
|
86 | + } |
|
87 | + } |
|
88 | + return $this->FQCNs; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * given a partial namespace, will find all files in that folder |
|
94 | + * ** PLZ NOTE ** |
|
95 | + * This assumes that all files within the specified folder should be loaded |
|
96 | + * |
|
97 | + * @access protected |
|
98 | + * @param string $partial_namespace |
|
99 | + * @return array |
|
100 | + * @throws InvalidClassException |
|
101 | + * @throws InvalidDataTypeException |
|
102 | + */ |
|
103 | + protected function findFQCNsByNamespace($partial_namespace) |
|
104 | + { |
|
105 | + $iterator = new FilesystemIterator( |
|
106 | + $this->getDirectoryFromPartialNamespace($partial_namespace) |
|
107 | + ); |
|
108 | + $iterator->setFlags(FilesystemIterator::CURRENT_AS_FILEINFO); |
|
109 | + $iterator->setFlags(FilesystemIterator::UNIX_PATHS); |
|
110 | + if (iterator_count($iterator) === 0) { |
|
111 | + return array(); |
|
112 | + } |
|
113 | + foreach ($iterator as $file) { |
|
114 | + if ($file->isFile() && $file->getExtension() === 'php') { |
|
115 | + $file = $file->getPath() . '/' . $file->getBasename('.php'); |
|
116 | + foreach ($this->namespaces as $namespace => $base_dir) { |
|
117 | + $namespace .= Psr4Autoloader::NS; |
|
118 | + if (strpos($file, $base_dir) === 0) { |
|
119 | + $this->FQCNs[] = Psr4Autoloader::NS . str_replace( |
|
120 | + array($base_dir, '/'), |
|
121 | + array($namespace, Psr4Autoloader::NS), |
|
122 | + $file |
|
123 | + ); |
|
124 | + } |
|
125 | + } |
|
126 | + } |
|
127 | + } |
|
128 | + return $this->FQCNs; |
|
129 | + } |
|
130 | + |
|
131 | + |
|
132 | + /** |
|
133 | + * getDirectoryFromPartialNamespace |
|
134 | + * |
|
135 | + * @access protected |
|
136 | + * @param string $partial_namespace almost fully qualified class name ? |
|
137 | + * @return string |
|
138 | + * @throws InvalidDataTypeException |
|
139 | + * @throws InvalidClassException |
|
140 | + */ |
|
141 | + protected function getDirectoryFromPartialNamespace($partial_namespace) |
|
142 | + { |
|
143 | + if (empty($partial_namespace)) { |
|
144 | + throw new InvalidClassException($partial_namespace); |
|
145 | + } |
|
146 | + // load our PSR-4 Autoloader so we can get the list of registered namespaces from it |
|
147 | + $psr4_loader = \EE_Psr4AutoloaderInit::psr4_loader(); |
|
148 | + // breakup the incoming namespace into segments so we can loop thru them |
|
149 | + $namespace_segments = explode(Psr4Autoloader::NS, trim($partial_namespace, Psr4Autoloader::NS)); |
|
150 | + // we're only interested in the Vendor and secondary base, so pull those from the array |
|
151 | + $vendor_base = array_slice($namespace_segments, 0, 2); |
|
152 | + $namespace = $prefix = null; |
|
153 | + while (! empty($vendor_base)) { |
|
154 | + $namespace = implode(Psr4Autoloader::NS, $vendor_base); |
|
155 | + // check if there's a base directory registered for that namespace |
|
156 | + $prefix = $psr4_loader->prefixes($namespace . Psr4Autoloader::NS); |
|
157 | + if (! empty($prefix) && ! empty($prefix[0])) { |
|
158 | + // found one! |
|
159 | + break; |
|
160 | + } |
|
161 | + // remove base and try vendor only portion of namespace |
|
162 | + array_pop($vendor_base); |
|
163 | + } |
|
164 | + // nope? then the incoming namespace is invalid |
|
165 | + if (empty($prefix) || empty($prefix[0])) { |
|
166 | + throw new InvalidClassException($partial_namespace); |
|
167 | + } |
|
168 | + $this->setNamespace($namespace, $prefix[0]); |
|
169 | + // but if it's good, add that base directory to the rest of the path, and return it |
|
170 | + return $prefix[0] . implode('/', array_diff($namespace_segments, $vendor_base)) . '/'; |
|
171 | + } |
|
172 | 172 | } |
@@ -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); |
@@ -28,84 +28,84 @@ |
||
28 | 28 | */ |
29 | 29 | class BootstrapRequestResponseObjects |
30 | 30 | { |
31 | - /** |
|
32 | - * @type LegacyRequestInterface $legacy_request |
|
33 | - */ |
|
34 | - protected $legacy_request; |
|
31 | + /** |
|
32 | + * @type LegacyRequestInterface $legacy_request |
|
33 | + */ |
|
34 | + protected $legacy_request; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @type LoaderInterface $loader |
|
38 | - */ |
|
39 | - protected $loader; |
|
36 | + /** |
|
37 | + * @type LoaderInterface $loader |
|
38 | + */ |
|
39 | + protected $loader; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var RequestInterface $request |
|
43 | - */ |
|
44 | - protected $request; |
|
41 | + /** |
|
42 | + * @var RequestInterface $request |
|
43 | + */ |
|
44 | + protected $request; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var ResponseInterface $response |
|
48 | - */ |
|
49 | - protected $response; |
|
46 | + /** |
|
47 | + * @var ResponseInterface $response |
|
48 | + */ |
|
49 | + protected $response; |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * BootstrapRequestResponseObjects constructor. |
|
54 | - * |
|
55 | - * @param LoaderInterface $loader |
|
56 | - */ |
|
57 | - public function __construct(LoaderInterface $loader) |
|
58 | - { |
|
59 | - $this->loader = $loader; |
|
60 | - } |
|
52 | + /** |
|
53 | + * BootstrapRequestResponseObjects constructor. |
|
54 | + * |
|
55 | + * @param LoaderInterface $loader |
|
56 | + */ |
|
57 | + public function __construct(LoaderInterface $loader) |
|
58 | + { |
|
59 | + $this->loader = $loader; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public function buildRequestResponse() |
|
67 | - { |
|
68 | - $request_params = new RequestParams(new RequestSanitizer()); |
|
69 | - $server_params = new ServerParams(new ServerSanitizer()); |
|
70 | - // load our Request and Response objects |
|
71 | - $this->request = new Request($request_params, $server_params); |
|
72 | - $this->response = new Response(); |
|
73 | - $this->loader->share(RequestParams::class, $request_params); |
|
74 | - $this->loader->share(ServerParams::class, $server_params); |
|
75 | - } |
|
63 | + /** |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public function buildRequestResponse() |
|
67 | + { |
|
68 | + $request_params = new RequestParams(new RequestSanitizer()); |
|
69 | + $server_params = new ServerParams(new ServerSanitizer()); |
|
70 | + // load our Request and Response objects |
|
71 | + $this->request = new Request($request_params, $server_params); |
|
72 | + $this->response = new Response(); |
|
73 | + $this->loader->share(RequestParams::class, $request_params); |
|
74 | + $this->loader->share(ServerParams::class, $server_params); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @return void |
|
80 | - * @throws InvalidArgumentException |
|
81 | - */ |
|
82 | - public function shareRequestResponse() |
|
83 | - { |
|
84 | - $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
85 | - $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
86 | - EE_Dependency_Map::instance()->setRequest($this->request); |
|
87 | - EE_Dependency_Map::instance()->setResponse($this->response); |
|
88 | - } |
|
78 | + /** |
|
79 | + * @return void |
|
80 | + * @throws InvalidArgumentException |
|
81 | + */ |
|
82 | + public function shareRequestResponse() |
|
83 | + { |
|
84 | + $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
85 | + $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
86 | + EE_Dependency_Map::instance()->setRequest($this->request); |
|
87 | + EE_Dependency_Map::instance()->setResponse($this->response); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * @return void |
|
93 | - * @throws InvalidArgumentException |
|
94 | - * @throws EE_Error |
|
95 | - */ |
|
96 | - public function setupLegacyRequest() |
|
97 | - { |
|
98 | - espresso_load_required( |
|
99 | - 'EE_Request', |
|
100 | - EE_CORE . 'request_stack/EE_Request.core.php' |
|
101 | - ); |
|
102 | - $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
103 | - $this->legacy_request->setRequest($this->request); |
|
104 | - $this->legacy_request->admin = $this->request->isAdmin(); |
|
105 | - $this->legacy_request->ajax = $this->request->isAjax(); |
|
106 | - $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
107 | - EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
108 | - $this->loader->share('EE_Request', $this->legacy_request); |
|
109 | - $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
110 | - } |
|
91 | + /** |
|
92 | + * @return void |
|
93 | + * @throws InvalidArgumentException |
|
94 | + * @throws EE_Error |
|
95 | + */ |
|
96 | + public function setupLegacyRequest() |
|
97 | + { |
|
98 | + espresso_load_required( |
|
99 | + 'EE_Request', |
|
100 | + EE_CORE . 'request_stack/EE_Request.core.php' |
|
101 | + ); |
|
102 | + $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
103 | + $this->legacy_request->setRequest($this->request); |
|
104 | + $this->legacy_request->admin = $this->request->isAdmin(); |
|
105 | + $this->legacy_request->ajax = $this->request->isAjax(); |
|
106 | + $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
107 | + EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
108 | + $this->loader->share('EE_Request', $this->legacy_request); |
|
109 | + $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
110 | + } |
|
111 | 111 | } |
@@ -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 |
@@ -46,225 +46,225 @@ |
||
46 | 46 | */ |
47 | 47 | class BootstrapCore |
48 | 48 | { |
49 | - /** |
|
50 | - * @type LoaderInterface $loader |
|
51 | - */ |
|
52 | - private $loader; |
|
49 | + /** |
|
50 | + * @type LoaderInterface $loader |
|
51 | + */ |
|
52 | + private $loader; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @var RequestInterface $request |
|
56 | - */ |
|
57 | - protected $request; |
|
54 | + /** |
|
55 | + * @var RequestInterface $request |
|
56 | + */ |
|
57 | + protected $request; |
|
58 | 58 | |
59 | - /** |
|
60 | - * @var ResponseInterface $response |
|
61 | - */ |
|
62 | - protected $response; |
|
59 | + /** |
|
60 | + * @var ResponseInterface $response |
|
61 | + */ |
|
62 | + protected $response; |
|
63 | 63 | |
64 | - /** |
|
65 | - * @var RequestStackBuilder $request_stack_builder |
|
66 | - */ |
|
67 | - protected $request_stack_builder; |
|
64 | + /** |
|
65 | + * @var RequestStackBuilder $request_stack_builder |
|
66 | + */ |
|
67 | + protected $request_stack_builder; |
|
68 | 68 | |
69 | - /** |
|
70 | - * @var RequestStack $request_stack |
|
71 | - */ |
|
72 | - protected $request_stack; |
|
69 | + /** |
|
70 | + * @var RequestStack $request_stack |
|
71 | + */ |
|
72 | + protected $request_stack; |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * BootstrapCore constructor. |
|
77 | - */ |
|
78 | - public function __construct() |
|
79 | - { |
|
80 | - do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
81 | - // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
82 | - add_action('plugins_loaded', array($this, 'initialize'), 0); |
|
83 | - } |
|
75 | + /** |
|
76 | + * BootstrapCore constructor. |
|
77 | + */ |
|
78 | + public function __construct() |
|
79 | + { |
|
80 | + do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
81 | + // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
82 | + add_action('plugins_loaded', array($this, 'initialize'), 0); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @throws DomainException |
|
88 | - * @throws EE_Error |
|
89 | - * @throws Exception |
|
90 | - * @throws InvalidArgumentException |
|
91 | - * @throws InvalidClassException |
|
92 | - * @throws InvalidDataTypeException |
|
93 | - * @throws InvalidFilePathException |
|
94 | - * @throws InvalidInterfaceException |
|
95 | - * @throws InvalidRequestStackMiddlewareException |
|
96 | - * @throws OutOfBoundsException |
|
97 | - * @throws ReflectionException |
|
98 | - */ |
|
99 | - public function initialize() |
|
100 | - { |
|
101 | - $this->bootstrapDependencyInjectionContainer(); |
|
102 | - $this->bootstrapDomain(); |
|
103 | - $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
104 | - add_action( |
|
105 | - 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
106 | - array($bootstrap_request, 'setupLegacyRequest') |
|
107 | - ); |
|
108 | - $this->runRequestStack(); |
|
109 | - } |
|
86 | + /** |
|
87 | + * @throws DomainException |
|
88 | + * @throws EE_Error |
|
89 | + * @throws Exception |
|
90 | + * @throws InvalidArgumentException |
|
91 | + * @throws InvalidClassException |
|
92 | + * @throws InvalidDataTypeException |
|
93 | + * @throws InvalidFilePathException |
|
94 | + * @throws InvalidInterfaceException |
|
95 | + * @throws InvalidRequestStackMiddlewareException |
|
96 | + * @throws OutOfBoundsException |
|
97 | + * @throws ReflectionException |
|
98 | + */ |
|
99 | + public function initialize() |
|
100 | + { |
|
101 | + $this->bootstrapDependencyInjectionContainer(); |
|
102 | + $this->bootstrapDomain(); |
|
103 | + $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
104 | + add_action( |
|
105 | + 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
106 | + array($bootstrap_request, 'setupLegacyRequest') |
|
107 | + ); |
|
108 | + $this->runRequestStack(); |
|
109 | + } |
|
110 | 110 | |
111 | 111 | |
112 | - /** |
|
113 | - * @throws ReflectionException |
|
114 | - * @throws EE_Error |
|
115 | - * @throws InvalidArgumentException |
|
116 | - * @throws InvalidDataTypeException |
|
117 | - * @throws InvalidInterfaceException |
|
118 | - * @throws OutOfBoundsException |
|
119 | - */ |
|
120 | - private function bootstrapDependencyInjectionContainer() |
|
121 | - { |
|
122 | - $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
123 | - $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
124 | - $bootstrap_di->buildLoader(); |
|
125 | - $registry = $bootstrap_di->getRegistry(); |
|
126 | - $dependency_map = $bootstrap_di->getDependencyMap(); |
|
127 | - $dependency_map->initialize(); |
|
128 | - $registry->initialize(); |
|
129 | - $this->loader = $bootstrap_di->getLoader(); |
|
130 | - } |
|
112 | + /** |
|
113 | + * @throws ReflectionException |
|
114 | + * @throws EE_Error |
|
115 | + * @throws InvalidArgumentException |
|
116 | + * @throws InvalidDataTypeException |
|
117 | + * @throws InvalidInterfaceException |
|
118 | + * @throws OutOfBoundsException |
|
119 | + */ |
|
120 | + private function bootstrapDependencyInjectionContainer() |
|
121 | + { |
|
122 | + $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
123 | + $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
124 | + $bootstrap_di->buildLoader(); |
|
125 | + $registry = $bootstrap_di->getRegistry(); |
|
126 | + $dependency_map = $bootstrap_di->getDependencyMap(); |
|
127 | + $dependency_map->initialize(); |
|
128 | + $registry->initialize(); |
|
129 | + $this->loader = $bootstrap_di->getLoader(); |
|
130 | + } |
|
131 | 131 | |
132 | 132 | |
133 | - /** |
|
134 | - * configures the Domain object for core |
|
135 | - * |
|
136 | - * @return void |
|
137 | - * @throws DomainException |
|
138 | - * @throws InvalidArgumentException |
|
139 | - * @throws InvalidDataTypeException |
|
140 | - * @throws InvalidClassException |
|
141 | - * @throws InvalidFilePathException |
|
142 | - * @throws InvalidInterfaceException |
|
143 | - */ |
|
144 | - private function bootstrapDomain() |
|
145 | - { |
|
146 | - DomainFactory::getEventEspressoCoreDomain(); |
|
147 | - } |
|
133 | + /** |
|
134 | + * configures the Domain object for core |
|
135 | + * |
|
136 | + * @return void |
|
137 | + * @throws DomainException |
|
138 | + * @throws InvalidArgumentException |
|
139 | + * @throws InvalidDataTypeException |
|
140 | + * @throws InvalidClassException |
|
141 | + * @throws InvalidFilePathException |
|
142 | + * @throws InvalidInterfaceException |
|
143 | + */ |
|
144 | + private function bootstrapDomain() |
|
145 | + { |
|
146 | + DomainFactory::getEventEspressoCoreDomain(); |
|
147 | + } |
|
148 | 148 | |
149 | 149 | |
150 | - /** |
|
151 | - * sets up the request and response objects |
|
152 | - * |
|
153 | - * @return BootstrapRequestResponseObjects |
|
154 | - * @throws InvalidArgumentException |
|
155 | - */ |
|
156 | - private function bootstrapRequestResponseObjects() |
|
157 | - { |
|
158 | - /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
159 | - $bootstrap_request = $this->loader->getShared( |
|
160 | - 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
161 | - array($this->loader) |
|
162 | - ); |
|
163 | - $bootstrap_request->buildRequestResponse(); |
|
164 | - $bootstrap_request->shareRequestResponse(); |
|
165 | - $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
166 | - $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
167 | - return $bootstrap_request; |
|
168 | - } |
|
150 | + /** |
|
151 | + * sets up the request and response objects |
|
152 | + * |
|
153 | + * @return BootstrapRequestResponseObjects |
|
154 | + * @throws InvalidArgumentException |
|
155 | + */ |
|
156 | + private function bootstrapRequestResponseObjects() |
|
157 | + { |
|
158 | + /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
159 | + $bootstrap_request = $this->loader->getShared( |
|
160 | + 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
161 | + array($this->loader) |
|
162 | + ); |
|
163 | + $bootstrap_request->buildRequestResponse(); |
|
164 | + $bootstrap_request->shareRequestResponse(); |
|
165 | + $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
166 | + $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
167 | + return $bootstrap_request; |
|
168 | + } |
|
169 | 169 | |
170 | 170 | |
171 | - /** |
|
172 | - * run_request_stack |
|
173 | - * construct request stack and run middleware apps |
|
174 | - * |
|
175 | - * @throws EE_Error |
|
176 | - * @throws Exception |
|
177 | - */ |
|
178 | - public function runRequestStack() |
|
179 | - { |
|
180 | - $this->loadAutoloader(); |
|
181 | - $this->setAutoloadersForRequiredFiles(); |
|
182 | - $this->request_stack_builder = $this->buildRequestStack(); |
|
183 | - $this->request_stack = $this->request_stack_builder->resolve( |
|
184 | - new RequestStackCoreApp() |
|
185 | - ); |
|
186 | - $this->request_stack->handleRequest($this->request, $this->response); |
|
187 | - $this->request_stack->handleResponse(); |
|
188 | - } |
|
171 | + /** |
|
172 | + * run_request_stack |
|
173 | + * construct request stack and run middleware apps |
|
174 | + * |
|
175 | + * @throws EE_Error |
|
176 | + * @throws Exception |
|
177 | + */ |
|
178 | + public function runRequestStack() |
|
179 | + { |
|
180 | + $this->loadAutoloader(); |
|
181 | + $this->setAutoloadersForRequiredFiles(); |
|
182 | + $this->request_stack_builder = $this->buildRequestStack(); |
|
183 | + $this->request_stack = $this->request_stack_builder->resolve( |
|
184 | + new RequestStackCoreApp() |
|
185 | + ); |
|
186 | + $this->request_stack->handleRequest($this->request, $this->response); |
|
187 | + $this->request_stack->handleResponse(); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | - /** |
|
192 | - * load_autoloader |
|
193 | - * |
|
194 | - * @throws EE_Error |
|
195 | - */ |
|
196 | - protected function loadAutoloader() |
|
197 | - { |
|
198 | - // load interfaces |
|
199 | - espresso_load_required( |
|
200 | - 'EEH_Autoloader', |
|
201 | - EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
202 | - ); |
|
203 | - EEH_Autoloader::instance(); |
|
204 | - } |
|
191 | + /** |
|
192 | + * load_autoloader |
|
193 | + * |
|
194 | + * @throws EE_Error |
|
195 | + */ |
|
196 | + protected function loadAutoloader() |
|
197 | + { |
|
198 | + // load interfaces |
|
199 | + espresso_load_required( |
|
200 | + 'EEH_Autoloader', |
|
201 | + EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
202 | + ); |
|
203 | + EEH_Autoloader::instance(); |
|
204 | + } |
|
205 | 205 | |
206 | 206 | |
207 | - /** |
|
208 | - * load_required_files |
|
209 | - * |
|
210 | - * @throws EE_Error |
|
211 | - */ |
|
212 | - protected function setAutoloadersForRequiredFiles() |
|
213 | - { |
|
214 | - // load interfaces |
|
215 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
216 | - // load helpers |
|
217 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
218 | - // register legacy request stack classes just in case |
|
219 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
220 | - // register legacy middleware classes just in case |
|
221 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
222 | - } |
|
207 | + /** |
|
208 | + * load_required_files |
|
209 | + * |
|
210 | + * @throws EE_Error |
|
211 | + */ |
|
212 | + protected function setAutoloadersForRequiredFiles() |
|
213 | + { |
|
214 | + // load interfaces |
|
215 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
216 | + // load helpers |
|
217 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
218 | + // register legacy request stack classes just in case |
|
219 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
220 | + // register legacy middleware classes just in case |
|
221 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
222 | + } |
|
223 | 223 | |
224 | 224 | |
225 | - /** |
|
226 | - * build_request_stack |
|
227 | - * |
|
228 | - * @return RequestStackBuilder |
|
229 | - */ |
|
230 | - public function buildRequestStack() |
|
231 | - { |
|
232 | - $request_stack_builder = new RequestStackBuilder($this->loader); |
|
233 | - /** |
|
234 | - * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
235 | - * so items at the beginning of the final middleware stack will run last. |
|
236 | - * First parameter is the middleware classname, second is an array of arguments |
|
237 | - */ |
|
238 | - $stack_apps = apply_filters( |
|
239 | - 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
240 | - array( |
|
241 | - // first in last out |
|
242 | - 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
243 | - 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
244 | - 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
245 | - 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
246 | - // last in first out |
|
247 | - 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
248 | - ) |
|
249 | - ); |
|
250 | - // legacy filter for backwards compatibility |
|
251 | - $stack_apps = apply_filters( |
|
252 | - 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
253 | - $stack_apps |
|
254 | - ); |
|
255 | - // load middleware onto stack : FILO (First In Last Out) |
|
256 | - // items at the beginning of the $stack_apps array will run last |
|
257 | - foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
258 | - $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
259 | - } |
|
260 | - // finally, we'll add this on its own because we need it to always be part of the stack |
|
261 | - // and we also need it to always run first because the rest of the system relies on it |
|
262 | - $request_stack_builder->push( |
|
263 | - array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
264 | - ); |
|
265 | - return apply_filters( |
|
266 | - 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
267 | - $request_stack_builder |
|
268 | - ); |
|
269 | - } |
|
225 | + /** |
|
226 | + * build_request_stack |
|
227 | + * |
|
228 | + * @return RequestStackBuilder |
|
229 | + */ |
|
230 | + public function buildRequestStack() |
|
231 | + { |
|
232 | + $request_stack_builder = new RequestStackBuilder($this->loader); |
|
233 | + /** |
|
234 | + * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
235 | + * so items at the beginning of the final middleware stack will run last. |
|
236 | + * First parameter is the middleware classname, second is an array of arguments |
|
237 | + */ |
|
238 | + $stack_apps = apply_filters( |
|
239 | + 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
240 | + array( |
|
241 | + // first in last out |
|
242 | + 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
243 | + 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
244 | + 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
245 | + 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
246 | + // last in first out |
|
247 | + 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
248 | + ) |
|
249 | + ); |
|
250 | + // legacy filter for backwards compatibility |
|
251 | + $stack_apps = apply_filters( |
|
252 | + 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
253 | + $stack_apps |
|
254 | + ); |
|
255 | + // load middleware onto stack : FILO (First In Last Out) |
|
256 | + // items at the beginning of the $stack_apps array will run last |
|
257 | + foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
258 | + $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
259 | + } |
|
260 | + // finally, we'll add this on its own because we need it to always be part of the stack |
|
261 | + // and we also need it to always run first because the rest of the system relies on it |
|
262 | + $request_stack_builder->push( |
|
263 | + array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
264 | + ); |
|
265 | + return apply_filters( |
|
266 | + 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
267 | + $request_stack_builder |
|
268 | + ); |
|
269 | + } |
|
270 | 270 | } |