@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | |
64 | 64 | } else { |
65 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
66 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | - /** |
|
68 | - * espresso_minimum_php_version_error |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
65 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
66 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | + /** |
|
68 | + * espresso_minimum_php_version_error |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.62.rc.017'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.62.rc.017'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
@@ -16,55 +16,55 @@ |
||
16 | 16 | interface DomainInterface extends InterminableInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @return string |
|
21 | - * @throws DomainException |
|
22 | - */ |
|
23 | - public function pluginFile(); |
|
19 | + /** |
|
20 | + * @return string |
|
21 | + * @throws DomainException |
|
22 | + */ |
|
23 | + public function pluginFile(); |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @return string |
|
28 | - * @throws DomainException |
|
29 | - */ |
|
30 | - public function pluginBasename(); |
|
26 | + /** |
|
27 | + * @return string |
|
28 | + * @throws DomainException |
|
29 | + */ |
|
30 | + public function pluginBasename(); |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function pluginPath(); |
|
33 | + /** |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function pluginPath(); |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @return string |
|
41 | - * @throws DomainException |
|
42 | - */ |
|
43 | - public function pluginUrl(); |
|
39 | + /** |
|
40 | + * @return string |
|
41 | + * @throws DomainException |
|
42 | + */ |
|
43 | + public function pluginUrl(); |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * @return string |
|
48 | - * @throws DomainException |
|
49 | - */ |
|
50 | - public function version(); |
|
46 | + /** |
|
47 | + * @return string |
|
48 | + * @throws DomainException |
|
49 | + */ |
|
50 | + public function version(); |
|
51 | 51 | |
52 | 52 | |
53 | - /** |
|
54 | - * @return string |
|
55 | - */ |
|
56 | - public function distributionAssetsPath(); |
|
53 | + /** |
|
54 | + * @return string |
|
55 | + */ |
|
56 | + public function distributionAssetsPath(); |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * @return string |
|
61 | - */ |
|
62 | - public function distributionAssetsUrl(); |
|
59 | + /** |
|
60 | + * @return string |
|
61 | + */ |
|
62 | + public function distributionAssetsUrl(); |
|
63 | 63 | |
64 | 64 | |
65 | - /** |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - public function assetNamespace(); |
|
65 | + /** |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + public function assetNamespace(); |
|
69 | 69 | |
70 | 70 | } |
@@ -20,157 +20,157 @@ |
||
20 | 20 | abstract class DomainBase implements DomainInterface |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Equivalent to `__FILE__` for main plugin file. |
|
25 | - * |
|
26 | - * @var FilePath |
|
27 | - */ |
|
28 | - private $plugin_file; |
|
29 | - |
|
30 | - /** |
|
31 | - * String indicating version for plugin |
|
32 | - * |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - private $version; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var string $plugin_basename |
|
39 | - */ |
|
40 | - private $plugin_basename; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var string $plugin_path |
|
44 | - */ |
|
45 | - private $plugin_path; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var string $plugin_url |
|
49 | - */ |
|
50 | - private $plugin_url; |
|
51 | - |
|
52 | - /** |
|
53 | - * @var string $asset_namespace |
|
54 | - */ |
|
55 | - private $asset_namespace; |
|
56 | - |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * Initializes internal properties. |
|
61 | - * |
|
62 | - * @param FilePath $plugin_file |
|
63 | - * @param Version $version |
|
64 | - */ |
|
65 | - public function __construct(FilePath $plugin_file, Version $version) |
|
66 | - { |
|
67 | - $this->plugin_file = $plugin_file; |
|
68 | - $this->version = $version; |
|
69 | - $this->plugin_basename = plugin_basename($this->pluginFile()); |
|
70 | - $this->plugin_path = plugin_dir_path($this->pluginFile()); |
|
71 | - $this->plugin_url = plugin_dir_url($this->pluginFile()); |
|
72 | - $this->setAssetNamespace(); |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * @return string |
|
78 | - */ |
|
79 | - public function pluginFile() |
|
80 | - { |
|
81 | - return (string) $this->plugin_file; |
|
82 | - } |
|
83 | - |
|
84 | - |
|
85 | - |
|
86 | - /** |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - public function pluginBasename() |
|
90 | - { |
|
91 | - return $this->plugin_basename; |
|
92 | - } |
|
93 | - |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * @return string |
|
98 | - */ |
|
99 | - public function pluginPath() |
|
100 | - { |
|
101 | - return $this->plugin_path; |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - public function pluginUrl() |
|
110 | - { |
|
111 | - return $this->plugin_url; |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @return string |
|
118 | - */ |
|
119 | - public function version() |
|
120 | - { |
|
121 | - return (string) $this->version; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * @return Version |
|
128 | - */ |
|
129 | - public function versionValueObject() |
|
130 | - { |
|
131 | - return $this->version; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @return string |
|
137 | - */ |
|
138 | - public function distributionAssetsPath() |
|
139 | - { |
|
140 | - return $this->pluginPath() . 'assets/dist/'; |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @return string |
|
146 | - */ |
|
147 | - public function distributionAssetsUrl() |
|
148 | - { |
|
149 | - return $this->pluginUrl() . 'assets/dist/'; |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * @return string |
|
155 | - */ |
|
156 | - public function assetNamespace() |
|
157 | - { |
|
158 | - return $this->asset_namespace; |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * @return void |
|
164 | - */ |
|
165 | - private function setAssetNamespace() |
|
166 | - { |
|
167 | - $asset_namespace = explode('/', $this->plugin_basename); |
|
168 | - $asset_namespace = reset($asset_namespace); |
|
169 | - $asset_namespace = $asset_namespace === 'event-espresso-core' |
|
170 | - ? Registry::ASSET_NAMESPACE_CORE |
|
171 | - : $asset_namespace; |
|
172 | - $this->asset_namespace = $asset_namespace; |
|
173 | - } |
|
23 | + /** |
|
24 | + * Equivalent to `__FILE__` for main plugin file. |
|
25 | + * |
|
26 | + * @var FilePath |
|
27 | + */ |
|
28 | + private $plugin_file; |
|
29 | + |
|
30 | + /** |
|
31 | + * String indicating version for plugin |
|
32 | + * |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + private $version; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var string $plugin_basename |
|
39 | + */ |
|
40 | + private $plugin_basename; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var string $plugin_path |
|
44 | + */ |
|
45 | + private $plugin_path; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var string $plugin_url |
|
49 | + */ |
|
50 | + private $plugin_url; |
|
51 | + |
|
52 | + /** |
|
53 | + * @var string $asset_namespace |
|
54 | + */ |
|
55 | + private $asset_namespace; |
|
56 | + |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * Initializes internal properties. |
|
61 | + * |
|
62 | + * @param FilePath $plugin_file |
|
63 | + * @param Version $version |
|
64 | + */ |
|
65 | + public function __construct(FilePath $plugin_file, Version $version) |
|
66 | + { |
|
67 | + $this->plugin_file = $plugin_file; |
|
68 | + $this->version = $version; |
|
69 | + $this->plugin_basename = plugin_basename($this->pluginFile()); |
|
70 | + $this->plugin_path = plugin_dir_path($this->pluginFile()); |
|
71 | + $this->plugin_url = plugin_dir_url($this->pluginFile()); |
|
72 | + $this->setAssetNamespace(); |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * @return string |
|
78 | + */ |
|
79 | + public function pluginFile() |
|
80 | + { |
|
81 | + return (string) $this->plugin_file; |
|
82 | + } |
|
83 | + |
|
84 | + |
|
85 | + |
|
86 | + /** |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + public function pluginBasename() |
|
90 | + { |
|
91 | + return $this->plugin_basename; |
|
92 | + } |
|
93 | + |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * @return string |
|
98 | + */ |
|
99 | + public function pluginPath() |
|
100 | + { |
|
101 | + return $this->plugin_path; |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + public function pluginUrl() |
|
110 | + { |
|
111 | + return $this->plugin_url; |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @return string |
|
118 | + */ |
|
119 | + public function version() |
|
120 | + { |
|
121 | + return (string) $this->version; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * @return Version |
|
128 | + */ |
|
129 | + public function versionValueObject() |
|
130 | + { |
|
131 | + return $this->version; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @return string |
|
137 | + */ |
|
138 | + public function distributionAssetsPath() |
|
139 | + { |
|
140 | + return $this->pluginPath() . 'assets/dist/'; |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @return string |
|
146 | + */ |
|
147 | + public function distributionAssetsUrl() |
|
148 | + { |
|
149 | + return $this->pluginUrl() . 'assets/dist/'; |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * @return string |
|
155 | + */ |
|
156 | + public function assetNamespace() |
|
157 | + { |
|
158 | + return $this->asset_namespace; |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * @return void |
|
164 | + */ |
|
165 | + private function setAssetNamespace() |
|
166 | + { |
|
167 | + $asset_namespace = explode('/', $this->plugin_basename); |
|
168 | + $asset_namespace = reset($asset_namespace); |
|
169 | + $asset_namespace = $asset_namespace === 'event-espresso-core' |
|
170 | + ? Registry::ASSET_NAMESPACE_CORE |
|
171 | + : $asset_namespace; |
|
172 | + $this->asset_namespace = $asset_namespace; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | |
176 | 176 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function distributionAssetsPath() |
139 | 139 | { |
140 | - return $this->pluginPath() . 'assets/dist/'; |
|
140 | + return $this->pluginPath().'assets/dist/'; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function distributionAssetsUrl() |
148 | 148 | { |
149 | - return $this->pluginUrl() . 'assets/dist/'; |
|
149 | + return $this->pluginUrl().'assets/dist/'; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function setAssetNamespace() |
166 | 166 | { |
167 | - $asset_namespace = explode('/', $this->plugin_basename); |
|
167 | + $asset_namespace = explode('/', $this->plugin_basename); |
|
168 | 168 | $asset_namespace = reset($asset_namespace); |
169 | 169 | $asset_namespace = $asset_namespace === 'event-espresso-core' |
170 | 170 | ? Registry::ASSET_NAMESPACE_CORE |
@@ -26,68 +26,68 @@ |
||
26 | 26 | interface BlockInterface |
27 | 27 | { |
28 | 28 | |
29 | - /** |
|
30 | - * Perform any early setup required by the block |
|
31 | - * including setting the block type and supported post types |
|
32 | - * |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function initialize(); |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function blockType(); |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * AssetRegister that this editor block uses for asset registration |
|
46 | - * |
|
47 | - * @return AssetRegisterInterface |
|
48 | - */ |
|
49 | - public function assetRegister(); |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * Registers the Editor Block with WP core; |
|
54 | - * Returns the registered block type on success, or false on failure. |
|
55 | - * |
|
56 | - * @return WP_Block_Type|false |
|
57 | - */ |
|
58 | - public function registerBlock(); |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * Un-registers the Editor Block with WP core; |
|
63 | - * Returns the registered block type on success, or false on failure. |
|
64 | - * |
|
65 | - * @return WP_Block_Type|false |
|
66 | - */ |
|
67 | - public function unRegisterBlock(); |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * returns true if the block type applies for the supplied post type |
|
72 | - * and should be added to that post type's editor |
|
73 | - * |
|
74 | - * @param string $post_type |
|
75 | - * @return boolean |
|
76 | - */ |
|
77 | - public function appliesToPostType($post_type); |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - public function getEditorContainer(); |
|
84 | - |
|
85 | - |
|
86 | - /** |
|
87 | - * returns the rendered HTML for the block |
|
88 | - * |
|
89 | - * @param array $attributes |
|
90 | - * @return string |
|
91 | - */ |
|
92 | - public function renderBlock(array $attributes = array()); |
|
29 | + /** |
|
30 | + * Perform any early setup required by the block |
|
31 | + * including setting the block type and supported post types |
|
32 | + * |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function initialize(); |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function blockType(); |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * AssetRegister that this editor block uses for asset registration |
|
46 | + * |
|
47 | + * @return AssetRegisterInterface |
|
48 | + */ |
|
49 | + public function assetRegister(); |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * Registers the Editor Block with WP core; |
|
54 | + * Returns the registered block type on success, or false on failure. |
|
55 | + * |
|
56 | + * @return WP_Block_Type|false |
|
57 | + */ |
|
58 | + public function registerBlock(); |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * Un-registers the Editor Block with WP core; |
|
63 | + * Returns the registered block type on success, or false on failure. |
|
64 | + * |
|
65 | + * @return WP_Block_Type|false |
|
66 | + */ |
|
67 | + public function unRegisterBlock(); |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * returns true if the block type applies for the supplied post type |
|
72 | + * and should be added to that post type's editor |
|
73 | + * |
|
74 | + * @param string $post_type |
|
75 | + * @return boolean |
|
76 | + */ |
|
77 | + public function appliesToPostType($post_type); |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + public function getEditorContainer(); |
|
84 | + |
|
85 | + |
|
86 | + /** |
|
87 | + * returns the rendered HTML for the block |
|
88 | + * |
|
89 | + * @param array $attributes |
|
90 | + * @return string |
|
91 | + */ |
|
92 | + public function renderBlock(array $attributes = array()); |
|
93 | 93 | } |
@@ -20,20 +20,20 @@ |
||
20 | 20 | */ |
21 | 21 | class CoreBlocksAssetRegister extends BlockAssetRegister |
22 | 22 | { |
23 | - /** |
|
24 | - * CoreBlocksAssetRegister constructor. |
|
25 | - * |
|
26 | - * @param DomainInterface $domain |
|
27 | - * @param Registry $registry |
|
28 | - */ |
|
29 | - public function __construct(DomainInterface $domain, Registry $registry) { |
|
30 | - parent::__construct( |
|
31 | - 'core-blocks', |
|
32 | - array(), |
|
33 | - 'core-blocks', |
|
34 | - array(), |
|
35 | - $domain, |
|
36 | - $registry |
|
37 | - ); |
|
38 | - } |
|
23 | + /** |
|
24 | + * CoreBlocksAssetRegister constructor. |
|
25 | + * |
|
26 | + * @param DomainInterface $domain |
|
27 | + * @param Registry $registry |
|
28 | + */ |
|
29 | + public function __construct(DomainInterface $domain, Registry $registry) { |
|
30 | + parent::__construct( |
|
31 | + 'core-blocks', |
|
32 | + array(), |
|
33 | + 'core-blocks', |
|
34 | + array(), |
|
35 | + $domain, |
|
36 | + $registry |
|
37 | + ); |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -25,29 +25,29 @@ |
||
25 | 25 | class EventAttendees extends Block |
26 | 26 | { |
27 | 27 | |
28 | - const BLOCK_TYPE = 'widgets-event-attendees'; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * EventAttendees constructor. |
|
33 | - * |
|
34 | - * @param CoreBlocksAssetRegister $asset_register |
|
35 | - */ |
|
36 | - public function __construct(CoreBlocksAssetRegister $asset_register) { |
|
37 | - parent::__construct($asset_register); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * Perform any early setup required by the block |
|
43 | - * including setting the block type and supported post types |
|
44 | - * |
|
45 | - * @return void |
|
46 | - */ |
|
47 | - public function initialize() |
|
48 | - { |
|
49 | - $this->setBlockType(EventAttendees::BLOCK_TYPE); |
|
50 | - $this->setSupportedPostTypes(array('espresso_events', 'post', 'page')); |
|
51 | - $this->setAttributes(array()); |
|
52 | - } |
|
28 | + const BLOCK_TYPE = 'widgets-event-attendees'; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * EventAttendees constructor. |
|
33 | + * |
|
34 | + * @param CoreBlocksAssetRegister $asset_register |
|
35 | + */ |
|
36 | + public function __construct(CoreBlocksAssetRegister $asset_register) { |
|
37 | + parent::__construct($asset_register); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * Perform any early setup required by the block |
|
43 | + * including setting the block type and supported post types |
|
44 | + * |
|
45 | + * @return void |
|
46 | + */ |
|
47 | + public function initialize() |
|
48 | + { |
|
49 | + $this->setBlockType(EventAttendees::BLOCK_TYPE); |
|
50 | + $this->setSupportedPostTypes(array('espresso_events', 'post', 'page')); |
|
51 | + $this->setAttributes(array()); |
|
52 | + } |
|
53 | 53 | } |
@@ -20,55 +20,55 @@ |
||
20 | 20 | class BlockCollection extends Collection |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Collection constructor |
|
25 | - * |
|
26 | - * @throws InvalidInterfaceException |
|
27 | - */ |
|
28 | - public function __construct() |
|
29 | - { |
|
30 | - parent::__construct('EventEspresso\core\domain\entities\editor\BlockInterface'); |
|
31 | - } |
|
23 | + /** |
|
24 | + * Collection constructor |
|
25 | + * |
|
26 | + * @throws InvalidInterfaceException |
|
27 | + */ |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + parent::__construct('EventEspresso\core\domain\entities\editor\BlockInterface'); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * unRegisterBlock |
|
36 | - * finds block in the Collection based on the identifier that was set using addObject() |
|
37 | - * and calls unRegisterBlock() on it. Returns block if successful and false if block was not found. |
|
38 | - * PLZ NOTE: the pointer is reset to the beginning of the collection afterwards |
|
39 | - * |
|
40 | - * @param mixed $identifier |
|
41 | - * @return boolean |
|
42 | - */ |
|
43 | - public function unRegisterBlock($identifier) |
|
44 | - { |
|
45 | - $this->rewind(); |
|
46 | - while ($this->valid()) { |
|
47 | - if ($identifier === $this->getInfo()) { |
|
48 | - $object = $this->current(); |
|
49 | - $this->rewind(); |
|
50 | - return $object->unRegisterBlock(); |
|
51 | - } |
|
52 | - $this->next(); |
|
53 | - } |
|
54 | - return false; |
|
55 | - } |
|
34 | + /** |
|
35 | + * unRegisterBlock |
|
36 | + * finds block in the Collection based on the identifier that was set using addObject() |
|
37 | + * and calls unRegisterBlock() on it. Returns block if successful and false if block was not found. |
|
38 | + * PLZ NOTE: the pointer is reset to the beginning of the collection afterwards |
|
39 | + * |
|
40 | + * @param mixed $identifier |
|
41 | + * @return boolean |
|
42 | + */ |
|
43 | + public function unRegisterBlock($identifier) |
|
44 | + { |
|
45 | + $this->rewind(); |
|
46 | + while ($this->valid()) { |
|
47 | + if ($identifier === $this->getInfo()) { |
|
48 | + $object = $this->current(); |
|
49 | + $this->rewind(); |
|
50 | + return $object->unRegisterBlock(); |
|
51 | + } |
|
52 | + $this->next(); |
|
53 | + } |
|
54 | + return false; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * unRegisterAllBlocks |
|
60 | - * calls unRegisterBlock() on all blocks in Collection. |
|
61 | - * PLZ NOTE: the pointer is reset to the beginning of the collection afterwards |
|
62 | - * |
|
63 | - * @return void |
|
64 | - */ |
|
65 | - public function unRegisterAllBlocks() |
|
66 | - { |
|
67 | - $this->rewind(); |
|
68 | - while ($this->valid()) { |
|
69 | - $this->current()->unRegisterBlock(); |
|
70 | - $this->next(); |
|
71 | - } |
|
72 | - $this->rewind(); |
|
73 | - } |
|
58 | + /** |
|
59 | + * unRegisterAllBlocks |
|
60 | + * calls unRegisterBlock() on all blocks in Collection. |
|
61 | + * PLZ NOTE: the pointer is reset to the beginning of the collection afterwards |
|
62 | + * |
|
63 | + * @return void |
|
64 | + */ |
|
65 | + public function unRegisterAllBlocks() |
|
66 | + { |
|
67 | + $this->rewind(); |
|
68 | + while ($this->valid()) { |
|
69 | + $this->current()->unRegisterBlock(); |
|
70 | + $this->next(); |
|
71 | + } |
|
72 | + $this->rewind(); |
|
73 | + } |
|
74 | 74 | } |
@@ -27,221 +27,221 @@ |
||
27 | 27 | abstract class Block implements BlockInterface |
28 | 28 | { |
29 | 29 | |
30 | - const NS = 'event-espresso/'; |
|
31 | - |
|
32 | - /** |
|
33 | - * AssetRegister that this editor block uses for asset registration |
|
34 | - * |
|
35 | - * @var AssetRegisterInterface $asset_register_fqcn |
|
36 | - */ |
|
37 | - protected $asset_register; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var string $editor_block_type |
|
41 | - */ |
|
42 | - private $editor_block_type; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var WP_Block_Type $wp_block_type |
|
46 | - */ |
|
47 | - private $wp_block_type; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var array $supported_post_types |
|
51 | - */ |
|
52 | - private $supported_post_types; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var array $attributes |
|
56 | - */ |
|
57 | - private $attributes; |
|
58 | - |
|
59 | - /** |
|
60 | - * If set to true, then the block will render its content client side |
|
61 | - * If false, then the block will render its content server side using the renderBlock() method |
|
62 | - * |
|
63 | - * @var bool $dynamic |
|
64 | - */ |
|
65 | - private $dynamic = false; |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * BlockLoader constructor. |
|
70 | - * |
|
71 | - * @param AssetRegisterInterface $asset_register |
|
72 | - */ |
|
73 | - public function __construct(AssetRegisterInterface $asset_register) { |
|
74 | - $this->asset_register = $asset_register; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @return string |
|
80 | - */ |
|
81 | - public function blockType() |
|
82 | - { |
|
83 | - return $this->editor_block_type; |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * @return string |
|
89 | - */ |
|
90 | - public function namespacedBlockType() |
|
91 | - { |
|
92 | - return Block::NS . $this->editor_block_type; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * @param string $editor_block_type |
|
98 | - */ |
|
99 | - protected function setBlockType($editor_block_type) |
|
100 | - { |
|
101 | - $this->editor_block_type = $editor_block_type; |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * AssetRegister that this editor block uses for asset registration |
|
107 | - * |
|
108 | - * @return AssetRegisterInterface |
|
109 | - */ |
|
110 | - public function assetRegister() |
|
111 | - { |
|
112 | - return $this->asset_register; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @param WP_Block_Type $wp_block_type |
|
119 | - */ |
|
120 | - protected function setWpBlockType($wp_block_type) |
|
121 | - { |
|
122 | - $this->wp_block_type = $wp_block_type; |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * @param array $supported_post_types |
|
128 | - */ |
|
129 | - protected function setSupportedPostTypes(array $supported_post_types) |
|
130 | - { |
|
131 | - $this->supported_post_types = $supported_post_types; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @return array |
|
137 | - */ |
|
138 | - public function attributes() |
|
139 | - { |
|
140 | - return $this->attributes; |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @param array $attributes |
|
146 | - */ |
|
147 | - public function setAttributes(array $attributes) |
|
148 | - { |
|
149 | - $this->attributes = $attributes; |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * @return bool |
|
155 | - */ |
|
156 | - public function isDynamic() |
|
157 | - { |
|
158 | - return $this->dynamic; |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * @param bool $dynamic |
|
164 | - */ |
|
165 | - public function setDynamic($dynamic = true) |
|
166 | - { |
|
167 | - $this->dynamic = filter_var($dynamic, FILTER_VALIDATE_BOOLEAN); |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * Registers the Editor Block with WP core; |
|
173 | - * Returns the registered block type on success, or false on failure. |
|
174 | - * |
|
175 | - * @return WP_Block_Type|false |
|
176 | - */ |
|
177 | - public function registerBlock() |
|
178 | - { |
|
179 | - $context ='core'; |
|
180 | - // todo add route detection (ie inject route) and change context based on route |
|
181 | - $args = array( |
|
182 | - 'attributes' => $this->attributes(), |
|
183 | - 'editor_script' => "{$context}-blocks", |
|
184 | - 'editor_style' => "{$context}-blocks", |
|
185 | - 'script' => "{$context}-blocks", |
|
186 | - 'style' => "{$context}-blocks", |
|
187 | - ); |
|
188 | - if(! $this->isDynamic()) { |
|
189 | - $args['render_callback'] = $this->renderBlock(); |
|
190 | - } |
|
191 | - $wp_block_type = register_block_type( |
|
192 | - new WP_Block_Type( |
|
193 | - $this->namespacedBlockType(), |
|
194 | - $args |
|
195 | - ) |
|
196 | - ); |
|
197 | - $this->setWpBlockType($wp_block_type); |
|
198 | - return $wp_block_type; |
|
199 | - } |
|
200 | - |
|
201 | - |
|
202 | - /** |
|
203 | - * @return WP_Block_Type|false The registered block type on success, or false on failure. |
|
204 | - */ |
|
205 | - public function unRegisterBlock() |
|
206 | - { |
|
207 | - return unregister_block_type($this->namespacedBlockType()); |
|
208 | - } |
|
209 | - |
|
210 | - |
|
211 | - /** |
|
212 | - * returns true if the block type applies for the supplied post type |
|
213 | - * and should be added to that post type's editor |
|
214 | - * |
|
215 | - * @param string $post_type |
|
216 | - * @return boolean |
|
217 | - */ |
|
218 | - public function appliesToPostType($post_type) |
|
219 | - { |
|
220 | - return in_array($post_type, $this->supported_post_types, true); |
|
221 | - } |
|
222 | - |
|
223 | - |
|
224 | - /** |
|
225 | - * @return array |
|
226 | - */ |
|
227 | - public function getEditorContainer() |
|
228 | - { |
|
229 | - return array( |
|
230 | - $this->namespacedBlockType(), |
|
231 | - array() |
|
232 | - ); |
|
233 | - } |
|
234 | - |
|
235 | - |
|
236 | - |
|
237 | - /** |
|
238 | - * returns the rendered HTML for the block |
|
239 | - * |
|
240 | - * @param array $attributes |
|
241 | - * @return string |
|
242 | - */ |
|
243 | - public function renderBlock(array $attributes = array()) |
|
244 | - { |
|
245 | - return ''; |
|
246 | - } |
|
30 | + const NS = 'event-espresso/'; |
|
31 | + |
|
32 | + /** |
|
33 | + * AssetRegister that this editor block uses for asset registration |
|
34 | + * |
|
35 | + * @var AssetRegisterInterface $asset_register_fqcn |
|
36 | + */ |
|
37 | + protected $asset_register; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var string $editor_block_type |
|
41 | + */ |
|
42 | + private $editor_block_type; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var WP_Block_Type $wp_block_type |
|
46 | + */ |
|
47 | + private $wp_block_type; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var array $supported_post_types |
|
51 | + */ |
|
52 | + private $supported_post_types; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var array $attributes |
|
56 | + */ |
|
57 | + private $attributes; |
|
58 | + |
|
59 | + /** |
|
60 | + * If set to true, then the block will render its content client side |
|
61 | + * If false, then the block will render its content server side using the renderBlock() method |
|
62 | + * |
|
63 | + * @var bool $dynamic |
|
64 | + */ |
|
65 | + private $dynamic = false; |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * BlockLoader constructor. |
|
70 | + * |
|
71 | + * @param AssetRegisterInterface $asset_register |
|
72 | + */ |
|
73 | + public function __construct(AssetRegisterInterface $asset_register) { |
|
74 | + $this->asset_register = $asset_register; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @return string |
|
80 | + */ |
|
81 | + public function blockType() |
|
82 | + { |
|
83 | + return $this->editor_block_type; |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * @return string |
|
89 | + */ |
|
90 | + public function namespacedBlockType() |
|
91 | + { |
|
92 | + return Block::NS . $this->editor_block_type; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * @param string $editor_block_type |
|
98 | + */ |
|
99 | + protected function setBlockType($editor_block_type) |
|
100 | + { |
|
101 | + $this->editor_block_type = $editor_block_type; |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * AssetRegister that this editor block uses for asset registration |
|
107 | + * |
|
108 | + * @return AssetRegisterInterface |
|
109 | + */ |
|
110 | + public function assetRegister() |
|
111 | + { |
|
112 | + return $this->asset_register; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @param WP_Block_Type $wp_block_type |
|
119 | + */ |
|
120 | + protected function setWpBlockType($wp_block_type) |
|
121 | + { |
|
122 | + $this->wp_block_type = $wp_block_type; |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * @param array $supported_post_types |
|
128 | + */ |
|
129 | + protected function setSupportedPostTypes(array $supported_post_types) |
|
130 | + { |
|
131 | + $this->supported_post_types = $supported_post_types; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @return array |
|
137 | + */ |
|
138 | + public function attributes() |
|
139 | + { |
|
140 | + return $this->attributes; |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @param array $attributes |
|
146 | + */ |
|
147 | + public function setAttributes(array $attributes) |
|
148 | + { |
|
149 | + $this->attributes = $attributes; |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * @return bool |
|
155 | + */ |
|
156 | + public function isDynamic() |
|
157 | + { |
|
158 | + return $this->dynamic; |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * @param bool $dynamic |
|
164 | + */ |
|
165 | + public function setDynamic($dynamic = true) |
|
166 | + { |
|
167 | + $this->dynamic = filter_var($dynamic, FILTER_VALIDATE_BOOLEAN); |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * Registers the Editor Block with WP core; |
|
173 | + * Returns the registered block type on success, or false on failure. |
|
174 | + * |
|
175 | + * @return WP_Block_Type|false |
|
176 | + */ |
|
177 | + public function registerBlock() |
|
178 | + { |
|
179 | + $context ='core'; |
|
180 | + // todo add route detection (ie inject route) and change context based on route |
|
181 | + $args = array( |
|
182 | + 'attributes' => $this->attributes(), |
|
183 | + 'editor_script' => "{$context}-blocks", |
|
184 | + 'editor_style' => "{$context}-blocks", |
|
185 | + 'script' => "{$context}-blocks", |
|
186 | + 'style' => "{$context}-blocks", |
|
187 | + ); |
|
188 | + if(! $this->isDynamic()) { |
|
189 | + $args['render_callback'] = $this->renderBlock(); |
|
190 | + } |
|
191 | + $wp_block_type = register_block_type( |
|
192 | + new WP_Block_Type( |
|
193 | + $this->namespacedBlockType(), |
|
194 | + $args |
|
195 | + ) |
|
196 | + ); |
|
197 | + $this->setWpBlockType($wp_block_type); |
|
198 | + return $wp_block_type; |
|
199 | + } |
|
200 | + |
|
201 | + |
|
202 | + /** |
|
203 | + * @return WP_Block_Type|false The registered block type on success, or false on failure. |
|
204 | + */ |
|
205 | + public function unRegisterBlock() |
|
206 | + { |
|
207 | + return unregister_block_type($this->namespacedBlockType()); |
|
208 | + } |
|
209 | + |
|
210 | + |
|
211 | + /** |
|
212 | + * returns true if the block type applies for the supplied post type |
|
213 | + * and should be added to that post type's editor |
|
214 | + * |
|
215 | + * @param string $post_type |
|
216 | + * @return boolean |
|
217 | + */ |
|
218 | + public function appliesToPostType($post_type) |
|
219 | + { |
|
220 | + return in_array($post_type, $this->supported_post_types, true); |
|
221 | + } |
|
222 | + |
|
223 | + |
|
224 | + /** |
|
225 | + * @return array |
|
226 | + */ |
|
227 | + public function getEditorContainer() |
|
228 | + { |
|
229 | + return array( |
|
230 | + $this->namespacedBlockType(), |
|
231 | + array() |
|
232 | + ); |
|
233 | + } |
|
234 | + |
|
235 | + |
|
236 | + |
|
237 | + /** |
|
238 | + * returns the rendered HTML for the block |
|
239 | + * |
|
240 | + * @param array $attributes |
|
241 | + * @return string |
|
242 | + */ |
|
243 | + public function renderBlock(array $attributes = array()) |
|
244 | + { |
|
245 | + return ''; |
|
246 | + } |
|
247 | 247 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function namespacedBlockType() |
91 | 91 | { |
92 | - return Block::NS . $this->editor_block_type; |
|
92 | + return Block::NS.$this->editor_block_type; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -176,16 +176,16 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function registerBlock() |
178 | 178 | { |
179 | - $context ='core'; |
|
179 | + $context = 'core'; |
|
180 | 180 | // todo add route detection (ie inject route) and change context based on route |
181 | - $args = array( |
|
181 | + $args = array( |
|
182 | 182 | 'attributes' => $this->attributes(), |
183 | 183 | 'editor_script' => "{$context}-blocks", |
184 | 184 | 'editor_style' => "{$context}-blocks", |
185 | 185 | 'script' => "{$context}-blocks", |
186 | 186 | 'style' => "{$context}-blocks", |
187 | 187 | ); |
188 | - if(! $this->isDynamic()) { |
|
188 | + if ( ! $this->isDynamic()) { |
|
189 | 189 | $args['render_callback'] = $this->renderBlock(); |
190 | 190 | } |
191 | 191 | $wp_block_type = register_block_type( |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\request\ResponseInterface; |
9 | 9 | |
10 | 10 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
11 | - exit('No direct script access allowed'); |
|
11 | + exit('No direct script access allowed'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
@@ -25,912 +25,912 @@ discard block |
||
25 | 25 | class EE_Dependency_Map |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * This means that the requested class dependency is not present in the dependency map |
|
30 | - */ |
|
31 | - const not_registered = 0; |
|
32 | - |
|
33 | - /** |
|
34 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
35 | - */ |
|
36 | - const load_new_object = 1; |
|
37 | - |
|
38 | - /** |
|
39 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
40 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
41 | - */ |
|
42 | - const load_from_cache = 2; |
|
43 | - |
|
44 | - /** |
|
45 | - * When registering a dependency, |
|
46 | - * this indicates to keep any existing dependencies that already exist, |
|
47 | - * and simply discard any new dependencies declared in the incoming data |
|
48 | - */ |
|
49 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
50 | - |
|
51 | - /** |
|
52 | - * When registering a dependency, |
|
53 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
54 | - */ |
|
55 | - const OVERWRITE_DEPENDENCIES = 1; |
|
56 | - |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * @type EE_Dependency_Map $_instance |
|
61 | - */ |
|
62 | - protected static $_instance; |
|
63 | - |
|
64 | - /** |
|
65 | - * @type RequestInterface $request |
|
66 | - */ |
|
67 | - protected $request; |
|
68 | - |
|
69 | - /** |
|
70 | - * @type LegacyRequestInterface $legacy_request |
|
71 | - */ |
|
72 | - protected $legacy_request; |
|
73 | - |
|
74 | - /** |
|
75 | - * @type ResponseInterface $response |
|
76 | - */ |
|
77 | - protected $response; |
|
78 | - |
|
79 | - /** |
|
80 | - * @type LoaderInterface $loader |
|
81 | - */ |
|
82 | - protected $loader; |
|
83 | - |
|
84 | - /** |
|
85 | - * @type array $_dependency_map |
|
86 | - */ |
|
87 | - protected $_dependency_map = array(); |
|
88 | - |
|
89 | - /** |
|
90 | - * @type array $_class_loaders |
|
91 | - */ |
|
92 | - protected $_class_loaders = array(); |
|
93 | - |
|
94 | - /** |
|
95 | - * @type array $_aliases |
|
96 | - */ |
|
97 | - protected $_aliases = array(); |
|
98 | - |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * EE_Dependency_Map constructor. |
|
103 | - */ |
|
104 | - protected function __construct() |
|
105 | - { |
|
106 | - // add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
107 | - do_action('EE_Dependency_Map____construct'); |
|
108 | - } |
|
109 | - |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * @throws InvalidDataTypeException |
|
114 | - * @throws InvalidInterfaceException |
|
115 | - * @throws InvalidArgumentException |
|
116 | - */ |
|
117 | - public function initialize() |
|
118 | - { |
|
119 | - $this->_register_core_dependencies(); |
|
120 | - $this->_register_core_class_loaders(); |
|
121 | - $this->_register_core_aliases(); |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * @singleton method used to instantiate class object |
|
128 | - * @return EE_Dependency_Map |
|
129 | - */ |
|
130 | - public static function instance() { |
|
131 | - // check if class object is instantiated, and instantiated properly |
|
132 | - if (! self::$_instance instanceof EE_Dependency_Map) { |
|
133 | - self::$_instance = new EE_Dependency_Map(/*$request, $response, $legacy_request*/); |
|
134 | - } |
|
135 | - return self::$_instance; |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * @param RequestInterface $request |
|
141 | - */ |
|
142 | - public function setRequest(RequestInterface $request) |
|
143 | - { |
|
144 | - $this->request = $request; |
|
145 | - } |
|
146 | - |
|
147 | - |
|
148 | - /** |
|
149 | - * @param LegacyRequestInterface $legacy_request |
|
150 | - */ |
|
151 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
152 | - { |
|
153 | - $this->legacy_request = $legacy_request; |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * @param ResponseInterface $response |
|
159 | - */ |
|
160 | - public function setResponse(ResponseInterface $response) |
|
161 | - { |
|
162 | - $this->response = $response; |
|
163 | - } |
|
164 | - |
|
165 | - |
|
166 | - |
|
167 | - /** |
|
168 | - * @param LoaderInterface $loader |
|
169 | - */ |
|
170 | - public function setLoader(LoaderInterface $loader) |
|
171 | - { |
|
172 | - $this->loader = $loader; |
|
173 | - } |
|
174 | - |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * @param string $class |
|
179 | - * @param array $dependencies |
|
180 | - * @param int $overwrite |
|
181 | - * @return bool |
|
182 | - */ |
|
183 | - public static function register_dependencies( |
|
184 | - $class, |
|
185 | - array $dependencies, |
|
186 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
187 | - ) { |
|
188 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
195 | - * to the class specified by the first parameter. |
|
196 | - * IMPORTANT !!! |
|
197 | - * The order of elements in the incoming $dependencies array MUST match |
|
198 | - * the order of the constructor parameters for the class in question. |
|
199 | - * This is especially important when overriding any existing dependencies that are registered. |
|
200 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
201 | - * |
|
202 | - * @param string $class |
|
203 | - * @param array $dependencies |
|
204 | - * @param int $overwrite |
|
205 | - * @return bool |
|
206 | - */ |
|
207 | - public function registerDependencies( |
|
208 | - $class, |
|
209 | - array $dependencies, |
|
210 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
211 | - ) { |
|
212 | - $class = trim($class, '\\'); |
|
213 | - $registered = false; |
|
214 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
215 | - self::$_instance->_dependency_map[ $class ] = array(); |
|
216 | - } |
|
217 | - // we need to make sure that any aliases used when registering a dependency |
|
218 | - // get resolved to the correct class name |
|
219 | - foreach ($dependencies as $dependency => $load_source) { |
|
220 | - $alias = self::$_instance->get_alias($dependency); |
|
221 | - if ( |
|
222 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
223 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
224 | - ) { |
|
225 | - unset($dependencies[$dependency]); |
|
226 | - $dependencies[$alias] = $load_source; |
|
227 | - $registered = true; |
|
228 | - } |
|
229 | - } |
|
230 | - // now add our two lists of dependencies together. |
|
231 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
232 | - // so $dependencies is NOT overwritten because it is listed first |
|
233 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
234 | - // Union is way faster than array_merge() but should be used with caution... |
|
235 | - // especially with numerically indexed arrays |
|
236 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
237 | - // now we need to ensure that the resulting dependencies |
|
238 | - // array only has the entries that are required for the class |
|
239 | - // so first count how many dependencies were originally registered for the class |
|
240 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
241 | - // if that count is non-zero (meaning dependencies were already registered) |
|
242 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
243 | - // then truncate the final array to match that count |
|
244 | - ? array_slice($dependencies, 0, $dependency_count) |
|
245 | - // otherwise just take the incoming array because nothing previously existed |
|
246 | - : $dependencies; |
|
247 | - return $registered; |
|
248 | - } |
|
249 | - |
|
250 | - |
|
251 | - |
|
252 | - /** |
|
253 | - * @param string $class_name |
|
254 | - * @param string $loader |
|
255 | - * @return bool |
|
256 | - * @throws DomainException |
|
257 | - */ |
|
258 | - public static function register_class_loader($class_name, $loader = 'load_core') |
|
259 | - { |
|
260 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
261 | - throw new DomainException( |
|
262 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
263 | - ); |
|
264 | - } |
|
265 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
266 | - if ( |
|
267 | - ! is_callable($loader) |
|
268 | - && ( |
|
269 | - strpos($loader, 'load_') !== 0 |
|
270 | - || ! method_exists('EE_Registry', $loader) |
|
271 | - ) |
|
272 | - ) { |
|
273 | - throw new DomainException( |
|
274 | - sprintf( |
|
275 | - esc_html__( |
|
276 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
277 | - 'event_espresso' |
|
278 | - ), |
|
279 | - $loader |
|
280 | - ) |
|
281 | - ); |
|
282 | - } |
|
283 | - $class_name = self::$_instance->get_alias($class_name); |
|
284 | - if (! isset(self::$_instance->_class_loaders[$class_name])) { |
|
285 | - self::$_instance->_class_loaders[$class_name] = $loader; |
|
286 | - return true; |
|
287 | - } |
|
288 | - return false; |
|
289 | - } |
|
290 | - |
|
291 | - |
|
292 | - |
|
293 | - /** |
|
294 | - * @return array |
|
295 | - */ |
|
296 | - public function dependency_map() |
|
297 | - { |
|
298 | - return $this->_dependency_map; |
|
299 | - } |
|
300 | - |
|
301 | - |
|
302 | - |
|
303 | - /** |
|
304 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
305 | - * |
|
306 | - * @param string $class_name |
|
307 | - * @return boolean |
|
308 | - */ |
|
309 | - public function has($class_name = '') |
|
310 | - { |
|
311 | - // all legacy models have the same dependencies |
|
312 | - if (strpos($class_name, 'EEM_') === 0) { |
|
313 | - $class_name = 'LEGACY_MODELS'; |
|
314 | - } |
|
315 | - return isset($this->_dependency_map[$class_name]) ? true : false; |
|
316 | - } |
|
317 | - |
|
318 | - |
|
319 | - |
|
320 | - /** |
|
321 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
322 | - * |
|
323 | - * @param string $class_name |
|
324 | - * @param string $dependency |
|
325 | - * @return bool |
|
326 | - */ |
|
327 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
328 | - { |
|
329 | - // all legacy models have the same dependencies |
|
330 | - if (strpos($class_name, 'EEM_') === 0) { |
|
331 | - $class_name = 'LEGACY_MODELS'; |
|
332 | - } |
|
333 | - $dependency = $this->get_alias($dependency); |
|
334 | - return isset($this->_dependency_map[$class_name][$dependency]) |
|
335 | - ? true |
|
336 | - : false; |
|
337 | - } |
|
338 | - |
|
339 | - |
|
340 | - |
|
341 | - /** |
|
342 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
343 | - * |
|
344 | - * @param string $class_name |
|
345 | - * @param string $dependency |
|
346 | - * @return int |
|
347 | - */ |
|
348 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
349 | - { |
|
350 | - // all legacy models have the same dependencies |
|
351 | - if (strpos($class_name, 'EEM_') === 0) { |
|
352 | - $class_name = 'LEGACY_MODELS'; |
|
353 | - } |
|
354 | - $dependency = $this->get_alias($dependency); |
|
355 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
356 | - ? $this->_dependency_map[$class_name][$dependency] |
|
357 | - : EE_Dependency_Map::not_registered; |
|
358 | - } |
|
359 | - |
|
360 | - |
|
361 | - |
|
362 | - /** |
|
363 | - * @param string $class_name |
|
364 | - * @return string | Closure |
|
365 | - */ |
|
366 | - public function class_loader($class_name) |
|
367 | - { |
|
368 | - // all legacy models use load_model() |
|
369 | - if(strpos($class_name, 'EEM_') === 0){ |
|
370 | - return 'load_model'; |
|
371 | - } |
|
372 | - $class_name = $this->get_alias($class_name); |
|
373 | - return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
374 | - } |
|
375 | - |
|
376 | - |
|
377 | - |
|
378 | - /** |
|
379 | - * @return array |
|
380 | - */ |
|
381 | - public function class_loaders() |
|
382 | - { |
|
383 | - return $this->_class_loaders; |
|
384 | - } |
|
385 | - |
|
386 | - |
|
387 | - |
|
388 | - /** |
|
389 | - * adds an alias for a classname |
|
390 | - * |
|
391 | - * @param string $class_name the class name that should be used (concrete class to replace interface) |
|
392 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
393 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
394 | - */ |
|
395 | - public function add_alias($class_name, $alias, $for_class = '') |
|
396 | - { |
|
397 | - if ($for_class !== '') { |
|
398 | - if (! isset($this->_aliases[$for_class])) { |
|
399 | - $this->_aliases[$for_class] = array(); |
|
400 | - } |
|
401 | - $this->_aliases[$for_class][$class_name] = $alias; |
|
402 | - } |
|
403 | - $this->_aliases[$class_name] = $alias; |
|
404 | - } |
|
405 | - |
|
406 | - |
|
407 | - |
|
408 | - /** |
|
409 | - * returns TRUE if the provided class name has an alias |
|
410 | - * |
|
411 | - * @param string $class_name |
|
412 | - * @param string $for_class |
|
413 | - * @return bool |
|
414 | - */ |
|
415 | - public function has_alias($class_name = '', $for_class = '') |
|
416 | - { |
|
417 | - return isset($this->_aliases[$for_class][$class_name]) |
|
418 | - || ( |
|
419 | - isset($this->_aliases[$class_name]) |
|
420 | - && ! is_array($this->_aliases[$class_name]) |
|
421 | - ); |
|
422 | - } |
|
423 | - |
|
424 | - |
|
425 | - |
|
426 | - /** |
|
427 | - * returns alias for class name if one exists, otherwise returns the original classname |
|
428 | - * functions recursively, so that multiple aliases can be used to drill down to a classname |
|
429 | - * for example: |
|
430 | - * if the following two entries were added to the _aliases array: |
|
431 | - * array( |
|
432 | - * 'interface_alias' => 'some\namespace\interface' |
|
433 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
434 | - * ) |
|
435 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
436 | - * to load an instance of 'some\namespace\classname' |
|
437 | - * |
|
438 | - * @param string $class_name |
|
439 | - * @param string $for_class |
|
440 | - * @return string |
|
441 | - */ |
|
442 | - public function get_alias($class_name = '', $for_class = '') |
|
443 | - { |
|
444 | - if (! $this->has_alias($class_name, $for_class)) { |
|
445 | - return $class_name; |
|
446 | - } |
|
447 | - if ($for_class !== '' && isset($this->_aliases[ $for_class ][ $class_name ])) { |
|
448 | - return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class); |
|
449 | - } |
|
450 | - return $this->get_alias($this->_aliases[$class_name]); |
|
451 | - } |
|
452 | - |
|
453 | - |
|
454 | - |
|
455 | - /** |
|
456 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
457 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
458 | - * This is done by using the following class constants: |
|
459 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
460 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
461 | - */ |
|
462 | - protected function _register_core_dependencies() |
|
463 | - { |
|
464 | - $this->_dependency_map = array( |
|
465 | - 'EE_Request_Handler' => array( |
|
466 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
467 | - ), |
|
468 | - 'EE_System' => array( |
|
469 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
470 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
471 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
472 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
473 | - ), |
|
474 | - 'EE_Session' => array( |
|
475 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
476 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
477 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
478 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
479 | - ), |
|
480 | - 'EE_Cart' => array( |
|
481 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
482 | - ), |
|
483 | - 'EE_Front_Controller' => array( |
|
484 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
485 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
486 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
487 | - ), |
|
488 | - 'EE_Messenger_Collection_Loader' => array( |
|
489 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
490 | - ), |
|
491 | - 'EE_Message_Type_Collection_Loader' => array( |
|
492 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
493 | - ), |
|
494 | - 'EE_Message_Resource_Manager' => array( |
|
495 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
496 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
497 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
498 | - ), |
|
499 | - 'EE_Message_Factory' => array( |
|
500 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
501 | - ), |
|
502 | - 'EE_messages' => array( |
|
503 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
504 | - ), |
|
505 | - 'EE_Messages_Generator' => array( |
|
506 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
507 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
508 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
509 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
510 | - ), |
|
511 | - 'EE_Messages_Processor' => array( |
|
512 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
513 | - ), |
|
514 | - 'EE_Messages_Queue' => array( |
|
515 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
516 | - ), |
|
517 | - 'EE_Messages_Template_Defaults' => array( |
|
518 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
519 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
520 | - ), |
|
521 | - 'EE_Message_To_Generate_From_Request' => array( |
|
522 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
523 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
524 | - ), |
|
525 | - 'EventEspresso\core\services\commands\CommandBus' => array( |
|
526 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
527 | - ), |
|
528 | - 'EventEspresso\services\commands\CommandHandler' => array( |
|
529 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
530 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
531 | - ), |
|
532 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
533 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
534 | - ), |
|
535 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
536 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
537 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
538 | - ), |
|
539 | - 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
540 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
541 | - ), |
|
542 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
543 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
544 | - ), |
|
545 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
546 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
547 | - ), |
|
548 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
549 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
550 | - ), |
|
551 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
552 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
553 | - ), |
|
554 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
555 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
556 | - ), |
|
557 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
558 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
559 | - ), |
|
560 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
561 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
562 | - ), |
|
563 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
564 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
565 | - ), |
|
566 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
567 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
568 | - ), |
|
569 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
570 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
571 | - ), |
|
572 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
573 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
574 | - ), |
|
575 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
576 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
577 | - ), |
|
578 | - 'EventEspresso\core\services\database\TableManager' => array( |
|
579 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
580 | - ), |
|
581 | - 'EE_Data_Migration_Class_Base' => array( |
|
582 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
584 | - ), |
|
585 | - 'EE_DMS_Core_4_1_0' => array( |
|
586 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | - ), |
|
589 | - 'EE_DMS_Core_4_2_0' => array( |
|
590 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | - ), |
|
593 | - 'EE_DMS_Core_4_3_0' => array( |
|
594 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | - ), |
|
597 | - 'EE_DMS_Core_4_4_0' => array( |
|
598 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | - ), |
|
601 | - 'EE_DMS_Core_4_5_0' => array( |
|
602 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | - ), |
|
605 | - 'EE_DMS_Core_4_6_0' => array( |
|
606 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | - ), |
|
609 | - 'EE_DMS_Core_4_7_0' => array( |
|
610 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | - ), |
|
613 | - 'EE_DMS_Core_4_8_0' => array( |
|
614 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
615 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
616 | - ), |
|
617 | - 'EE_DMS_Core_4_9_0' => array( |
|
618 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
619 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
620 | - ), |
|
621 | - 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
622 | - array(), |
|
623 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
624 | - ), |
|
625 | - 'EventEspresso\core\services\assets\Registry' => array( |
|
626 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
627 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
628 | - 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
629 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
630 | - ), |
|
631 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
632 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
633 | - ), |
|
634 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
635 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
636 | - ), |
|
637 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
638 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
639 | - ), |
|
640 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
641 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
642 | - ), |
|
643 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
644 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
645 | - ), |
|
646 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
647 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
648 | - ), |
|
649 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
650 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
651 | - ), |
|
652 | - 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
653 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
654 | - ), |
|
655 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
656 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
657 | - ), |
|
658 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
659 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
660 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
661 | - ), |
|
662 | - 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
663 | - null, |
|
664 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
665 | - ), |
|
666 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
667 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
668 | - ), |
|
669 | - 'LEGACY_MODELS' => array( |
|
670 | - null, |
|
671 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
672 | - ), |
|
673 | - 'EE_Module_Request_Router' => array( |
|
674 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
675 | - ), |
|
676 | - 'EE_Registration_Processor' => array( |
|
677 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
678 | - ), |
|
679 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
680 | - null, |
|
681 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
682 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
683 | - ), |
|
684 | - 'EE_Admin_Transactions_List_Table' => array( |
|
685 | - null, |
|
686 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
687 | - ), |
|
688 | - 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
689 | - 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
690 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache |
|
691 | - ), |
|
692 | - 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
693 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
694 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
695 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache |
|
696 | - ), |
|
697 | - 'EventEspresso\core\domain\services\pue\Config' => array( |
|
698 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
699 | - 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
700 | - ), |
|
701 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
702 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
703 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
704 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
705 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
706 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
707 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
708 | - 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
709 | - ), |
|
710 | - 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
711 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
712 | - ), |
|
713 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
714 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
715 | - ), |
|
716 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
717 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
718 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
719 | - ), |
|
720 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
721 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
722 | - ), |
|
723 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
724 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
725 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
726 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
727 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
728 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
729 | - ), |
|
730 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
731 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
732 | - ), |
|
733 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' => array( |
|
734 | - 'EventEspresso\core\services\assets\AssetRegisterCollection' => EE_Dependency_Map::load_from_cache, |
|
735 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
736 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
737 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
738 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
739 | - ), |
|
740 | - 'EventEspresso\core\domain\entities\editor\blocks\widgets\EventAttendees' => array( |
|
741 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
742 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
743 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
744 | - ), |
|
745 | - 'EventEspresso\core\domain\entities\editor\blocks\CoreBlocksAssetRegister' => array( |
|
746 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
747 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
748 | - ), |
|
749 | - ); |
|
750 | - } |
|
751 | - |
|
752 | - |
|
753 | - |
|
754 | - /** |
|
755 | - * Registers how core classes are loaded. |
|
756 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
757 | - * 'EE_Request_Handler' => 'load_core' |
|
758 | - * 'EE_Messages_Queue' => 'load_lib' |
|
759 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
760 | - * or, if greater control is required, by providing a custom closure. For example: |
|
761 | - * 'Some_Class' => function () { |
|
762 | - * return new Some_Class(); |
|
763 | - * }, |
|
764 | - * This is required for instantiating dependencies |
|
765 | - * where an interface has been type hinted in a class constructor. For example: |
|
766 | - * 'Required_Interface' => function () { |
|
767 | - * return new A_Class_That_Implements_Required_Interface(); |
|
768 | - * }, |
|
769 | - * |
|
770 | - * @throws InvalidInterfaceException |
|
771 | - * @throws InvalidDataTypeException |
|
772 | - * @throws InvalidArgumentException |
|
773 | - */ |
|
774 | - protected function _register_core_class_loaders() |
|
775 | - { |
|
776 | - //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot |
|
777 | - //be used in a closure. |
|
778 | - $request = &$this->request; |
|
779 | - $response = &$this->response; |
|
780 | - $legacy_request = &$this->legacy_request; |
|
781 | - // $loader = &$this->loader; |
|
782 | - $this->_class_loaders = array( |
|
783 | - //load_core |
|
784 | - 'EE_Capabilities' => 'load_core', |
|
785 | - 'EE_Encryption' => 'load_core', |
|
786 | - 'EE_Front_Controller' => 'load_core', |
|
787 | - 'EE_Module_Request_Router' => 'load_core', |
|
788 | - 'EE_Registry' => 'load_core', |
|
789 | - 'EE_Request' => function () use (&$legacy_request) { |
|
790 | - return $legacy_request; |
|
791 | - }, |
|
792 | - 'EventEspresso\core\services\request\Request' => function () use (&$request) { |
|
793 | - return $request; |
|
794 | - }, |
|
795 | - 'EventEspresso\core\services\request\Response' => function () use (&$response) { |
|
796 | - return $response; |
|
797 | - }, |
|
798 | - 'EE_Request_Handler' => 'load_core', |
|
799 | - 'EE_Session' => 'load_core', |
|
800 | - 'EE_Cron_Tasks' => 'load_core', |
|
801 | - 'EE_System' => 'load_core', |
|
802 | - 'EE_Maintenance_Mode' => 'load_core', |
|
803 | - 'EE_Register_CPTs' => 'load_core', |
|
804 | - 'EE_Admin' => '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 | - ); |
|
862 | - } |
|
863 | - |
|
864 | - |
|
865 | - |
|
866 | - /** |
|
867 | - * can be used for supplying alternate names for classes, |
|
868 | - * or for connecting interface names to instantiable classes |
|
869 | - */ |
|
870 | - protected function _register_core_aliases() |
|
871 | - { |
|
872 | - $this->_aliases = array( |
|
873 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
874 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
875 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
876 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
877 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
878 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
879 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
880 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
881 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
882 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
883 | - 'CreateRegCodeCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegCodeCommand', |
|
884 | - 'CreateRegUrlLinkCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegUrlLinkCommand', |
|
885 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
886 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
887 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
888 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
889 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
890 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
891 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
892 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
893 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
894 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
895 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
896 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
897 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
898 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
899 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
900 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
901 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
902 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
903 | - 'EventEspresso\core\domain\services\session\SessionIdentifierInterface' => 'EE_Session', |
|
904 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
905 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
906 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
907 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
908 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
909 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
910 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
911 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
912 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
913 | - ); |
|
914 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
915 | - $this->_aliases['EventEspresso\core\services\notices\NoticeConverterInterface'] = 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices'; |
|
916 | - } |
|
917 | - } |
|
918 | - |
|
919 | - |
|
920 | - |
|
921 | - /** |
|
922 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
923 | - * request Primarily used by unit tests. |
|
924 | - * |
|
925 | - * @throws InvalidDataTypeException |
|
926 | - * @throws InvalidInterfaceException |
|
927 | - * @throws InvalidArgumentException |
|
928 | - */ |
|
929 | - public function reset() |
|
930 | - { |
|
931 | - $this->_register_core_class_loaders(); |
|
932 | - $this->_register_core_dependencies(); |
|
933 | - } |
|
28 | + /** |
|
29 | + * This means that the requested class dependency is not present in the dependency map |
|
30 | + */ |
|
31 | + const not_registered = 0; |
|
32 | + |
|
33 | + /** |
|
34 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
35 | + */ |
|
36 | + const load_new_object = 1; |
|
37 | + |
|
38 | + /** |
|
39 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
40 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
41 | + */ |
|
42 | + const load_from_cache = 2; |
|
43 | + |
|
44 | + /** |
|
45 | + * When registering a dependency, |
|
46 | + * this indicates to keep any existing dependencies that already exist, |
|
47 | + * and simply discard any new dependencies declared in the incoming data |
|
48 | + */ |
|
49 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
50 | + |
|
51 | + /** |
|
52 | + * When registering a dependency, |
|
53 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
54 | + */ |
|
55 | + const OVERWRITE_DEPENDENCIES = 1; |
|
56 | + |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * @type EE_Dependency_Map $_instance |
|
61 | + */ |
|
62 | + protected static $_instance; |
|
63 | + |
|
64 | + /** |
|
65 | + * @type RequestInterface $request |
|
66 | + */ |
|
67 | + protected $request; |
|
68 | + |
|
69 | + /** |
|
70 | + * @type LegacyRequestInterface $legacy_request |
|
71 | + */ |
|
72 | + protected $legacy_request; |
|
73 | + |
|
74 | + /** |
|
75 | + * @type ResponseInterface $response |
|
76 | + */ |
|
77 | + protected $response; |
|
78 | + |
|
79 | + /** |
|
80 | + * @type LoaderInterface $loader |
|
81 | + */ |
|
82 | + protected $loader; |
|
83 | + |
|
84 | + /** |
|
85 | + * @type array $_dependency_map |
|
86 | + */ |
|
87 | + protected $_dependency_map = array(); |
|
88 | + |
|
89 | + /** |
|
90 | + * @type array $_class_loaders |
|
91 | + */ |
|
92 | + protected $_class_loaders = array(); |
|
93 | + |
|
94 | + /** |
|
95 | + * @type array $_aliases |
|
96 | + */ |
|
97 | + protected $_aliases = array(); |
|
98 | + |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * EE_Dependency_Map constructor. |
|
103 | + */ |
|
104 | + protected function __construct() |
|
105 | + { |
|
106 | + // add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
107 | + do_action('EE_Dependency_Map____construct'); |
|
108 | + } |
|
109 | + |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * @throws InvalidDataTypeException |
|
114 | + * @throws InvalidInterfaceException |
|
115 | + * @throws InvalidArgumentException |
|
116 | + */ |
|
117 | + public function initialize() |
|
118 | + { |
|
119 | + $this->_register_core_dependencies(); |
|
120 | + $this->_register_core_class_loaders(); |
|
121 | + $this->_register_core_aliases(); |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * @singleton method used to instantiate class object |
|
128 | + * @return EE_Dependency_Map |
|
129 | + */ |
|
130 | + public static function instance() { |
|
131 | + // check if class object is instantiated, and instantiated properly |
|
132 | + if (! self::$_instance instanceof EE_Dependency_Map) { |
|
133 | + self::$_instance = new EE_Dependency_Map(/*$request, $response, $legacy_request*/); |
|
134 | + } |
|
135 | + return self::$_instance; |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * @param RequestInterface $request |
|
141 | + */ |
|
142 | + public function setRequest(RequestInterface $request) |
|
143 | + { |
|
144 | + $this->request = $request; |
|
145 | + } |
|
146 | + |
|
147 | + |
|
148 | + /** |
|
149 | + * @param LegacyRequestInterface $legacy_request |
|
150 | + */ |
|
151 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
152 | + { |
|
153 | + $this->legacy_request = $legacy_request; |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * @param ResponseInterface $response |
|
159 | + */ |
|
160 | + public function setResponse(ResponseInterface $response) |
|
161 | + { |
|
162 | + $this->response = $response; |
|
163 | + } |
|
164 | + |
|
165 | + |
|
166 | + |
|
167 | + /** |
|
168 | + * @param LoaderInterface $loader |
|
169 | + */ |
|
170 | + public function setLoader(LoaderInterface $loader) |
|
171 | + { |
|
172 | + $this->loader = $loader; |
|
173 | + } |
|
174 | + |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * @param string $class |
|
179 | + * @param array $dependencies |
|
180 | + * @param int $overwrite |
|
181 | + * @return bool |
|
182 | + */ |
|
183 | + public static function register_dependencies( |
|
184 | + $class, |
|
185 | + array $dependencies, |
|
186 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
187 | + ) { |
|
188 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
195 | + * to the class specified by the first parameter. |
|
196 | + * IMPORTANT !!! |
|
197 | + * The order of elements in the incoming $dependencies array MUST match |
|
198 | + * the order of the constructor parameters for the class in question. |
|
199 | + * This is especially important when overriding any existing dependencies that are registered. |
|
200 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
201 | + * |
|
202 | + * @param string $class |
|
203 | + * @param array $dependencies |
|
204 | + * @param int $overwrite |
|
205 | + * @return bool |
|
206 | + */ |
|
207 | + public function registerDependencies( |
|
208 | + $class, |
|
209 | + array $dependencies, |
|
210 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
211 | + ) { |
|
212 | + $class = trim($class, '\\'); |
|
213 | + $registered = false; |
|
214 | + if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
215 | + self::$_instance->_dependency_map[ $class ] = array(); |
|
216 | + } |
|
217 | + // we need to make sure that any aliases used when registering a dependency |
|
218 | + // get resolved to the correct class name |
|
219 | + foreach ($dependencies as $dependency => $load_source) { |
|
220 | + $alias = self::$_instance->get_alias($dependency); |
|
221 | + if ( |
|
222 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
223 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
224 | + ) { |
|
225 | + unset($dependencies[$dependency]); |
|
226 | + $dependencies[$alias] = $load_source; |
|
227 | + $registered = true; |
|
228 | + } |
|
229 | + } |
|
230 | + // now add our two lists of dependencies together. |
|
231 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
232 | + // so $dependencies is NOT overwritten because it is listed first |
|
233 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
234 | + // Union is way faster than array_merge() but should be used with caution... |
|
235 | + // especially with numerically indexed arrays |
|
236 | + $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
237 | + // now we need to ensure that the resulting dependencies |
|
238 | + // array only has the entries that are required for the class |
|
239 | + // so first count how many dependencies were originally registered for the class |
|
240 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
241 | + // if that count is non-zero (meaning dependencies were already registered) |
|
242 | + self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
243 | + // then truncate the final array to match that count |
|
244 | + ? array_slice($dependencies, 0, $dependency_count) |
|
245 | + // otherwise just take the incoming array because nothing previously existed |
|
246 | + : $dependencies; |
|
247 | + return $registered; |
|
248 | + } |
|
249 | + |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * @param string $class_name |
|
254 | + * @param string $loader |
|
255 | + * @return bool |
|
256 | + * @throws DomainException |
|
257 | + */ |
|
258 | + public static function register_class_loader($class_name, $loader = 'load_core') |
|
259 | + { |
|
260 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
261 | + throw new DomainException( |
|
262 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
263 | + ); |
|
264 | + } |
|
265 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
266 | + if ( |
|
267 | + ! is_callable($loader) |
|
268 | + && ( |
|
269 | + strpos($loader, 'load_') !== 0 |
|
270 | + || ! method_exists('EE_Registry', $loader) |
|
271 | + ) |
|
272 | + ) { |
|
273 | + throw new DomainException( |
|
274 | + sprintf( |
|
275 | + esc_html__( |
|
276 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
277 | + 'event_espresso' |
|
278 | + ), |
|
279 | + $loader |
|
280 | + ) |
|
281 | + ); |
|
282 | + } |
|
283 | + $class_name = self::$_instance->get_alias($class_name); |
|
284 | + if (! isset(self::$_instance->_class_loaders[$class_name])) { |
|
285 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
286 | + return true; |
|
287 | + } |
|
288 | + return false; |
|
289 | + } |
|
290 | + |
|
291 | + |
|
292 | + |
|
293 | + /** |
|
294 | + * @return array |
|
295 | + */ |
|
296 | + public function dependency_map() |
|
297 | + { |
|
298 | + return $this->_dependency_map; |
|
299 | + } |
|
300 | + |
|
301 | + |
|
302 | + |
|
303 | + /** |
|
304 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
305 | + * |
|
306 | + * @param string $class_name |
|
307 | + * @return boolean |
|
308 | + */ |
|
309 | + public function has($class_name = '') |
|
310 | + { |
|
311 | + // all legacy models have the same dependencies |
|
312 | + if (strpos($class_name, 'EEM_') === 0) { |
|
313 | + $class_name = 'LEGACY_MODELS'; |
|
314 | + } |
|
315 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
316 | + } |
|
317 | + |
|
318 | + |
|
319 | + |
|
320 | + /** |
|
321 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
322 | + * |
|
323 | + * @param string $class_name |
|
324 | + * @param string $dependency |
|
325 | + * @return bool |
|
326 | + */ |
|
327 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
328 | + { |
|
329 | + // all legacy models have the same dependencies |
|
330 | + if (strpos($class_name, 'EEM_') === 0) { |
|
331 | + $class_name = 'LEGACY_MODELS'; |
|
332 | + } |
|
333 | + $dependency = $this->get_alias($dependency); |
|
334 | + return isset($this->_dependency_map[$class_name][$dependency]) |
|
335 | + ? true |
|
336 | + : false; |
|
337 | + } |
|
338 | + |
|
339 | + |
|
340 | + |
|
341 | + /** |
|
342 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
343 | + * |
|
344 | + * @param string $class_name |
|
345 | + * @param string $dependency |
|
346 | + * @return int |
|
347 | + */ |
|
348 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
349 | + { |
|
350 | + // all legacy models have the same dependencies |
|
351 | + if (strpos($class_name, 'EEM_') === 0) { |
|
352 | + $class_name = 'LEGACY_MODELS'; |
|
353 | + } |
|
354 | + $dependency = $this->get_alias($dependency); |
|
355 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
356 | + ? $this->_dependency_map[$class_name][$dependency] |
|
357 | + : EE_Dependency_Map::not_registered; |
|
358 | + } |
|
359 | + |
|
360 | + |
|
361 | + |
|
362 | + /** |
|
363 | + * @param string $class_name |
|
364 | + * @return string | Closure |
|
365 | + */ |
|
366 | + public function class_loader($class_name) |
|
367 | + { |
|
368 | + // all legacy models use load_model() |
|
369 | + if(strpos($class_name, 'EEM_') === 0){ |
|
370 | + return 'load_model'; |
|
371 | + } |
|
372 | + $class_name = $this->get_alias($class_name); |
|
373 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
374 | + } |
|
375 | + |
|
376 | + |
|
377 | + |
|
378 | + /** |
|
379 | + * @return array |
|
380 | + */ |
|
381 | + public function class_loaders() |
|
382 | + { |
|
383 | + return $this->_class_loaders; |
|
384 | + } |
|
385 | + |
|
386 | + |
|
387 | + |
|
388 | + /** |
|
389 | + * adds an alias for a classname |
|
390 | + * |
|
391 | + * @param string $class_name the class name that should be used (concrete class to replace interface) |
|
392 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
393 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
394 | + */ |
|
395 | + public function add_alias($class_name, $alias, $for_class = '') |
|
396 | + { |
|
397 | + if ($for_class !== '') { |
|
398 | + if (! isset($this->_aliases[$for_class])) { |
|
399 | + $this->_aliases[$for_class] = array(); |
|
400 | + } |
|
401 | + $this->_aliases[$for_class][$class_name] = $alias; |
|
402 | + } |
|
403 | + $this->_aliases[$class_name] = $alias; |
|
404 | + } |
|
405 | + |
|
406 | + |
|
407 | + |
|
408 | + /** |
|
409 | + * returns TRUE if the provided class name has an alias |
|
410 | + * |
|
411 | + * @param string $class_name |
|
412 | + * @param string $for_class |
|
413 | + * @return bool |
|
414 | + */ |
|
415 | + public function has_alias($class_name = '', $for_class = '') |
|
416 | + { |
|
417 | + return isset($this->_aliases[$for_class][$class_name]) |
|
418 | + || ( |
|
419 | + isset($this->_aliases[$class_name]) |
|
420 | + && ! is_array($this->_aliases[$class_name]) |
|
421 | + ); |
|
422 | + } |
|
423 | + |
|
424 | + |
|
425 | + |
|
426 | + /** |
|
427 | + * returns alias for class name if one exists, otherwise returns the original classname |
|
428 | + * functions recursively, so that multiple aliases can be used to drill down to a classname |
|
429 | + * for example: |
|
430 | + * if the following two entries were added to the _aliases array: |
|
431 | + * array( |
|
432 | + * 'interface_alias' => 'some\namespace\interface' |
|
433 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
434 | + * ) |
|
435 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
436 | + * to load an instance of 'some\namespace\classname' |
|
437 | + * |
|
438 | + * @param string $class_name |
|
439 | + * @param string $for_class |
|
440 | + * @return string |
|
441 | + */ |
|
442 | + public function get_alias($class_name = '', $for_class = '') |
|
443 | + { |
|
444 | + if (! $this->has_alias($class_name, $for_class)) { |
|
445 | + return $class_name; |
|
446 | + } |
|
447 | + if ($for_class !== '' && isset($this->_aliases[ $for_class ][ $class_name ])) { |
|
448 | + return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class); |
|
449 | + } |
|
450 | + return $this->get_alias($this->_aliases[$class_name]); |
|
451 | + } |
|
452 | + |
|
453 | + |
|
454 | + |
|
455 | + /** |
|
456 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
457 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
458 | + * This is done by using the following class constants: |
|
459 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
460 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
461 | + */ |
|
462 | + protected function _register_core_dependencies() |
|
463 | + { |
|
464 | + $this->_dependency_map = array( |
|
465 | + 'EE_Request_Handler' => array( |
|
466 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
467 | + ), |
|
468 | + 'EE_System' => array( |
|
469 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
470 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
471 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
472 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
473 | + ), |
|
474 | + 'EE_Session' => array( |
|
475 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
476 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
477 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
478 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
479 | + ), |
|
480 | + 'EE_Cart' => array( |
|
481 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
482 | + ), |
|
483 | + 'EE_Front_Controller' => array( |
|
484 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
485 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
486 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
487 | + ), |
|
488 | + 'EE_Messenger_Collection_Loader' => array( |
|
489 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
490 | + ), |
|
491 | + 'EE_Message_Type_Collection_Loader' => array( |
|
492 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
493 | + ), |
|
494 | + 'EE_Message_Resource_Manager' => array( |
|
495 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
496 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
497 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
498 | + ), |
|
499 | + 'EE_Message_Factory' => array( |
|
500 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
501 | + ), |
|
502 | + 'EE_messages' => array( |
|
503 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
504 | + ), |
|
505 | + 'EE_Messages_Generator' => array( |
|
506 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
507 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
508 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
509 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
510 | + ), |
|
511 | + 'EE_Messages_Processor' => array( |
|
512 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
513 | + ), |
|
514 | + 'EE_Messages_Queue' => array( |
|
515 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
516 | + ), |
|
517 | + 'EE_Messages_Template_Defaults' => array( |
|
518 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
519 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
520 | + ), |
|
521 | + 'EE_Message_To_Generate_From_Request' => array( |
|
522 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
523 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
524 | + ), |
|
525 | + 'EventEspresso\core\services\commands\CommandBus' => array( |
|
526 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
527 | + ), |
|
528 | + 'EventEspresso\services\commands\CommandHandler' => array( |
|
529 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
530 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
531 | + ), |
|
532 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
533 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
534 | + ), |
|
535 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
536 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
537 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
538 | + ), |
|
539 | + 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
540 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
541 | + ), |
|
542 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
543 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
544 | + ), |
|
545 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
546 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
547 | + ), |
|
548 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
549 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
550 | + ), |
|
551 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
552 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
553 | + ), |
|
554 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
555 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
556 | + ), |
|
557 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
558 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
559 | + ), |
|
560 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
561 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
562 | + ), |
|
563 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
564 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
565 | + ), |
|
566 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
567 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
568 | + ), |
|
569 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
570 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
571 | + ), |
|
572 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
573 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
574 | + ), |
|
575 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
576 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
577 | + ), |
|
578 | + 'EventEspresso\core\services\database\TableManager' => array( |
|
579 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
580 | + ), |
|
581 | + 'EE_Data_Migration_Class_Base' => array( |
|
582 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
584 | + ), |
|
585 | + 'EE_DMS_Core_4_1_0' => array( |
|
586 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | + ), |
|
589 | + 'EE_DMS_Core_4_2_0' => array( |
|
590 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | + ), |
|
593 | + 'EE_DMS_Core_4_3_0' => array( |
|
594 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | + ), |
|
597 | + 'EE_DMS_Core_4_4_0' => array( |
|
598 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | + ), |
|
601 | + 'EE_DMS_Core_4_5_0' => array( |
|
602 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | + ), |
|
605 | + 'EE_DMS_Core_4_6_0' => array( |
|
606 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | + ), |
|
609 | + 'EE_DMS_Core_4_7_0' => array( |
|
610 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | + ), |
|
613 | + 'EE_DMS_Core_4_8_0' => array( |
|
614 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
615 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
616 | + ), |
|
617 | + 'EE_DMS_Core_4_9_0' => array( |
|
618 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
619 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
620 | + ), |
|
621 | + 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
622 | + array(), |
|
623 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
624 | + ), |
|
625 | + 'EventEspresso\core\services\assets\Registry' => array( |
|
626 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
627 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
628 | + 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
629 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
630 | + ), |
|
631 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
632 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
633 | + ), |
|
634 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
635 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
636 | + ), |
|
637 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
638 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
639 | + ), |
|
640 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
641 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
642 | + ), |
|
643 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
644 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
645 | + ), |
|
646 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
647 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
648 | + ), |
|
649 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
650 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
651 | + ), |
|
652 | + 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
653 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
654 | + ), |
|
655 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
656 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
657 | + ), |
|
658 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
659 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
660 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
661 | + ), |
|
662 | + 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
663 | + null, |
|
664 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
665 | + ), |
|
666 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
667 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
668 | + ), |
|
669 | + 'LEGACY_MODELS' => array( |
|
670 | + null, |
|
671 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
672 | + ), |
|
673 | + 'EE_Module_Request_Router' => array( |
|
674 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
675 | + ), |
|
676 | + 'EE_Registration_Processor' => array( |
|
677 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
678 | + ), |
|
679 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
680 | + null, |
|
681 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
682 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
683 | + ), |
|
684 | + 'EE_Admin_Transactions_List_Table' => array( |
|
685 | + null, |
|
686 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
687 | + ), |
|
688 | + 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
689 | + 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
690 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache |
|
691 | + ), |
|
692 | + 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
693 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
694 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
695 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache |
|
696 | + ), |
|
697 | + 'EventEspresso\core\domain\services\pue\Config' => array( |
|
698 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
699 | + 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
700 | + ), |
|
701 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
702 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
703 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
704 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
705 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
706 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
707 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
708 | + 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
709 | + ), |
|
710 | + 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
711 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
712 | + ), |
|
713 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
714 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache |
|
715 | + ), |
|
716 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
717 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
718 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
719 | + ), |
|
720 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
721 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
722 | + ), |
|
723 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
724 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
725 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
726 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
727 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
728 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
729 | + ), |
|
730 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
731 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
732 | + ), |
|
733 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' => array( |
|
734 | + 'EventEspresso\core\services\assets\AssetRegisterCollection' => EE_Dependency_Map::load_from_cache, |
|
735 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
736 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
737 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
738 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
739 | + ), |
|
740 | + 'EventEspresso\core\domain\entities\editor\blocks\widgets\EventAttendees' => array( |
|
741 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
742 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
743 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
744 | + ), |
|
745 | + 'EventEspresso\core\domain\entities\editor\blocks\CoreBlocksAssetRegister' => array( |
|
746 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
747 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache |
|
748 | + ), |
|
749 | + ); |
|
750 | + } |
|
751 | + |
|
752 | + |
|
753 | + |
|
754 | + /** |
|
755 | + * Registers how core classes are loaded. |
|
756 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
757 | + * 'EE_Request_Handler' => 'load_core' |
|
758 | + * 'EE_Messages_Queue' => 'load_lib' |
|
759 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
760 | + * or, if greater control is required, by providing a custom closure. For example: |
|
761 | + * 'Some_Class' => function () { |
|
762 | + * return new Some_Class(); |
|
763 | + * }, |
|
764 | + * This is required for instantiating dependencies |
|
765 | + * where an interface has been type hinted in a class constructor. For example: |
|
766 | + * 'Required_Interface' => function () { |
|
767 | + * return new A_Class_That_Implements_Required_Interface(); |
|
768 | + * }, |
|
769 | + * |
|
770 | + * @throws InvalidInterfaceException |
|
771 | + * @throws InvalidDataTypeException |
|
772 | + * @throws InvalidArgumentException |
|
773 | + */ |
|
774 | + protected function _register_core_class_loaders() |
|
775 | + { |
|
776 | + //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot |
|
777 | + //be used in a closure. |
|
778 | + $request = &$this->request; |
|
779 | + $response = &$this->response; |
|
780 | + $legacy_request = &$this->legacy_request; |
|
781 | + // $loader = &$this->loader; |
|
782 | + $this->_class_loaders = array( |
|
783 | + //load_core |
|
784 | + 'EE_Capabilities' => 'load_core', |
|
785 | + 'EE_Encryption' => 'load_core', |
|
786 | + 'EE_Front_Controller' => 'load_core', |
|
787 | + 'EE_Module_Request_Router' => 'load_core', |
|
788 | + 'EE_Registry' => 'load_core', |
|
789 | + 'EE_Request' => function () use (&$legacy_request) { |
|
790 | + return $legacy_request; |
|
791 | + }, |
|
792 | + 'EventEspresso\core\services\request\Request' => function () use (&$request) { |
|
793 | + return $request; |
|
794 | + }, |
|
795 | + 'EventEspresso\core\services\request\Response' => function () use (&$response) { |
|
796 | + return $response; |
|
797 | + }, |
|
798 | + 'EE_Request_Handler' => 'load_core', |
|
799 | + 'EE_Session' => 'load_core', |
|
800 | + 'EE_Cron_Tasks' => 'load_core', |
|
801 | + 'EE_System' => 'load_core', |
|
802 | + 'EE_Maintenance_Mode' => 'load_core', |
|
803 | + 'EE_Register_CPTs' => 'load_core', |
|
804 | + 'EE_Admin' => '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 | + ); |
|
862 | + } |
|
863 | + |
|
864 | + |
|
865 | + |
|
866 | + /** |
|
867 | + * can be used for supplying alternate names for classes, |
|
868 | + * or for connecting interface names to instantiable classes |
|
869 | + */ |
|
870 | + protected function _register_core_aliases() |
|
871 | + { |
|
872 | + $this->_aliases = array( |
|
873 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
874 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
875 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
876 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
877 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
878 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
879 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
880 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
881 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
882 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
883 | + 'CreateRegCodeCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegCodeCommand', |
|
884 | + 'CreateRegUrlLinkCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegUrlLinkCommand', |
|
885 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
886 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
887 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
888 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
889 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
890 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
891 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
892 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
893 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
894 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
895 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
896 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
897 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
898 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
899 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
900 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
901 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
902 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
903 | + 'EventEspresso\core\domain\services\session\SessionIdentifierInterface' => 'EE_Session', |
|
904 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
905 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
906 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
907 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
908 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
909 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
910 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
911 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
912 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
913 | + ); |
|
914 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
915 | + $this->_aliases['EventEspresso\core\services\notices\NoticeConverterInterface'] = 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices'; |
|
916 | + } |
|
917 | + } |
|
918 | + |
|
919 | + |
|
920 | + |
|
921 | + /** |
|
922 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
923 | + * request Primarily used by unit tests. |
|
924 | + * |
|
925 | + * @throws InvalidDataTypeException |
|
926 | + * @throws InvalidInterfaceException |
|
927 | + * @throws InvalidArgumentException |
|
928 | + */ |
|
929 | + public function reset() |
|
930 | + { |
|
931 | + $this->_register_core_class_loaders(); |
|
932 | + $this->_register_core_dependencies(); |
|
933 | + } |
|
934 | 934 | |
935 | 935 | |
936 | 936 | } |