@@ -18,78 +18,78 @@ |
||
18 | 18 | class PrivacyPolicy implements PrivacyPolicyInterface |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var EEM_Payment_Method |
|
23 | - */ |
|
24 | - protected $payment_method_model; |
|
21 | + /** |
|
22 | + * @var EEM_Payment_Method |
|
23 | + */ |
|
24 | + protected $payment_method_model; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var SessionLifespan |
|
28 | - */ |
|
29 | - protected $session_lifespan; |
|
26 | + /** |
|
27 | + * @var SessionLifespan |
|
28 | + */ |
|
29 | + protected $session_lifespan; |
|
30 | 30 | |
31 | - /** |
|
32 | - * PrivacyPolicy constructor. |
|
33 | - * |
|
34 | - * @param EEM_Payment_Method $payment_method_model |
|
35 | - */ |
|
36 | - public function __construct(EEM_Payment_Method $payment_method_model, SessionLifespan $session_lifespan) |
|
37 | - { |
|
38 | - $this->payment_method_model = $payment_method_model; |
|
39 | - $this->session_lifespan = $session_lifespan; |
|
40 | - } |
|
31 | + /** |
|
32 | + * PrivacyPolicy constructor. |
|
33 | + * |
|
34 | + * @param EEM_Payment_Method $payment_method_model |
|
35 | + */ |
|
36 | + public function __construct(EEM_Payment_Method $payment_method_model, SessionLifespan $session_lifespan) |
|
37 | + { |
|
38 | + $this->payment_method_model = $payment_method_model; |
|
39 | + $this->session_lifespan = $session_lifespan; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * Returns the name of the plugin and will be shown in the privacy policy's postbox header |
|
45 | - * |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function getName() |
|
49 | - { |
|
50 | - return esc_html__('Event Espresso', 'event_espresso'); |
|
51 | - } |
|
43 | + /** |
|
44 | + * Returns the name of the plugin and will be shown in the privacy policy's postbox header |
|
45 | + * |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function getName() |
|
49 | + { |
|
50 | + return esc_html__('Event Espresso', 'event_espresso'); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * Gets the HTML for the privacy policy. May be dynamic |
|
56 | - * |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getContent() |
|
60 | - { |
|
61 | - // do they have any offsite payment methods? or onsite payment methods? |
|
62 | - $active_payment_methods = $this->payment_method_model->get_all_active(EEM_Payment_Method::scope_cart); |
|
63 | - $active_onsite_pms = false; |
|
64 | - $active_offsite_pms = false; |
|
65 | - foreach ($active_payment_methods as $payment_method) { |
|
66 | - if ($payment_method->type_obj() instanceof \EE_PMT_Base) { |
|
67 | - if ($payment_method->type_obj()->get_gateway() instanceof \EE_Onsite_Gateway) { |
|
68 | - $active_onsite_pms[] = $payment_method->name(); |
|
69 | - } elseif ($payment_method->type_obj()->get_gateway() instanceof \EE_Offsite_Gateway) { |
|
70 | - $active_offsite_pms[] = $payment_method->name(); |
|
71 | - } |
|
72 | - } |
|
73 | - } |
|
74 | - $session_lifespan_in_hours = round($this->session_lifespan->inSeconds() / HOUR_IN_SECONDS); |
|
75 | - return (string) EEH_Template::display_template( |
|
76 | - __DIR__ . '/privacy_policy.template.php', |
|
77 | - array( |
|
78 | - 'active_onsite_payment_methods' => $active_onsite_pms, |
|
79 | - 'active_offsite_payment_methods' => $active_offsite_pms, |
|
80 | - 'session_lifespan' => sprintf( |
|
81 | - _n( |
|
82 | - '%1$s hour', |
|
83 | - '%1$s hours', |
|
84 | - $session_lifespan_in_hours, |
|
85 | - 'event_espresso' |
|
86 | - ), |
|
87 | - $session_lifespan_in_hours |
|
88 | - ) |
|
89 | - ), |
|
90 | - true |
|
91 | - ); |
|
92 | - } |
|
54 | + /** |
|
55 | + * Gets the HTML for the privacy policy. May be dynamic |
|
56 | + * |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getContent() |
|
60 | + { |
|
61 | + // do they have any offsite payment methods? or onsite payment methods? |
|
62 | + $active_payment_methods = $this->payment_method_model->get_all_active(EEM_Payment_Method::scope_cart); |
|
63 | + $active_onsite_pms = false; |
|
64 | + $active_offsite_pms = false; |
|
65 | + foreach ($active_payment_methods as $payment_method) { |
|
66 | + if ($payment_method->type_obj() instanceof \EE_PMT_Base) { |
|
67 | + if ($payment_method->type_obj()->get_gateway() instanceof \EE_Onsite_Gateway) { |
|
68 | + $active_onsite_pms[] = $payment_method->name(); |
|
69 | + } elseif ($payment_method->type_obj()->get_gateway() instanceof \EE_Offsite_Gateway) { |
|
70 | + $active_offsite_pms[] = $payment_method->name(); |
|
71 | + } |
|
72 | + } |
|
73 | + } |
|
74 | + $session_lifespan_in_hours = round($this->session_lifespan->inSeconds() / HOUR_IN_SECONDS); |
|
75 | + return (string) EEH_Template::display_template( |
|
76 | + __DIR__ . '/privacy_policy.template.php', |
|
77 | + array( |
|
78 | + 'active_onsite_payment_methods' => $active_onsite_pms, |
|
79 | + 'active_offsite_payment_methods' => $active_offsite_pms, |
|
80 | + 'session_lifespan' => sprintf( |
|
81 | + _n( |
|
82 | + '%1$s hour', |
|
83 | + '%1$s hours', |
|
84 | + $session_lifespan_in_hours, |
|
85 | + 'event_espresso' |
|
86 | + ), |
|
87 | + $session_lifespan_in_hours |
|
88 | + ) |
|
89 | + ), |
|
90 | + true |
|
91 | + ); |
|
92 | + } |
|
93 | 93 | } |
94 | 94 | // End of file PrivacyPolicy.php |
95 | 95 | // Location: EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy.php |
@@ -73,7 +73,7 @@ |
||
73 | 73 | } |
74 | 74 | $session_lifespan_in_hours = round($this->session_lifespan->inSeconds() / HOUR_IN_SECONDS); |
75 | 75 | return (string) EEH_Template::display_template( |
76 | - __DIR__ . '/privacy_policy.template.php', |
|
76 | + __DIR__.'/privacy_policy.template.php', |
|
77 | 77 | array( |
78 | 78 | 'active_onsite_payment_methods' => $active_onsite_pms, |
79 | 79 | 'active_offsite_payment_methods' => $active_offsite_pms, |
@@ -24,29 +24,29 @@ discard block |
||
24 | 24 | // if onsite or offsite payment methods are active |
25 | 25 | if (! empty($active_onsite_payment_methods)) { ?> |
26 | 26 | <p><?php esc_html_e('In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.', |
27 | - 'event_espresso'); ?></p> |
|
27 | + 'event_espresso'); ?></p> |
|
28 | 28 | <p><?php printf( |
29 | - esc_html__('Please see the privacy policy of %1$s.', 'event_espresso'), |
|
30 | - implode( |
|
29 | + esc_html__('Please see the privacy policy of %1$s.', 'event_espresso'), |
|
30 | + implode( |
|
31 | 31 | |
32 | - ', ', |
|
33 | - array_merge( |
|
34 | - $active_onsite_payment_methods, |
|
35 | - $active_offsite_payment_methods |
|
36 | - ) |
|
37 | - ) |
|
38 | - ); ?></p> |
|
32 | + ', ', |
|
33 | + array_merge( |
|
34 | + $active_onsite_payment_methods, |
|
35 | + $active_offsite_payment_methods |
|
36 | + ) |
|
37 | + ) |
|
38 | + ); ?></p> |
|
39 | 39 | <p><?php esc_html_e('Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored).', |
40 | - 'event_espresso'); ?></p> |
|
40 | + 'event_espresso'); ?></p> |
|
41 | 41 | <?php } |
42 | 42 | |
43 | 43 | // IF OFFSITE PAYMENT METHOD ACTIVE |
44 | 44 | elseif (! empty($active_onsite_payment_methods)) { ?> |
45 | 45 | <p><?php printf( |
46 | - esc_html__('Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.', |
|
47 | - 'event_espresso'), |
|
48 | - implode(', ', $active_offsite_payment_methods) |
|
49 | - ); ?></p> |
|
46 | + esc_html__('Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.', |
|
47 | + 'event_espresso'), |
|
48 | + implode(', ', $active_offsite_payment_methods) |
|
49 | + ); ?></p> |
|
50 | 50 | <?php }?> |
51 | 51 | <h2><?php esc_html_e('Payment Logging', 'event_espresso');?></h2> |
52 | 52 | <p><?php esc_html_e('Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.', 'event_espresso');?></p> |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | <h2><?php esc_html_e('Event Registration Cookies', 'event_espresso');?></h2> |
56 | 56 | <p><?php printf( |
57 | - esc_html__('When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.', 'event_espresso'), |
|
58 | - $session_lifespan |
|
59 | - );?></p> |
|
57 | + esc_html__('When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.', 'event_espresso'), |
|
58 | + $session_lifespan |
|
59 | + );?></p> |
|
60 | 60 | |
61 | 61 | <h2><?php esc_html_e('Email History Data', 'event_espresso');?></h2> |
62 | 62 | <p><?php esc_html_e('We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.', 'event_espresso');?></p> |
@@ -1,28 +1,28 @@ discard block |
||
1 | -<h2><?php esc_html_e('Event Registration Data', 'event_espresso');?></h2> |
|
2 | -<p><?php esc_html_e('We collect information about you during event registration. This information may include but is not limited to:', 'event_espresso');?></p> |
|
1 | +<h2><?php esc_html_e('Event Registration Data', 'event_espresso'); ?></h2> |
|
2 | +<p><?php esc_html_e('We collect information about you during event registration. This information may include but is not limited to:', 'event_espresso'); ?></p> |
|
3 | 3 | <ul> |
4 | - <li><?php esc_html_e('Your names', 'event_espresso');?></li> |
|
5 | - <li><?php esc_html_e('Billing address', 'event_espresso');?></li> |
|
6 | - <li><?php esc_html_e('Mailing address', 'event_espresso');?></li> |
|
7 | - <li><?php esc_html_e('Email address', 'event_espresso');?></li> |
|
8 | - <li><?php esc_html_e('Phone number', 'event_espresso');?></li> |
|
9 | - <li><?php esc_html_e('Location and traffic data (including IP address and browser type)', 'event_espresso');?></li> |
|
10 | - <li><?php esc_html_e('Any other details that might be requested from you for the purpose of processing your registration or ticket purchase', 'event_espresso');?></li> |
|
4 | + <li><?php esc_html_e('Your names', 'event_espresso'); ?></li> |
|
5 | + <li><?php esc_html_e('Billing address', 'event_espresso'); ?></li> |
|
6 | + <li><?php esc_html_e('Mailing address', 'event_espresso'); ?></li> |
|
7 | + <li><?php esc_html_e('Email address', 'event_espresso'); ?></li> |
|
8 | + <li><?php esc_html_e('Phone number', 'event_espresso'); ?></li> |
|
9 | + <li><?php esc_html_e('Location and traffic data (including IP address and browser type)', 'event_espresso'); ?></li> |
|
10 | + <li><?php esc_html_e('Any other details that might be requested from you for the purpose of processing your registration or ticket purchase', 'event_espresso'); ?></li> |
|
11 | 11 | </ul> |
12 | 12 | |
13 | -<p><?php esc_html_e('Handling this data also allows us to:', 'event_espresso');?></p> |
|
13 | +<p><?php esc_html_e('Handling this data also allows us to:', 'event_espresso'); ?></p> |
|
14 | 14 | <ul> |
15 | - <li><?php esc_html_e('Send you important account/purchase/service information.', 'event_espresso');?></li> |
|
16 | - <li><?php esc_html_e('Respond to your queries, refund requests, or complaints.', 'event_espresso');?></li> |
|
17 | - <li><?php esc_html_e('Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'event_espresso');?></li> |
|
18 | - <li><?php esc_html_e('Set up and administer your account, provide technical and customer support, and to verify your identity.', 'event_espresso');?></li> |
|
15 | + <li><?php esc_html_e('Send you important account/purchase/service information.', 'event_espresso'); ?></li> |
|
16 | + <li><?php esc_html_e('Respond to your queries, refund requests, or complaints.', 'event_espresso'); ?></li> |
|
17 | + <li><?php esc_html_e('Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'event_espresso'); ?></li> |
|
18 | + <li><?php esc_html_e('Set up and administer your account, provide technical and customer support, and to verify your identity.', 'event_espresso'); ?></li> |
|
19 | 19 | </ul> |
20 | 20 | |
21 | -<?php if (!empty($active_onsite_payment_methods) || !empty($active_offsite_payment_methods)) { ?> |
|
22 | -<h2><?php esc_html_e('Billing Information', 'event_espresso');?> </h2 > |
|
21 | +<?php if ( ! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?> |
|
22 | +<h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2 > |
|
23 | 23 | <?php |
24 | 24 | // if onsite or offsite payment methods are active |
25 | -if (! empty($active_onsite_payment_methods)) { ?> |
|
25 | +if ( ! empty($active_onsite_payment_methods)) { ?> |
|
26 | 26 | <p><?php esc_html_e('In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.', |
27 | 27 | 'event_espresso'); ?></p> |
28 | 28 | <p><?php printf( |
@@ -41,32 +41,32 @@ discard block |
||
41 | 41 | <?php } |
42 | 42 | |
43 | 43 | // IF OFFSITE PAYMENT METHOD ACTIVE |
44 | -elseif (! empty($active_onsite_payment_methods)) { ?> |
|
44 | +elseif ( ! empty($active_onsite_payment_methods)) { ?> |
|
45 | 45 | <p><?php printf( |
46 | 46 | esc_html__('Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.', |
47 | 47 | 'event_espresso'), |
48 | 48 | implode(', ', $active_offsite_payment_methods) |
49 | 49 | ); ?></p> |
50 | 50 | <?php }?> |
51 | - <h2><?php esc_html_e('Payment Logging', 'event_espresso');?></h2> |
|
52 | - <p><?php esc_html_e('Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.', 'event_espresso');?></p> |
|
51 | + <h2><?php esc_html_e('Payment Logging', 'event_espresso'); ?></h2> |
|
52 | + <p><?php esc_html_e('Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.', 'event_espresso'); ?></p> |
|
53 | 53 | <?php }?> |
54 | 54 | |
55 | - <h2><?php esc_html_e('Event Registration Cookies', 'event_espresso');?></h2> |
|
55 | + <h2><?php esc_html_e('Event Registration Cookies', 'event_espresso'); ?></h2> |
|
56 | 56 | <p><?php printf( |
57 | 57 | esc_html__('When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.', 'event_espresso'), |
58 | 58 | $session_lifespan |
59 | - );?></p> |
|
59 | + ); ?></p> |
|
60 | 60 | |
61 | - <h2><?php esc_html_e('Email History Data', 'event_espresso');?></h2> |
|
62 | - <p><?php esc_html_e('We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.', 'event_espresso');?></p> |
|
61 | + <h2><?php esc_html_e('Email History Data', 'event_espresso'); ?></h2> |
|
62 | + <p><?php esc_html_e('We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.', 'event_espresso'); ?></p> |
|
63 | 63 | |
64 | - <h2><?php esc_html_e('Event Check-In Record', 'event_espresso');?></h2> |
|
65 | - <p><?php esc_html_e('When you attend an event, an event manager may record the time you check in or out of the event.', 'event_espresso');?></p> |
|
64 | + <h2><?php esc_html_e('Event Check-In Record', 'event_espresso'); ?></h2> |
|
65 | + <p><?php esc_html_e('When you attend an event, an event manager may record the time you check in or out of the event.', 'event_espresso'); ?></p> |
|
66 | 66 | |
67 | - <h2><?php esc_html_e('Event Registration Data Retention', 'event_espresso');?></h2> |
|
68 | - <p><?php esc_html_e('Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.', 'event_espresso');?></p> |
|
67 | + <h2><?php esc_html_e('Event Registration Data Retention', 'event_espresso'); ?></h2> |
|
68 | + <p><?php esc_html_e('Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.', 'event_espresso'); ?></p> |
|
69 | 69 | |
70 | - <h2><?php esc_html_e('Event Registration Data Erasure and Export', 'event_espresso');?></h2> |
|
71 | - <p><?php esc_html_e('You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.', 'event_espresso');?></p> |
|
70 | + <h2><?php esc_html_e('Event Registration Data Erasure and Export', 'event_espresso'); ?></h2> |
|
71 | + <p><?php esc_html_e('You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.', 'event_espresso'); ?></p> |
|
72 | 72 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use EventEspresso\core\services\request\ResponseInterface; |
10 | 10 | |
11 | 11 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
12 | - exit('No direct script access allowed'); |
|
12 | + exit('No direct script access allowed'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | |
@@ -26,971 +26,971 @@ discard block |
||
26 | 26 | class EE_Dependency_Map |
27 | 27 | { |
28 | 28 | |
29 | - /** |
|
30 | - * This means that the requested class dependency is not present in the dependency map |
|
31 | - */ |
|
32 | - const not_registered = 0; |
|
33 | - |
|
34 | - /** |
|
35 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
36 | - */ |
|
37 | - const load_new_object = 1; |
|
38 | - |
|
39 | - /** |
|
40 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
41 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
42 | - */ |
|
43 | - const load_from_cache = 2; |
|
44 | - |
|
45 | - /** |
|
46 | - * When registering a dependency, |
|
47 | - * this indicates to keep any existing dependencies that already exist, |
|
48 | - * and simply discard any new dependencies declared in the incoming data |
|
49 | - */ |
|
50 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
51 | - |
|
52 | - /** |
|
53 | - * When registering a dependency, |
|
54 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
55 | - */ |
|
56 | - const OVERWRITE_DEPENDENCIES = 1; |
|
57 | - |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * @type EE_Dependency_Map $_instance |
|
62 | - */ |
|
63 | - protected static $_instance; |
|
64 | - |
|
65 | - /** |
|
66 | - * @var ClassInterfaceCache $class_cache |
|
67 | - */ |
|
68 | - private $class_cache; |
|
69 | - |
|
70 | - /** |
|
71 | - * @type RequestInterface $request |
|
72 | - */ |
|
73 | - protected $request; |
|
74 | - |
|
75 | - /** |
|
76 | - * @type LegacyRequestInterface $legacy_request |
|
77 | - */ |
|
78 | - protected $legacy_request; |
|
79 | - |
|
80 | - /** |
|
81 | - * @type ResponseInterface $response |
|
82 | - */ |
|
83 | - protected $response; |
|
84 | - |
|
85 | - /** |
|
86 | - * @type LoaderInterface $loader |
|
87 | - */ |
|
88 | - protected $loader; |
|
89 | - |
|
90 | - /** |
|
91 | - * @type array $_dependency_map |
|
92 | - */ |
|
93 | - protected $_dependency_map = array(); |
|
94 | - |
|
95 | - /** |
|
96 | - * @type array $_class_loaders |
|
97 | - */ |
|
98 | - protected $_class_loaders = array(); |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * EE_Dependency_Map constructor. |
|
103 | - * |
|
104 | - * @param ClassInterfaceCache $class_cache |
|
105 | - */ |
|
106 | - protected function __construct(ClassInterfaceCache $class_cache) |
|
107 | - { |
|
108 | - $this->class_cache = $class_cache; |
|
109 | - do_action('EE_Dependency_Map____construct', $this); |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - /** |
|
114 | - * @return void |
|
115 | - */ |
|
116 | - public function initialize() |
|
117 | - { |
|
118 | - $this->_register_core_dependencies(); |
|
119 | - $this->_register_core_class_loaders(); |
|
120 | - $this->_register_core_aliases(); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * @singleton method used to instantiate class object |
|
126 | - * @param ClassInterfaceCache|null $class_cache |
|
127 | - * @return EE_Dependency_Map |
|
128 | - */ |
|
129 | - public static function instance(ClassInterfaceCache $class_cache = null) { |
|
130 | - // check if class object is instantiated, and instantiated properly |
|
131 | - if ( |
|
132 | - ! self::$_instance instanceof EE_Dependency_Map |
|
133 | - && $class_cache instanceof ClassInterfaceCache |
|
134 | - ) { |
|
135 | - self::$_instance = new EE_Dependency_Map($class_cache); |
|
136 | - } |
|
137 | - return self::$_instance; |
|
138 | - } |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * @param RequestInterface $request |
|
143 | - */ |
|
144 | - public function setRequest(RequestInterface $request) |
|
145 | - { |
|
146 | - $this->request = $request; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * @param LegacyRequestInterface $legacy_request |
|
152 | - */ |
|
153 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
154 | - { |
|
155 | - $this->legacy_request = $legacy_request; |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - /** |
|
160 | - * @param ResponseInterface $response |
|
161 | - */ |
|
162 | - public function setResponse(ResponseInterface $response) |
|
163 | - { |
|
164 | - $this->response = $response; |
|
165 | - } |
|
166 | - |
|
167 | - |
|
168 | - |
|
169 | - /** |
|
170 | - * @param LoaderInterface $loader |
|
171 | - */ |
|
172 | - public function setLoader(LoaderInterface $loader) |
|
173 | - { |
|
174 | - $this->loader = $loader; |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - |
|
179 | - /** |
|
180 | - * @param string $class |
|
181 | - * @param array $dependencies |
|
182 | - * @param int $overwrite |
|
183 | - * @return bool |
|
184 | - */ |
|
185 | - public static function register_dependencies( |
|
186 | - $class, |
|
187 | - array $dependencies, |
|
188 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
189 | - ) { |
|
190 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
191 | - } |
|
192 | - |
|
193 | - |
|
194 | - |
|
195 | - /** |
|
196 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
197 | - * to the class specified by the first parameter. |
|
198 | - * IMPORTANT !!! |
|
199 | - * The order of elements in the incoming $dependencies array MUST match |
|
200 | - * the order of the constructor parameters for the class in question. |
|
201 | - * This is especially important when overriding any existing dependencies that are registered. |
|
202 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
203 | - * |
|
204 | - * @param string $class |
|
205 | - * @param array $dependencies |
|
206 | - * @param int $overwrite |
|
207 | - * @return bool |
|
208 | - */ |
|
209 | - public function registerDependencies( |
|
210 | - $class, |
|
211 | - array $dependencies, |
|
212 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
213 | - ) { |
|
214 | - $class = trim($class, '\\'); |
|
215 | - $registered = false; |
|
216 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
217 | - self::$_instance->_dependency_map[ $class ] = array(); |
|
218 | - } |
|
219 | - // we need to make sure that any aliases used when registering a dependency |
|
220 | - // get resolved to the correct class name |
|
221 | - foreach ($dependencies as $dependency => $load_source) { |
|
222 | - $alias = self::$_instance->getFqnForAlias($dependency); |
|
223 | - if ( |
|
224 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
225 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
226 | - ) { |
|
227 | - unset($dependencies[$dependency]); |
|
228 | - $dependencies[$alias] = $load_source; |
|
229 | - $registered = true; |
|
230 | - } |
|
231 | - } |
|
232 | - // now add our two lists of dependencies together. |
|
233 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
234 | - // so $dependencies is NOT overwritten because it is listed first |
|
235 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
236 | - // Union is way faster than array_merge() but should be used with caution... |
|
237 | - // especially with numerically indexed arrays |
|
238 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
239 | - // now we need to ensure that the resulting dependencies |
|
240 | - // array only has the entries that are required for the class |
|
241 | - // so first count how many dependencies were originally registered for the class |
|
242 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
243 | - // if that count is non-zero (meaning dependencies were already registered) |
|
244 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
245 | - // then truncate the final array to match that count |
|
246 | - ? array_slice($dependencies, 0, $dependency_count) |
|
247 | - // otherwise just take the incoming array because nothing previously existed |
|
248 | - : $dependencies; |
|
249 | - return $registered; |
|
250 | - } |
|
251 | - |
|
252 | - |
|
253 | - |
|
254 | - /** |
|
255 | - * @param string $class_name |
|
256 | - * @param string $loader |
|
257 | - * @return bool |
|
258 | - * @throws DomainException |
|
259 | - */ |
|
260 | - public static function register_class_loader($class_name, $loader = 'load_core') |
|
261 | - { |
|
262 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
263 | - throw new DomainException( |
|
264 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
265 | - ); |
|
266 | - } |
|
267 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
268 | - if ( |
|
269 | - ! is_callable($loader) |
|
270 | - && ( |
|
271 | - strpos($loader, 'load_') !== 0 |
|
272 | - || ! method_exists('EE_Registry', $loader) |
|
273 | - ) |
|
274 | - ) { |
|
275 | - throw new DomainException( |
|
276 | - sprintf( |
|
277 | - esc_html__( |
|
278 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
279 | - 'event_espresso' |
|
280 | - ), |
|
281 | - $loader |
|
282 | - ) |
|
283 | - ); |
|
284 | - } |
|
285 | - $class_name = self::$_instance->getFqnForAlias($class_name); |
|
286 | - if (! isset(self::$_instance->_class_loaders[$class_name])) { |
|
287 | - self::$_instance->_class_loaders[$class_name] = $loader; |
|
288 | - return true; |
|
289 | - } |
|
290 | - return false; |
|
291 | - } |
|
292 | - |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * @return array |
|
297 | - */ |
|
298 | - public function dependency_map() |
|
299 | - { |
|
300 | - return $this->_dependency_map; |
|
301 | - } |
|
302 | - |
|
303 | - |
|
304 | - |
|
305 | - /** |
|
306 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
307 | - * |
|
308 | - * @param string $class_name |
|
309 | - * @return boolean |
|
310 | - */ |
|
311 | - public function has($class_name = '') |
|
312 | - { |
|
313 | - // all legacy models have the same dependencies |
|
314 | - if (strpos($class_name, 'EEM_') === 0) { |
|
315 | - $class_name = 'LEGACY_MODELS'; |
|
316 | - } |
|
317 | - return isset($this->_dependency_map[$class_name]) ? true : false; |
|
318 | - } |
|
319 | - |
|
320 | - |
|
321 | - |
|
322 | - /** |
|
323 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
324 | - * |
|
325 | - * @param string $class_name |
|
326 | - * @param string $dependency |
|
327 | - * @return bool |
|
328 | - */ |
|
329 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
330 | - { |
|
331 | - // all legacy models have the same dependencies |
|
332 | - if (strpos($class_name, 'EEM_') === 0) { |
|
333 | - $class_name = 'LEGACY_MODELS'; |
|
334 | - } |
|
335 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
336 | - return isset($this->_dependency_map[$class_name][$dependency]) |
|
337 | - ? true |
|
338 | - : false; |
|
339 | - } |
|
340 | - |
|
341 | - |
|
342 | - |
|
343 | - /** |
|
344 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
345 | - * |
|
346 | - * @param string $class_name |
|
347 | - * @param string $dependency |
|
348 | - * @return int |
|
349 | - */ |
|
350 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
351 | - { |
|
352 | - // all legacy models have the same dependencies |
|
353 | - if (strpos($class_name, 'EEM_') === 0) { |
|
354 | - $class_name = 'LEGACY_MODELS'; |
|
355 | - } |
|
356 | - $dependency = $this->getFqnForAlias($dependency); |
|
357 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
358 | - ? $this->_dependency_map[$class_name][$dependency] |
|
359 | - : EE_Dependency_Map::not_registered; |
|
360 | - } |
|
361 | - |
|
362 | - |
|
363 | - |
|
364 | - /** |
|
365 | - * @param string $class_name |
|
366 | - * @return string | Closure |
|
367 | - */ |
|
368 | - public function class_loader($class_name) |
|
369 | - { |
|
370 | - // all legacy models use load_model() |
|
371 | - if(strpos($class_name, 'EEM_') === 0){ |
|
372 | - return 'load_model'; |
|
373 | - } |
|
374 | - $class_name = $this->getFqnForAlias($class_name); |
|
375 | - return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
376 | - } |
|
377 | - |
|
378 | - |
|
379 | - |
|
380 | - /** |
|
381 | - * @return array |
|
382 | - */ |
|
383 | - public function class_loaders() |
|
384 | - { |
|
385 | - return $this->_class_loaders; |
|
386 | - } |
|
387 | - |
|
388 | - |
|
389 | - |
|
390 | - /** |
|
391 | - * adds an alias for a classname |
|
392 | - * |
|
393 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
394 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
395 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
396 | - */ |
|
397 | - public function add_alias($fqcn, $alias, $for_class = '') |
|
398 | - { |
|
399 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
400 | - } |
|
401 | - |
|
402 | - |
|
403 | - |
|
404 | - /** |
|
405 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
406 | - * WHY? |
|
407 | - * Because if a class is type hinting for a concretion, |
|
408 | - * then why would we need to find another class to supply it? |
|
409 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
410 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
411 | - * Don't go looking for some substitute. |
|
412 | - * Whereas if a class is type hinting for an interface... |
|
413 | - * then we need to find an actual class to use. |
|
414 | - * So the interface IS the alias for some other FQN, |
|
415 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
416 | - * represents some other class. |
|
417 | - * |
|
418 | - * @param string $fqn |
|
419 | - * @param string $for_class |
|
420 | - * @return bool |
|
421 | - */ |
|
422 | - public function isAlias($fqn = '', $for_class = '') |
|
423 | - { |
|
424 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
425 | - } |
|
426 | - |
|
427 | - |
|
428 | - |
|
429 | - /** |
|
430 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
431 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
432 | - * for example: |
|
433 | - * if the following two entries were added to the _aliases array: |
|
434 | - * array( |
|
435 | - * 'interface_alias' => 'some\namespace\interface' |
|
436 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
437 | - * ) |
|
438 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
439 | - * to load an instance of 'some\namespace\classname' |
|
440 | - * |
|
441 | - * @param string $alias |
|
442 | - * @param string $for_class |
|
443 | - * @return string |
|
444 | - */ |
|
445 | - public function getFqnForAlias($alias = '', $for_class = '') |
|
446 | - { |
|
447 | - return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
448 | - } |
|
449 | - |
|
450 | - |
|
451 | - |
|
452 | - /** |
|
453 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
454 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
455 | - * This is done by using the following class constants: |
|
456 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
457 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
458 | - */ |
|
459 | - protected function _register_core_dependencies() |
|
460 | - { |
|
461 | - $this->_dependency_map = array( |
|
462 | - 'EE_Request_Handler' => array( |
|
463 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
464 | - ), |
|
465 | - 'EE_System' => array( |
|
466 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
467 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
468 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
469 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
470 | - ), |
|
471 | - 'EE_Session' => array( |
|
472 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
473 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
474 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
475 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
476 | - ), |
|
477 | - 'EE_Cart' => array( |
|
478 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
479 | - ), |
|
480 | - 'EE_Front_Controller' => array( |
|
481 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
482 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
483 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
484 | - ), |
|
485 | - 'EE_Messenger_Collection_Loader' => array( |
|
486 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
487 | - ), |
|
488 | - 'EE_Message_Type_Collection_Loader' => array( |
|
489 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
490 | - ), |
|
491 | - 'EE_Message_Resource_Manager' => array( |
|
492 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
493 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
494 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
495 | - ), |
|
496 | - 'EE_Message_Factory' => array( |
|
497 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
498 | - ), |
|
499 | - 'EE_messages' => array( |
|
500 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
501 | - ), |
|
502 | - 'EE_Messages_Generator' => array( |
|
503 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
504 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
505 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
506 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
507 | - ), |
|
508 | - 'EE_Messages_Processor' => array( |
|
509 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
510 | - ), |
|
511 | - 'EE_Messages_Queue' => array( |
|
512 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
513 | - ), |
|
514 | - 'EE_Messages_Template_Defaults' => array( |
|
515 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
516 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
517 | - ), |
|
518 | - 'EE_Message_To_Generate_From_Request' => array( |
|
519 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
520 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
521 | - ), |
|
522 | - 'EventEspresso\core\services\commands\CommandBus' => array( |
|
523 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
524 | - ), |
|
525 | - 'EventEspresso\services\commands\CommandHandler' => array( |
|
526 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
527 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
528 | - ), |
|
529 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
530 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
531 | - ), |
|
532 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
533 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
534 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
535 | - ), |
|
536 | - 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
537 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
538 | - ), |
|
539 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
540 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
541 | - ), |
|
542 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
543 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
544 | - ), |
|
545 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
546 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
547 | - ), |
|
548 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
549 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
550 | - ), |
|
551 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
552 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
553 | - ), |
|
554 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
555 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
556 | - ), |
|
557 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
558 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
559 | - ), |
|
560 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
561 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
562 | - ), |
|
563 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
564 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
565 | - ), |
|
566 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
567 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
568 | - ), |
|
569 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
570 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
571 | - ), |
|
572 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
573 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
574 | - ), |
|
575 | - 'EventEspresso\core\services\database\TableManager' => array( |
|
576 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
577 | - ), |
|
578 | - 'EE_Data_Migration_Class_Base' => array( |
|
579 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
580 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
581 | - ), |
|
582 | - 'EE_DMS_Core_4_1_0' => array( |
|
583 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
584 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
585 | - ), |
|
586 | - 'EE_DMS_Core_4_2_0' => array( |
|
587 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
588 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
589 | - ), |
|
590 | - 'EE_DMS_Core_4_3_0' => array( |
|
591 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
592 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
593 | - ), |
|
594 | - 'EE_DMS_Core_4_4_0' => array( |
|
595 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
596 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
597 | - ), |
|
598 | - 'EE_DMS_Core_4_5_0' => array( |
|
599 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
600 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
601 | - ), |
|
602 | - 'EE_DMS_Core_4_6_0' => array( |
|
603 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
604 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
605 | - ), |
|
606 | - 'EE_DMS_Core_4_7_0' => array( |
|
607 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
608 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
609 | - ), |
|
610 | - 'EE_DMS_Core_4_8_0' => array( |
|
611 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
612 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
613 | - ), |
|
614 | - 'EE_DMS_Core_4_9_0' => array( |
|
615 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
616 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
617 | - ), |
|
618 | - 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
619 | - array(), |
|
620 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
621 | - ), |
|
622 | - 'EventEspresso\core\services\assets\Registry' => array( |
|
623 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
624 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
625 | - 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
626 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
627 | - ), |
|
628 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
629 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
630 | - ), |
|
631 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
632 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
633 | - ), |
|
634 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
635 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
636 | - ), |
|
637 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
638 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
639 | - ), |
|
640 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
641 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
642 | - ), |
|
643 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
644 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
645 | - ), |
|
646 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
647 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
648 | - ), |
|
649 | - 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
650 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
651 | - ), |
|
652 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
653 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
654 | - ), |
|
655 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
656 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
657 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
658 | - ), |
|
659 | - 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
660 | - null, |
|
661 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
662 | - ), |
|
663 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
664 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
665 | - ), |
|
666 | - 'LEGACY_MODELS' => array( |
|
667 | - null, |
|
668 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
669 | - ), |
|
670 | - 'EE_Module_Request_Router' => array( |
|
671 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
672 | - ), |
|
673 | - 'EE_Registration_Processor' => array( |
|
674 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
675 | - ), |
|
676 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
677 | - null, |
|
678 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
679 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
680 | - ), |
|
681 | - 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
682 | - 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
683 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache |
|
684 | - ), |
|
29 | + /** |
|
30 | + * This means that the requested class dependency is not present in the dependency map |
|
31 | + */ |
|
32 | + const not_registered = 0; |
|
33 | + |
|
34 | + /** |
|
35 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
36 | + */ |
|
37 | + const load_new_object = 1; |
|
38 | + |
|
39 | + /** |
|
40 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
41 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
42 | + */ |
|
43 | + const load_from_cache = 2; |
|
44 | + |
|
45 | + /** |
|
46 | + * When registering a dependency, |
|
47 | + * this indicates to keep any existing dependencies that already exist, |
|
48 | + * and simply discard any new dependencies declared in the incoming data |
|
49 | + */ |
|
50 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
51 | + |
|
52 | + /** |
|
53 | + * When registering a dependency, |
|
54 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
55 | + */ |
|
56 | + const OVERWRITE_DEPENDENCIES = 1; |
|
57 | + |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * @type EE_Dependency_Map $_instance |
|
62 | + */ |
|
63 | + protected static $_instance; |
|
64 | + |
|
65 | + /** |
|
66 | + * @var ClassInterfaceCache $class_cache |
|
67 | + */ |
|
68 | + private $class_cache; |
|
69 | + |
|
70 | + /** |
|
71 | + * @type RequestInterface $request |
|
72 | + */ |
|
73 | + protected $request; |
|
74 | + |
|
75 | + /** |
|
76 | + * @type LegacyRequestInterface $legacy_request |
|
77 | + */ |
|
78 | + protected $legacy_request; |
|
79 | + |
|
80 | + /** |
|
81 | + * @type ResponseInterface $response |
|
82 | + */ |
|
83 | + protected $response; |
|
84 | + |
|
85 | + /** |
|
86 | + * @type LoaderInterface $loader |
|
87 | + */ |
|
88 | + protected $loader; |
|
89 | + |
|
90 | + /** |
|
91 | + * @type array $_dependency_map |
|
92 | + */ |
|
93 | + protected $_dependency_map = array(); |
|
94 | + |
|
95 | + /** |
|
96 | + * @type array $_class_loaders |
|
97 | + */ |
|
98 | + protected $_class_loaders = array(); |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * EE_Dependency_Map constructor. |
|
103 | + * |
|
104 | + * @param ClassInterfaceCache $class_cache |
|
105 | + */ |
|
106 | + protected function __construct(ClassInterfaceCache $class_cache) |
|
107 | + { |
|
108 | + $this->class_cache = $class_cache; |
|
109 | + do_action('EE_Dependency_Map____construct', $this); |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + /** |
|
114 | + * @return void |
|
115 | + */ |
|
116 | + public function initialize() |
|
117 | + { |
|
118 | + $this->_register_core_dependencies(); |
|
119 | + $this->_register_core_class_loaders(); |
|
120 | + $this->_register_core_aliases(); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * @singleton method used to instantiate class object |
|
126 | + * @param ClassInterfaceCache|null $class_cache |
|
127 | + * @return EE_Dependency_Map |
|
128 | + */ |
|
129 | + public static function instance(ClassInterfaceCache $class_cache = null) { |
|
130 | + // check if class object is instantiated, and instantiated properly |
|
131 | + if ( |
|
132 | + ! self::$_instance instanceof EE_Dependency_Map |
|
133 | + && $class_cache instanceof ClassInterfaceCache |
|
134 | + ) { |
|
135 | + self::$_instance = new EE_Dependency_Map($class_cache); |
|
136 | + } |
|
137 | + return self::$_instance; |
|
138 | + } |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * @param RequestInterface $request |
|
143 | + */ |
|
144 | + public function setRequest(RequestInterface $request) |
|
145 | + { |
|
146 | + $this->request = $request; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * @param LegacyRequestInterface $legacy_request |
|
152 | + */ |
|
153 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
154 | + { |
|
155 | + $this->legacy_request = $legacy_request; |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + /** |
|
160 | + * @param ResponseInterface $response |
|
161 | + */ |
|
162 | + public function setResponse(ResponseInterface $response) |
|
163 | + { |
|
164 | + $this->response = $response; |
|
165 | + } |
|
166 | + |
|
167 | + |
|
168 | + |
|
169 | + /** |
|
170 | + * @param LoaderInterface $loader |
|
171 | + */ |
|
172 | + public function setLoader(LoaderInterface $loader) |
|
173 | + { |
|
174 | + $this->loader = $loader; |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + |
|
179 | + /** |
|
180 | + * @param string $class |
|
181 | + * @param array $dependencies |
|
182 | + * @param int $overwrite |
|
183 | + * @return bool |
|
184 | + */ |
|
185 | + public static function register_dependencies( |
|
186 | + $class, |
|
187 | + array $dependencies, |
|
188 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
189 | + ) { |
|
190 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
191 | + } |
|
192 | + |
|
193 | + |
|
194 | + |
|
195 | + /** |
|
196 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
197 | + * to the class specified by the first parameter. |
|
198 | + * IMPORTANT !!! |
|
199 | + * The order of elements in the incoming $dependencies array MUST match |
|
200 | + * the order of the constructor parameters for the class in question. |
|
201 | + * This is especially important when overriding any existing dependencies that are registered. |
|
202 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
203 | + * |
|
204 | + * @param string $class |
|
205 | + * @param array $dependencies |
|
206 | + * @param int $overwrite |
|
207 | + * @return bool |
|
208 | + */ |
|
209 | + public function registerDependencies( |
|
210 | + $class, |
|
211 | + array $dependencies, |
|
212 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
213 | + ) { |
|
214 | + $class = trim($class, '\\'); |
|
215 | + $registered = false; |
|
216 | + if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
217 | + self::$_instance->_dependency_map[ $class ] = array(); |
|
218 | + } |
|
219 | + // we need to make sure that any aliases used when registering a dependency |
|
220 | + // get resolved to the correct class name |
|
221 | + foreach ($dependencies as $dependency => $load_source) { |
|
222 | + $alias = self::$_instance->getFqnForAlias($dependency); |
|
223 | + if ( |
|
224 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
225 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
226 | + ) { |
|
227 | + unset($dependencies[$dependency]); |
|
228 | + $dependencies[$alias] = $load_source; |
|
229 | + $registered = true; |
|
230 | + } |
|
231 | + } |
|
232 | + // now add our two lists of dependencies together. |
|
233 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
234 | + // so $dependencies is NOT overwritten because it is listed first |
|
235 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
236 | + // Union is way faster than array_merge() but should be used with caution... |
|
237 | + // especially with numerically indexed arrays |
|
238 | + $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
239 | + // now we need to ensure that the resulting dependencies |
|
240 | + // array only has the entries that are required for the class |
|
241 | + // so first count how many dependencies were originally registered for the class |
|
242 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
243 | + // if that count is non-zero (meaning dependencies were already registered) |
|
244 | + self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
245 | + // then truncate the final array to match that count |
|
246 | + ? array_slice($dependencies, 0, $dependency_count) |
|
247 | + // otherwise just take the incoming array because nothing previously existed |
|
248 | + : $dependencies; |
|
249 | + return $registered; |
|
250 | + } |
|
251 | + |
|
252 | + |
|
253 | + |
|
254 | + /** |
|
255 | + * @param string $class_name |
|
256 | + * @param string $loader |
|
257 | + * @return bool |
|
258 | + * @throws DomainException |
|
259 | + */ |
|
260 | + public static function register_class_loader($class_name, $loader = 'load_core') |
|
261 | + { |
|
262 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
263 | + throw new DomainException( |
|
264 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
265 | + ); |
|
266 | + } |
|
267 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
268 | + if ( |
|
269 | + ! is_callable($loader) |
|
270 | + && ( |
|
271 | + strpos($loader, 'load_') !== 0 |
|
272 | + || ! method_exists('EE_Registry', $loader) |
|
273 | + ) |
|
274 | + ) { |
|
275 | + throw new DomainException( |
|
276 | + sprintf( |
|
277 | + esc_html__( |
|
278 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
279 | + 'event_espresso' |
|
280 | + ), |
|
281 | + $loader |
|
282 | + ) |
|
283 | + ); |
|
284 | + } |
|
285 | + $class_name = self::$_instance->getFqnForAlias($class_name); |
|
286 | + if (! isset(self::$_instance->_class_loaders[$class_name])) { |
|
287 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
288 | + return true; |
|
289 | + } |
|
290 | + return false; |
|
291 | + } |
|
292 | + |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * @return array |
|
297 | + */ |
|
298 | + public function dependency_map() |
|
299 | + { |
|
300 | + return $this->_dependency_map; |
|
301 | + } |
|
302 | + |
|
303 | + |
|
304 | + |
|
305 | + /** |
|
306 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
307 | + * |
|
308 | + * @param string $class_name |
|
309 | + * @return boolean |
|
310 | + */ |
|
311 | + public function has($class_name = '') |
|
312 | + { |
|
313 | + // all legacy models have the same dependencies |
|
314 | + if (strpos($class_name, 'EEM_') === 0) { |
|
315 | + $class_name = 'LEGACY_MODELS'; |
|
316 | + } |
|
317 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
318 | + } |
|
319 | + |
|
320 | + |
|
321 | + |
|
322 | + /** |
|
323 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
324 | + * |
|
325 | + * @param string $class_name |
|
326 | + * @param string $dependency |
|
327 | + * @return bool |
|
328 | + */ |
|
329 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
330 | + { |
|
331 | + // all legacy models have the same dependencies |
|
332 | + if (strpos($class_name, 'EEM_') === 0) { |
|
333 | + $class_name = 'LEGACY_MODELS'; |
|
334 | + } |
|
335 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
336 | + return isset($this->_dependency_map[$class_name][$dependency]) |
|
337 | + ? true |
|
338 | + : false; |
|
339 | + } |
|
340 | + |
|
341 | + |
|
342 | + |
|
343 | + /** |
|
344 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
345 | + * |
|
346 | + * @param string $class_name |
|
347 | + * @param string $dependency |
|
348 | + * @return int |
|
349 | + */ |
|
350 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
351 | + { |
|
352 | + // all legacy models have the same dependencies |
|
353 | + if (strpos($class_name, 'EEM_') === 0) { |
|
354 | + $class_name = 'LEGACY_MODELS'; |
|
355 | + } |
|
356 | + $dependency = $this->getFqnForAlias($dependency); |
|
357 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
358 | + ? $this->_dependency_map[$class_name][$dependency] |
|
359 | + : EE_Dependency_Map::not_registered; |
|
360 | + } |
|
361 | + |
|
362 | + |
|
363 | + |
|
364 | + /** |
|
365 | + * @param string $class_name |
|
366 | + * @return string | Closure |
|
367 | + */ |
|
368 | + public function class_loader($class_name) |
|
369 | + { |
|
370 | + // all legacy models use load_model() |
|
371 | + if(strpos($class_name, 'EEM_') === 0){ |
|
372 | + return 'load_model'; |
|
373 | + } |
|
374 | + $class_name = $this->getFqnForAlias($class_name); |
|
375 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
376 | + } |
|
377 | + |
|
378 | + |
|
379 | + |
|
380 | + /** |
|
381 | + * @return array |
|
382 | + */ |
|
383 | + public function class_loaders() |
|
384 | + { |
|
385 | + return $this->_class_loaders; |
|
386 | + } |
|
387 | + |
|
388 | + |
|
389 | + |
|
390 | + /** |
|
391 | + * adds an alias for a classname |
|
392 | + * |
|
393 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
394 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
395 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
396 | + */ |
|
397 | + public function add_alias($fqcn, $alias, $for_class = '') |
|
398 | + { |
|
399 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
400 | + } |
|
401 | + |
|
402 | + |
|
403 | + |
|
404 | + /** |
|
405 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
406 | + * WHY? |
|
407 | + * Because if a class is type hinting for a concretion, |
|
408 | + * then why would we need to find another class to supply it? |
|
409 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
410 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
411 | + * Don't go looking for some substitute. |
|
412 | + * Whereas if a class is type hinting for an interface... |
|
413 | + * then we need to find an actual class to use. |
|
414 | + * So the interface IS the alias for some other FQN, |
|
415 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
416 | + * represents some other class. |
|
417 | + * |
|
418 | + * @param string $fqn |
|
419 | + * @param string $for_class |
|
420 | + * @return bool |
|
421 | + */ |
|
422 | + public function isAlias($fqn = '', $for_class = '') |
|
423 | + { |
|
424 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
425 | + } |
|
426 | + |
|
427 | + |
|
428 | + |
|
429 | + /** |
|
430 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
431 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
432 | + * for example: |
|
433 | + * if the following two entries were added to the _aliases array: |
|
434 | + * array( |
|
435 | + * 'interface_alias' => 'some\namespace\interface' |
|
436 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
437 | + * ) |
|
438 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
439 | + * to load an instance of 'some\namespace\classname' |
|
440 | + * |
|
441 | + * @param string $alias |
|
442 | + * @param string $for_class |
|
443 | + * @return string |
|
444 | + */ |
|
445 | + public function getFqnForAlias($alias = '', $for_class = '') |
|
446 | + { |
|
447 | + return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
448 | + } |
|
449 | + |
|
450 | + |
|
451 | + |
|
452 | + /** |
|
453 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
454 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
455 | + * This is done by using the following class constants: |
|
456 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
457 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
458 | + */ |
|
459 | + protected function _register_core_dependencies() |
|
460 | + { |
|
461 | + $this->_dependency_map = array( |
|
462 | + 'EE_Request_Handler' => array( |
|
463 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
464 | + ), |
|
465 | + 'EE_System' => array( |
|
466 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
467 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
468 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
469 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
470 | + ), |
|
471 | + 'EE_Session' => array( |
|
472 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
473 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
474 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
475 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
476 | + ), |
|
477 | + 'EE_Cart' => array( |
|
478 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
479 | + ), |
|
480 | + 'EE_Front_Controller' => array( |
|
481 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
482 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
483 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
484 | + ), |
|
485 | + 'EE_Messenger_Collection_Loader' => array( |
|
486 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
487 | + ), |
|
488 | + 'EE_Message_Type_Collection_Loader' => array( |
|
489 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
490 | + ), |
|
491 | + 'EE_Message_Resource_Manager' => array( |
|
492 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
493 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
494 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
495 | + ), |
|
496 | + 'EE_Message_Factory' => array( |
|
497 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
498 | + ), |
|
499 | + 'EE_messages' => array( |
|
500 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
501 | + ), |
|
502 | + 'EE_Messages_Generator' => array( |
|
503 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
504 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
505 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
506 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
507 | + ), |
|
508 | + 'EE_Messages_Processor' => array( |
|
509 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
510 | + ), |
|
511 | + 'EE_Messages_Queue' => array( |
|
512 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
513 | + ), |
|
514 | + 'EE_Messages_Template_Defaults' => array( |
|
515 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
516 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
517 | + ), |
|
518 | + 'EE_Message_To_Generate_From_Request' => array( |
|
519 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
520 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
521 | + ), |
|
522 | + 'EventEspresso\core\services\commands\CommandBus' => array( |
|
523 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
524 | + ), |
|
525 | + 'EventEspresso\services\commands\CommandHandler' => array( |
|
526 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
527 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
528 | + ), |
|
529 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
530 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
531 | + ), |
|
532 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
533 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
534 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
535 | + ), |
|
536 | + 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
537 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
538 | + ), |
|
539 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
540 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
541 | + ), |
|
542 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
543 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
544 | + ), |
|
545 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
546 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
547 | + ), |
|
548 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
549 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
550 | + ), |
|
551 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
552 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
553 | + ), |
|
554 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
555 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
556 | + ), |
|
557 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
558 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
559 | + ), |
|
560 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
561 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
562 | + ), |
|
563 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
564 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
565 | + ), |
|
566 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
567 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
568 | + ), |
|
569 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
570 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
571 | + ), |
|
572 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
573 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
574 | + ), |
|
575 | + 'EventEspresso\core\services\database\TableManager' => array( |
|
576 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
577 | + ), |
|
578 | + 'EE_Data_Migration_Class_Base' => array( |
|
579 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
580 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
581 | + ), |
|
582 | + 'EE_DMS_Core_4_1_0' => array( |
|
583 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
584 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
585 | + ), |
|
586 | + 'EE_DMS_Core_4_2_0' => array( |
|
587 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
588 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
589 | + ), |
|
590 | + 'EE_DMS_Core_4_3_0' => array( |
|
591 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
592 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
593 | + ), |
|
594 | + 'EE_DMS_Core_4_4_0' => array( |
|
595 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
596 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
597 | + ), |
|
598 | + 'EE_DMS_Core_4_5_0' => array( |
|
599 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
600 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
601 | + ), |
|
602 | + 'EE_DMS_Core_4_6_0' => array( |
|
603 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
604 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
605 | + ), |
|
606 | + 'EE_DMS_Core_4_7_0' => array( |
|
607 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
608 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
609 | + ), |
|
610 | + 'EE_DMS_Core_4_8_0' => array( |
|
611 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
612 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
613 | + ), |
|
614 | + 'EE_DMS_Core_4_9_0' => array( |
|
615 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
616 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
617 | + ), |
|
618 | + 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
619 | + array(), |
|
620 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
621 | + ), |
|
622 | + 'EventEspresso\core\services\assets\Registry' => array( |
|
623 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
624 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
625 | + 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
626 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
627 | + ), |
|
628 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
629 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
630 | + ), |
|
631 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
632 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
633 | + ), |
|
634 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
635 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
636 | + ), |
|
637 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
638 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
639 | + ), |
|
640 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
641 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
642 | + ), |
|
643 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
644 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
645 | + ), |
|
646 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
647 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
648 | + ), |
|
649 | + 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
650 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
651 | + ), |
|
652 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
653 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
654 | + ), |
|
655 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
656 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
657 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
658 | + ), |
|
659 | + 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
660 | + null, |
|
661 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
662 | + ), |
|
663 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
664 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
665 | + ), |
|
666 | + 'LEGACY_MODELS' => array( |
|
667 | + null, |
|
668 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
669 | + ), |
|
670 | + 'EE_Module_Request_Router' => array( |
|
671 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
672 | + ), |
|
673 | + 'EE_Registration_Processor' => array( |
|
674 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
675 | + ), |
|
676 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
677 | + null, |
|
678 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
679 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
680 | + ), |
|
681 | + 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
682 | + 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
683 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache |
|
684 | + ), |
|
685 | 685 | 'EE_Admin_Transactions_List_Table' => array( |
686 | - null, |
|
687 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
688 | - ), |
|
689 | - 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
690 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
691 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
692 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache |
|
693 | - ), |
|
694 | - 'EventEspresso\core\domain\services\pue\Config' => array( |
|
695 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
696 | - 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
697 | - ), |
|
698 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
699 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
700 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
701 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
702 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
703 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
704 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
705 | - 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
706 | - ), |
|
707 | - 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
708 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
709 | - ), |
|
710 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
711 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
712 | - ), |
|
713 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
714 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
715 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
716 | - ), |
|
717 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
718 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
719 | - ), |
|
720 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
721 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
722 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
723 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
724 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
725 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
726 | - ), |
|
727 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
728 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
729 | - ), |
|
730 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => array( |
|
731 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
732 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
733 | - ), |
|
734 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => array( |
|
735 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
736 | - ), |
|
737 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => array( |
|
738 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
739 | - ), |
|
740 | - 'EE_CPT_Strategy' => array( |
|
741 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
742 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
743 | - ), |
|
744 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => array( |
|
745 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
746 | - ), |
|
747 | - 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array( |
|
748 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
749 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache |
|
750 | - ) |
|
751 | - ); |
|
752 | - } |
|
753 | - |
|
754 | - |
|
755 | - /** |
|
756 | - * Registers how core classes are loaded. |
|
757 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
758 | - * 'EE_Request_Handler' => 'load_core' |
|
759 | - * 'EE_Messages_Queue' => 'load_lib' |
|
760 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
761 | - * or, if greater control is required, by providing a custom closure. For example: |
|
762 | - * 'Some_Class' => function () { |
|
763 | - * return new Some_Class(); |
|
764 | - * }, |
|
765 | - * This is required for instantiating dependencies |
|
766 | - * where an interface has been type hinted in a class constructor. For example: |
|
767 | - * 'Required_Interface' => function () { |
|
768 | - * return new A_Class_That_Implements_Required_Interface(); |
|
769 | - * }, |
|
770 | - * |
|
771 | - */ |
|
772 | - protected function _register_core_class_loaders() |
|
773 | - { |
|
774 | - //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot |
|
775 | - //be used in a closure. |
|
776 | - $request = &$this->request; |
|
777 | - $response = &$this->response; |
|
778 | - $legacy_request = &$this->legacy_request; |
|
779 | - // $loader = &$this->loader; |
|
780 | - $this->_class_loaders = array( |
|
781 | - //load_core |
|
782 | - 'EE_Capabilities' => 'load_core', |
|
783 | - 'EE_Encryption' => 'load_core', |
|
784 | - 'EE_Front_Controller' => 'load_core', |
|
785 | - 'EE_Module_Request_Router' => 'load_core', |
|
786 | - 'EE_Registry' => 'load_core', |
|
787 | - 'EE_Request' => function () use (&$legacy_request) { |
|
788 | - return $legacy_request; |
|
789 | - }, |
|
790 | - 'EventEspresso\core\services\request\Request' => function () use (&$request) { |
|
791 | - return $request; |
|
792 | - }, |
|
793 | - 'EventEspresso\core\services\request\Response' => function () use (&$response) { |
|
794 | - return $response; |
|
795 | - }, |
|
796 | - 'EE_Base' => 'load_core', |
|
797 | - 'EE_Request_Handler' => 'load_core', |
|
798 | - 'EE_Session' => 'load_core', |
|
799 | - 'EE_Cron_Tasks' => 'load_core', |
|
800 | - 'EE_System' => 'load_core', |
|
801 | - 'EE_Maintenance_Mode' => 'load_core', |
|
802 | - 'EE_Register_CPTs' => 'load_core', |
|
803 | - 'EE_Admin' => 'load_core', |
|
804 | - 'EE_CPT_Strategy' => 'load_core', |
|
805 | - //load_lib |
|
806 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
807 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
808 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
809 | - 'EE_Messenger_Collection' => 'load_lib', |
|
810 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
811 | - 'EE_Messages_Processor' => 'load_lib', |
|
812 | - 'EE_Message_Repository' => 'load_lib', |
|
813 | - 'EE_Messages_Queue' => 'load_lib', |
|
814 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
815 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
816 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
817 | - 'EE_Messages_Generator' => function () { |
|
818 | - return EE_Registry::instance()->load_lib( |
|
819 | - 'Messages_Generator', |
|
820 | - array(), |
|
821 | - false, |
|
822 | - false |
|
823 | - ); |
|
824 | - }, |
|
825 | - 'EE_Messages_Template_Defaults' => function ($arguments = array()) { |
|
826 | - return EE_Registry::instance()->load_lib( |
|
827 | - 'Messages_Template_Defaults', |
|
828 | - $arguments, |
|
829 | - false, |
|
830 | - false |
|
831 | - ); |
|
832 | - }, |
|
833 | - //load_helper |
|
834 | - 'EEH_Parse_Shortcodes' => function () { |
|
835 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
836 | - return new EEH_Parse_Shortcodes(); |
|
837 | - } |
|
838 | - return null; |
|
839 | - }, |
|
840 | - 'EE_Template_Config' => function () { |
|
841 | - return EE_Config::instance()->template_settings; |
|
842 | - }, |
|
843 | - 'EE_Currency_Config' => function () { |
|
844 | - return EE_Config::instance()->currency; |
|
845 | - }, |
|
846 | - 'EE_Registration_Config' => function () { |
|
847 | - return EE_Config::instance()->registration; |
|
848 | - }, |
|
849 | - 'EE_Core_Config' => function () { |
|
850 | - return EE_Config::instance()->core; |
|
851 | - }, |
|
852 | - 'EventEspresso\core\services\loaders\Loader' => function () { |
|
853 | - return LoaderFactory::getLoader(); |
|
854 | - }, |
|
855 | - 'EE_Network_Config' => function() { |
|
856 | - return EE_Network_Config::instance(); |
|
857 | - }, |
|
858 | - 'EE_Config' => function () { |
|
859 | - return EE_Config::instance(); |
|
860 | - }, |
|
861 | - 'EventEspresso\core\domain\Domain' => function () { |
|
862 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
863 | - }, |
|
864 | - ); |
|
865 | - } |
|
866 | - |
|
867 | - |
|
868 | - |
|
869 | - |
|
870 | - /** |
|
871 | - * can be used for supplying alternate names for classes, |
|
872 | - * or for connecting interface names to instantiable classes |
|
873 | - */ |
|
874 | - protected function _register_core_aliases() |
|
875 | - { |
|
876 | - $aliases = array( |
|
877 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
878 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
879 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
880 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
881 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
882 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
883 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
884 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
885 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
886 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
887 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
888 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
889 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
890 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
891 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
892 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
893 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
894 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
895 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
896 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
897 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
898 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
899 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
900 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
901 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
902 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
903 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
904 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
905 | - 'EventEspresso\core\domain\services\session\SessionIdentifierInterface' => 'EE_Session', |
|
906 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
907 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
908 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
909 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
910 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
911 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
912 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
913 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
914 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
915 | - ); |
|
916 | - foreach ($aliases as $alias => $fqn) { |
|
917 | - if(is_array($fqn)) { |
|
918 | - foreach ($fqn as $class => $for_class) { |
|
919 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
920 | - } |
|
921 | - continue; |
|
922 | - } |
|
923 | - $this->class_cache->addAlias($fqn, $alias); |
|
924 | - } |
|
925 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
926 | - $this->class_cache->addAlias( |
|
927 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
928 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
929 | - ); |
|
930 | - } |
|
931 | - } |
|
932 | - |
|
933 | - |
|
934 | - |
|
935 | - /** |
|
936 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
937 | - * request Primarily used by unit tests. |
|
938 | - */ |
|
939 | - public function reset() |
|
940 | - { |
|
941 | - $this->_register_core_class_loaders(); |
|
942 | - $this->_register_core_dependencies(); |
|
943 | - } |
|
944 | - |
|
945 | - |
|
946 | - /** |
|
947 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
948 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
949 | - * WHY? |
|
950 | - * Because if a class is type hinting for a concretion, |
|
951 | - * then why would we need to find another class to supply it? |
|
952 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
953 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
954 | - * Don't go looking for some substitute. |
|
955 | - * Whereas if a class is type hinting for an interface... |
|
956 | - * then we need to find an actual class to use. |
|
957 | - * So the interface IS the alias for some other FQN, |
|
958 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
959 | - * represents some other class. |
|
960 | - * |
|
961 | - * @deprecated $VID:$ |
|
962 | - * @param string $fqn |
|
963 | - * @param string $for_class |
|
964 | - * @return bool |
|
965 | - */ |
|
966 | - public function has_alias($fqn = '', $for_class = '') |
|
967 | - { |
|
968 | - return $this->isAlias($fqn, $for_class); |
|
969 | - } |
|
970 | - |
|
971 | - |
|
972 | - /** |
|
973 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
974 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
975 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
976 | - * for example: |
|
977 | - * if the following two entries were added to the _aliases array: |
|
978 | - * array( |
|
979 | - * 'interface_alias' => 'some\namespace\interface' |
|
980 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
981 | - * ) |
|
982 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
983 | - * to load an instance of 'some\namespace\classname' |
|
984 | - * |
|
985 | - * @deprecated $VID:$ |
|
986 | - * @param string $alias |
|
987 | - * @param string $for_class |
|
988 | - * @return string |
|
989 | - */ |
|
990 | - public function get_alias($alias = '', $for_class = '') |
|
991 | - { |
|
992 | - return $this->getFqnForAlias($alias, $for_class); |
|
993 | - } |
|
686 | + null, |
|
687 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
688 | + ), |
|
689 | + 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
690 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
691 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
692 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache |
|
693 | + ), |
|
694 | + 'EventEspresso\core\domain\services\pue\Config' => array( |
|
695 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
696 | + 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
697 | + ), |
|
698 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
699 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
700 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
701 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
702 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
703 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
704 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
705 | + 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
706 | + ), |
|
707 | + 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
708 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
709 | + ), |
|
710 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
711 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
712 | + ), |
|
713 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
714 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
715 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
716 | + ), |
|
717 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
718 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
719 | + ), |
|
720 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
721 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
722 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
723 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
724 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
725 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
726 | + ), |
|
727 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
728 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
729 | + ), |
|
730 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => array( |
|
731 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
732 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
733 | + ), |
|
734 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => array( |
|
735 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
736 | + ), |
|
737 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => array( |
|
738 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
739 | + ), |
|
740 | + 'EE_CPT_Strategy' => array( |
|
741 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
742 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
743 | + ), |
|
744 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => array( |
|
745 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
746 | + ), |
|
747 | + 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array( |
|
748 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
749 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache |
|
750 | + ) |
|
751 | + ); |
|
752 | + } |
|
753 | + |
|
754 | + |
|
755 | + /** |
|
756 | + * Registers how core classes are loaded. |
|
757 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
758 | + * 'EE_Request_Handler' => 'load_core' |
|
759 | + * 'EE_Messages_Queue' => 'load_lib' |
|
760 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
761 | + * or, if greater control is required, by providing a custom closure. For example: |
|
762 | + * 'Some_Class' => function () { |
|
763 | + * return new Some_Class(); |
|
764 | + * }, |
|
765 | + * This is required for instantiating dependencies |
|
766 | + * where an interface has been type hinted in a class constructor. For example: |
|
767 | + * 'Required_Interface' => function () { |
|
768 | + * return new A_Class_That_Implements_Required_Interface(); |
|
769 | + * }, |
|
770 | + * |
|
771 | + */ |
|
772 | + protected function _register_core_class_loaders() |
|
773 | + { |
|
774 | + //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot |
|
775 | + //be used in a closure. |
|
776 | + $request = &$this->request; |
|
777 | + $response = &$this->response; |
|
778 | + $legacy_request = &$this->legacy_request; |
|
779 | + // $loader = &$this->loader; |
|
780 | + $this->_class_loaders = array( |
|
781 | + //load_core |
|
782 | + 'EE_Capabilities' => 'load_core', |
|
783 | + 'EE_Encryption' => 'load_core', |
|
784 | + 'EE_Front_Controller' => 'load_core', |
|
785 | + 'EE_Module_Request_Router' => 'load_core', |
|
786 | + 'EE_Registry' => 'load_core', |
|
787 | + 'EE_Request' => function () use (&$legacy_request) { |
|
788 | + return $legacy_request; |
|
789 | + }, |
|
790 | + 'EventEspresso\core\services\request\Request' => function () use (&$request) { |
|
791 | + return $request; |
|
792 | + }, |
|
793 | + 'EventEspresso\core\services\request\Response' => function () use (&$response) { |
|
794 | + return $response; |
|
795 | + }, |
|
796 | + 'EE_Base' => 'load_core', |
|
797 | + 'EE_Request_Handler' => 'load_core', |
|
798 | + 'EE_Session' => 'load_core', |
|
799 | + 'EE_Cron_Tasks' => 'load_core', |
|
800 | + 'EE_System' => 'load_core', |
|
801 | + 'EE_Maintenance_Mode' => 'load_core', |
|
802 | + 'EE_Register_CPTs' => 'load_core', |
|
803 | + 'EE_Admin' => 'load_core', |
|
804 | + 'EE_CPT_Strategy' => 'load_core', |
|
805 | + //load_lib |
|
806 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
807 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
808 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
809 | + 'EE_Messenger_Collection' => 'load_lib', |
|
810 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
811 | + 'EE_Messages_Processor' => 'load_lib', |
|
812 | + 'EE_Message_Repository' => 'load_lib', |
|
813 | + 'EE_Messages_Queue' => 'load_lib', |
|
814 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
815 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
816 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
817 | + 'EE_Messages_Generator' => function () { |
|
818 | + return EE_Registry::instance()->load_lib( |
|
819 | + 'Messages_Generator', |
|
820 | + array(), |
|
821 | + false, |
|
822 | + false |
|
823 | + ); |
|
824 | + }, |
|
825 | + 'EE_Messages_Template_Defaults' => function ($arguments = array()) { |
|
826 | + return EE_Registry::instance()->load_lib( |
|
827 | + 'Messages_Template_Defaults', |
|
828 | + $arguments, |
|
829 | + false, |
|
830 | + false |
|
831 | + ); |
|
832 | + }, |
|
833 | + //load_helper |
|
834 | + 'EEH_Parse_Shortcodes' => function () { |
|
835 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
836 | + return new EEH_Parse_Shortcodes(); |
|
837 | + } |
|
838 | + return null; |
|
839 | + }, |
|
840 | + 'EE_Template_Config' => function () { |
|
841 | + return EE_Config::instance()->template_settings; |
|
842 | + }, |
|
843 | + 'EE_Currency_Config' => function () { |
|
844 | + return EE_Config::instance()->currency; |
|
845 | + }, |
|
846 | + 'EE_Registration_Config' => function () { |
|
847 | + return EE_Config::instance()->registration; |
|
848 | + }, |
|
849 | + 'EE_Core_Config' => function () { |
|
850 | + return EE_Config::instance()->core; |
|
851 | + }, |
|
852 | + 'EventEspresso\core\services\loaders\Loader' => function () { |
|
853 | + return LoaderFactory::getLoader(); |
|
854 | + }, |
|
855 | + 'EE_Network_Config' => function() { |
|
856 | + return EE_Network_Config::instance(); |
|
857 | + }, |
|
858 | + 'EE_Config' => function () { |
|
859 | + return EE_Config::instance(); |
|
860 | + }, |
|
861 | + 'EventEspresso\core\domain\Domain' => function () { |
|
862 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
863 | + }, |
|
864 | + ); |
|
865 | + } |
|
866 | + |
|
867 | + |
|
868 | + |
|
869 | + |
|
870 | + /** |
|
871 | + * can be used for supplying alternate names for classes, |
|
872 | + * or for connecting interface names to instantiable classes |
|
873 | + */ |
|
874 | + protected function _register_core_aliases() |
|
875 | + { |
|
876 | + $aliases = array( |
|
877 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
878 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
879 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
880 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
881 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
882 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
883 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
884 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
885 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
886 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
887 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
888 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
889 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
890 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
891 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
892 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
893 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
894 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
895 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
896 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
897 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
898 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
899 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
900 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
901 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
902 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
903 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
904 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
905 | + 'EventEspresso\core\domain\services\session\SessionIdentifierInterface' => 'EE_Session', |
|
906 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
907 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
908 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
909 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
910 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
911 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
912 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
913 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
914 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
915 | + ); |
|
916 | + foreach ($aliases as $alias => $fqn) { |
|
917 | + if(is_array($fqn)) { |
|
918 | + foreach ($fqn as $class => $for_class) { |
|
919 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
920 | + } |
|
921 | + continue; |
|
922 | + } |
|
923 | + $this->class_cache->addAlias($fqn, $alias); |
|
924 | + } |
|
925 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
926 | + $this->class_cache->addAlias( |
|
927 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
928 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
929 | + ); |
|
930 | + } |
|
931 | + } |
|
932 | + |
|
933 | + |
|
934 | + |
|
935 | + /** |
|
936 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
937 | + * request Primarily used by unit tests. |
|
938 | + */ |
|
939 | + public function reset() |
|
940 | + { |
|
941 | + $this->_register_core_class_loaders(); |
|
942 | + $this->_register_core_dependencies(); |
|
943 | + } |
|
944 | + |
|
945 | + |
|
946 | + /** |
|
947 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
948 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
949 | + * WHY? |
|
950 | + * Because if a class is type hinting for a concretion, |
|
951 | + * then why would we need to find another class to supply it? |
|
952 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
953 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
954 | + * Don't go looking for some substitute. |
|
955 | + * Whereas if a class is type hinting for an interface... |
|
956 | + * then we need to find an actual class to use. |
|
957 | + * So the interface IS the alias for some other FQN, |
|
958 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
959 | + * represents some other class. |
|
960 | + * |
|
961 | + * @deprecated $VID:$ |
|
962 | + * @param string $fqn |
|
963 | + * @param string $for_class |
|
964 | + * @return bool |
|
965 | + */ |
|
966 | + public function has_alias($fqn = '', $for_class = '') |
|
967 | + { |
|
968 | + return $this->isAlias($fqn, $for_class); |
|
969 | + } |
|
970 | + |
|
971 | + |
|
972 | + /** |
|
973 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
974 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
975 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
976 | + * for example: |
|
977 | + * if the following two entries were added to the _aliases array: |
|
978 | + * array( |
|
979 | + * 'interface_alias' => 'some\namespace\interface' |
|
980 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
981 | + * ) |
|
982 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
983 | + * to load an instance of 'some\namespace\classname' |
|
984 | + * |
|
985 | + * @deprecated $VID:$ |
|
986 | + * @param string $alias |
|
987 | + * @param string $for_class |
|
988 | + * @return string |
|
989 | + */ |
|
990 | + public function get_alias($alias = '', $for_class = '') |
|
991 | + { |
|
992 | + return $this->getFqnForAlias($alias, $for_class); |
|
993 | + } |
|
994 | 994 | } |
995 | 995 | // End of file EE_Dependency_Map.core.php |
996 | 996 | // Location: /EE_Dependency_Map.core.php |