@@ -18,207 +18,207 @@ |
||
18 | 18 | abstract class DomainBase implements DomainInterface |
19 | 19 | { |
20 | 20 | |
21 | - const ASSETS_FOLDER = 'assets/'; |
|
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 | - * @var string $assets_path |
|
59 | - */ |
|
60 | - private $assets_path; |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * Initializes internal properties. |
|
65 | - * |
|
66 | - * @param FilePath $plugin_file |
|
67 | - * @param Version $version |
|
68 | - * @param string $asset_namespace |
|
69 | - */ |
|
70 | - public function __construct(FilePath $plugin_file, Version $version, $asset_namespace = 'eventespresso') |
|
71 | - { |
|
72 | - $this->plugin_file = $plugin_file; |
|
73 | - $this->version = $version; |
|
74 | - $this->initialize($asset_namespace); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @param string $asset_namespace |
|
80 | - * @return void |
|
81 | - * @since $VID:$ |
|
82 | - */ |
|
83 | - public function initialize($asset_namespace = 'eventespresso') |
|
84 | - { |
|
85 | - $this->plugin_basename = plugin_basename($this->pluginFile()); |
|
86 | - $this->plugin_path = plugin_dir_path($this->pluginFile()); |
|
87 | - $this->plugin_url = plugin_dir_url($this->pluginFile()); |
|
88 | - $this->setAssetNamespace($asset_namespace); |
|
89 | - $this->setDistributionAssetsPath(); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @param string $asset_namespace |
|
95 | - * @return void |
|
96 | - */ |
|
97 | - public function setAssetNamespace($asset_namespace = 'eventespresso') |
|
98 | - { |
|
99 | - if (! $this->asset_namespace) { |
|
100 | - $this->asset_namespace = sanitize_key( |
|
101 | - // convert directory separators to dashes and remove file extension |
|
102 | - str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
|
103 | - ); |
|
104 | - } |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * @throws DomainException |
|
110 | - * @since $VID:$ |
|
111 | - */ |
|
112 | - private function setDistributionAssetsPath() |
|
113 | - { |
|
114 | - $assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER; |
|
115 | - if (! is_readable($assets_path)) { |
|
116 | - throw new DomainException( |
|
117 | - sprintf( |
|
118 | - esc_html__( |
|
119 | - 'The assets distribution folder was not found or is not readable. Please verify that "%1$s" exists and has valid permissions.', |
|
120 | - 'event_espresso' |
|
121 | - ), |
|
122 | - $assets_path |
|
123 | - ) |
|
124 | - ); |
|
125 | - } |
|
126 | - $this->assets_path = trailingslashit($assets_path); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * @return string |
|
132 | - */ |
|
133 | - public function pluginFile() |
|
134 | - { |
|
135 | - return (string) $this->plugin_file; |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * @return string |
|
141 | - */ |
|
142 | - public function pluginBasename() |
|
143 | - { |
|
144 | - return $this->plugin_basename; |
|
145 | - } |
|
146 | - |
|
147 | - |
|
148 | - /** |
|
149 | - * @return string |
|
150 | - */ |
|
151 | - public function pluginPath() |
|
152 | - { |
|
153 | - return $this->plugin_path; |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * @return string |
|
159 | - */ |
|
160 | - public function pluginUrl() |
|
161 | - { |
|
162 | - return $this->plugin_url; |
|
163 | - } |
|
164 | - |
|
165 | - |
|
166 | - /** |
|
167 | - * @return string |
|
168 | - */ |
|
169 | - public function version() |
|
170 | - { |
|
171 | - return (string) $this->version; |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - /** |
|
176 | - * @return Version |
|
177 | - */ |
|
178 | - public function versionValueObject() |
|
179 | - { |
|
180 | - return $this->version; |
|
181 | - } |
|
182 | - |
|
183 | - |
|
184 | - /** |
|
185 | - * @return string |
|
186 | - */ |
|
187 | - public function distributionAssetsFolder() |
|
188 | - { |
|
189 | - return DomainBase::ASSETS_FOLDER; |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * @param string $additional_path |
|
195 | - * @return string |
|
196 | - */ |
|
197 | - public function distributionAssetsPath($additional_path = '') |
|
198 | - { |
|
199 | - return is_string($additional_path) && $additional_path !== '' |
|
200 | - ? $this->assets_path . $additional_path |
|
201 | - : $this->assets_path; |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * @param string $additional_path |
|
207 | - * @return string |
|
208 | - */ |
|
209 | - public function distributionAssetsUrl($additional_path = '') |
|
210 | - { |
|
211 | - return is_string($additional_path) && $additional_path !== '' |
|
212 | - ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path |
|
213 | - : $this->plugin_url . DomainBase::ASSETS_FOLDER; |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - /** |
|
218 | - * @return string |
|
219 | - */ |
|
220 | - public function assetNamespace() |
|
221 | - { |
|
222 | - return $this->asset_namespace; |
|
223 | - } |
|
21 | + const ASSETS_FOLDER = 'assets/'; |
|
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 | + * @var string $assets_path |
|
59 | + */ |
|
60 | + private $assets_path; |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * Initializes internal properties. |
|
65 | + * |
|
66 | + * @param FilePath $plugin_file |
|
67 | + * @param Version $version |
|
68 | + * @param string $asset_namespace |
|
69 | + */ |
|
70 | + public function __construct(FilePath $plugin_file, Version $version, $asset_namespace = 'eventespresso') |
|
71 | + { |
|
72 | + $this->plugin_file = $plugin_file; |
|
73 | + $this->version = $version; |
|
74 | + $this->initialize($asset_namespace); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @param string $asset_namespace |
|
80 | + * @return void |
|
81 | + * @since $VID:$ |
|
82 | + */ |
|
83 | + public function initialize($asset_namespace = 'eventespresso') |
|
84 | + { |
|
85 | + $this->plugin_basename = plugin_basename($this->pluginFile()); |
|
86 | + $this->plugin_path = plugin_dir_path($this->pluginFile()); |
|
87 | + $this->plugin_url = plugin_dir_url($this->pluginFile()); |
|
88 | + $this->setAssetNamespace($asset_namespace); |
|
89 | + $this->setDistributionAssetsPath(); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @param string $asset_namespace |
|
95 | + * @return void |
|
96 | + */ |
|
97 | + public function setAssetNamespace($asset_namespace = 'eventespresso') |
|
98 | + { |
|
99 | + if (! $this->asset_namespace) { |
|
100 | + $this->asset_namespace = sanitize_key( |
|
101 | + // convert directory separators to dashes and remove file extension |
|
102 | + str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
|
103 | + ); |
|
104 | + } |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * @throws DomainException |
|
110 | + * @since $VID:$ |
|
111 | + */ |
|
112 | + private function setDistributionAssetsPath() |
|
113 | + { |
|
114 | + $assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER; |
|
115 | + if (! is_readable($assets_path)) { |
|
116 | + throw new DomainException( |
|
117 | + sprintf( |
|
118 | + esc_html__( |
|
119 | + 'The assets distribution folder was not found or is not readable. Please verify that "%1$s" exists and has valid permissions.', |
|
120 | + 'event_espresso' |
|
121 | + ), |
|
122 | + $assets_path |
|
123 | + ) |
|
124 | + ); |
|
125 | + } |
|
126 | + $this->assets_path = trailingslashit($assets_path); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * @return string |
|
132 | + */ |
|
133 | + public function pluginFile() |
|
134 | + { |
|
135 | + return (string) $this->plugin_file; |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * @return string |
|
141 | + */ |
|
142 | + public function pluginBasename() |
|
143 | + { |
|
144 | + return $this->plugin_basename; |
|
145 | + } |
|
146 | + |
|
147 | + |
|
148 | + /** |
|
149 | + * @return string |
|
150 | + */ |
|
151 | + public function pluginPath() |
|
152 | + { |
|
153 | + return $this->plugin_path; |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * @return string |
|
159 | + */ |
|
160 | + public function pluginUrl() |
|
161 | + { |
|
162 | + return $this->plugin_url; |
|
163 | + } |
|
164 | + |
|
165 | + |
|
166 | + /** |
|
167 | + * @return string |
|
168 | + */ |
|
169 | + public function version() |
|
170 | + { |
|
171 | + return (string) $this->version; |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + /** |
|
176 | + * @return Version |
|
177 | + */ |
|
178 | + public function versionValueObject() |
|
179 | + { |
|
180 | + return $this->version; |
|
181 | + } |
|
182 | + |
|
183 | + |
|
184 | + /** |
|
185 | + * @return string |
|
186 | + */ |
|
187 | + public function distributionAssetsFolder() |
|
188 | + { |
|
189 | + return DomainBase::ASSETS_FOLDER; |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * @param string $additional_path |
|
195 | + * @return string |
|
196 | + */ |
|
197 | + public function distributionAssetsPath($additional_path = '') |
|
198 | + { |
|
199 | + return is_string($additional_path) && $additional_path !== '' |
|
200 | + ? $this->assets_path . $additional_path |
|
201 | + : $this->assets_path; |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * @param string $additional_path |
|
207 | + * @return string |
|
208 | + */ |
|
209 | + public function distributionAssetsUrl($additional_path = '') |
|
210 | + { |
|
211 | + return is_string($additional_path) && $additional_path !== '' |
|
212 | + ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path |
|
213 | + : $this->plugin_url . DomainBase::ASSETS_FOLDER; |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + /** |
|
218 | + * @return string |
|
219 | + */ |
|
220 | + public function assetNamespace() |
|
221 | + { |
|
222 | + return $this->asset_namespace; |
|
223 | + } |
|
224 | 224 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function setAssetNamespace($asset_namespace = 'eventespresso') |
98 | 98 | { |
99 | - if (! $this->asset_namespace) { |
|
99 | + if ( ! $this->asset_namespace) { |
|
100 | 100 | $this->asset_namespace = sanitize_key( |
101 | 101 | // convert directory separators to dashes and remove file extension |
102 | 102 | str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | */ |
112 | 112 | private function setDistributionAssetsPath() |
113 | 113 | { |
114 | - $assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER; |
|
115 | - if (! is_readable($assets_path)) { |
|
114 | + $assets_path = $this->pluginPath().DomainBase::ASSETS_FOLDER; |
|
115 | + if ( ! is_readable($assets_path)) { |
|
116 | 116 | throw new DomainException( |
117 | 117 | sprintf( |
118 | 118 | esc_html__( |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | public function distributionAssetsPath($additional_path = '') |
198 | 198 | { |
199 | 199 | return is_string($additional_path) && $additional_path !== '' |
200 | - ? $this->assets_path . $additional_path |
|
200 | + ? $this->assets_path.$additional_path |
|
201 | 201 | : $this->assets_path; |
202 | 202 | } |
203 | 203 | |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | public function distributionAssetsUrl($additional_path = '') |
210 | 210 | { |
211 | 211 | return is_string($additional_path) && $additional_path !== '' |
212 | - ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path |
|
213 | - : $this->plugin_url . DomainBase::ASSETS_FOLDER; |
|
212 | + ? $this->plugin_url.DomainBase::ASSETS_FOLDER.$additional_path |
|
213 | + : $this->plugin_url.DomainBase::ASSETS_FOLDER; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 |
@@ -23,83 +23,83 @@ |
||
23 | 23 | class Config extends JsonDataNode |
24 | 24 | { |
25 | 25 | |
26 | - const NODE_NAME = 'config'; |
|
26 | + const NODE_NAME = 'config'; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @var CurrentUser $current_user |
|
30 | - */ |
|
31 | - private $current_user; |
|
28 | + /** |
|
29 | + * @var CurrentUser $current_user |
|
30 | + */ |
|
31 | + private $current_user; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @var EspressoCoreDomain $core_domain |
|
35 | - */ |
|
36 | - private $core_domain; |
|
33 | + /** |
|
34 | + * @var EspressoCoreDomain $core_domain |
|
35 | + */ |
|
36 | + private $core_domain; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var GeneralSettings $general_settings |
|
40 | - */ |
|
41 | - private $general_settings; |
|
38 | + /** |
|
39 | + * @var GeneralSettings $general_settings |
|
40 | + */ |
|
41 | + private $general_settings; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @var Locale $locale |
|
45 | - */ |
|
46 | - private $locale; |
|
43 | + /** |
|
44 | + * @var Locale $locale |
|
45 | + */ |
|
46 | + private $locale; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @var SiteCurrency $site_currency |
|
50 | - */ |
|
51 | - private $site_currency; |
|
48 | + /** |
|
49 | + * @var SiteCurrency $site_currency |
|
50 | + */ |
|
51 | + private $site_currency; |
|
52 | 52 | |
53 | - /** |
|
54 | - * @var SiteUrls $site_urls |
|
55 | - */ |
|
56 | - private $site_urls; |
|
53 | + /** |
|
54 | + * @var SiteUrls $site_urls |
|
55 | + */ |
|
56 | + private $site_urls; |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * JsonDataNode constructor. |
|
61 | - * |
|
62 | - * @param CurrentUser $current_user |
|
63 | - * @param EspressoCoreDomain $core_domain |
|
64 | - * @param GeneralSettings $general_settings |
|
65 | - * @param Locale $locale |
|
66 | - * @param SiteCurrency $site_currency |
|
67 | - * @param SiteUrls $site_urls |
|
68 | - * @param JsonDataNodeValidator $validator |
|
69 | - */ |
|
70 | - public function __construct( |
|
71 | - CurrentUser $current_user, |
|
72 | - EspressoCoreDomain $core_domain, |
|
73 | - GeneralSettings $general_settings, |
|
74 | - Locale $locale, |
|
75 | - SiteCurrency $site_currency, |
|
76 | - SiteUrls $site_urls, |
|
77 | - JsonDataNodeValidator $validator |
|
78 | - ) { |
|
79 | - parent::__construct($validator); |
|
80 | - $this->current_user = $current_user; |
|
81 | - $this->core_domain = $core_domain; |
|
82 | - $this->general_settings = $general_settings; |
|
83 | - $this->locale = $locale; |
|
84 | - $this->site_currency = $site_currency; |
|
85 | - $this->site_urls = $site_urls; |
|
86 | - $this->setNodeName(Config::NODE_NAME); |
|
87 | - } |
|
59 | + /** |
|
60 | + * JsonDataNode constructor. |
|
61 | + * |
|
62 | + * @param CurrentUser $current_user |
|
63 | + * @param EspressoCoreDomain $core_domain |
|
64 | + * @param GeneralSettings $general_settings |
|
65 | + * @param Locale $locale |
|
66 | + * @param SiteCurrency $site_currency |
|
67 | + * @param SiteUrls $site_urls |
|
68 | + * @param JsonDataNodeValidator $validator |
|
69 | + */ |
|
70 | + public function __construct( |
|
71 | + CurrentUser $current_user, |
|
72 | + EspressoCoreDomain $core_domain, |
|
73 | + GeneralSettings $general_settings, |
|
74 | + Locale $locale, |
|
75 | + SiteCurrency $site_currency, |
|
76 | + SiteUrls $site_urls, |
|
77 | + JsonDataNodeValidator $validator |
|
78 | + ) { |
|
79 | + parent::__construct($validator); |
|
80 | + $this->current_user = $current_user; |
|
81 | + $this->core_domain = $core_domain; |
|
82 | + $this->general_settings = $general_settings; |
|
83 | + $this->locale = $locale; |
|
84 | + $this->site_currency = $site_currency; |
|
85 | + $this->site_urls = $site_urls; |
|
86 | + $this->setNodeName(Config::NODE_NAME); |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | - /** |
|
91 | - * @throws DomainException |
|
92 | - * @since $VID:$ |
|
93 | - */ |
|
94 | - public function initialize() |
|
95 | - { |
|
96 | - $this->addDataNode($this->core_domain); |
|
97 | - $this->addDataNode($this->site_currency); |
|
98 | - $this->addDataNode($this->current_user); |
|
99 | - $this->addDataNode($this->general_settings); |
|
100 | - $this->addDataNode($this->locale); |
|
101 | - $this->addDataNode($this->site_urls); |
|
102 | - $this->addData('wp_debug', WP_DEBUG); |
|
103 | - $this->setInitialized(true); |
|
104 | - } |
|
90 | + /** |
|
91 | + * @throws DomainException |
|
92 | + * @since $VID:$ |
|
93 | + */ |
|
94 | + public function initialize() |
|
95 | + { |
|
96 | + $this->addDataNode($this->core_domain); |
|
97 | + $this->addDataNode($this->site_currency); |
|
98 | + $this->addDataNode($this->current_user); |
|
99 | + $this->addDataNode($this->general_settings); |
|
100 | + $this->addDataNode($this->locale); |
|
101 | + $this->addDataNode($this->site_urls); |
|
102 | + $this->addData('wp_debug', WP_DEBUG); |
|
103 | + $this->setInitialized(true); |
|
104 | + } |
|
105 | 105 | } |