@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
145 | - * @param $handle |
|
145 | + * @param string $handle |
|
146 | 146 | * @param array $dependencies |
147 | 147 | * @since $VID:$ |
148 | 148 | * @return JavascriptAsset |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | |
170 | 170 | /** |
171 | - * @param $handle |
|
171 | + * @param string $handle |
|
172 | 172 | * @param array $dependencies |
173 | 173 | * @since $VID:$ |
174 | 174 | * @return StylesheetAsset |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | |
195 | 195 | /** |
196 | - * @param $handle |
|
196 | + * @param string $handle |
|
197 | 197 | * @param array $dependencies |
198 | 198 | * @since $VID:$ |
199 | 199 | * @return JavascriptAsset |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | |
221 | 221 | /** |
222 | - * @param $handle |
|
222 | + * @param string $handle |
|
223 | 223 | * @param array $dependencies |
224 | 224 | * @since $VID:$ |
225 | 225 | * @return StylesheetAsset |
@@ -22,309 +22,309 @@ |
||
22 | 22 | abstract class BlockAssetManager extends AssetManager implements BlockAssetManagerInterface |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @var string $editor_script_handle |
|
27 | - */ |
|
28 | - private $editor_script_handle; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string $editor_style_handle |
|
32 | - */ |
|
33 | - private $editor_style_handle; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var string $script_handle |
|
37 | - */ |
|
38 | - private $script_handle; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var string $style_handle |
|
42 | - */ |
|
43 | - private $style_handle; |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * @return string |
|
48 | - */ |
|
49 | - public function getEditorScriptHandle() |
|
50 | - { |
|
51 | - return $this->editor_script_handle; |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * @param string $editor_script_handle |
|
57 | - */ |
|
58 | - public function setEditorScriptHandle($editor_script_handle) |
|
59 | - { |
|
60 | - if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
61 | - $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle; |
|
62 | - } |
|
63 | - $this->editor_script_handle = $editor_script_handle; |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * @return string |
|
69 | - */ |
|
70 | - public function getEditorStyleHandle() |
|
71 | - { |
|
72 | - return $this->editor_style_handle; |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * @param string $editor_style_handle |
|
78 | - */ |
|
79 | - public function setEditorStyleHandle($editor_style_handle) |
|
80 | - { |
|
81 | - if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
82 | - $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle; |
|
83 | - } |
|
84 | - $this->editor_style_handle = $editor_style_handle; |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * @return string |
|
90 | - */ |
|
91 | - public function getScriptHandle() |
|
92 | - { |
|
93 | - return $this->script_handle; |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param string $script_handle |
|
99 | - */ |
|
100 | - public function setScriptHandle($script_handle) |
|
101 | - { |
|
102 | - if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
103 | - $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle; |
|
104 | - } |
|
105 | - $this->script_handle = $script_handle; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @return string |
|
111 | - */ |
|
112 | - public function getStyleHandle() |
|
113 | - { |
|
114 | - return $this->style_handle; |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * @param string $style_handle |
|
120 | - */ |
|
121 | - public function setStyleHandle($style_handle) |
|
122 | - { |
|
123 | - if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
124 | - $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle; |
|
125 | - } |
|
126 | - $this->style_handle = $style_handle; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @since $VID:$ |
|
131 | - * @throws InvalidDataTypeException |
|
132 | - * @throws InvalidEntityException |
|
133 | - * @throws DuplicateCollectionIdentifierException |
|
134 | - */ |
|
135 | - public function addAssets() |
|
136 | - { |
|
137 | - $this->addEditorScript($this->getEditorScriptHandle()); |
|
138 | - $this->addEditorStyle($this->getEditorStyleHandle()); |
|
139 | - $this->addScript($this->getScriptHandle()); |
|
140 | - $this->addStyle($this->getStyleHandle()); |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @param $handle |
|
146 | - * @param array $dependencies |
|
147 | - * @since $VID:$ |
|
148 | - * @return JavascriptAsset |
|
149 | - * @throws InvalidDataTypeException |
|
150 | - * @throws InvalidEntityException |
|
151 | - * @throws DuplicateCollectionIdentifierException |
|
152 | - */ |
|
153 | - public function addEditorScript($handle, array $dependencies = array()) |
|
154 | - { |
|
155 | - if($this->assets->hasJavascriptAsset($handle)){ |
|
156 | - return $this->assets->getJavascriptAsset($handle); |
|
157 | - } |
|
158 | - return parent::addJavascript( |
|
159 | - $handle, |
|
160 | - $this->registry->getJsUrl( |
|
161 | - $this->domain->assetNamespace(), |
|
162 | - $handle |
|
163 | - ), |
|
164 | - $this->addDefaultBlockScriptDependencies($dependencies) |
|
165 | - ) |
|
166 | - ->setRequiresTranslation(); |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * @param $handle |
|
172 | - * @param array $dependencies |
|
173 | - * @since $VID:$ |
|
174 | - * @return StylesheetAsset |
|
175 | - * @throws InvalidDataTypeException |
|
176 | - * @throws InvalidEntityException |
|
177 | - * @throws DuplicateCollectionIdentifierException |
|
178 | - */ |
|
179 | - public function addEditorStyle($handle, array $dependencies = array()) |
|
180 | - { |
|
181 | - if ($this->assets->hasStylesheetAsset($handle)) { |
|
182 | - return $this->assets->getStylesheetAsset($handle); |
|
183 | - } |
|
184 | - return parent::addStylesheet( |
|
185 | - $handle, |
|
186 | - $this->registry->getCssUrl( |
|
187 | - $this->domain->assetNamespace(), |
|
188 | - $handle |
|
189 | - ), |
|
190 | - $this->addDefaultBlockStyleDependencies($dependencies) |
|
191 | - ); |
|
192 | - } |
|
193 | - |
|
194 | - |
|
195 | - /** |
|
196 | - * @param $handle |
|
197 | - * @param array $dependencies |
|
198 | - * @since $VID:$ |
|
199 | - * @return JavascriptAsset |
|
200 | - * @throws InvalidDataTypeException |
|
201 | - * @throws InvalidEntityException |
|
202 | - * @throws DuplicateCollectionIdentifierException |
|
203 | - */ |
|
204 | - public function addScript($handle, array $dependencies = array()) |
|
205 | - { |
|
206 | - if ($this->assets->hasJavascriptAsset($handle)) { |
|
207 | - return $this->assets->getJavascriptAsset($handle); |
|
208 | - } |
|
209 | - return parent::addJavascript( |
|
210 | - $handle, |
|
211 | - $this->registry->getJsUrl( |
|
212 | - $this->domain->assetNamespace(), |
|
213 | - $handle |
|
214 | - ), |
|
215 | - $dependencies + array( CoreAssetManager::JS_HANDLE_EE_COMPONENTS ) |
|
216 | - ) |
|
217 | - ->setRequiresTranslation(); |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - /** |
|
222 | - * @param $handle |
|
223 | - * @param array $dependencies |
|
224 | - * @since $VID:$ |
|
225 | - * @return StylesheetAsset |
|
226 | - * @throws InvalidDataTypeException |
|
227 | - * @throws InvalidEntityException |
|
228 | - * @throws DuplicateCollectionIdentifierException |
|
229 | - */ |
|
230 | - public function addStyle($handle, array $dependencies = array()) |
|
231 | - { |
|
232 | - if ($this->assets->hasStylesheetAsset($handle)) { |
|
233 | - return $this->assets->getStylesheetAsset($handle); |
|
234 | - } |
|
235 | - return parent::addStylesheet( |
|
236 | - $handle, |
|
237 | - $this->registry->getCssUrl( |
|
238 | - $this->domain->assetNamespace(), |
|
239 | - $handle |
|
240 | - ), |
|
241 | - $dependencies + array( CoreAssetManager::CSS_HANDLE_EE_COMPONENTS ) |
|
242 | - ); |
|
243 | - } |
|
244 | - |
|
245 | - |
|
246 | - /** |
|
247 | - * @param array $dependencies |
|
248 | - * @return array |
|
249 | - */ |
|
250 | - protected function addDefaultBlockScriptDependencies(array $dependencies) |
|
251 | - { |
|
252 | - $dependencies += array( |
|
253 | - 'wp-blocks', // Provides useful functions and components for extending the editor |
|
254 | - 'wp-i18n', // Provides localization functions |
|
255 | - 'wp-element', // Provides React.Component |
|
256 | - 'wp-components', // Provides many prebuilt components and controls |
|
257 | - $this->getScriptHandle(), |
|
258 | - ); |
|
259 | - return $dependencies; |
|
260 | - } |
|
261 | - |
|
262 | - |
|
263 | - /** |
|
264 | - * @param array $dependencies |
|
265 | - * @return array |
|
266 | - */ |
|
267 | - protected function addDefaultBlockStyleDependencies(array $dependencies) |
|
268 | - { |
|
269 | - $dependencies += array( |
|
270 | - $this->getStyleHandle() |
|
271 | - ); |
|
272 | - return $dependencies; |
|
273 | - } |
|
274 | - |
|
275 | - |
|
276 | - /** |
|
277 | - * @return JavascriptAsset|null |
|
278 | - */ |
|
279 | - public function getEditorScript() |
|
280 | - { |
|
281 | - return $this->assets->getJavascriptAsset($this->editor_script_handle); |
|
282 | - } |
|
283 | - |
|
284 | - |
|
285 | - /** |
|
286 | - * @return StylesheetAsset|null |
|
287 | - */ |
|
288 | - public function getEditorStyle() |
|
289 | - { |
|
290 | - return $this->assets->getStylesheetAsset($this->editor_style_handle); |
|
291 | - } |
|
292 | - |
|
293 | - |
|
294 | - /** |
|
295 | - * @return JavascriptAsset|null |
|
296 | - */ |
|
297 | - public function getScript() |
|
298 | - { |
|
299 | - return $this->assets->getJavascriptAsset($this->script_handle); |
|
300 | - } |
|
301 | - |
|
302 | - |
|
303 | - /** |
|
304 | - * @return StylesheetAsset|null |
|
305 | - */ |
|
306 | - public function getStyle() |
|
307 | - { |
|
308 | - return $this->assets->getStylesheetAsset($this->style_handle); |
|
309 | - } |
|
310 | - |
|
311 | - |
|
312 | - /** |
|
313 | - * @return void |
|
314 | - */ |
|
315 | - public function enqueueAssets() |
|
316 | - { |
|
317 | - $assets = array( |
|
318 | - $this->getEditorScript(), |
|
319 | - $this->getEditorStyle(), |
|
320 | - $this->getScript(), |
|
321 | - $this->getStyle(), |
|
322 | - ); |
|
323 | - foreach ($assets as $asset) { |
|
324 | - if ($asset instanceof BrowserAsset && $asset->isRegistered()) { |
|
325 | - $asset->enqueueAsset(); |
|
326 | - } |
|
327 | - } |
|
328 | - } |
|
25 | + /** |
|
26 | + * @var string $editor_script_handle |
|
27 | + */ |
|
28 | + private $editor_script_handle; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string $editor_style_handle |
|
32 | + */ |
|
33 | + private $editor_style_handle; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var string $script_handle |
|
37 | + */ |
|
38 | + private $script_handle; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var string $style_handle |
|
42 | + */ |
|
43 | + private $style_handle; |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * @return string |
|
48 | + */ |
|
49 | + public function getEditorScriptHandle() |
|
50 | + { |
|
51 | + return $this->editor_script_handle; |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * @param string $editor_script_handle |
|
57 | + */ |
|
58 | + public function setEditorScriptHandle($editor_script_handle) |
|
59 | + { |
|
60 | + if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
61 | + $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle; |
|
62 | + } |
|
63 | + $this->editor_script_handle = $editor_script_handle; |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * @return string |
|
69 | + */ |
|
70 | + public function getEditorStyleHandle() |
|
71 | + { |
|
72 | + return $this->editor_style_handle; |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * @param string $editor_style_handle |
|
78 | + */ |
|
79 | + public function setEditorStyleHandle($editor_style_handle) |
|
80 | + { |
|
81 | + if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
82 | + $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle; |
|
83 | + } |
|
84 | + $this->editor_style_handle = $editor_style_handle; |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * @return string |
|
90 | + */ |
|
91 | + public function getScriptHandle() |
|
92 | + { |
|
93 | + return $this->script_handle; |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param string $script_handle |
|
99 | + */ |
|
100 | + public function setScriptHandle($script_handle) |
|
101 | + { |
|
102 | + if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
103 | + $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle; |
|
104 | + } |
|
105 | + $this->script_handle = $script_handle; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @return string |
|
111 | + */ |
|
112 | + public function getStyleHandle() |
|
113 | + { |
|
114 | + return $this->style_handle; |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * @param string $style_handle |
|
120 | + */ |
|
121 | + public function setStyleHandle($style_handle) |
|
122 | + { |
|
123 | + if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
124 | + $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle; |
|
125 | + } |
|
126 | + $this->style_handle = $style_handle; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @since $VID:$ |
|
131 | + * @throws InvalidDataTypeException |
|
132 | + * @throws InvalidEntityException |
|
133 | + * @throws DuplicateCollectionIdentifierException |
|
134 | + */ |
|
135 | + public function addAssets() |
|
136 | + { |
|
137 | + $this->addEditorScript($this->getEditorScriptHandle()); |
|
138 | + $this->addEditorStyle($this->getEditorStyleHandle()); |
|
139 | + $this->addScript($this->getScriptHandle()); |
|
140 | + $this->addStyle($this->getStyleHandle()); |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @param $handle |
|
146 | + * @param array $dependencies |
|
147 | + * @since $VID:$ |
|
148 | + * @return JavascriptAsset |
|
149 | + * @throws InvalidDataTypeException |
|
150 | + * @throws InvalidEntityException |
|
151 | + * @throws DuplicateCollectionIdentifierException |
|
152 | + */ |
|
153 | + public function addEditorScript($handle, array $dependencies = array()) |
|
154 | + { |
|
155 | + if($this->assets->hasJavascriptAsset($handle)){ |
|
156 | + return $this->assets->getJavascriptAsset($handle); |
|
157 | + } |
|
158 | + return parent::addJavascript( |
|
159 | + $handle, |
|
160 | + $this->registry->getJsUrl( |
|
161 | + $this->domain->assetNamespace(), |
|
162 | + $handle |
|
163 | + ), |
|
164 | + $this->addDefaultBlockScriptDependencies($dependencies) |
|
165 | + ) |
|
166 | + ->setRequiresTranslation(); |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * @param $handle |
|
172 | + * @param array $dependencies |
|
173 | + * @since $VID:$ |
|
174 | + * @return StylesheetAsset |
|
175 | + * @throws InvalidDataTypeException |
|
176 | + * @throws InvalidEntityException |
|
177 | + * @throws DuplicateCollectionIdentifierException |
|
178 | + */ |
|
179 | + public function addEditorStyle($handle, array $dependencies = array()) |
|
180 | + { |
|
181 | + if ($this->assets->hasStylesheetAsset($handle)) { |
|
182 | + return $this->assets->getStylesheetAsset($handle); |
|
183 | + } |
|
184 | + return parent::addStylesheet( |
|
185 | + $handle, |
|
186 | + $this->registry->getCssUrl( |
|
187 | + $this->domain->assetNamespace(), |
|
188 | + $handle |
|
189 | + ), |
|
190 | + $this->addDefaultBlockStyleDependencies($dependencies) |
|
191 | + ); |
|
192 | + } |
|
193 | + |
|
194 | + |
|
195 | + /** |
|
196 | + * @param $handle |
|
197 | + * @param array $dependencies |
|
198 | + * @since $VID:$ |
|
199 | + * @return JavascriptAsset |
|
200 | + * @throws InvalidDataTypeException |
|
201 | + * @throws InvalidEntityException |
|
202 | + * @throws DuplicateCollectionIdentifierException |
|
203 | + */ |
|
204 | + public function addScript($handle, array $dependencies = array()) |
|
205 | + { |
|
206 | + if ($this->assets->hasJavascriptAsset($handle)) { |
|
207 | + return $this->assets->getJavascriptAsset($handle); |
|
208 | + } |
|
209 | + return parent::addJavascript( |
|
210 | + $handle, |
|
211 | + $this->registry->getJsUrl( |
|
212 | + $this->domain->assetNamespace(), |
|
213 | + $handle |
|
214 | + ), |
|
215 | + $dependencies + array( CoreAssetManager::JS_HANDLE_EE_COMPONENTS ) |
|
216 | + ) |
|
217 | + ->setRequiresTranslation(); |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + /** |
|
222 | + * @param $handle |
|
223 | + * @param array $dependencies |
|
224 | + * @since $VID:$ |
|
225 | + * @return StylesheetAsset |
|
226 | + * @throws InvalidDataTypeException |
|
227 | + * @throws InvalidEntityException |
|
228 | + * @throws DuplicateCollectionIdentifierException |
|
229 | + */ |
|
230 | + public function addStyle($handle, array $dependencies = array()) |
|
231 | + { |
|
232 | + if ($this->assets->hasStylesheetAsset($handle)) { |
|
233 | + return $this->assets->getStylesheetAsset($handle); |
|
234 | + } |
|
235 | + return parent::addStylesheet( |
|
236 | + $handle, |
|
237 | + $this->registry->getCssUrl( |
|
238 | + $this->domain->assetNamespace(), |
|
239 | + $handle |
|
240 | + ), |
|
241 | + $dependencies + array( CoreAssetManager::CSS_HANDLE_EE_COMPONENTS ) |
|
242 | + ); |
|
243 | + } |
|
244 | + |
|
245 | + |
|
246 | + /** |
|
247 | + * @param array $dependencies |
|
248 | + * @return array |
|
249 | + */ |
|
250 | + protected function addDefaultBlockScriptDependencies(array $dependencies) |
|
251 | + { |
|
252 | + $dependencies += array( |
|
253 | + 'wp-blocks', // Provides useful functions and components for extending the editor |
|
254 | + 'wp-i18n', // Provides localization functions |
|
255 | + 'wp-element', // Provides React.Component |
|
256 | + 'wp-components', // Provides many prebuilt components and controls |
|
257 | + $this->getScriptHandle(), |
|
258 | + ); |
|
259 | + return $dependencies; |
|
260 | + } |
|
261 | + |
|
262 | + |
|
263 | + /** |
|
264 | + * @param array $dependencies |
|
265 | + * @return array |
|
266 | + */ |
|
267 | + protected function addDefaultBlockStyleDependencies(array $dependencies) |
|
268 | + { |
|
269 | + $dependencies += array( |
|
270 | + $this->getStyleHandle() |
|
271 | + ); |
|
272 | + return $dependencies; |
|
273 | + } |
|
274 | + |
|
275 | + |
|
276 | + /** |
|
277 | + * @return JavascriptAsset|null |
|
278 | + */ |
|
279 | + public function getEditorScript() |
|
280 | + { |
|
281 | + return $this->assets->getJavascriptAsset($this->editor_script_handle); |
|
282 | + } |
|
283 | + |
|
284 | + |
|
285 | + /** |
|
286 | + * @return StylesheetAsset|null |
|
287 | + */ |
|
288 | + public function getEditorStyle() |
|
289 | + { |
|
290 | + return $this->assets->getStylesheetAsset($this->editor_style_handle); |
|
291 | + } |
|
292 | + |
|
293 | + |
|
294 | + /** |
|
295 | + * @return JavascriptAsset|null |
|
296 | + */ |
|
297 | + public function getScript() |
|
298 | + { |
|
299 | + return $this->assets->getJavascriptAsset($this->script_handle); |
|
300 | + } |
|
301 | + |
|
302 | + |
|
303 | + /** |
|
304 | + * @return StylesheetAsset|null |
|
305 | + */ |
|
306 | + public function getStyle() |
|
307 | + { |
|
308 | + return $this->assets->getStylesheetAsset($this->style_handle); |
|
309 | + } |
|
310 | + |
|
311 | + |
|
312 | + /** |
|
313 | + * @return void |
|
314 | + */ |
|
315 | + public function enqueueAssets() |
|
316 | + { |
|
317 | + $assets = array( |
|
318 | + $this->getEditorScript(), |
|
319 | + $this->getEditorStyle(), |
|
320 | + $this->getScript(), |
|
321 | + $this->getStyle(), |
|
322 | + ); |
|
323 | + foreach ($assets as $asset) { |
|
324 | + if ($asset instanceof BrowserAsset && $asset->isRegistered()) { |
|
325 | + $asset->enqueueAsset(); |
|
326 | + } |
|
327 | + } |
|
328 | + } |
|
329 | 329 | |
330 | 330 | } |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function setEditorScriptHandle($editor_script_handle) |
59 | 59 | { |
60 | - if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
61 | - $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle; |
|
60 | + if (strpos($editor_script_handle, BlockInterface::NAME_SPACE.'-') !== 0) { |
|
61 | + $editor_script_handle = BlockInterface::NAME_SPACE.'-'.$editor_script_handle; |
|
62 | 62 | } |
63 | 63 | $this->editor_script_handle = $editor_script_handle; |
64 | 64 | } |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function setEditorStyleHandle($editor_style_handle) |
80 | 80 | { |
81 | - if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
82 | - $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle; |
|
81 | + if (strpos($editor_style_handle, BlockInterface::NAME_SPACE.'-') !== 0) { |
|
82 | + $editor_style_handle = BlockInterface::NAME_SPACE.'-'.$editor_style_handle; |
|
83 | 83 | } |
84 | 84 | $this->editor_style_handle = $editor_style_handle; |
85 | 85 | } |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function setScriptHandle($script_handle) |
101 | 101 | { |
102 | - if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
103 | - $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle; |
|
102 | + if (strpos($script_handle, BlockInterface::NAME_SPACE.'-') !== 0) { |
|
103 | + $script_handle = BlockInterface::NAME_SPACE.'-'.$script_handle; |
|
104 | 104 | } |
105 | 105 | $this->script_handle = $script_handle; |
106 | 106 | } |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function setStyleHandle($style_handle) |
122 | 122 | { |
123 | - if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) { |
|
124 | - $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle; |
|
123 | + if (strpos($style_handle, BlockInterface::NAME_SPACE.'-') !== 0) { |
|
124 | + $style_handle = BlockInterface::NAME_SPACE.'-'.$style_handle; |
|
125 | 125 | } |
126 | 126 | $this->style_handle = $style_handle; |
127 | 127 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function addEditorScript($handle, array $dependencies = array()) |
154 | 154 | { |
155 | - if($this->assets->hasJavascriptAsset($handle)){ |
|
155 | + if ($this->assets->hasJavascriptAsset($handle)) { |
|
156 | 156 | return $this->assets->getJavascriptAsset($handle); |
157 | 157 | } |
158 | 158 | return parent::addJavascript( |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $this->domain->assetNamespace(), |
213 | 213 | $handle |
214 | 214 | ), |
215 | - $dependencies + array( CoreAssetManager::JS_HANDLE_EE_COMPONENTS ) |
|
215 | + $dependencies + array(CoreAssetManager::JS_HANDLE_EE_COMPONENTS) |
|
216 | 216 | ) |
217 | 217 | ->setRequiresTranslation(); |
218 | 218 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $this->domain->assetNamespace(), |
239 | 239 | $handle |
240 | 240 | ), |
241 | - $dependencies + array( CoreAssetManager::CSS_HANDLE_EE_COMPONENTS ) |
|
241 | + $dependencies + array(CoreAssetManager::CSS_HANDLE_EE_COMPONENTS) |
|
242 | 242 | ); |
243 | 243 | } |
244 | 244 | |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | protected function addDefaultBlockScriptDependencies(array $dependencies) |
251 | 251 | { |
252 | 252 | $dependencies += array( |
253 | - 'wp-blocks', // Provides useful functions and components for extending the editor |
|
254 | - 'wp-i18n', // Provides localization functions |
|
255 | - 'wp-element', // Provides React.Component |
|
253 | + 'wp-blocks', // Provides useful functions and components for extending the editor |
|
254 | + 'wp-i18n', // Provides localization functions |
|
255 | + 'wp-element', // Provides React.Component |
|
256 | 256 | 'wp-components', // Provides many prebuilt components and controls |
257 | 257 | $this->getScriptHandle(), |
258 | 258 | ); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | EventAttendeesBlockRenderer $renderer |
43 | 43 | ) { |
44 | 44 | parent::__construct($block_asset_manager, $request); |
45 | - $this->renderer= $renderer; |
|
45 | + $this->renderer = $renderer; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -154,19 +154,19 @@ discard block |
||
154 | 154 | $sanitized_attributes = array(); |
155 | 155 | foreach ($attributes as $attribute => $value) { |
156 | 156 | $convert = $this->getAttributesMap(); |
157 | - if (isset($convert[ $attribute ])) { |
|
158 | - $sanitize = $convert[ $attribute ]; |
|
157 | + if (isset($convert[$attribute])) { |
|
158 | + $sanitize = $convert[$attribute]; |
|
159 | 159 | if ($sanitize === 'bool') { |
160 | - $sanitized_attributes[ $attribute ] = filter_var( |
|
160 | + $sanitized_attributes[$attribute] = filter_var( |
|
161 | 161 | $value, |
162 | 162 | FILTER_VALIDATE_BOOLEAN |
163 | 163 | ); |
164 | 164 | } else { |
165 | - $sanitized_attributes[ $attribute ] = $sanitize($value); |
|
165 | + $sanitized_attributes[$attribute] = $sanitize($value); |
|
166 | 166 | } |
167 | 167 | // don't pass along attributes with a 0 value |
168 | - if ($sanitized_attributes[ $attribute ] === 0) { |
|
169 | - unset($sanitized_attributes[ $attribute ]); |
|
168 | + if ($sanitized_attributes[$attribute] === 0) { |
|
169 | + unset($sanitized_attributes[$attribute]); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | } |
@@ -21,172 +21,172 @@ |
||
21 | 21 | class EventAttendees extends Block |
22 | 22 | { |
23 | 23 | |
24 | - const BLOCK_TYPE = 'event-attendees'; |
|
24 | + const BLOCK_TYPE = 'event-attendees'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var EventAttendeesBlockRenderer $renderer |
|
28 | - */ |
|
29 | - protected $renderer; |
|
26 | + /** |
|
27 | + * @var EventAttendeesBlockRenderer $renderer |
|
28 | + */ |
|
29 | + protected $renderer; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * EventAttendees constructor. |
|
34 | - * |
|
35 | - * @param CoreBlocksAssetManager $block_asset_manager |
|
36 | - * @param RequestInterface $request |
|
37 | - * @param EventAttendeesBlockRenderer $renderer |
|
38 | - */ |
|
39 | - public function __construct( |
|
40 | - CoreBlocksAssetManager $block_asset_manager, |
|
41 | - RequestInterface $request, |
|
42 | - EventAttendeesBlockRenderer $renderer |
|
43 | - ) { |
|
44 | - parent::__construct($block_asset_manager, $request); |
|
45 | - $this->renderer= $renderer; |
|
46 | - } |
|
32 | + /** |
|
33 | + * EventAttendees constructor. |
|
34 | + * |
|
35 | + * @param CoreBlocksAssetManager $block_asset_manager |
|
36 | + * @param RequestInterface $request |
|
37 | + * @param EventAttendeesBlockRenderer $renderer |
|
38 | + */ |
|
39 | + public function __construct( |
|
40 | + CoreBlocksAssetManager $block_asset_manager, |
|
41 | + RequestInterface $request, |
|
42 | + EventAttendeesBlockRenderer $renderer |
|
43 | + ) { |
|
44 | + parent::__construct($block_asset_manager, $request); |
|
45 | + $this->renderer= $renderer; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * Perform any early setup required by the block |
|
51 | - * including setting the block type and supported post types |
|
52 | - * |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - public function initialize() |
|
56 | - { |
|
57 | - $this->setBlockType(self::BLOCK_TYPE); |
|
58 | - $this->setSupportedRoutes( |
|
59 | - array( |
|
60 | - 'EventEspresso\core\domain\entities\route_match\specifications\admin\EspressoStandardPostTypeEditor', |
|
61 | - 'EventEspresso\core\domain\entities\route_match\specifications\admin\WordPressPostTypeEditor', |
|
62 | - 'EventEspresso\core\domain\entities\route_match\specifications\frontend\EspressoBlockRenderer', |
|
63 | - 'EventEspresso\core\domain\entities\route_match\specifications\frontend\AnyFrontendRequest' |
|
64 | - ) |
|
65 | - ); |
|
66 | - $EVT_ID = $this->request->getRequestParam('page') === 'espresso_events' |
|
67 | - ? $this->request->getRequestParam('post', 0) |
|
68 | - : 0; |
|
69 | - $this->setAttributes( |
|
70 | - array( |
|
71 | - 'eventId' => array( |
|
72 | - 'type' => 'number', |
|
73 | - 'default' => $EVT_ID, |
|
74 | - ), |
|
75 | - 'datetimeId' => array( |
|
76 | - 'type' => 'number', |
|
77 | - 'default' => 0, |
|
78 | - ), |
|
79 | - 'ticketId' => array( |
|
80 | - 'type' => 'number', |
|
81 | - 'default' => 0, |
|
82 | - ), |
|
83 | - 'status' => array( |
|
84 | - 'type' => 'string', |
|
85 | - 'default' => EEM_Registration::status_id_approved, |
|
86 | - ), |
|
87 | - 'limit' => array( |
|
88 | - 'type' => 'number', |
|
89 | - 'default' => 10, |
|
90 | - ), |
|
91 | - 'order' => array( |
|
92 | - 'type' => 'string', |
|
93 | - 'default' => 'ASC' |
|
94 | - ), |
|
95 | - 'orderBy' => array( |
|
96 | - 'type' => 'string', |
|
97 | - 'default' => 'lastThenFirstName', |
|
98 | - ), |
|
99 | - 'showGravatar' => array( |
|
100 | - 'type' => 'boolean', |
|
101 | - 'default' => false, |
|
102 | - ), |
|
103 | - 'avatarClass' => array( |
|
104 | - 'type' => 'string', |
|
105 | - 'default' => 'contact', |
|
106 | - ), |
|
107 | - 'avatarSize' => array( |
|
108 | - 'type' => 'number', |
|
109 | - 'default' => 24, |
|
110 | - ), |
|
111 | - 'displayOnArchives' => array( |
|
112 | - 'type' => 'boolean', |
|
113 | - 'default' => false, |
|
114 | - ), |
|
115 | - ) |
|
116 | - ); |
|
117 | - $this->setDynamic(); |
|
118 | - } |
|
49 | + /** |
|
50 | + * Perform any early setup required by the block |
|
51 | + * including setting the block type and supported post types |
|
52 | + * |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + public function initialize() |
|
56 | + { |
|
57 | + $this->setBlockType(self::BLOCK_TYPE); |
|
58 | + $this->setSupportedRoutes( |
|
59 | + array( |
|
60 | + 'EventEspresso\core\domain\entities\route_match\specifications\admin\EspressoStandardPostTypeEditor', |
|
61 | + 'EventEspresso\core\domain\entities\route_match\specifications\admin\WordPressPostTypeEditor', |
|
62 | + 'EventEspresso\core\domain\entities\route_match\specifications\frontend\EspressoBlockRenderer', |
|
63 | + 'EventEspresso\core\domain\entities\route_match\specifications\frontend\AnyFrontendRequest' |
|
64 | + ) |
|
65 | + ); |
|
66 | + $EVT_ID = $this->request->getRequestParam('page') === 'espresso_events' |
|
67 | + ? $this->request->getRequestParam('post', 0) |
|
68 | + : 0; |
|
69 | + $this->setAttributes( |
|
70 | + array( |
|
71 | + 'eventId' => array( |
|
72 | + 'type' => 'number', |
|
73 | + 'default' => $EVT_ID, |
|
74 | + ), |
|
75 | + 'datetimeId' => array( |
|
76 | + 'type' => 'number', |
|
77 | + 'default' => 0, |
|
78 | + ), |
|
79 | + 'ticketId' => array( |
|
80 | + 'type' => 'number', |
|
81 | + 'default' => 0, |
|
82 | + ), |
|
83 | + 'status' => array( |
|
84 | + 'type' => 'string', |
|
85 | + 'default' => EEM_Registration::status_id_approved, |
|
86 | + ), |
|
87 | + 'limit' => array( |
|
88 | + 'type' => 'number', |
|
89 | + 'default' => 10, |
|
90 | + ), |
|
91 | + 'order' => array( |
|
92 | + 'type' => 'string', |
|
93 | + 'default' => 'ASC' |
|
94 | + ), |
|
95 | + 'orderBy' => array( |
|
96 | + 'type' => 'string', |
|
97 | + 'default' => 'lastThenFirstName', |
|
98 | + ), |
|
99 | + 'showGravatar' => array( |
|
100 | + 'type' => 'boolean', |
|
101 | + 'default' => false, |
|
102 | + ), |
|
103 | + 'avatarClass' => array( |
|
104 | + 'type' => 'string', |
|
105 | + 'default' => 'contact', |
|
106 | + ), |
|
107 | + 'avatarSize' => array( |
|
108 | + 'type' => 'number', |
|
109 | + 'default' => 24, |
|
110 | + ), |
|
111 | + 'displayOnArchives' => array( |
|
112 | + 'type' => 'boolean', |
|
113 | + 'default' => false, |
|
114 | + ), |
|
115 | + ) |
|
116 | + ); |
|
117 | + $this->setDynamic(); |
|
118 | + } |
|
119 | 119 | |
120 | 120 | |
121 | - /** |
|
122 | - * Returns an array where the key corresponds to the incoming attribute name from the WP block |
|
123 | - * and the value corresponds to the attribute name for the existing EspressoEventAttendees shortcode |
|
124 | - * |
|
125 | - * @since $VID:$ |
|
126 | - * @return array |
|
127 | - */ |
|
128 | - private function getAttributesMap() |
|
129 | - { |
|
130 | - return array( |
|
131 | - 'eventId' => 'absint', |
|
132 | - 'datetimeId' => 'absint', |
|
133 | - 'ticketId' => 'absint', |
|
134 | - 'status' => 'sanitize_text_field', |
|
135 | - 'limit' => 'intval', |
|
136 | - 'showGravatar' => 'bool', |
|
137 | - 'avatarClass' => 'sanitize_text_field', |
|
138 | - 'avatarSize' => 'absint', |
|
139 | - 'displayOnArchives' => 'bool', |
|
140 | - 'order' => 'sanitize_text_field', |
|
141 | - 'orderBy' => 'sanitize_text_field', |
|
142 | - ); |
|
143 | - } |
|
121 | + /** |
|
122 | + * Returns an array where the key corresponds to the incoming attribute name from the WP block |
|
123 | + * and the value corresponds to the attribute name for the existing EspressoEventAttendees shortcode |
|
124 | + * |
|
125 | + * @since $VID:$ |
|
126 | + * @return array |
|
127 | + */ |
|
128 | + private function getAttributesMap() |
|
129 | + { |
|
130 | + return array( |
|
131 | + 'eventId' => 'absint', |
|
132 | + 'datetimeId' => 'absint', |
|
133 | + 'ticketId' => 'absint', |
|
134 | + 'status' => 'sanitize_text_field', |
|
135 | + 'limit' => 'intval', |
|
136 | + 'showGravatar' => 'bool', |
|
137 | + 'avatarClass' => 'sanitize_text_field', |
|
138 | + 'avatarSize' => 'absint', |
|
139 | + 'displayOnArchives' => 'bool', |
|
140 | + 'order' => 'sanitize_text_field', |
|
141 | + 'orderBy' => 'sanitize_text_field', |
|
142 | + ); |
|
143 | + } |
|
144 | 144 | |
145 | 145 | |
146 | - /** |
|
147 | - * Sanitizes attributes. |
|
148 | - * |
|
149 | - * @param array $attributes |
|
150 | - * @return array |
|
151 | - */ |
|
152 | - private function sanitizeAttributes(array $attributes) |
|
153 | - { |
|
154 | - $sanitized_attributes = array(); |
|
155 | - foreach ($attributes as $attribute => $value) { |
|
156 | - $convert = $this->getAttributesMap(); |
|
157 | - if (isset($convert[ $attribute ])) { |
|
158 | - $sanitize = $convert[ $attribute ]; |
|
159 | - if ($sanitize === 'bool') { |
|
160 | - $sanitized_attributes[ $attribute ] = filter_var( |
|
161 | - $value, |
|
162 | - FILTER_VALIDATE_BOOLEAN |
|
163 | - ); |
|
164 | - } else { |
|
165 | - $sanitized_attributes[ $attribute ] = $sanitize($value); |
|
166 | - } |
|
167 | - // don't pass along attributes with a 0 value |
|
168 | - if ($sanitized_attributes[ $attribute ] === 0) { |
|
169 | - unset($sanitized_attributes[ $attribute ]); |
|
170 | - } |
|
171 | - } |
|
172 | - } |
|
173 | - return $attributes; |
|
174 | - } |
|
146 | + /** |
|
147 | + * Sanitizes attributes. |
|
148 | + * |
|
149 | + * @param array $attributes |
|
150 | + * @return array |
|
151 | + */ |
|
152 | + private function sanitizeAttributes(array $attributes) |
|
153 | + { |
|
154 | + $sanitized_attributes = array(); |
|
155 | + foreach ($attributes as $attribute => $value) { |
|
156 | + $convert = $this->getAttributesMap(); |
|
157 | + if (isset($convert[ $attribute ])) { |
|
158 | + $sanitize = $convert[ $attribute ]; |
|
159 | + if ($sanitize === 'bool') { |
|
160 | + $sanitized_attributes[ $attribute ] = filter_var( |
|
161 | + $value, |
|
162 | + FILTER_VALIDATE_BOOLEAN |
|
163 | + ); |
|
164 | + } else { |
|
165 | + $sanitized_attributes[ $attribute ] = $sanitize($value); |
|
166 | + } |
|
167 | + // don't pass along attributes with a 0 value |
|
168 | + if ($sanitized_attributes[ $attribute ] === 0) { |
|
169 | + unset($sanitized_attributes[ $attribute ]); |
|
170 | + } |
|
171 | + } |
|
172 | + } |
|
173 | + return $attributes; |
|
174 | + } |
|
175 | 175 | |
176 | 176 | |
177 | - /** |
|
178 | - * Returns the rendered HTML for the block |
|
179 | - * |
|
180 | - * @param array $attributes |
|
181 | - * @return string |
|
182 | - * @throws DomainException |
|
183 | - * @throws EE_Error |
|
184 | - */ |
|
185 | - public function renderBlock(array $attributes = array()) |
|
186 | - { |
|
187 | - $attributes = $this->sanitizeAttributes($attributes); |
|
188 | - return (is_archive() || is_front_page() || is_home()) && ! $attributes['displayOnArchives'] |
|
189 | - ? '' |
|
190 | - : $this->renderer->render($attributes); |
|
191 | - } |
|
177 | + /** |
|
178 | + * Returns the rendered HTML for the block |
|
179 | + * |
|
180 | + * @param array $attributes |
|
181 | + * @return string |
|
182 | + * @throws DomainException |
|
183 | + * @throws EE_Error |
|
184 | + */ |
|
185 | + public function renderBlock(array $attributes = array()) |
|
186 | + { |
|
187 | + $attributes = $this->sanitizeAttributes($attributes); |
|
188 | + return (is_archive() || is_front_page() || is_home()) && ! $attributes['displayOnArchives'] |
|
189 | + ? '' |
|
190 | + : $this->renderer->render($attributes); |
|
191 | + } |
|
192 | 192 | } |
@@ -20,104 +20,104 @@ |
||
20 | 20 | class EventAttendeesBlockRenderer extends BlockRenderer |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var EEM_Attendee |
|
25 | - */ |
|
26 | - private $attendee_model; |
|
23 | + /** |
|
24 | + * @var EEM_Attendee |
|
25 | + */ |
|
26 | + private $attendee_model; |
|
27 | 27 | |
28 | - public function __construct(DomainInterface $domain, EEM_Attendee $attendee_model) |
|
29 | - { |
|
30 | - $this->attendee_model = $attendee_model; |
|
31 | - parent::__construct($domain); |
|
32 | - } |
|
28 | + public function __construct(DomainInterface $domain, EEM_Attendee $attendee_model) |
|
29 | + { |
|
30 | + $this->attendee_model = $attendee_model; |
|
31 | + parent::__construct($domain); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Renders the block. |
|
37 | - * |
|
38 | - * @param array $attributes Expect already validated and sanitized array of attributes for use in generating the |
|
39 | - * query and the template output. |
|
40 | - * @return string |
|
41 | - * @throws DomainException |
|
42 | - * @throws EE_Error |
|
43 | - */ |
|
44 | - public function render(array $attributes) |
|
45 | - { |
|
46 | - $template_args['attributes'] = $attributes; |
|
47 | - $template_args['attendees'] = $this->attendee_model->get_all($this->getQueryParams($attributes)); |
|
48 | - return EEH_Template::display_template( |
|
49 | - $this->templateRootPath() . 'event-attendees.php', |
|
50 | - $template_args, |
|
51 | - true |
|
52 | - ); |
|
53 | - } |
|
35 | + /** |
|
36 | + * Renders the block. |
|
37 | + * |
|
38 | + * @param array $attributes Expect already validated and sanitized array of attributes for use in generating the |
|
39 | + * query and the template output. |
|
40 | + * @return string |
|
41 | + * @throws DomainException |
|
42 | + * @throws EE_Error |
|
43 | + */ |
|
44 | + public function render(array $attributes) |
|
45 | + { |
|
46 | + $template_args['attributes'] = $attributes; |
|
47 | + $template_args['attendees'] = $this->attendee_model->get_all($this->getQueryParams($attributes)); |
|
48 | + return EEH_Template::display_template( |
|
49 | + $this->templateRootPath() . 'event-attendees.php', |
|
50 | + $template_args, |
|
51 | + true |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Get query parameters for model query. |
|
58 | - * |
|
59 | - * @param array $attributes |
|
60 | - * @return array |
|
61 | - */ |
|
62 | - private function getQueryParams(array $attributes) |
|
63 | - { |
|
64 | - return array( |
|
65 | - 0 => $this->getWhereQueryPart($attributes), |
|
66 | - 'default_where_conditions' => 'this_model_only', |
|
67 | - 'limit' => $attributes['limit'], |
|
68 | - 'group_by' => array('ATT_ID'), |
|
69 | - 'order_by' => $this->getOrderByQueryPart($attributes) |
|
70 | - ); |
|
71 | - } |
|
56 | + /** |
|
57 | + * Get query parameters for model query. |
|
58 | + * |
|
59 | + * @param array $attributes |
|
60 | + * @return array |
|
61 | + */ |
|
62 | + private function getQueryParams(array $attributes) |
|
63 | + { |
|
64 | + return array( |
|
65 | + 0 => $this->getWhereQueryPart($attributes), |
|
66 | + 'default_where_conditions' => 'this_model_only', |
|
67 | + 'limit' => $attributes['limit'], |
|
68 | + 'group_by' => array('ATT_ID'), |
|
69 | + 'order_by' => $this->getOrderByQueryPart($attributes) |
|
70 | + ); |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | - /** |
|
75 | - * Get where query part for query parameters for model query. |
|
76 | - * |
|
77 | - * @param array $attributes |
|
78 | - * @return array |
|
79 | - */ |
|
80 | - private function getWhereQueryPart(array $attributes) |
|
81 | - { |
|
82 | - $where = array(); |
|
83 | - if ($attributes['ticketId'] > 0) { |
|
84 | - $where['Registration.TKT_ID'] = $attributes['ticketId']; |
|
85 | - } elseif ($attributes['datetimeId'] > 0) { |
|
86 | - $where['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetimeId']; |
|
87 | - } else { |
|
88 | - $where['Registration.EVT_ID'] = $attributes['eventId']; |
|
89 | - } |
|
90 | - $where['Registration.STS_ID'] = $attributes['status']; |
|
91 | - return $where; |
|
92 | - } |
|
74 | + /** |
|
75 | + * Get where query part for query parameters for model query. |
|
76 | + * |
|
77 | + * @param array $attributes |
|
78 | + * @return array |
|
79 | + */ |
|
80 | + private function getWhereQueryPart(array $attributes) |
|
81 | + { |
|
82 | + $where = array(); |
|
83 | + if ($attributes['ticketId'] > 0) { |
|
84 | + $where['Registration.TKT_ID'] = $attributes['ticketId']; |
|
85 | + } elseif ($attributes['datetimeId'] > 0) { |
|
86 | + $where['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetimeId']; |
|
87 | + } else { |
|
88 | + $where['Registration.EVT_ID'] = $attributes['eventId']; |
|
89 | + } |
|
90 | + $where['Registration.STS_ID'] = $attributes['status']; |
|
91 | + return $where; |
|
92 | + } |
|
93 | 93 | |
94 | 94 | |
95 | - /** |
|
96 | - * Get order by query part for query parameters for model query. |
|
97 | - * |
|
98 | - * @param array $attributes |
|
99 | - * @return array |
|
100 | - */ |
|
101 | - private function getOrderByQueryPart(array $attributes) |
|
102 | - { |
|
103 | - $order = $attributes['order']; |
|
104 | - switch ($attributes['orderBy']) { |
|
105 | - case 'id': |
|
106 | - $order_by = array('ATT_ID' => $order); |
|
107 | - break; |
|
108 | - case 'lastNameOnly': |
|
109 | - $order_by = array('ATT_lname' => $order); |
|
110 | - break; |
|
111 | - case 'firstNameOnly': |
|
112 | - $order_by = array('ATT_fname' => $order); |
|
113 | - break; |
|
114 | - case 'firstThenLastName': |
|
115 | - $order_by = array('ATT_fname' => $order, 'ATT_lname' => $order); |
|
116 | - break; |
|
117 | - default: |
|
118 | - $order_by = array('ATT_lname' => $order, 'ATT_fname' => $order); |
|
119 | - break; |
|
120 | - } |
|
121 | - return $order_by; |
|
122 | - } |
|
95 | + /** |
|
96 | + * Get order by query part for query parameters for model query. |
|
97 | + * |
|
98 | + * @param array $attributes |
|
99 | + * @return array |
|
100 | + */ |
|
101 | + private function getOrderByQueryPart(array $attributes) |
|
102 | + { |
|
103 | + $order = $attributes['order']; |
|
104 | + switch ($attributes['orderBy']) { |
|
105 | + case 'id': |
|
106 | + $order_by = array('ATT_ID' => $order); |
|
107 | + break; |
|
108 | + case 'lastNameOnly': |
|
109 | + $order_by = array('ATT_lname' => $order); |
|
110 | + break; |
|
111 | + case 'firstNameOnly': |
|
112 | + $order_by = array('ATT_fname' => $order); |
|
113 | + break; |
|
114 | + case 'firstThenLastName': |
|
115 | + $order_by = array('ATT_fname' => $order, 'ATT_lname' => $order); |
|
116 | + break; |
|
117 | + default: |
|
118 | + $order_by = array('ATT_lname' => $order, 'ATT_fname' => $order); |
|
119 | + break; |
|
120 | + } |
|
121 | + return $order_by; |
|
122 | + } |
|
123 | 123 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $template_args['attributes'] = $attributes; |
47 | 47 | $template_args['attendees'] = $this->attendee_model->get_all($this->getQueryParams($attributes)); |
48 | 48 | return EEH_Template::display_template( |
49 | - $this->templateRootPath() . 'event-attendees.php', |
|
49 | + $this->templateRootPath().'event-attendees.php', |
|
50 | 50 | $template_args, |
51 | 51 | true |
52 | 52 | ); |
@@ -14,11 +14,11 @@ |
||
14 | 14 | interface BlockRendererInterface |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * This receives an array of attributes and returns rendered content for the block using those attributes. |
|
19 | - * |
|
20 | - * @param array $attributes |
|
21 | - * @return string Rendered Content |
|
22 | - */ |
|
23 | - public function render(array $attributes); |
|
17 | + /** |
|
18 | + * This receives an array of attributes and returns rendered content for the block using those attributes. |
|
19 | + * |
|
20 | + * @param array $attributes |
|
21 | + * @return string Rendered Content |
|
22 | + */ |
|
23 | + public function render(array $attributes); |
|
24 | 24 | } |
@@ -15,15 +15,15 @@ |
||
15 | 15 | */ |
16 | 16 | class WordPressPostTypeEditor extends RouteMatchSpecification |
17 | 17 | { |
18 | - /** |
|
19 | - * returns true if current request matches specification |
|
20 | - * |
|
21 | - * @since $VID:$ |
|
22 | - * @return boolean |
|
23 | - */ |
|
24 | - public function isMatchingRoute() |
|
25 | - { |
|
26 | - return strpos($this->request->requestUri(), 'wp-admin/post.php') !== false |
|
27 | - || strpos($this->request->requestUri(), 'wp-admin/post-new.php') !== false; |
|
28 | - } |
|
18 | + /** |
|
19 | + * returns true if current request matches specification |
|
20 | + * |
|
21 | + * @since $VID:$ |
|
22 | + * @return boolean |
|
23 | + */ |
|
24 | + public function isMatchingRoute() |
|
25 | + { |
|
26 | + return strpos($this->request->requestUri(), 'wp-admin/post.php') !== false |
|
27 | + || strpos($this->request->requestUri(), 'wp-admin/post-new.php') !== false; |
|
28 | + } |
|
29 | 29 | } |
@@ -15,349 +15,349 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * The following are the properties that this messenger requires for generating pdf |
|
20 | - */ |
|
21 | - |
|
22 | - /** |
|
23 | - * This is the pdf body generated by the template via the message type. |
|
24 | - * |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - protected $_content; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * This is for the page title that gets displayed. This will end up being the filename for the generated pdf. |
|
32 | - * |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - protected $_subject; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * @return EE_Pdf_messenger |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - // set properties |
|
44 | - $this->name = 'pdf'; |
|
45 | - $this->description = __('This messenger is used for generating a pdf version of the message.', 'event_espresso'); |
|
46 | - $this->label = array( |
|
47 | - 'singular' => __('PDF', 'event_espresso'), |
|
48 | - 'plural' => __('PDFs', 'event_espresso') |
|
49 | - ); |
|
50 | - $this->activate_on_install = true; |
|
51 | - |
|
52 | - parent::__construct(); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * PDF Messenger desires execution immediately. |
|
58 | - * @see parent::send_now() for documentation. |
|
59 | - * @since 4.9.0 |
|
60 | - * @return bool |
|
61 | - */ |
|
62 | - public function send_now() |
|
63 | - { |
|
64 | - return true; |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * HTML Messenger allows an empty to field. |
|
70 | - * @see parent::allow_empty_to_field() for documentation |
|
71 | - * @since 4.9.0 |
|
72 | - * @return bool |
|
73 | - */ |
|
74 | - public function allow_empty_to_field() |
|
75 | - { |
|
76 | - return true; |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * @see abstract declaration in EE_messenger for details. |
|
82 | - */ |
|
83 | - protected function _set_admin_pages() |
|
84 | - { |
|
85 | - $this->admin_registered_pages = array('events_edit' => false); |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @see abstract declaration in EE_messenger for details. |
|
91 | - */ |
|
92 | - protected function _set_valid_shortcodes() |
|
93 | - { |
|
94 | - $this->_valid_shortcodes = array(); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * @see abstract declaration in EE_messenger for details. |
|
100 | - */ |
|
101 | - protected function _set_validator_config() |
|
102 | - { |
|
103 | - $this->_validator_config = array( |
|
104 | - 'subject' => array( |
|
105 | - 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
106 | - ), |
|
107 | - 'content' => array( |
|
108 | - 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
109 | - ), |
|
110 | - 'attendee_list' => array( |
|
111 | - 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
|
112 | - 'required' => array('[ATTENDEE_LIST]') |
|
113 | - ), |
|
114 | - 'event_list' => array( |
|
115 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'venue', 'datetime_list', 'attendee', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list'), |
|
116 | - 'required' => array('[EVENT_LIST]') |
|
117 | - ), |
|
118 | - 'ticket_list' => array( |
|
119 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'), |
|
120 | - 'required' => array('[TICKET_LIST]') |
|
121 | - ), |
|
122 | - 'datetime_list' => array( |
|
123 | - 'shortcodes' => array('datetime'), |
|
124 | - 'required' => array('[DATETIME_LIST]') |
|
125 | - ), |
|
126 | - ); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * Takes care of enqueuing any necessary scripts or styles for the page. A do_action() so message types using this messenger can add their own js. |
|
132 | - * |
|
133 | - * @return void. |
|
134 | - */ |
|
135 | - public function enqueue_scripts_styles() |
|
136 | - { |
|
137 | - parent::enqueue_scripts_styles(); |
|
138 | - do_action('AHEE__EE_Pdf_messenger__enqueue_scripts_styles'); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * _set_template_fields |
|
144 | - * This sets up the fields that a messenger requires for the message to go out. |
|
145 | - * |
|
146 | - * @access protected |
|
147 | - * @return void |
|
148 | - */ |
|
149 | - protected function _set_template_fields() |
|
150 | - { |
|
151 | - // any extra template fields that are NOT used by the messenger but will get used by a messenger field for shortcode replacement get added to the 'extra' key in an associated array indexed by the messenger field they relate to. This is important for the Messages_admin to know what fields to display to the user. Also, notice that the "values" are equal to the field type that messages admin will use to know what kind of field to display. The values ALSO have one index labeled "shortcode". the values in that array indicate which ACTUAL SHORTCODE (i.e. [SHORTCODE]) is required in order for this extra field to be displayed. If the required shortcode isn't part of the shortcodes array then the field is not needed and will not be displayed/parsed. |
|
152 | - $this->_template_fields = array( |
|
153 | - 'subject' => array( |
|
154 | - 'input' => 'text', |
|
155 | - 'label' => __('Page Title', 'event_espresso'), |
|
156 | - 'type' => 'string', |
|
157 | - 'required' => true, |
|
158 | - 'validation' => true, |
|
159 | - 'css_class' => 'large-text', |
|
160 | - 'format' => '%s' |
|
161 | - ), |
|
162 | - 'content' => '', // left empty b/c it is in the "extra array" but messenger still needs needs to know this is a field. |
|
163 | - 'extra' => array( |
|
164 | - 'content' => array( |
|
165 | - 'main' => array( |
|
166 | - 'input' => 'wp_editor', |
|
167 | - 'label' => __('Main Content', 'event_espresso'), |
|
168 | - 'type' => 'string', |
|
169 | - 'required' => true, |
|
170 | - 'validation' => true, |
|
171 | - 'format' => '%s', |
|
172 | - 'rows' => '15' |
|
173 | - ), |
|
174 | - 'event_list' => array( |
|
175 | - 'input' => 'wp_editor', |
|
176 | - 'label' => '[EVENT_LIST]', |
|
177 | - 'type' => 'string', |
|
178 | - 'required' => true, |
|
179 | - 'validation' => true, |
|
180 | - 'format' => '%s', |
|
181 | - 'rows' => '15', |
|
182 | - 'shortcodes_required' => array('[EVENT_LIST]') |
|
183 | - ), |
|
184 | - 'attendee_list' => array( |
|
185 | - 'input' => 'textarea', |
|
186 | - 'label' => '[ATTENDEE_LIST]', |
|
187 | - 'type' => 'string', |
|
188 | - 'required' => true, |
|
189 | - 'validation' => true, |
|
190 | - 'format' => '%s', |
|
191 | - 'css_class' => 'large-text', |
|
192 | - 'rows' => '5', |
|
193 | - 'shortcodes_required' => array('[ATTENDEE_LIST]') |
|
194 | - ), |
|
195 | - 'ticket_list' => array( |
|
196 | - 'input' => 'textarea', |
|
197 | - 'label' => '[TICKET_LIST]', |
|
198 | - 'type' => 'string', |
|
199 | - 'required' => true, |
|
200 | - 'validation' => true, |
|
201 | - 'format' => '%s', |
|
202 | - 'css_class' => 'large-text', |
|
203 | - 'rows' => '10', |
|
204 | - 'shortcodes_required' => array('[TICKET_LIST]') |
|
205 | - ), |
|
206 | - 'datetime_list' => array( |
|
207 | - 'input' => 'textarea', |
|
208 | - 'label' => '[DATETIME_LIST]', |
|
209 | - 'type' => 'string', |
|
210 | - 'required' => true, |
|
211 | - 'validation' => true, |
|
212 | - 'format' => '%s', |
|
213 | - 'css_class' => 'large-text', |
|
214 | - 'rows' => '10', |
|
215 | - 'shortcodes_required' => array('[DATETIME_LIST]') |
|
216 | - ) |
|
217 | - ) |
|
218 | - ) |
|
219 | - ); |
|
220 | - } |
|
221 | - |
|
222 | - |
|
223 | - /** |
|
224 | - * @see definition of this method in parent |
|
225 | - * |
|
226 | - * @since 4.5.0 |
|
227 | - * |
|
228 | - */ |
|
229 | - protected function _set_default_message_types() |
|
230 | - { |
|
231 | - // note currently PDF is only a secondary messenger so it never has any associated message types. |
|
232 | - $this->_default_message_types = array(); |
|
233 | - } |
|
234 | - |
|
235 | - |
|
236 | - /** |
|
237 | - * @see definition of this method in parent |
|
238 | - * |
|
239 | - * @since 4.5.0 |
|
240 | - */ |
|
241 | - protected function _set_valid_message_types() |
|
242 | - { |
|
243 | - $this->_valid_message_types = array(); |
|
244 | - } |
|
245 | - |
|
246 | - |
|
247 | - /** |
|
248 | - * Generates html version of the message content and then sends it to the pdf generator. |
|
249 | - * |
|
250 | - * |
|
251 | - * @since 4.5.0 |
|
252 | - * |
|
253 | - * @return string. |
|
254 | - */ |
|
255 | - protected function _send_message() |
|
256 | - { |
|
257 | - $this->_template_args = array( |
|
258 | - 'page_title' => $this->_subject, |
|
259 | - 'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'base', $this->_variation), |
|
260 | - 'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'print', $this->_variation), |
|
261 | - 'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'main', $this->_variation), |
|
262 | - 'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css', |
|
263 | - 'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop($this->_content), $this->_content) |
|
264 | - ); |
|
265 | - $this->_deregister_wp_hooks(); |
|
266 | - add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
267 | - $content = $this->_get_main_template(); |
|
18 | + /** |
|
19 | + * The following are the properties that this messenger requires for generating pdf |
|
20 | + */ |
|
21 | + |
|
22 | + /** |
|
23 | + * This is the pdf body generated by the template via the message type. |
|
24 | + * |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + protected $_content; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * This is for the page title that gets displayed. This will end up being the filename for the generated pdf. |
|
32 | + * |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + protected $_subject; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * @return EE_Pdf_messenger |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + // set properties |
|
44 | + $this->name = 'pdf'; |
|
45 | + $this->description = __('This messenger is used for generating a pdf version of the message.', 'event_espresso'); |
|
46 | + $this->label = array( |
|
47 | + 'singular' => __('PDF', 'event_espresso'), |
|
48 | + 'plural' => __('PDFs', 'event_espresso') |
|
49 | + ); |
|
50 | + $this->activate_on_install = true; |
|
51 | + |
|
52 | + parent::__construct(); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * PDF Messenger desires execution immediately. |
|
58 | + * @see parent::send_now() for documentation. |
|
59 | + * @since 4.9.0 |
|
60 | + * @return bool |
|
61 | + */ |
|
62 | + public function send_now() |
|
63 | + { |
|
64 | + return true; |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * HTML Messenger allows an empty to field. |
|
70 | + * @see parent::allow_empty_to_field() for documentation |
|
71 | + * @since 4.9.0 |
|
72 | + * @return bool |
|
73 | + */ |
|
74 | + public function allow_empty_to_field() |
|
75 | + { |
|
76 | + return true; |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * @see abstract declaration in EE_messenger for details. |
|
82 | + */ |
|
83 | + protected function _set_admin_pages() |
|
84 | + { |
|
85 | + $this->admin_registered_pages = array('events_edit' => false); |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @see abstract declaration in EE_messenger for details. |
|
91 | + */ |
|
92 | + protected function _set_valid_shortcodes() |
|
93 | + { |
|
94 | + $this->_valid_shortcodes = array(); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * @see abstract declaration in EE_messenger for details. |
|
100 | + */ |
|
101 | + protected function _set_validator_config() |
|
102 | + { |
|
103 | + $this->_validator_config = array( |
|
104 | + 'subject' => array( |
|
105 | + 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
106 | + ), |
|
107 | + 'content' => array( |
|
108 | + 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
109 | + ), |
|
110 | + 'attendee_list' => array( |
|
111 | + 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
|
112 | + 'required' => array('[ATTENDEE_LIST]') |
|
113 | + ), |
|
114 | + 'event_list' => array( |
|
115 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'venue', 'datetime_list', 'attendee', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list'), |
|
116 | + 'required' => array('[EVENT_LIST]') |
|
117 | + ), |
|
118 | + 'ticket_list' => array( |
|
119 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'), |
|
120 | + 'required' => array('[TICKET_LIST]') |
|
121 | + ), |
|
122 | + 'datetime_list' => array( |
|
123 | + 'shortcodes' => array('datetime'), |
|
124 | + 'required' => array('[DATETIME_LIST]') |
|
125 | + ), |
|
126 | + ); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * Takes care of enqueuing any necessary scripts or styles for the page. A do_action() so message types using this messenger can add their own js. |
|
132 | + * |
|
133 | + * @return void. |
|
134 | + */ |
|
135 | + public function enqueue_scripts_styles() |
|
136 | + { |
|
137 | + parent::enqueue_scripts_styles(); |
|
138 | + do_action('AHEE__EE_Pdf_messenger__enqueue_scripts_styles'); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * _set_template_fields |
|
144 | + * This sets up the fields that a messenger requires for the message to go out. |
|
145 | + * |
|
146 | + * @access protected |
|
147 | + * @return void |
|
148 | + */ |
|
149 | + protected function _set_template_fields() |
|
150 | + { |
|
151 | + // any extra template fields that are NOT used by the messenger but will get used by a messenger field for shortcode replacement get added to the 'extra' key in an associated array indexed by the messenger field they relate to. This is important for the Messages_admin to know what fields to display to the user. Also, notice that the "values" are equal to the field type that messages admin will use to know what kind of field to display. The values ALSO have one index labeled "shortcode". the values in that array indicate which ACTUAL SHORTCODE (i.e. [SHORTCODE]) is required in order for this extra field to be displayed. If the required shortcode isn't part of the shortcodes array then the field is not needed and will not be displayed/parsed. |
|
152 | + $this->_template_fields = array( |
|
153 | + 'subject' => array( |
|
154 | + 'input' => 'text', |
|
155 | + 'label' => __('Page Title', 'event_espresso'), |
|
156 | + 'type' => 'string', |
|
157 | + 'required' => true, |
|
158 | + 'validation' => true, |
|
159 | + 'css_class' => 'large-text', |
|
160 | + 'format' => '%s' |
|
161 | + ), |
|
162 | + 'content' => '', // left empty b/c it is in the "extra array" but messenger still needs needs to know this is a field. |
|
163 | + 'extra' => array( |
|
164 | + 'content' => array( |
|
165 | + 'main' => array( |
|
166 | + 'input' => 'wp_editor', |
|
167 | + 'label' => __('Main Content', 'event_espresso'), |
|
168 | + 'type' => 'string', |
|
169 | + 'required' => true, |
|
170 | + 'validation' => true, |
|
171 | + 'format' => '%s', |
|
172 | + 'rows' => '15' |
|
173 | + ), |
|
174 | + 'event_list' => array( |
|
175 | + 'input' => 'wp_editor', |
|
176 | + 'label' => '[EVENT_LIST]', |
|
177 | + 'type' => 'string', |
|
178 | + 'required' => true, |
|
179 | + 'validation' => true, |
|
180 | + 'format' => '%s', |
|
181 | + 'rows' => '15', |
|
182 | + 'shortcodes_required' => array('[EVENT_LIST]') |
|
183 | + ), |
|
184 | + 'attendee_list' => array( |
|
185 | + 'input' => 'textarea', |
|
186 | + 'label' => '[ATTENDEE_LIST]', |
|
187 | + 'type' => 'string', |
|
188 | + 'required' => true, |
|
189 | + 'validation' => true, |
|
190 | + 'format' => '%s', |
|
191 | + 'css_class' => 'large-text', |
|
192 | + 'rows' => '5', |
|
193 | + 'shortcodes_required' => array('[ATTENDEE_LIST]') |
|
194 | + ), |
|
195 | + 'ticket_list' => array( |
|
196 | + 'input' => 'textarea', |
|
197 | + 'label' => '[TICKET_LIST]', |
|
198 | + 'type' => 'string', |
|
199 | + 'required' => true, |
|
200 | + 'validation' => true, |
|
201 | + 'format' => '%s', |
|
202 | + 'css_class' => 'large-text', |
|
203 | + 'rows' => '10', |
|
204 | + 'shortcodes_required' => array('[TICKET_LIST]') |
|
205 | + ), |
|
206 | + 'datetime_list' => array( |
|
207 | + 'input' => 'textarea', |
|
208 | + 'label' => '[DATETIME_LIST]', |
|
209 | + 'type' => 'string', |
|
210 | + 'required' => true, |
|
211 | + 'validation' => true, |
|
212 | + 'format' => '%s', |
|
213 | + 'css_class' => 'large-text', |
|
214 | + 'rows' => '10', |
|
215 | + 'shortcodes_required' => array('[DATETIME_LIST]') |
|
216 | + ) |
|
217 | + ) |
|
218 | + ) |
|
219 | + ); |
|
220 | + } |
|
221 | + |
|
222 | + |
|
223 | + /** |
|
224 | + * @see definition of this method in parent |
|
225 | + * |
|
226 | + * @since 4.5.0 |
|
227 | + * |
|
228 | + */ |
|
229 | + protected function _set_default_message_types() |
|
230 | + { |
|
231 | + // note currently PDF is only a secondary messenger so it never has any associated message types. |
|
232 | + $this->_default_message_types = array(); |
|
233 | + } |
|
234 | + |
|
235 | + |
|
236 | + /** |
|
237 | + * @see definition of this method in parent |
|
238 | + * |
|
239 | + * @since 4.5.0 |
|
240 | + */ |
|
241 | + protected function _set_valid_message_types() |
|
242 | + { |
|
243 | + $this->_valid_message_types = array(); |
|
244 | + } |
|
245 | + |
|
246 | + |
|
247 | + /** |
|
248 | + * Generates html version of the message content and then sends it to the pdf generator. |
|
249 | + * |
|
250 | + * |
|
251 | + * @since 4.5.0 |
|
252 | + * |
|
253 | + * @return string. |
|
254 | + */ |
|
255 | + protected function _send_message() |
|
256 | + { |
|
257 | + $this->_template_args = array( |
|
258 | + 'page_title' => $this->_subject, |
|
259 | + 'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'base', $this->_variation), |
|
260 | + 'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'print', $this->_variation), |
|
261 | + 'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'main', $this->_variation), |
|
262 | + 'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css', |
|
263 | + 'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop($this->_content), $this->_content) |
|
264 | + ); |
|
265 | + $this->_deregister_wp_hooks(); |
|
266 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
267 | + $content = $this->_get_main_template(); |
|
268 | 268 | // die( $content ); |
269 | - $this->_do_pdf($content); |
|
270 | - exit(0); |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - /** |
|
275 | - * The purpose of this function is to de register all actions hooked into wp_head and wp_footer so that it doesn't interfere with our templates. If users want to add any custom styles or scripts they must use the AHEE__EE_Pdf_messenger__enqueue_scripts_styles hook. |
|
276 | - * |
|
277 | - * @since 4.5.0 |
|
278 | - * |
|
279 | - * @return void |
|
280 | - */ |
|
281 | - protected function _deregister_wp_hooks() |
|
282 | - { |
|
283 | - remove_all_actions('wp_head'); |
|
284 | - remove_all_actions('wp_footer'); |
|
285 | - remove_all_actions('wp_print_footer_scripts'); |
|
286 | - remove_all_actions('wp_enqueue_scripts'); |
|
287 | - global $wp_scripts, $wp_styles; |
|
288 | - $wp_scripts = $wp_styles = array(); |
|
289 | - |
|
290 | - // just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load. |
|
291 | - add_action('wp_head', 'wp_enqueue_scripts'); |
|
292 | - add_action('wp_footer', 'wp_print_footer_scripts'); |
|
293 | - add_action('wp_print_footer_scripts', '_wp_footer_scripts'); |
|
294 | - } |
|
295 | - |
|
296 | - |
|
297 | - /** |
|
298 | - * Overwrite parent _get_main_template for pdf purposes. |
|
299 | - * |
|
300 | - * @since 4.5.0 |
|
301 | - * |
|
302 | - * @param bool $preview |
|
303 | - * @return string |
|
304 | - */ |
|
305 | - protected function _get_main_template($preview = false) |
|
306 | - { |
|
307 | - $wrapper_template = $this->_tmp_pack->get_wrapper('html', 'main'); |
|
308 | - // add message type to template_args |
|
309 | - $this->_template_args['message_type'] = $this->_incoming_message_type; |
|
310 | - return EEH_Template::display_template($wrapper_template, $this->_template_args, true); |
|
311 | - } |
|
312 | - |
|
313 | - |
|
314 | - /** |
|
315 | - * This takes care of loading the dompdf library and generating the actual pdf |
|
316 | - * |
|
317 | - * @param string $content This is the generated html content being converted into a pdf. |
|
318 | - * |
|
319 | - * @return void |
|
320 | - */ |
|
321 | - protected function _do_pdf($content = '') |
|
322 | - { |
|
323 | - $invoice_name = $this->_subject; |
|
324 | - |
|
325 | - // only load dompdf if nobody else has yet... |
|
326 | - if (! class_exists('Dompdf\Dompdf')) { |
|
327 | - require_once(EE_THIRD_PARTY . 'dompdf/src/Autoloader.php'); |
|
328 | - Dompdf\Autoloader::register(); |
|
329 | - } |
|
330 | - $options = new Dompdf\Options(); |
|
331 | - $options->set('isRemoteEnabled', true); |
|
332 | - $options->set('isJavascriptEnabled', false); |
|
333 | - if (defined('DOMPDF_FONT_DIR')) { |
|
334 | - $options->setFontDir(DOMPDF_FONT_DIR); |
|
335 | - $options->setFontCache(DOMPDF_FONT_DIR); |
|
336 | - } |
|
337 | - // Allow changing the paper size. |
|
338 | - if (defined('DOMPDF_DEFAULT_PAPER_SIZE')) { |
|
339 | - $options->set('defaultPaperSize', DOMPDF_DEFAULT_PAPER_SIZE); |
|
340 | - } |
|
341 | - $dompdf = new Dompdf\Dompdf($options); |
|
342 | - // Remove all spaces between HTML tags |
|
343 | - $content = preg_replace('/>\s+</', '><', $content); |
|
344 | - $dompdf->loadHtml($content); |
|
345 | - $dompdf->render(); |
|
346 | - // forcing the browser to open a download dialog. |
|
347 | - $dompdf->stream($invoice_name . ".pdf", array('Attachment' => true)); |
|
348 | - } |
|
349 | - |
|
350 | - |
|
351 | - /** |
|
352 | - * @return string |
|
353 | - */ |
|
354 | - protected function _preview() |
|
355 | - { |
|
356 | - return $this->_send_message(); |
|
357 | - } |
|
358 | - |
|
359 | - |
|
360 | - protected function _set_admin_settings_fields() |
|
361 | - { |
|
362 | - } |
|
269 | + $this->_do_pdf($content); |
|
270 | + exit(0); |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + /** |
|
275 | + * The purpose of this function is to de register all actions hooked into wp_head and wp_footer so that it doesn't interfere with our templates. If users want to add any custom styles or scripts they must use the AHEE__EE_Pdf_messenger__enqueue_scripts_styles hook. |
|
276 | + * |
|
277 | + * @since 4.5.0 |
|
278 | + * |
|
279 | + * @return void |
|
280 | + */ |
|
281 | + protected function _deregister_wp_hooks() |
|
282 | + { |
|
283 | + remove_all_actions('wp_head'); |
|
284 | + remove_all_actions('wp_footer'); |
|
285 | + remove_all_actions('wp_print_footer_scripts'); |
|
286 | + remove_all_actions('wp_enqueue_scripts'); |
|
287 | + global $wp_scripts, $wp_styles; |
|
288 | + $wp_scripts = $wp_styles = array(); |
|
289 | + |
|
290 | + // just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load. |
|
291 | + add_action('wp_head', 'wp_enqueue_scripts'); |
|
292 | + add_action('wp_footer', 'wp_print_footer_scripts'); |
|
293 | + add_action('wp_print_footer_scripts', '_wp_footer_scripts'); |
|
294 | + } |
|
295 | + |
|
296 | + |
|
297 | + /** |
|
298 | + * Overwrite parent _get_main_template for pdf purposes. |
|
299 | + * |
|
300 | + * @since 4.5.0 |
|
301 | + * |
|
302 | + * @param bool $preview |
|
303 | + * @return string |
|
304 | + */ |
|
305 | + protected function _get_main_template($preview = false) |
|
306 | + { |
|
307 | + $wrapper_template = $this->_tmp_pack->get_wrapper('html', 'main'); |
|
308 | + // add message type to template_args |
|
309 | + $this->_template_args['message_type'] = $this->_incoming_message_type; |
|
310 | + return EEH_Template::display_template($wrapper_template, $this->_template_args, true); |
|
311 | + } |
|
312 | + |
|
313 | + |
|
314 | + /** |
|
315 | + * This takes care of loading the dompdf library and generating the actual pdf |
|
316 | + * |
|
317 | + * @param string $content This is the generated html content being converted into a pdf. |
|
318 | + * |
|
319 | + * @return void |
|
320 | + */ |
|
321 | + protected function _do_pdf($content = '') |
|
322 | + { |
|
323 | + $invoice_name = $this->_subject; |
|
324 | + |
|
325 | + // only load dompdf if nobody else has yet... |
|
326 | + if (! class_exists('Dompdf\Dompdf')) { |
|
327 | + require_once(EE_THIRD_PARTY . 'dompdf/src/Autoloader.php'); |
|
328 | + Dompdf\Autoloader::register(); |
|
329 | + } |
|
330 | + $options = new Dompdf\Options(); |
|
331 | + $options->set('isRemoteEnabled', true); |
|
332 | + $options->set('isJavascriptEnabled', false); |
|
333 | + if (defined('DOMPDF_FONT_DIR')) { |
|
334 | + $options->setFontDir(DOMPDF_FONT_DIR); |
|
335 | + $options->setFontCache(DOMPDF_FONT_DIR); |
|
336 | + } |
|
337 | + // Allow changing the paper size. |
|
338 | + if (defined('DOMPDF_DEFAULT_PAPER_SIZE')) { |
|
339 | + $options->set('defaultPaperSize', DOMPDF_DEFAULT_PAPER_SIZE); |
|
340 | + } |
|
341 | + $dompdf = new Dompdf\Dompdf($options); |
|
342 | + // Remove all spaces between HTML tags |
|
343 | + $content = preg_replace('/>\s+</', '><', $content); |
|
344 | + $dompdf->loadHtml($content); |
|
345 | + $dompdf->render(); |
|
346 | + // forcing the browser to open a download dialog. |
|
347 | + $dompdf->stream($invoice_name . ".pdf", array('Attachment' => true)); |
|
348 | + } |
|
349 | + |
|
350 | + |
|
351 | + /** |
|
352 | + * @return string |
|
353 | + */ |
|
354 | + protected function _preview() |
|
355 | + { |
|
356 | + return $this->_send_message(); |
|
357 | + } |
|
358 | + |
|
359 | + |
|
360 | + protected function _set_admin_settings_fields() |
|
361 | + { |
|
362 | + } |
|
363 | 363 | } |
@@ -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 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
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.70.rc.015'); |
|
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.70.rc.015'); |
|
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 | } |
@@ -14,44 +14,44 @@ |
||
14 | 14 | abstract class BlockRenderer implements BlockRendererInterface |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @var DomainInterface |
|
19 | - */ |
|
20 | - protected $domain; |
|
21 | - |
|
22 | - /** |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - private $template_root_path; |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * BlockRenderer constructor. |
|
30 | - * |
|
31 | - * @param DomainInterface $domain |
|
32 | - */ |
|
33 | - public function __construct(DomainInterface $domain) |
|
34 | - { |
|
35 | - $this->domain = $domain; |
|
36 | - $this->setTemplateRootPath(); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * Sets the root path to the main block template. |
|
42 | - */ |
|
43 | - private function setTemplateRootPath() |
|
44 | - { |
|
45 | - $this->template_root_path = $this->domain->pluginPath() . 'ui/blocks/'; |
|
46 | - } |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * Exposes the root path for the main block template. |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function templateRootPath() |
|
54 | - { |
|
55 | - return $this->template_root_path; |
|
56 | - } |
|
17 | + /** |
|
18 | + * @var DomainInterface |
|
19 | + */ |
|
20 | + protected $domain; |
|
21 | + |
|
22 | + /** |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + private $template_root_path; |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * BlockRenderer constructor. |
|
30 | + * |
|
31 | + * @param DomainInterface $domain |
|
32 | + */ |
|
33 | + public function __construct(DomainInterface $domain) |
|
34 | + { |
|
35 | + $this->domain = $domain; |
|
36 | + $this->setTemplateRootPath(); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * Sets the root path to the main block template. |
|
42 | + */ |
|
43 | + private function setTemplateRootPath() |
|
44 | + { |
|
45 | + $this->template_root_path = $this->domain->pluginPath() . 'ui/blocks/'; |
|
46 | + } |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * Exposes the root path for the main block template. |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function templateRootPath() |
|
54 | + { |
|
55 | + return $this->template_root_path; |
|
56 | + } |
|
57 | 57 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | private function setTemplateRootPath() |
44 | 44 | { |
45 | - $this->template_root_path = $this->domain->pluginPath() . 'ui/blocks/'; |
|
45 | + $this->template_root_path = $this->domain->pluginPath().'ui/blocks/'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |
@@ -11,30 +11,30 @@ |
||
11 | 11 | <div id="ee-block-event-attendees" class="ee-core-blocks event-espresso-blocks event-attendees"> |
12 | 12 | <ul> |
13 | 13 | <?php |
14 | - foreach ($attendees as $attendee) { |
|
15 | - $gravatar = $attributes['showGravatar'] |
|
16 | - ? get_avatar_url( |
|
17 | - $attendee->email(), |
|
18 | - array( |
|
19 | - 'default' => 'mm', |
|
20 | - 'width' => $attributes['avatarSize'], |
|
21 | - 'height' => $attributes['avatarSize'] |
|
22 | - ) |
|
23 | - ) |
|
24 | - : ''; |
|
25 | - $gravatar_class = $attributes['avatarClass'] |
|
26 | - ? $attributes['avatarClass'] . ' contact-avatar-img avatar' |
|
27 | - : 'contact-avatar-img avatar'; |
|
28 | - $gravatar = $gravatar !== '' |
|
29 | - ? '<div class="contact-image-wrap-div">' |
|
30 | - . '<img class="' . $gravatar_class . '"' |
|
31 | - . ' width="' . $attributes['avatarSize'] . '"' |
|
32 | - . ' height="' . $attributes['avatarSize'] . '"' |
|
33 | - . ' src="' . $gravatar . '" alt="contact avatar">' |
|
34 | - . '</div>' |
|
35 | - : ''; |
|
36 | - echo "<li>{$gravatar}<span>{$attendee->full_name()}</span>"; |
|
37 | - } |
|
38 | - ?> |
|
14 | + foreach ($attendees as $attendee) { |
|
15 | + $gravatar = $attributes['showGravatar'] |
|
16 | + ? get_avatar_url( |
|
17 | + $attendee->email(), |
|
18 | + array( |
|
19 | + 'default' => 'mm', |
|
20 | + 'width' => $attributes['avatarSize'], |
|
21 | + 'height' => $attributes['avatarSize'] |
|
22 | + ) |
|
23 | + ) |
|
24 | + : ''; |
|
25 | + $gravatar_class = $attributes['avatarClass'] |
|
26 | + ? $attributes['avatarClass'] . ' contact-avatar-img avatar' |
|
27 | + : 'contact-avatar-img avatar'; |
|
28 | + $gravatar = $gravatar !== '' |
|
29 | + ? '<div class="contact-image-wrap-div">' |
|
30 | + . '<img class="' . $gravatar_class . '"' |
|
31 | + . ' width="' . $attributes['avatarSize'] . '"' |
|
32 | + . ' height="' . $attributes['avatarSize'] . '"' |
|
33 | + . ' src="' . $gravatar . '" alt="contact avatar">' |
|
34 | + . '</div>' |
|
35 | + : ''; |
|
36 | + echo "<li>{$gravatar}<span>{$attendee->full_name()}</span>"; |
|
37 | + } |
|
38 | + ?> |
|
39 | 39 | </ul> |
40 | 40 | </div> |
@@ -23,14 +23,14 @@ |
||
23 | 23 | ) |
24 | 24 | : ''; |
25 | 25 | $gravatar_class = $attributes['avatarClass'] |
26 | - ? $attributes['avatarClass'] . ' contact-avatar-img avatar' |
|
26 | + ? $attributes['avatarClass'].' contact-avatar-img avatar' |
|
27 | 27 | : 'contact-avatar-img avatar'; |
28 | 28 | $gravatar = $gravatar !== '' |
29 | 29 | ? '<div class="contact-image-wrap-div">' |
30 | - . '<img class="' . $gravatar_class . '"' |
|
31 | - . ' width="' . $attributes['avatarSize'] . '"' |
|
32 | - . ' height="' . $attributes['avatarSize'] . '"' |
|
33 | - . ' src="' . $gravatar . '" alt="contact avatar">' |
|
30 | + . '<img class="'.$gravatar_class.'"' |
|
31 | + . ' width="'.$attributes['avatarSize'].'"' |
|
32 | + . ' height="'.$attributes['avatarSize'].'"' |
|
33 | + . ' src="'.$gravatar.'" alt="contact avatar">' |
|
34 | 34 | . '</div>' |
35 | 35 | : ''; |
36 | 36 | echo "<li>{$gravatar}<span>{$attendee->full_name()}</span>"; |