@@ -21,56 +21,56 @@ |
||
21 | 21 | */ |
22 | 22 | class Wordlift_Post_Related_Storage extends Wordlift_Storage { |
23 | 23 | |
24 | - /** |
|
25 | - * The {@link Wordlift_Entity_Service} instance. |
|
26 | - * |
|
27 | - * @since 3.15.0 |
|
28 | - * @access private |
|
29 | - * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
30 | - */ |
|
31 | - private $entity_service; |
|
24 | + /** |
|
25 | + * The {@link Wordlift_Entity_Service} instance. |
|
26 | + * |
|
27 | + * @since 3.15.0 |
|
28 | + * @access private |
|
29 | + * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
30 | + */ |
|
31 | + private $entity_service; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Create a {@link Wordlift_Post_Related_Storage} instance. |
|
35 | - * |
|
36 | - * @since 3.15.0 |
|
37 | - * |
|
38 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
39 | - */ |
|
40 | - public function __construct( $entity_service ) { |
|
33 | + /** |
|
34 | + * Create a {@link Wordlift_Post_Related_Storage} instance. |
|
35 | + * |
|
36 | + * @since 3.15.0 |
|
37 | + * |
|
38 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
39 | + */ |
|
40 | + public function __construct( $entity_service ) { |
|
41 | 41 | |
42 | - $this->entity_service = $entity_service; |
|
42 | + $this->entity_service = $entity_service; |
|
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Get the property value. |
|
48 | - * |
|
49 | - * There is no filter for entities or posts, the returned data here can |
|
50 | - * be used for `relations` and `references` according to the client. |
|
51 | - * |
|
52 | - * @since 3.15.0 |
|
53 | - * |
|
54 | - * @param int $post_id The {@link WP_Post}'s id. |
|
55 | - * |
|
56 | - * @return array|string|null A single string, or an array of values or null |
|
57 | - * if the property isn't recognized. |
|
58 | - */ |
|
59 | - public function get( $post_id ) { |
|
46 | + /** |
|
47 | + * Get the property value. |
|
48 | + * |
|
49 | + * There is no filter for entities or posts, the returned data here can |
|
50 | + * be used for `relations` and `references` according to the client. |
|
51 | + * |
|
52 | + * @since 3.15.0 |
|
53 | + * |
|
54 | + * @param int $post_id The {@link WP_Post}'s id. |
|
55 | + * |
|
56 | + * @return array|string|null A single string, or an array of values or null |
|
57 | + * if the property isn't recognized. |
|
58 | + */ |
|
59 | + public function get( $post_id ) { |
|
60 | 60 | |
61 | - // get related entities. |
|
62 | - $related = wl_core_get_related_entity_ids( $post_id ); |
|
61 | + // get related entities. |
|
62 | + $related = wl_core_get_related_entity_ids( $post_id ); |
|
63 | 63 | |
64 | - // A reference to the entity service. |
|
65 | - $entity_service = $this->entity_service; |
|
64 | + // A reference to the entity service. |
|
65 | + $entity_service = $this->entity_service; |
|
66 | 66 | |
67 | - // Map the related posts' ids to URIs. |
|
68 | - return array_map( |
|
69 | - function ( $item ) use ( $entity_service ) { |
|
70 | - return $entity_service->get_uri( $item ); |
|
71 | - }, |
|
72 | - $related |
|
73 | - ); |
|
74 | - } |
|
67 | + // Map the related posts' ids to URIs. |
|
68 | + return array_map( |
|
69 | + function ( $item ) use ( $entity_service ) { |
|
70 | + return $entity_service->get_uri( $item ); |
|
71 | + }, |
|
72 | + $related |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
39 | 39 | */ |
40 | - public function __construct( $entity_service ) { |
|
40 | + public function __construct($entity_service) { |
|
41 | 41 | |
42 | 42 | $this->entity_service = $entity_service; |
43 | 43 | |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | * @return array|string|null A single string, or an array of values or null |
57 | 57 | * if the property isn't recognized. |
58 | 58 | */ |
59 | - public function get( $post_id ) { |
|
59 | + public function get($post_id) { |
|
60 | 60 | |
61 | 61 | // get related entities. |
62 | - $related = wl_core_get_related_entity_ids( $post_id ); |
|
62 | + $related = wl_core_get_related_entity_ids($post_id); |
|
63 | 63 | |
64 | 64 | // A reference to the entity service. |
65 | 65 | $entity_service = $this->entity_service; |
66 | 66 | |
67 | 67 | // Map the related posts' ids to URIs. |
68 | 68 | return array_map( |
69 | - function ( $item ) use ( $entity_service ) { |
|
70 | - return $entity_service->get_uri( $item ); |
|
69 | + function($item) use ($entity_service) { |
|
70 | + return $entity_service->get_uri($item); |
|
71 | 71 | }, |
72 | 72 | $related |
73 | 73 | ); |
@@ -82,1792 +82,1792 @@ |
||
82 | 82 | */ |
83 | 83 | class Wordlift { |
84 | 84 | |
85 | - /** |
|
86 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
87 | - * the plugin. |
|
88 | - * |
|
89 | - * @since 1.0.0 |
|
90 | - * @access protected |
|
91 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
92 | - */ |
|
93 | - protected $loader; |
|
94 | - |
|
95 | - /** |
|
96 | - * The unique identifier of this plugin. |
|
97 | - * |
|
98 | - * @since 1.0.0 |
|
99 | - * @access protected |
|
100 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
101 | - */ |
|
102 | - protected $plugin_name; |
|
103 | - |
|
104 | - /** |
|
105 | - * The current version of the plugin. |
|
106 | - * |
|
107 | - * @since 1.0.0 |
|
108 | - * @access protected |
|
109 | - * @var string $version The current version of the plugin. |
|
110 | - */ |
|
111 | - protected $version; |
|
112 | - |
|
113 | - /** |
|
114 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
115 | - * |
|
116 | - * @since 3.12.0 |
|
117 | - * @access protected |
|
118 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
119 | - */ |
|
120 | - protected $tinymce_adapter; |
|
121 | - |
|
122 | - /** |
|
123 | - * The Schema service. |
|
124 | - * |
|
125 | - * @since 3.3.0 |
|
126 | - * @access protected |
|
127 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
128 | - */ |
|
129 | - protected $schema_service; |
|
130 | - |
|
131 | - /** |
|
132 | - * The Topic Taxonomy service. |
|
133 | - * |
|
134 | - * @since 3.5.0 |
|
135 | - * @access private |
|
136 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
137 | - */ |
|
138 | - private $topic_taxonomy_service; |
|
139 | - |
|
140 | - /** |
|
141 | - * The Entity Types Taxonomy service. |
|
142 | - * |
|
143 | - * @since 3.18.0 |
|
144 | - * @access private |
|
145 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
146 | - */ |
|
147 | - private $entity_types_taxonomy_service; |
|
148 | - |
|
149 | - /** |
|
150 | - * The User service. |
|
151 | - * |
|
152 | - * @since 3.1.7 |
|
153 | - * @access protected |
|
154 | - * @var \Wordlift_User_Service $user_service The User service. |
|
155 | - */ |
|
156 | - protected $user_service; |
|
157 | - |
|
158 | - /** |
|
159 | - * The Timeline service. |
|
160 | - * |
|
161 | - * @since 3.1.0 |
|
162 | - * @access private |
|
163 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
164 | - */ |
|
165 | - private $timeline_service; |
|
166 | - |
|
167 | - /** |
|
168 | - * The Redirect service. |
|
169 | - * |
|
170 | - * @since 3.2.0 |
|
171 | - * @access private |
|
172 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
173 | - */ |
|
174 | - private $redirect_service; |
|
175 | - |
|
176 | - /** |
|
177 | - * The Notice service. |
|
178 | - * |
|
179 | - * @since 3.3.0 |
|
180 | - * @access private |
|
181 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
182 | - */ |
|
183 | - private $notice_service; |
|
184 | - |
|
185 | - /** |
|
186 | - * The Entity list customization. |
|
187 | - * |
|
188 | - * @since 3.3.0 |
|
189 | - * @access protected |
|
190 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
191 | - */ |
|
192 | - protected $entity_list_service; |
|
193 | - |
|
194 | - /** |
|
195 | - * The Entity Types Taxonomy Walker. |
|
196 | - * |
|
197 | - * @since 3.1.0 |
|
198 | - * @access private |
|
199 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
200 | - */ |
|
201 | - private $entity_types_taxonomy_walker; |
|
202 | - |
|
203 | - /** |
|
204 | - * The ShareThis service. |
|
205 | - * |
|
206 | - * @since 3.2.0 |
|
207 | - * @access private |
|
208 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
209 | - */ |
|
210 | - private $sharethis_service; |
|
211 | - |
|
212 | - /** |
|
213 | - * The PrimaShop adapter. |
|
214 | - * |
|
215 | - * @since 3.2.3 |
|
216 | - * @access private |
|
217 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
218 | - */ |
|
219 | - private $primashop_adapter; |
|
220 | - |
|
221 | - /** |
|
222 | - * The entity type service. |
|
223 | - * |
|
224 | - * @since 3.6.0 |
|
225 | - * @access private |
|
226 | - * @var \Wordlift_Entity_Post_Type_Service |
|
227 | - */ |
|
228 | - private $entity_post_type_service; |
|
229 | - |
|
230 | - /** |
|
231 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
232 | - * |
|
233 | - * @since 3.6.0 |
|
234 | - * @access private |
|
235 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
236 | - */ |
|
237 | - private $entity_link_service; |
|
238 | - |
|
239 | - /** |
|
240 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
241 | - * |
|
242 | - * @since 3.7.0 |
|
243 | - * @access protected |
|
244 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
245 | - */ |
|
246 | - protected $jsonld_service; |
|
247 | - |
|
248 | - /** |
|
249 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
250 | - * |
|
251 | - * @since 3.14.0 |
|
252 | - * @access protected |
|
253 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
254 | - */ |
|
255 | - protected $jsonld_website_converter; |
|
256 | - |
|
257 | - /** |
|
258 | - * A {@link Wordlift_Property_Factory} instance. |
|
259 | - * |
|
260 | - * @since 3.7.0 |
|
261 | - * @access private |
|
262 | - * @var \Wordlift_Property_Factory $property_factory |
|
263 | - */ |
|
264 | - private $property_factory; |
|
265 | - |
|
266 | - /** |
|
267 | - * The 'Download Your Data' page. |
|
268 | - * |
|
269 | - * @since 3.6.0 |
|
270 | - * @access private |
|
271 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
272 | - */ |
|
273 | - private $download_your_data_page; |
|
274 | - |
|
275 | - /** |
|
276 | - * The 'WordLift Settings' page. |
|
277 | - * |
|
278 | - * @since 3.11.0 |
|
279 | - * @access protected |
|
280 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
281 | - */ |
|
282 | - protected $settings_page; |
|
283 | - |
|
284 | - /** |
|
285 | - * The install wizard page. |
|
286 | - * |
|
287 | - * @since 3.9.0 |
|
288 | - * @access private |
|
289 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
290 | - */ |
|
291 | - public $admin_setup; |
|
292 | - |
|
293 | - /** |
|
294 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
295 | - * linking of entities to their pages. |
|
296 | - * |
|
297 | - * @since 3.8.0 |
|
298 | - * @access private |
|
299 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
300 | - */ |
|
301 | - private $content_filter_service; |
|
302 | - |
|
303 | - /** |
|
304 | - * The Faq Content filter service |
|
305 | - * |
|
306 | - * @since 3.26.0 |
|
307 | - * @access private |
|
308 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
309 | - */ |
|
310 | - private $faq_content_filter_service; |
|
311 | - |
|
312 | - /** |
|
313 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
314 | - * |
|
315 | - * @since 3.9.0 |
|
316 | - * @access private |
|
317 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
318 | - */ |
|
319 | - private $key_validation_service; |
|
320 | - |
|
321 | - /** |
|
322 | - * A {@link Wordlift_Rating_Service} instance. |
|
323 | - * |
|
324 | - * @since 3.10.0 |
|
325 | - * @access private |
|
326 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
327 | - */ |
|
328 | - private $rating_service; |
|
329 | - |
|
330 | - /** |
|
331 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
332 | - * |
|
333 | - * @since 3.10.0 |
|
334 | - * @access protected |
|
335 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
336 | - */ |
|
337 | - protected $post_to_jsonld_converter; |
|
338 | - |
|
339 | - /** |
|
340 | - * A {@link Wordlift_Install_Service} instance. |
|
341 | - * |
|
342 | - * @since 3.18.0 |
|
343 | - * @access protected |
|
344 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
345 | - */ |
|
346 | - protected $install_service; |
|
347 | - |
|
348 | - /** |
|
349 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
350 | - * |
|
351 | - * @since 3.10.0 |
|
352 | - * @access protected |
|
353 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
354 | - */ |
|
355 | - protected $entity_post_to_jsonld_converter; |
|
356 | - |
|
357 | - /** |
|
358 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
359 | - * |
|
360 | - * @since 3.10.0 |
|
361 | - * @access protected |
|
362 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
363 | - */ |
|
364 | - protected $postid_to_jsonld_converter; |
|
365 | - |
|
366 | - /** |
|
367 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
368 | - * |
|
369 | - * @since 3.11.0 |
|
370 | - * @access protected |
|
371 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
372 | - */ |
|
373 | - protected $category_taxonomy_service; |
|
374 | - |
|
375 | - /** |
|
376 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
377 | - * |
|
378 | - * @since 3.11.0 |
|
379 | - * @access protected |
|
380 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
381 | - */ |
|
382 | - protected $entity_page_service; |
|
383 | - |
|
384 | - /** |
|
385 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
386 | - * |
|
387 | - * @since 3.11.0 |
|
388 | - * @access protected |
|
389 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
390 | - */ |
|
391 | - protected $settings_page_action_link; |
|
392 | - |
|
393 | - /** |
|
394 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
395 | - * |
|
396 | - * @since 3.11.0 |
|
397 | - * @access protected |
|
398 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
399 | - */ |
|
400 | - protected $analytics_settings_page_action_link; |
|
401 | - |
|
402 | - /** |
|
403 | - * The {@link Wordlift_Analytics_Connect} class. |
|
404 | - * |
|
405 | - * @since 3.11.0 |
|
406 | - * @access protected |
|
407 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
408 | - */ |
|
409 | - protected $analytics_connect; |
|
410 | - |
|
411 | - /** |
|
412 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
413 | - * |
|
414 | - * @since 3.11.0 |
|
415 | - * @access protected |
|
416 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
417 | - */ |
|
418 | - protected $publisher_ajax_adapter; |
|
419 | - |
|
420 | - /** |
|
421 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
422 | - * |
|
423 | - * @since 3.11.0 |
|
424 | - * @access protected |
|
425 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
426 | - */ |
|
427 | - protected $input_element; |
|
428 | - |
|
429 | - /** |
|
430 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
431 | - * |
|
432 | - * @since 3.13.0 |
|
433 | - * @access protected |
|
434 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
435 | - */ |
|
436 | - protected $radio_input_element; |
|
437 | - |
|
438 | - /** |
|
439 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
440 | - * |
|
441 | - * @since 3.11.0 |
|
442 | - * @access protected |
|
443 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
444 | - */ |
|
445 | - protected $language_select_element; |
|
446 | - |
|
447 | - /** |
|
448 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
449 | - * |
|
450 | - * @since 3.18.0 |
|
451 | - * @access protected |
|
452 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
453 | - */ |
|
454 | - protected $country_select_element; |
|
455 | - |
|
456 | - /** |
|
457 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
458 | - * |
|
459 | - * @since 3.11.0 |
|
460 | - * @access protected |
|
461 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
462 | - */ |
|
463 | - protected $publisher_element; |
|
464 | - |
|
465 | - /** |
|
466 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
467 | - * |
|
468 | - * @since 3.11.0 |
|
469 | - * @access protected |
|
470 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
471 | - */ |
|
472 | - protected $select2_element; |
|
473 | - |
|
474 | - /** |
|
475 | - * The controller for the entity type list admin page |
|
476 | - * |
|
477 | - * @since 3.11.0 |
|
478 | - * @access private |
|
479 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
480 | - */ |
|
481 | - private $entity_type_admin_page; |
|
482 | - |
|
483 | - /** |
|
484 | - * The controller for the entity type settings admin page |
|
485 | - * |
|
486 | - * @since 3.11.0 |
|
487 | - * @access private |
|
488 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
489 | - */ |
|
490 | - private $entity_type_settings_admin_page; |
|
491 | - |
|
492 | - /** |
|
493 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
494 | - * |
|
495 | - * @since 3.11.0 |
|
496 | - * @access protected |
|
497 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
498 | - */ |
|
499 | - protected $related_entities_cloud_widget; |
|
500 | - |
|
501 | - /** |
|
502 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
503 | - * |
|
504 | - * @since 3.14.0 |
|
505 | - * @access protected |
|
506 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
507 | - */ |
|
508 | - protected $author_element; |
|
509 | - |
|
510 | - /** |
|
511 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
512 | - * |
|
513 | - * @since 3.12.0 |
|
514 | - * @access protected |
|
515 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
516 | - */ |
|
517 | - protected $sample_data_service; |
|
518 | - |
|
519 | - /** |
|
520 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
521 | - * |
|
522 | - * @since 3.12.0 |
|
523 | - * @access protected |
|
524 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
525 | - */ |
|
526 | - protected $sample_data_ajax_adapter; |
|
527 | - |
|
528 | - /** |
|
529 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
530 | - * |
|
531 | - * @since 3.16.0 |
|
532 | - * @access protected |
|
533 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
534 | - */ |
|
535 | - protected $google_analytics_export_service; |
|
536 | - |
|
537 | - /** |
|
538 | - * {@link Wordlift}'s singleton instance. |
|
539 | - * |
|
540 | - * @since 3.15.0 |
|
541 | - * @access protected |
|
542 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
543 | - */ |
|
544 | - protected $entity_type_adapter; |
|
545 | - |
|
546 | - /** |
|
547 | - * The {@link Wordlift_Storage_Factory} instance. |
|
548 | - * |
|
549 | - * @since 3.15.0 |
|
550 | - * @access protected |
|
551 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
552 | - */ |
|
553 | - protected $storage_factory; |
|
554 | - |
|
555 | - /** |
|
556 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
557 | - * |
|
558 | - * @since 3.15.0 |
|
559 | - * @access private |
|
560 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
561 | - */ |
|
562 | - private $autocomplete_adapter; |
|
563 | - |
|
564 | - /** |
|
565 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
566 | - * |
|
567 | - * @since 3.16.0 |
|
568 | - * @access protected |
|
569 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
570 | - */ |
|
571 | - protected $cached_postid_to_jsonld_converter; |
|
572 | - |
|
573 | - /** |
|
574 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
575 | - * |
|
576 | - * @since 3.16.3 |
|
577 | - * @access protected |
|
578 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
579 | - */ |
|
580 | - protected $entity_uri_service; |
|
581 | - |
|
582 | - /** |
|
583 | - * The {@link Wordlift_Publisher_Service} instance. |
|
584 | - * |
|
585 | - * @since 3.19.0 |
|
586 | - * @access protected |
|
587 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
588 | - */ |
|
589 | - protected $publisher_service; |
|
590 | - |
|
591 | - /** |
|
592 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
593 | - * |
|
594 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
595 | - */ |
|
596 | - protected $context_cards_service; |
|
597 | - |
|
598 | - /** |
|
599 | - * {@link Wordlift}'s singleton instance. |
|
600 | - * |
|
601 | - * @since 3.11.2 |
|
602 | - * @access private |
|
603 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
604 | - */ |
|
605 | - private static $instance; |
|
606 | - |
|
607 | - /** |
|
608 | - * A singleton instance of features registry. |
|
609 | - * |
|
610 | - * @since 3.30.0 |
|
611 | - * @var Features_Registry |
|
612 | - */ |
|
613 | - private $features_registry; |
|
614 | - |
|
615 | - private $analytics_settings_page; |
|
616 | - |
|
617 | - private $webhook_loader; |
|
618 | - |
|
619 | - /** |
|
620 | - * Define the core functionality of the plugin. |
|
621 | - * |
|
622 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
623 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
624 | - * the public-facing side of the site. |
|
625 | - * |
|
626 | - * @since 1.0.0 |
|
627 | - */ |
|
628 | - public function __construct() { |
|
629 | - |
|
630 | - self::$instance = $this; |
|
631 | - |
|
632 | - $this->plugin_name = 'wordlift'; |
|
633 | - $this->version = '3.37.2'; |
|
634 | - $this->load_dependencies(); |
|
635 | - $this->set_locale(); |
|
636 | - |
|
637 | - $that = $this; |
|
638 | - add_action( |
|
639 | - 'plugins_loaded', |
|
640 | - function () use ( $that ) { |
|
641 | - $that->define_admin_hooks( $that ); |
|
642 | - $that->define_public_hooks( $that ); |
|
643 | - }, |
|
644 | - 4 |
|
645 | - ); |
|
646 | - |
|
647 | - // If we're in `WP_CLI` load the related files. |
|
648 | - if ( class_exists( 'WP_CLI' ) ) { |
|
649 | - $this->load_cli_dependencies(); |
|
650 | - } |
|
651 | - |
|
652 | - } |
|
653 | - |
|
654 | - /** |
|
655 | - * Get the singleton instance. |
|
656 | - * |
|
657 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
658 | - * @since 3.11.2 |
|
659 | - */ |
|
660 | - public static function get_instance() { |
|
661 | - |
|
662 | - return self::$instance; |
|
663 | - } |
|
664 | - |
|
665 | - /** |
|
666 | - * Load the required dependencies for this plugin. |
|
667 | - * |
|
668 | - * Include the following files that make up the plugin: |
|
669 | - * |
|
670 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
671 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
672 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
673 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
674 | - * |
|
675 | - * Create an instance of the loader which will be used to register the hooks |
|
676 | - * with WordPress. |
|
677 | - * |
|
678 | - * @throws Exception when an error occurs. |
|
679 | - * @since 1.0.0 |
|
680 | - * @access private |
|
681 | - */ |
|
682 | - private function load_dependencies() { |
|
683 | - |
|
684 | - /** |
|
685 | - * The class responsible for orchestrating the actions and filters of the |
|
686 | - * core plugin. |
|
687 | - */ |
|
688 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
689 | - |
|
690 | - // The class responsible for plugin uninstall. |
|
691 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
692 | - |
|
693 | - /** |
|
694 | - * The class responsible for defining internationalization functionality |
|
695 | - * of the plugin. |
|
696 | - */ |
|
697 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
698 | - |
|
699 | - /** |
|
700 | - * WordLift's supported languages. |
|
701 | - */ |
|
702 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
703 | - |
|
704 | - /** |
|
705 | - * WordLift's supported countries. |
|
706 | - */ |
|
707 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
708 | - |
|
709 | - /** |
|
710 | - * Provide support functions to sanitize data. |
|
711 | - */ |
|
712 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
713 | - |
|
714 | - /** Services. */ |
|
715 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
716 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
717 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
718 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
719 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
720 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
721 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
722 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
723 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
724 | - |
|
725 | - /** |
|
726 | - * The Schema service. |
|
727 | - */ |
|
728 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
729 | - |
|
730 | - /** |
|
731 | - * The schema:url property service. |
|
732 | - */ |
|
733 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
734 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
735 | - |
|
736 | - /** |
|
737 | - * The UI service. |
|
738 | - */ |
|
739 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
740 | - |
|
741 | - /** |
|
742 | - * The Entity Types Taxonomy service. |
|
743 | - */ |
|
744 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
745 | - |
|
746 | - /** |
|
747 | - * The Entity service. |
|
748 | - */ |
|
749 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
750 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
751 | - |
|
752 | - // Add the entity rating service. |
|
753 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
754 | - |
|
755 | - /** |
|
756 | - * The User service. |
|
757 | - */ |
|
758 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
759 | - |
|
760 | - /** |
|
761 | - * The Timeline service. |
|
762 | - */ |
|
763 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
764 | - |
|
765 | - /** |
|
766 | - * The Topic Taxonomy service. |
|
767 | - */ |
|
768 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
769 | - |
|
770 | - /** |
|
771 | - * The WordLift URI service. |
|
772 | - */ |
|
773 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
774 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
775 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
776 | - |
|
777 | - require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
778 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
779 | - |
|
780 | - /** |
|
781 | - * Load the converters. |
|
782 | - */ |
|
783 | - require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
784 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
785 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
786 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
787 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
788 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
789 | - |
|
790 | - /** |
|
791 | - * Load cache-related files. |
|
792 | - */ |
|
793 | - require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
794 | - |
|
795 | - /** |
|
796 | - * Load the content filter. |
|
797 | - */ |
|
798 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
799 | - |
|
800 | - /* |
|
85 | + /** |
|
86 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
87 | + * the plugin. |
|
88 | + * |
|
89 | + * @since 1.0.0 |
|
90 | + * @access protected |
|
91 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
92 | + */ |
|
93 | + protected $loader; |
|
94 | + |
|
95 | + /** |
|
96 | + * The unique identifier of this plugin. |
|
97 | + * |
|
98 | + * @since 1.0.0 |
|
99 | + * @access protected |
|
100 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
101 | + */ |
|
102 | + protected $plugin_name; |
|
103 | + |
|
104 | + /** |
|
105 | + * The current version of the plugin. |
|
106 | + * |
|
107 | + * @since 1.0.0 |
|
108 | + * @access protected |
|
109 | + * @var string $version The current version of the plugin. |
|
110 | + */ |
|
111 | + protected $version; |
|
112 | + |
|
113 | + /** |
|
114 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
115 | + * |
|
116 | + * @since 3.12.0 |
|
117 | + * @access protected |
|
118 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
119 | + */ |
|
120 | + protected $tinymce_adapter; |
|
121 | + |
|
122 | + /** |
|
123 | + * The Schema service. |
|
124 | + * |
|
125 | + * @since 3.3.0 |
|
126 | + * @access protected |
|
127 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
128 | + */ |
|
129 | + protected $schema_service; |
|
130 | + |
|
131 | + /** |
|
132 | + * The Topic Taxonomy service. |
|
133 | + * |
|
134 | + * @since 3.5.0 |
|
135 | + * @access private |
|
136 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
137 | + */ |
|
138 | + private $topic_taxonomy_service; |
|
139 | + |
|
140 | + /** |
|
141 | + * The Entity Types Taxonomy service. |
|
142 | + * |
|
143 | + * @since 3.18.0 |
|
144 | + * @access private |
|
145 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
146 | + */ |
|
147 | + private $entity_types_taxonomy_service; |
|
148 | + |
|
149 | + /** |
|
150 | + * The User service. |
|
151 | + * |
|
152 | + * @since 3.1.7 |
|
153 | + * @access protected |
|
154 | + * @var \Wordlift_User_Service $user_service The User service. |
|
155 | + */ |
|
156 | + protected $user_service; |
|
157 | + |
|
158 | + /** |
|
159 | + * The Timeline service. |
|
160 | + * |
|
161 | + * @since 3.1.0 |
|
162 | + * @access private |
|
163 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
164 | + */ |
|
165 | + private $timeline_service; |
|
166 | + |
|
167 | + /** |
|
168 | + * The Redirect service. |
|
169 | + * |
|
170 | + * @since 3.2.0 |
|
171 | + * @access private |
|
172 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
173 | + */ |
|
174 | + private $redirect_service; |
|
175 | + |
|
176 | + /** |
|
177 | + * The Notice service. |
|
178 | + * |
|
179 | + * @since 3.3.0 |
|
180 | + * @access private |
|
181 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
182 | + */ |
|
183 | + private $notice_service; |
|
184 | + |
|
185 | + /** |
|
186 | + * The Entity list customization. |
|
187 | + * |
|
188 | + * @since 3.3.0 |
|
189 | + * @access protected |
|
190 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
191 | + */ |
|
192 | + protected $entity_list_service; |
|
193 | + |
|
194 | + /** |
|
195 | + * The Entity Types Taxonomy Walker. |
|
196 | + * |
|
197 | + * @since 3.1.0 |
|
198 | + * @access private |
|
199 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
200 | + */ |
|
201 | + private $entity_types_taxonomy_walker; |
|
202 | + |
|
203 | + /** |
|
204 | + * The ShareThis service. |
|
205 | + * |
|
206 | + * @since 3.2.0 |
|
207 | + * @access private |
|
208 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
209 | + */ |
|
210 | + private $sharethis_service; |
|
211 | + |
|
212 | + /** |
|
213 | + * The PrimaShop adapter. |
|
214 | + * |
|
215 | + * @since 3.2.3 |
|
216 | + * @access private |
|
217 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
218 | + */ |
|
219 | + private $primashop_adapter; |
|
220 | + |
|
221 | + /** |
|
222 | + * The entity type service. |
|
223 | + * |
|
224 | + * @since 3.6.0 |
|
225 | + * @access private |
|
226 | + * @var \Wordlift_Entity_Post_Type_Service |
|
227 | + */ |
|
228 | + private $entity_post_type_service; |
|
229 | + |
|
230 | + /** |
|
231 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
232 | + * |
|
233 | + * @since 3.6.0 |
|
234 | + * @access private |
|
235 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
236 | + */ |
|
237 | + private $entity_link_service; |
|
238 | + |
|
239 | + /** |
|
240 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
241 | + * |
|
242 | + * @since 3.7.0 |
|
243 | + * @access protected |
|
244 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
245 | + */ |
|
246 | + protected $jsonld_service; |
|
247 | + |
|
248 | + /** |
|
249 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
250 | + * |
|
251 | + * @since 3.14.0 |
|
252 | + * @access protected |
|
253 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
254 | + */ |
|
255 | + protected $jsonld_website_converter; |
|
256 | + |
|
257 | + /** |
|
258 | + * A {@link Wordlift_Property_Factory} instance. |
|
259 | + * |
|
260 | + * @since 3.7.0 |
|
261 | + * @access private |
|
262 | + * @var \Wordlift_Property_Factory $property_factory |
|
263 | + */ |
|
264 | + private $property_factory; |
|
265 | + |
|
266 | + /** |
|
267 | + * The 'Download Your Data' page. |
|
268 | + * |
|
269 | + * @since 3.6.0 |
|
270 | + * @access private |
|
271 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
272 | + */ |
|
273 | + private $download_your_data_page; |
|
274 | + |
|
275 | + /** |
|
276 | + * The 'WordLift Settings' page. |
|
277 | + * |
|
278 | + * @since 3.11.0 |
|
279 | + * @access protected |
|
280 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
281 | + */ |
|
282 | + protected $settings_page; |
|
283 | + |
|
284 | + /** |
|
285 | + * The install wizard page. |
|
286 | + * |
|
287 | + * @since 3.9.0 |
|
288 | + * @access private |
|
289 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
290 | + */ |
|
291 | + public $admin_setup; |
|
292 | + |
|
293 | + /** |
|
294 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
295 | + * linking of entities to their pages. |
|
296 | + * |
|
297 | + * @since 3.8.0 |
|
298 | + * @access private |
|
299 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
300 | + */ |
|
301 | + private $content_filter_service; |
|
302 | + |
|
303 | + /** |
|
304 | + * The Faq Content filter service |
|
305 | + * |
|
306 | + * @since 3.26.0 |
|
307 | + * @access private |
|
308 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
309 | + */ |
|
310 | + private $faq_content_filter_service; |
|
311 | + |
|
312 | + /** |
|
313 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
314 | + * |
|
315 | + * @since 3.9.0 |
|
316 | + * @access private |
|
317 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
318 | + */ |
|
319 | + private $key_validation_service; |
|
320 | + |
|
321 | + /** |
|
322 | + * A {@link Wordlift_Rating_Service} instance. |
|
323 | + * |
|
324 | + * @since 3.10.0 |
|
325 | + * @access private |
|
326 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
327 | + */ |
|
328 | + private $rating_service; |
|
329 | + |
|
330 | + /** |
|
331 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
332 | + * |
|
333 | + * @since 3.10.0 |
|
334 | + * @access protected |
|
335 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
336 | + */ |
|
337 | + protected $post_to_jsonld_converter; |
|
338 | + |
|
339 | + /** |
|
340 | + * A {@link Wordlift_Install_Service} instance. |
|
341 | + * |
|
342 | + * @since 3.18.0 |
|
343 | + * @access protected |
|
344 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
345 | + */ |
|
346 | + protected $install_service; |
|
347 | + |
|
348 | + /** |
|
349 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
350 | + * |
|
351 | + * @since 3.10.0 |
|
352 | + * @access protected |
|
353 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
354 | + */ |
|
355 | + protected $entity_post_to_jsonld_converter; |
|
356 | + |
|
357 | + /** |
|
358 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
359 | + * |
|
360 | + * @since 3.10.0 |
|
361 | + * @access protected |
|
362 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
363 | + */ |
|
364 | + protected $postid_to_jsonld_converter; |
|
365 | + |
|
366 | + /** |
|
367 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
368 | + * |
|
369 | + * @since 3.11.0 |
|
370 | + * @access protected |
|
371 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
372 | + */ |
|
373 | + protected $category_taxonomy_service; |
|
374 | + |
|
375 | + /** |
|
376 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
377 | + * |
|
378 | + * @since 3.11.0 |
|
379 | + * @access protected |
|
380 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
381 | + */ |
|
382 | + protected $entity_page_service; |
|
383 | + |
|
384 | + /** |
|
385 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
386 | + * |
|
387 | + * @since 3.11.0 |
|
388 | + * @access protected |
|
389 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
390 | + */ |
|
391 | + protected $settings_page_action_link; |
|
392 | + |
|
393 | + /** |
|
394 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
395 | + * |
|
396 | + * @since 3.11.0 |
|
397 | + * @access protected |
|
398 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
399 | + */ |
|
400 | + protected $analytics_settings_page_action_link; |
|
401 | + |
|
402 | + /** |
|
403 | + * The {@link Wordlift_Analytics_Connect} class. |
|
404 | + * |
|
405 | + * @since 3.11.0 |
|
406 | + * @access protected |
|
407 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
408 | + */ |
|
409 | + protected $analytics_connect; |
|
410 | + |
|
411 | + /** |
|
412 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
413 | + * |
|
414 | + * @since 3.11.0 |
|
415 | + * @access protected |
|
416 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
417 | + */ |
|
418 | + protected $publisher_ajax_adapter; |
|
419 | + |
|
420 | + /** |
|
421 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
422 | + * |
|
423 | + * @since 3.11.0 |
|
424 | + * @access protected |
|
425 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
426 | + */ |
|
427 | + protected $input_element; |
|
428 | + |
|
429 | + /** |
|
430 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
431 | + * |
|
432 | + * @since 3.13.0 |
|
433 | + * @access protected |
|
434 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
435 | + */ |
|
436 | + protected $radio_input_element; |
|
437 | + |
|
438 | + /** |
|
439 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
440 | + * |
|
441 | + * @since 3.11.0 |
|
442 | + * @access protected |
|
443 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
444 | + */ |
|
445 | + protected $language_select_element; |
|
446 | + |
|
447 | + /** |
|
448 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
449 | + * |
|
450 | + * @since 3.18.0 |
|
451 | + * @access protected |
|
452 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
453 | + */ |
|
454 | + protected $country_select_element; |
|
455 | + |
|
456 | + /** |
|
457 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
458 | + * |
|
459 | + * @since 3.11.0 |
|
460 | + * @access protected |
|
461 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
462 | + */ |
|
463 | + protected $publisher_element; |
|
464 | + |
|
465 | + /** |
|
466 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
467 | + * |
|
468 | + * @since 3.11.0 |
|
469 | + * @access protected |
|
470 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
471 | + */ |
|
472 | + protected $select2_element; |
|
473 | + |
|
474 | + /** |
|
475 | + * The controller for the entity type list admin page |
|
476 | + * |
|
477 | + * @since 3.11.0 |
|
478 | + * @access private |
|
479 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
480 | + */ |
|
481 | + private $entity_type_admin_page; |
|
482 | + |
|
483 | + /** |
|
484 | + * The controller for the entity type settings admin page |
|
485 | + * |
|
486 | + * @since 3.11.0 |
|
487 | + * @access private |
|
488 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
489 | + */ |
|
490 | + private $entity_type_settings_admin_page; |
|
491 | + |
|
492 | + /** |
|
493 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
494 | + * |
|
495 | + * @since 3.11.0 |
|
496 | + * @access protected |
|
497 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
498 | + */ |
|
499 | + protected $related_entities_cloud_widget; |
|
500 | + |
|
501 | + /** |
|
502 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
503 | + * |
|
504 | + * @since 3.14.0 |
|
505 | + * @access protected |
|
506 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
507 | + */ |
|
508 | + protected $author_element; |
|
509 | + |
|
510 | + /** |
|
511 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
512 | + * |
|
513 | + * @since 3.12.0 |
|
514 | + * @access protected |
|
515 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
516 | + */ |
|
517 | + protected $sample_data_service; |
|
518 | + |
|
519 | + /** |
|
520 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
521 | + * |
|
522 | + * @since 3.12.0 |
|
523 | + * @access protected |
|
524 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
525 | + */ |
|
526 | + protected $sample_data_ajax_adapter; |
|
527 | + |
|
528 | + /** |
|
529 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
530 | + * |
|
531 | + * @since 3.16.0 |
|
532 | + * @access protected |
|
533 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
534 | + */ |
|
535 | + protected $google_analytics_export_service; |
|
536 | + |
|
537 | + /** |
|
538 | + * {@link Wordlift}'s singleton instance. |
|
539 | + * |
|
540 | + * @since 3.15.0 |
|
541 | + * @access protected |
|
542 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
543 | + */ |
|
544 | + protected $entity_type_adapter; |
|
545 | + |
|
546 | + /** |
|
547 | + * The {@link Wordlift_Storage_Factory} instance. |
|
548 | + * |
|
549 | + * @since 3.15.0 |
|
550 | + * @access protected |
|
551 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
552 | + */ |
|
553 | + protected $storage_factory; |
|
554 | + |
|
555 | + /** |
|
556 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
557 | + * |
|
558 | + * @since 3.15.0 |
|
559 | + * @access private |
|
560 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
561 | + */ |
|
562 | + private $autocomplete_adapter; |
|
563 | + |
|
564 | + /** |
|
565 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
566 | + * |
|
567 | + * @since 3.16.0 |
|
568 | + * @access protected |
|
569 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
570 | + */ |
|
571 | + protected $cached_postid_to_jsonld_converter; |
|
572 | + |
|
573 | + /** |
|
574 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
575 | + * |
|
576 | + * @since 3.16.3 |
|
577 | + * @access protected |
|
578 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
579 | + */ |
|
580 | + protected $entity_uri_service; |
|
581 | + |
|
582 | + /** |
|
583 | + * The {@link Wordlift_Publisher_Service} instance. |
|
584 | + * |
|
585 | + * @since 3.19.0 |
|
586 | + * @access protected |
|
587 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
588 | + */ |
|
589 | + protected $publisher_service; |
|
590 | + |
|
591 | + /** |
|
592 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
593 | + * |
|
594 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
595 | + */ |
|
596 | + protected $context_cards_service; |
|
597 | + |
|
598 | + /** |
|
599 | + * {@link Wordlift}'s singleton instance. |
|
600 | + * |
|
601 | + * @since 3.11.2 |
|
602 | + * @access private |
|
603 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
604 | + */ |
|
605 | + private static $instance; |
|
606 | + |
|
607 | + /** |
|
608 | + * A singleton instance of features registry. |
|
609 | + * |
|
610 | + * @since 3.30.0 |
|
611 | + * @var Features_Registry |
|
612 | + */ |
|
613 | + private $features_registry; |
|
614 | + |
|
615 | + private $analytics_settings_page; |
|
616 | + |
|
617 | + private $webhook_loader; |
|
618 | + |
|
619 | + /** |
|
620 | + * Define the core functionality of the plugin. |
|
621 | + * |
|
622 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
623 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
624 | + * the public-facing side of the site. |
|
625 | + * |
|
626 | + * @since 1.0.0 |
|
627 | + */ |
|
628 | + public function __construct() { |
|
629 | + |
|
630 | + self::$instance = $this; |
|
631 | + |
|
632 | + $this->plugin_name = 'wordlift'; |
|
633 | + $this->version = '3.37.2'; |
|
634 | + $this->load_dependencies(); |
|
635 | + $this->set_locale(); |
|
636 | + |
|
637 | + $that = $this; |
|
638 | + add_action( |
|
639 | + 'plugins_loaded', |
|
640 | + function () use ( $that ) { |
|
641 | + $that->define_admin_hooks( $that ); |
|
642 | + $that->define_public_hooks( $that ); |
|
643 | + }, |
|
644 | + 4 |
|
645 | + ); |
|
646 | + |
|
647 | + // If we're in `WP_CLI` load the related files. |
|
648 | + if ( class_exists( 'WP_CLI' ) ) { |
|
649 | + $this->load_cli_dependencies(); |
|
650 | + } |
|
651 | + |
|
652 | + } |
|
653 | + |
|
654 | + /** |
|
655 | + * Get the singleton instance. |
|
656 | + * |
|
657 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
658 | + * @since 3.11.2 |
|
659 | + */ |
|
660 | + public static function get_instance() { |
|
661 | + |
|
662 | + return self::$instance; |
|
663 | + } |
|
664 | + |
|
665 | + /** |
|
666 | + * Load the required dependencies for this plugin. |
|
667 | + * |
|
668 | + * Include the following files that make up the plugin: |
|
669 | + * |
|
670 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
671 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
672 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
673 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
674 | + * |
|
675 | + * Create an instance of the loader which will be used to register the hooks |
|
676 | + * with WordPress. |
|
677 | + * |
|
678 | + * @throws Exception when an error occurs. |
|
679 | + * @since 1.0.0 |
|
680 | + * @access private |
|
681 | + */ |
|
682 | + private function load_dependencies() { |
|
683 | + |
|
684 | + /** |
|
685 | + * The class responsible for orchestrating the actions and filters of the |
|
686 | + * core plugin. |
|
687 | + */ |
|
688 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
689 | + |
|
690 | + // The class responsible for plugin uninstall. |
|
691 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
692 | + |
|
693 | + /** |
|
694 | + * The class responsible for defining internationalization functionality |
|
695 | + * of the plugin. |
|
696 | + */ |
|
697 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
698 | + |
|
699 | + /** |
|
700 | + * WordLift's supported languages. |
|
701 | + */ |
|
702 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
703 | + |
|
704 | + /** |
|
705 | + * WordLift's supported countries. |
|
706 | + */ |
|
707 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
708 | + |
|
709 | + /** |
|
710 | + * Provide support functions to sanitize data. |
|
711 | + */ |
|
712 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
713 | + |
|
714 | + /** Services. */ |
|
715 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
716 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
717 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
718 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
719 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
720 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
721 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
722 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
723 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
724 | + |
|
725 | + /** |
|
726 | + * The Schema service. |
|
727 | + */ |
|
728 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
729 | + |
|
730 | + /** |
|
731 | + * The schema:url property service. |
|
732 | + */ |
|
733 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
734 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
735 | + |
|
736 | + /** |
|
737 | + * The UI service. |
|
738 | + */ |
|
739 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
740 | + |
|
741 | + /** |
|
742 | + * The Entity Types Taxonomy service. |
|
743 | + */ |
|
744 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
745 | + |
|
746 | + /** |
|
747 | + * The Entity service. |
|
748 | + */ |
|
749 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
750 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
751 | + |
|
752 | + // Add the entity rating service. |
|
753 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
754 | + |
|
755 | + /** |
|
756 | + * The User service. |
|
757 | + */ |
|
758 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
759 | + |
|
760 | + /** |
|
761 | + * The Timeline service. |
|
762 | + */ |
|
763 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
764 | + |
|
765 | + /** |
|
766 | + * The Topic Taxonomy service. |
|
767 | + */ |
|
768 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
769 | + |
|
770 | + /** |
|
771 | + * The WordLift URI service. |
|
772 | + */ |
|
773 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
774 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
775 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
776 | + |
|
777 | + require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
778 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
779 | + |
|
780 | + /** |
|
781 | + * Load the converters. |
|
782 | + */ |
|
783 | + require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
784 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
785 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
786 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
787 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
788 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
789 | + |
|
790 | + /** |
|
791 | + * Load cache-related files. |
|
792 | + */ |
|
793 | + require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
794 | + |
|
795 | + /** |
|
796 | + * Load the content filter. |
|
797 | + */ |
|
798 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
799 | + |
|
800 | + /* |
|
801 | 801 | * Load the excerpt helper. |
802 | 802 | */ |
803 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
804 | - |
|
805 | - /** |
|
806 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
807 | - * |
|
808 | - * @since 3.8.0 |
|
809 | - */ |
|
810 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
811 | - |
|
812 | - // The Publisher Service and the AJAX adapter. |
|
813 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
814 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
815 | - |
|
816 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
817 | - |
|
818 | - /** |
|
819 | - * Load the WordLift key validation service. |
|
820 | - */ |
|
821 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
822 | - |
|
823 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
824 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
825 | - |
|
826 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
827 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
828 | - |
|
829 | - /** Linked Data. */ |
|
830 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
831 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
832 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
833 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
834 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
835 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
836 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
837 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
838 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
839 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
840 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
841 | - |
|
842 | - /** Services. */ |
|
843 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
844 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
845 | - |
|
846 | - /** Adapters. */ |
|
847 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
848 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
849 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
850 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
851 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
852 | - |
|
853 | - /** Autocomplete. */ |
|
854 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
855 | - |
|
856 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
857 | - |
|
858 | - /** Analytics */ |
|
859 | - require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
860 | - |
|
861 | - /** |
|
862 | - * The class responsible for defining all actions that occur in the admin area. |
|
863 | - */ |
|
864 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
865 | - |
|
866 | - /** |
|
867 | - * The class to customize the entity list admin page. |
|
868 | - */ |
|
869 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
870 | - |
|
871 | - /** |
|
872 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
873 | - */ |
|
874 | - global $wp_version; |
|
875 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
876 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
877 | - } else { |
|
878 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
879 | - } |
|
880 | - |
|
881 | - /** |
|
882 | - * The Notice service. |
|
883 | - */ |
|
884 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
885 | - |
|
886 | - /** |
|
887 | - * The PrimaShop adapter. |
|
888 | - */ |
|
889 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
890 | - |
|
891 | - /** |
|
892 | - * The WordLift Dashboard service. |
|
893 | - */ |
|
894 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
895 | - |
|
896 | - /** |
|
897 | - * The admin 'Install wizard' page. |
|
898 | - */ |
|
899 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
900 | - |
|
901 | - /** |
|
902 | - * The WordLift entity type list admin page controller. |
|
903 | - */ |
|
904 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
905 | - |
|
906 | - /** |
|
907 | - * The WordLift entity type settings admin page controller. |
|
908 | - */ |
|
909 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
910 | - |
|
911 | - /** |
|
912 | - * The admin 'Download Your Data' page. |
|
913 | - */ |
|
914 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
915 | - |
|
916 | - /** |
|
917 | - * The admin 'WordLift Settings' page. |
|
918 | - */ |
|
919 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
920 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
921 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
922 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
923 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
924 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
925 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
926 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
927 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
928 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
929 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
930 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
931 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
932 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
933 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
934 | - |
|
935 | - /** Admin Pages */ |
|
936 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
937 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
938 | - |
|
939 | - /** |
|
940 | - * The class responsible for defining all actions that occur in the public-facing |
|
941 | - * side of the site. |
|
942 | - */ |
|
943 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
944 | - |
|
945 | - /** |
|
946 | - * The shortcode abstract class. |
|
947 | - */ |
|
948 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
949 | - |
|
950 | - /** |
|
951 | - * The Timeline shortcode. |
|
952 | - */ |
|
953 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
954 | - |
|
955 | - /** |
|
956 | - * The Navigator shortcode. |
|
957 | - */ |
|
958 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
959 | - |
|
960 | - /** |
|
961 | - * The Products Navigator shortcode. |
|
962 | - */ |
|
963 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
964 | - |
|
965 | - /** |
|
966 | - * The chord shortcode. |
|
967 | - */ |
|
968 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
969 | - |
|
970 | - /** |
|
971 | - * The geomap shortcode. |
|
972 | - */ |
|
973 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
974 | - |
|
975 | - /** |
|
976 | - * The entity cloud shortcode. |
|
977 | - */ |
|
978 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
979 | - |
|
980 | - /** |
|
981 | - * The entity glossary shortcode. |
|
982 | - */ |
|
983 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
984 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
985 | - |
|
986 | - /** |
|
987 | - * Faceted Search shortcode. |
|
988 | - */ |
|
989 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
990 | - |
|
991 | - /** |
|
992 | - * The ShareThis service. |
|
993 | - */ |
|
994 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
995 | - |
|
996 | - /** |
|
997 | - * The SEO service. |
|
998 | - */ |
|
999 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
1000 | - |
|
1001 | - /** |
|
1002 | - * The AMP service. |
|
1003 | - */ |
|
1004 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
1005 | - |
|
1006 | - /** Widgets */ |
|
1007 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
1008 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1009 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
1010 | - |
|
1011 | - /* |
|
803 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
804 | + |
|
805 | + /** |
|
806 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
807 | + * |
|
808 | + * @since 3.8.0 |
|
809 | + */ |
|
810 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
811 | + |
|
812 | + // The Publisher Service and the AJAX adapter. |
|
813 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
814 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
815 | + |
|
816 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
817 | + |
|
818 | + /** |
|
819 | + * Load the WordLift key validation service. |
|
820 | + */ |
|
821 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
822 | + |
|
823 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
824 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
825 | + |
|
826 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
827 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
828 | + |
|
829 | + /** Linked Data. */ |
|
830 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
831 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
832 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
833 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
834 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
835 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
836 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
837 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
838 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
839 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
840 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
841 | + |
|
842 | + /** Services. */ |
|
843 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
844 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
845 | + |
|
846 | + /** Adapters. */ |
|
847 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
848 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
849 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
850 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
851 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
852 | + |
|
853 | + /** Autocomplete. */ |
|
854 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
855 | + |
|
856 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
857 | + |
|
858 | + /** Analytics */ |
|
859 | + require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
860 | + |
|
861 | + /** |
|
862 | + * The class responsible for defining all actions that occur in the admin area. |
|
863 | + */ |
|
864 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
865 | + |
|
866 | + /** |
|
867 | + * The class to customize the entity list admin page. |
|
868 | + */ |
|
869 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
870 | + |
|
871 | + /** |
|
872 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
873 | + */ |
|
874 | + global $wp_version; |
|
875 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
876 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
877 | + } else { |
|
878 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
879 | + } |
|
880 | + |
|
881 | + /** |
|
882 | + * The Notice service. |
|
883 | + */ |
|
884 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
885 | + |
|
886 | + /** |
|
887 | + * The PrimaShop adapter. |
|
888 | + */ |
|
889 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
890 | + |
|
891 | + /** |
|
892 | + * The WordLift Dashboard service. |
|
893 | + */ |
|
894 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
895 | + |
|
896 | + /** |
|
897 | + * The admin 'Install wizard' page. |
|
898 | + */ |
|
899 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
900 | + |
|
901 | + /** |
|
902 | + * The WordLift entity type list admin page controller. |
|
903 | + */ |
|
904 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
905 | + |
|
906 | + /** |
|
907 | + * The WordLift entity type settings admin page controller. |
|
908 | + */ |
|
909 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
910 | + |
|
911 | + /** |
|
912 | + * The admin 'Download Your Data' page. |
|
913 | + */ |
|
914 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
915 | + |
|
916 | + /** |
|
917 | + * The admin 'WordLift Settings' page. |
|
918 | + */ |
|
919 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
920 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
921 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
922 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
923 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
924 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
925 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
926 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
927 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
928 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
929 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
930 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
931 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
932 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
933 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
934 | + |
|
935 | + /** Admin Pages */ |
|
936 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
937 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
938 | + |
|
939 | + /** |
|
940 | + * The class responsible for defining all actions that occur in the public-facing |
|
941 | + * side of the site. |
|
942 | + */ |
|
943 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
944 | + |
|
945 | + /** |
|
946 | + * The shortcode abstract class. |
|
947 | + */ |
|
948 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
949 | + |
|
950 | + /** |
|
951 | + * The Timeline shortcode. |
|
952 | + */ |
|
953 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
954 | + |
|
955 | + /** |
|
956 | + * The Navigator shortcode. |
|
957 | + */ |
|
958 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
959 | + |
|
960 | + /** |
|
961 | + * The Products Navigator shortcode. |
|
962 | + */ |
|
963 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
964 | + |
|
965 | + /** |
|
966 | + * The chord shortcode. |
|
967 | + */ |
|
968 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
969 | + |
|
970 | + /** |
|
971 | + * The geomap shortcode. |
|
972 | + */ |
|
973 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
974 | + |
|
975 | + /** |
|
976 | + * The entity cloud shortcode. |
|
977 | + */ |
|
978 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
979 | + |
|
980 | + /** |
|
981 | + * The entity glossary shortcode. |
|
982 | + */ |
|
983 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
984 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
985 | + |
|
986 | + /** |
|
987 | + * Faceted Search shortcode. |
|
988 | + */ |
|
989 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
990 | + |
|
991 | + /** |
|
992 | + * The ShareThis service. |
|
993 | + */ |
|
994 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
995 | + |
|
996 | + /** |
|
997 | + * The SEO service. |
|
998 | + */ |
|
999 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
1000 | + |
|
1001 | + /** |
|
1002 | + * The AMP service. |
|
1003 | + */ |
|
1004 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
1005 | + |
|
1006 | + /** Widgets */ |
|
1007 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
1008 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1009 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
1010 | + |
|
1011 | + /* |
|
1012 | 1012 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
1013 | 1013 | * |
1014 | 1014 | * Eventually Batch Actions will become Batch Operations. |
1015 | 1015 | * |
1016 | 1016 | * @since 3.20.0 |
1017 | 1017 | */ |
1018 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1019 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1018 | + require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1019 | + require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1020 | 1020 | |
1021 | - /* |
|
1021 | + /* |
|
1022 | 1022 | * Schema.org Services. |
1023 | 1023 | * |
1024 | 1024 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1025 | 1025 | */ |
1026 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1027 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1028 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1029 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1030 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1031 | - new Wordlift_Schemaorg_Sync_Service(); |
|
1032 | - $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
1033 | - new Wordlift_Schemaorg_Class_Service(); |
|
1034 | - } else { |
|
1035 | - $schemaorg_property_service = null; |
|
1036 | - } |
|
1037 | - |
|
1038 | - $this->loader = new Wordlift_Loader(); |
|
1039 | - /** |
|
1040 | - * @since 3.30.0 |
|
1041 | - */ |
|
1042 | - $this->features_registry = Features_Registry::get_instance(); |
|
1043 | - |
|
1044 | - // Instantiate a global logger. |
|
1045 | - global $wl_logger; |
|
1046 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1047 | - |
|
1048 | - // Load the `wl-api` end-point. |
|
1049 | - new Wordlift_Http_Api(); |
|
1050 | - |
|
1051 | - // Load the Install Service. |
|
1052 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
1053 | - $this->install_service = new Wordlift_Install_Service(); |
|
1054 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
1055 | - $this->user_service = Wordlift_User_Service::get_instance(); |
|
1056 | - // create an instance of the entity type list admin page controller. |
|
1057 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
1058 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
1059 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
1060 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
1061 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
1062 | - Wordlift_Entity_Service::TYPE_NAME, |
|
1063 | - Wordlift_Configuration_Service::get_instance()->get_entity_base_path() |
|
1064 | - ); |
|
1065 | - /* WordPress Admin. */ |
|
1066 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
1067 | - // create an instance of the entity type setting admin page controller. |
|
1068 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
1069 | - |
|
1070 | - $that = $this; |
|
1071 | - add_action( |
|
1072 | - 'plugins_loaded', |
|
1073 | - // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
|
1074 | - function () use ( &$that, $schemaorg_property_service ) { |
|
1075 | - |
|
1076 | - /** Services. */ |
|
1077 | - // Create the configuration service. |
|
1078 | - $api_service = new Wordlift_Api_Service(); |
|
1079 | - |
|
1080 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
1081 | - $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
1082 | - |
|
1083 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
1084 | - |
|
1085 | - $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
1086 | - |
|
1087 | - // Create a new instance of the Redirect service. |
|
1088 | - $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
1089 | - |
|
1090 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
1091 | - $that->timeline_service = new Wordlift_Timeline_Service(); |
|
1092 | - |
|
1093 | - $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
1094 | - |
|
1095 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
1096 | - $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
1097 | - |
|
1098 | - // Create an instance of the PrimaShop adapter. |
|
1099 | - $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
1100 | - |
|
1101 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1102 | - |
|
1103 | - // Create the entity rating service. |
|
1104 | - $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
1105 | - |
|
1106 | - // Create entity list customization (wp-admin/edit.php). |
|
1107 | - $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
1108 | - |
|
1109 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
1110 | - $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
1111 | - $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1112 | - $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1113 | - |
|
1114 | - $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
1115 | - |
|
1116 | - // Instantiate the JSON-LD service. |
|
1117 | - $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
1118 | - $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1119 | - $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
1120 | - $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
1121 | - $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1122 | - |
|
1123 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
1124 | - $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
1125 | - /* |
|
1026 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1027 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1028 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1029 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1030 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1031 | + new Wordlift_Schemaorg_Sync_Service(); |
|
1032 | + $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
1033 | + new Wordlift_Schemaorg_Class_Service(); |
|
1034 | + } else { |
|
1035 | + $schemaorg_property_service = null; |
|
1036 | + } |
|
1037 | + |
|
1038 | + $this->loader = new Wordlift_Loader(); |
|
1039 | + /** |
|
1040 | + * @since 3.30.0 |
|
1041 | + */ |
|
1042 | + $this->features_registry = Features_Registry::get_instance(); |
|
1043 | + |
|
1044 | + // Instantiate a global logger. |
|
1045 | + global $wl_logger; |
|
1046 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1047 | + |
|
1048 | + // Load the `wl-api` end-point. |
|
1049 | + new Wordlift_Http_Api(); |
|
1050 | + |
|
1051 | + // Load the Install Service. |
|
1052 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
1053 | + $this->install_service = new Wordlift_Install_Service(); |
|
1054 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
1055 | + $this->user_service = Wordlift_User_Service::get_instance(); |
|
1056 | + // create an instance of the entity type list admin page controller. |
|
1057 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
1058 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
1059 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
1060 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
1061 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
1062 | + Wordlift_Entity_Service::TYPE_NAME, |
|
1063 | + Wordlift_Configuration_Service::get_instance()->get_entity_base_path() |
|
1064 | + ); |
|
1065 | + /* WordPress Admin. */ |
|
1066 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
1067 | + // create an instance of the entity type setting admin page controller. |
|
1068 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
1069 | + |
|
1070 | + $that = $this; |
|
1071 | + add_action( |
|
1072 | + 'plugins_loaded', |
|
1073 | + // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
|
1074 | + function () use ( &$that, $schemaorg_property_service ) { |
|
1075 | + |
|
1076 | + /** Services. */ |
|
1077 | + // Create the configuration service. |
|
1078 | + $api_service = new Wordlift_Api_Service(); |
|
1079 | + |
|
1080 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
1081 | + $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
1082 | + |
|
1083 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
1084 | + |
|
1085 | + $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
1086 | + |
|
1087 | + // Create a new instance of the Redirect service. |
|
1088 | + $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
1089 | + |
|
1090 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
1091 | + $that->timeline_service = new Wordlift_Timeline_Service(); |
|
1092 | + |
|
1093 | + $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
1094 | + |
|
1095 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
1096 | + $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
1097 | + |
|
1098 | + // Create an instance of the PrimaShop adapter. |
|
1099 | + $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
1100 | + |
|
1101 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1102 | + |
|
1103 | + // Create the entity rating service. |
|
1104 | + $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
1105 | + |
|
1106 | + // Create entity list customization (wp-admin/edit.php). |
|
1107 | + $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
1108 | + |
|
1109 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
1110 | + $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
1111 | + $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1112 | + $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1113 | + |
|
1114 | + $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
1115 | + |
|
1116 | + // Instantiate the JSON-LD service. |
|
1117 | + $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
1118 | + $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1119 | + $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
1120 | + $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
1121 | + $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1122 | + |
|
1123 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
1124 | + $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
1125 | + /* |
|
1126 | 1126 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
1127 | 1127 | * |
1128 | 1128 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
1129 | 1129 | * |
1130 | 1130 | * @since 3.20.0 |
1131 | 1131 | */ |
1132 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1133 | - |
|
1134 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
1135 | - $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
1136 | - |
|
1137 | - $jsonld_service = new Jsonld_Service( |
|
1138 | - $that->jsonld_service, |
|
1139 | - $term_jsonld_adapter, |
|
1140 | - new Jsonld_User_Service( $that->user_service ) |
|
1141 | - ); |
|
1142 | - new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
1143 | - |
|
1144 | - // Prints the JSON-LD in the head. |
|
1145 | - new Jsonld_Adapter( $that->jsonld_service ); |
|
1146 | - |
|
1147 | - new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
1148 | - |
|
1149 | - /** |
|
1150 | - * @since 3.37.1 |
|
1151 | - * Add mentions property to the entity. |
|
1152 | - */ |
|
1153 | - new Mentions(); |
|
1154 | - |
|
1155 | - $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
1156 | - $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
1157 | - // Creating Faq Content filter service. |
|
1158 | - $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
1159 | - $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
1160 | - $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
1161 | - |
|
1162 | - $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
1163 | - $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
1164 | - |
|
1165 | - /** |
|
1166 | - * Filter: wl_feature__enable__blocks. |
|
1167 | - * |
|
1168 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
1169 | - * |
|
1170 | - * @return bool |
|
1171 | - * @since 3.27.6 |
|
1172 | - */ |
|
1173 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1174 | - // Initialize the short-codes. |
|
1175 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
1176 | - new Wordlift_Chord_Shortcode(); |
|
1177 | - new Wordlift_Geomap_Shortcode(); |
|
1178 | - new Wordlift_Timeline_Shortcode(); |
|
1179 | - new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
1180 | - new Wordlift_Vocabulary_Shortcode(); |
|
1181 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
1182 | - } |
|
1183 | - |
|
1184 | - new Wordlift_Products_Navigator_Shortcode(); |
|
1185 | - |
|
1186 | - // Initialize the Context Cards Service |
|
1187 | - $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
1188 | - |
|
1189 | - // Initialize the SEO service. |
|
1190 | - new Wordlift_Seo_Service(); |
|
1191 | - |
|
1192 | - // Initialize the AMP service. |
|
1193 | - new Wordlift_AMP_Service( $that->jsonld_service ); |
|
1194 | - |
|
1195 | - /** Services. */ |
|
1196 | - $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
1197 | - new Wordlift_Image_Service(); |
|
1198 | - |
|
1199 | - /** Adapters. */ |
|
1200 | - $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
1201 | - $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
1202 | - $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
1203 | - |
|
1204 | - /* |
|
1132 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1133 | + |
|
1134 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
1135 | + $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
1136 | + |
|
1137 | + $jsonld_service = new Jsonld_Service( |
|
1138 | + $that->jsonld_service, |
|
1139 | + $term_jsonld_adapter, |
|
1140 | + new Jsonld_User_Service( $that->user_service ) |
|
1141 | + ); |
|
1142 | + new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
1143 | + |
|
1144 | + // Prints the JSON-LD in the head. |
|
1145 | + new Jsonld_Adapter( $that->jsonld_service ); |
|
1146 | + |
|
1147 | + new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
1148 | + |
|
1149 | + /** |
|
1150 | + * @since 3.37.1 |
|
1151 | + * Add mentions property to the entity. |
|
1152 | + */ |
|
1153 | + new Mentions(); |
|
1154 | + |
|
1155 | + $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
1156 | + $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
1157 | + // Creating Faq Content filter service. |
|
1158 | + $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
1159 | + $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
1160 | + $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
1161 | + |
|
1162 | + $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
1163 | + $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
1164 | + |
|
1165 | + /** |
|
1166 | + * Filter: wl_feature__enable__blocks. |
|
1167 | + * |
|
1168 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
1169 | + * |
|
1170 | + * @return bool |
|
1171 | + * @since 3.27.6 |
|
1172 | + */ |
|
1173 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1174 | + // Initialize the short-codes. |
|
1175 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
1176 | + new Wordlift_Chord_Shortcode(); |
|
1177 | + new Wordlift_Geomap_Shortcode(); |
|
1178 | + new Wordlift_Timeline_Shortcode(); |
|
1179 | + new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
1180 | + new Wordlift_Vocabulary_Shortcode(); |
|
1181 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
1182 | + } |
|
1183 | + |
|
1184 | + new Wordlift_Products_Navigator_Shortcode(); |
|
1185 | + |
|
1186 | + // Initialize the Context Cards Service |
|
1187 | + $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
1188 | + |
|
1189 | + // Initialize the SEO service. |
|
1190 | + new Wordlift_Seo_Service(); |
|
1191 | + |
|
1192 | + // Initialize the AMP service. |
|
1193 | + new Wordlift_AMP_Service( $that->jsonld_service ); |
|
1194 | + |
|
1195 | + /** Services. */ |
|
1196 | + $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
1197 | + new Wordlift_Image_Service(); |
|
1198 | + |
|
1199 | + /** Adapters. */ |
|
1200 | + $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
1201 | + $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
1202 | + $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
1203 | + |
|
1204 | + /* |
|
1205 | 1205 | * Exclude our public js from WP-Rocket. |
1206 | 1206 | * |
1207 | 1207 | * @since 3.19.4 |
1208 | 1208 | * |
1209 | 1209 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
1210 | 1210 | */ |
1211 | - new Wordlift_WpRocket_Adapter(); |
|
1211 | + new Wordlift_WpRocket_Adapter(); |
|
1212 | 1212 | |
1213 | - /** WordPress Admin UI. */ |
|
1213 | + /** WordPress Admin UI. */ |
|
1214 | 1214 | |
1215 | - // UI elements. |
|
1216 | - $that->input_element = new Wordlift_Admin_Input_Element(); |
|
1217 | - $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
1218 | - $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
1219 | - $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
1220 | - $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
1221 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
1222 | - $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
1223 | - $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
1215 | + // UI elements. |
|
1216 | + $that->input_element = new Wordlift_Admin_Input_Element(); |
|
1217 | + $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
1218 | + $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
1219 | + $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
1220 | + $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
1221 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
1222 | + $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
1223 | + $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
1224 | 1224 | |
1225 | - $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
1226 | - $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
1225 | + $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
1226 | + $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
1227 | 1227 | |
1228 | - $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
1229 | - $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
1230 | - $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
1228 | + $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
1229 | + $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
1230 | + $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
1231 | 1231 | |
1232 | - // Pages. |
|
1233 | - /* |
|
1232 | + // Pages. |
|
1233 | + /* |
|
1234 | 1234 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
1235 | 1235 | * |
1236 | 1236 | * @since 3.20.3 |
1237 | 1237 | * |
1238 | 1238 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
1239 | 1239 | */ |
1240 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
1241 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1242 | - new Wordlift_Admin_Post_Edit_Page( $that ); |
|
1243 | - } |
|
1244 | - new Wordlift_Entity_Type_Admin_Service(); |
|
1240 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
1241 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1242 | + new Wordlift_Admin_Post_Edit_Page( $that ); |
|
1243 | + } |
|
1244 | + new Wordlift_Entity_Type_Admin_Service(); |
|
1245 | 1245 | |
1246 | - /** Widgets */ |
|
1247 | - $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
1246 | + /** Widgets */ |
|
1247 | + $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
1248 | 1248 | |
1249 | - // Create an instance of the install wizard. |
|
1250 | - $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
1249 | + // Create an instance of the install wizard. |
|
1250 | + $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
1251 | 1251 | |
1252 | - $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
1252 | + $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
1253 | 1253 | |
1254 | - // User Profile. |
|
1255 | - new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
1254 | + // User Profile. |
|
1255 | + new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
1256 | 1256 | |
1257 | - $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
1257 | + $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
1258 | 1258 | |
1259 | - // Load the debug service if WP is in debug mode. |
|
1260 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1261 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
1262 | - new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
1263 | - } |
|
1259 | + // Load the debug service if WP is in debug mode. |
|
1260 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1261 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
1262 | + new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
1263 | + } |
|
1264 | 1264 | |
1265 | - // Remote Image Service. |
|
1266 | - new Wordlift_Remote_Image_Service(); |
|
1265 | + // Remote Image Service. |
|
1266 | + new Wordlift_Remote_Image_Service(); |
|
1267 | 1267 | |
1268 | - /* |
|
1268 | + /* |
|
1269 | 1269 | * Provides mappings between post types and entity types. |
1270 | 1270 | * |
1271 | 1271 | * @since 3.20.0 |
1272 | 1272 | * |
1273 | 1273 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
1274 | 1274 | */ |
1275 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
1276 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1277 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1275 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
1276 | + require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1277 | + require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1278 | 1278 | |
1279 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
1280 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1279 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
1280 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1281 | 1281 | |
1282 | - /* |
|
1282 | + /* |
|
1283 | 1283 | * Load the Mappings JSON-LD post processing. |
1284 | 1284 | * |
1285 | 1285 | * @since 3.25.0 |
1286 | 1286 | */ |
1287 | 1287 | |
1288 | - $mappings_dbo = new Mappings_DBO(); |
|
1289 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
1290 | - new Post_Type_Rule_Validator(); |
|
1291 | - // Taxonomy term rule validator for validating rules for term pages. |
|
1292 | - new Taxonomy_Term_Rule_Validator(); |
|
1293 | - new Post_Taxonomy_Term_Rule_Validator(); |
|
1294 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
1295 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
1296 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
1297 | - |
|
1298 | - new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
1299 | - new Taxonomy_To_Terms_Transform_Function(); |
|
1300 | - new Post_Id_To_Entity_Transform_Function(); |
|
1301 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
1302 | - |
|
1303 | - /** |
|
1304 | - * @since 3.27.1 |
|
1305 | - * Intiailize the acf group data formatter. |
|
1306 | - */ |
|
1307 | - new Acf_Group_Formatter(); |
|
1308 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
1309 | - |
|
1310 | - /** |
|
1311 | - * @since 3.26.0 |
|
1312 | - * Initialize the Faq JSON LD converter here - disabled. |
|
1313 | - */ |
|
1314 | - // new Faq_To_Jsonld_Converter(); |
|
1315 | - /* |
|
1288 | + $mappings_dbo = new Mappings_DBO(); |
|
1289 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
1290 | + new Post_Type_Rule_Validator(); |
|
1291 | + // Taxonomy term rule validator for validating rules for term pages. |
|
1292 | + new Taxonomy_Term_Rule_Validator(); |
|
1293 | + new Post_Taxonomy_Term_Rule_Validator(); |
|
1294 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
1295 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
1296 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
1297 | + |
|
1298 | + new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
1299 | + new Taxonomy_To_Terms_Transform_Function(); |
|
1300 | + new Post_Id_To_Entity_Transform_Function(); |
|
1301 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
1302 | + |
|
1303 | + /** |
|
1304 | + * @since 3.27.1 |
|
1305 | + * Intiailize the acf group data formatter. |
|
1306 | + */ |
|
1307 | + new Acf_Group_Formatter(); |
|
1308 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
1309 | + |
|
1310 | + /** |
|
1311 | + * @since 3.26.0 |
|
1312 | + * Initialize the Faq JSON LD converter here - disabled. |
|
1313 | + */ |
|
1314 | + // new Faq_To_Jsonld_Converter(); |
|
1315 | + /* |
|
1316 | 1316 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
1317 | 1317 | * end-point. |
1318 | 1318 | * |
1319 | 1319 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
1320 | 1320 | * @since 3.24.4 |
1321 | 1321 | */ |
1322 | - new Templates_Ajax_Endpoint(); |
|
1323 | - // Call this static method to register FAQ routes to rest api - disabled |
|
1324 | - // Faq_Rest_Controller::register_routes(); |
|
1325 | - |
|
1326 | - $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
1327 | - |
|
1328 | - /** WL Autocomplete. */ |
|
1329 | - $autocomplete_service = new All_Autocomplete_Service( |
|
1330 | - array( |
|
1331 | - new Local_Autocomplete_Service(), |
|
1332 | - new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
1333 | - ) |
|
1334 | - ); |
|
1335 | - $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
1336 | - |
|
1337 | - /** |
|
1338 | - * @since 3.27.2 |
|
1339 | - * Integrate the recipe maker jsonld & set recipe |
|
1340 | - * as default entity type to the wprm_recipe CPT. |
|
1341 | - */ |
|
1342 | - new Recipe_Maker_Post_Type_Hook(); |
|
1343 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
1344 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
1345 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
1346 | - new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
1347 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
1348 | - |
|
1349 | - new Duplicate_Markup_Remover(); |
|
1350 | - |
|
1351 | - /** |
|
1352 | - * @since 3.27.8 |
|
1353 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
1354 | - */ |
|
1355 | - new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
1356 | - /** |
|
1357 | - * @since 3.28.0 |
|
1358 | - * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
1359 | - */ |
|
1360 | - new Entity_No_Index_Flag(); |
|
1361 | - |
|
1362 | - /** |
|
1363 | - * @since 3.29.0 |
|
1364 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
1365 | - */ |
|
1366 | - new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
1367 | - |
|
1368 | - /** |
|
1369 | - * Expand author in to references. |
|
1370 | - * |
|
1371 | - * @since 3.30.0 |
|
1372 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
1373 | - */ |
|
1374 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1375 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
1376 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
1377 | - } |
|
1378 | - |
|
1379 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1380 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
1381 | - $vocabulary_loader = new Vocabulary_Loader(); |
|
1382 | - $vocabulary_loader->init_vocabulary(); |
|
1383 | - } |
|
1384 | - |
|
1385 | - /** |
|
1386 | - * Added for feature request 1496 (Webhooks) |
|
1387 | - */ |
|
1388 | - if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
1389 | - $that->webhook_loader = new Webhooks_Loader(); |
|
1390 | - $that->webhook_loader->init(); |
|
1391 | - } |
|
1392 | - |
|
1393 | - /** |
|
1394 | - * @since 3.30.0 |
|
1395 | - * Add a checkbox to user option screen for wordlift admin. |
|
1396 | - */ |
|
1397 | - $wordlift_admin_checkbox = new Admin_User_Option(); |
|
1398 | - $wordlift_admin_checkbox->connect_hook(); |
|
1399 | - |
|
1400 | - /** |
|
1401 | - * @since 3.31.0 |
|
1402 | - * Init loader class for videoobject. |
|
1403 | - */ |
|
1404 | - $videoobject_loader = new Loader(); |
|
1405 | - $videoobject_loader->init_feature(); |
|
1406 | - |
|
1407 | - /** |
|
1408 | - * @since 3.35.0 |
|
1409 | - */ |
|
1410 | - $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
1411 | - $google_addon_integration_loader->init_feature(); |
|
1412 | - |
|
1413 | - /** |
|
1414 | - * @since 3.31.5 |
|
1415 | - * Create configuration endpoint for webapp to configure. |
|
1416 | - */ |
|
1417 | - new Config( $that->admin_setup, $that->key_validation_service ); |
|
1418 | - /** |
|
1419 | - * @since 3.31.7 |
|
1420 | - * Remove duplicate videoobject. |
|
1421 | - */ |
|
1422 | - new Videoobject_Duplicate_Remover(); |
|
1423 | - $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
1424 | - $synonym_loader->init_feature(); |
|
1425 | - /** |
|
1426 | - * @since 3.32.0 |
|
1427 | - * Create loader for vocabulary terms. |
|
1428 | - */ |
|
1429 | - $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
1430 | - $vocabulary_terms_loader->init_feature(); |
|
1431 | - |
|
1432 | - new Entity_Type_Change_Handler( |
|
1433 | - Wordlift_Entity_Service::get_instance(), |
|
1434 | - Wordlift_Entity_Type_Service::get_instance() |
|
1435 | - ); |
|
1436 | - |
|
1437 | - }, |
|
1438 | - 3 |
|
1439 | - ); |
|
1440 | - |
|
1441 | - new Entity_Type_Setter(); |
|
1442 | - $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
1443 | - $no_editor_analysis_loader->init_feature(); |
|
1444 | - } |
|
1445 | - |
|
1446 | - /** |
|
1447 | - * Define the locale for this plugin for internationalization. |
|
1448 | - * |
|
1449 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
1450 | - * with WordPress. |
|
1451 | - * |
|
1452 | - * @since 1.0.0 |
|
1453 | - * @access private |
|
1454 | - */ |
|
1455 | - private function set_locale() { |
|
1456 | - |
|
1457 | - $plugin_i18n = new Wordlift_I18n(); |
|
1458 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1459 | - |
|
1460 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1461 | - |
|
1462 | - } |
|
1463 | - |
|
1464 | - /** |
|
1465 | - * Register all of the hooks related to the admin area functionality |
|
1466 | - * of the plugin. |
|
1467 | - * |
|
1468 | - * @since 1.0.0 |
|
1469 | - * @access private |
|
1470 | - */ |
|
1471 | - private function define_admin_hooks( $that ) { |
|
1472 | - $plugin_admin = new Wordlift_Admin( |
|
1473 | - $that->get_plugin_name(), |
|
1474 | - $that->get_version(), |
|
1475 | - $that->notice_service, |
|
1476 | - $that->user_service |
|
1477 | - ); |
|
1478 | - |
|
1479 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1480 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1481 | - |
|
1482 | - // Hook the `admin_init` function to the Admin Setup. |
|
1483 | - Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
1484 | - $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
1485 | - |
|
1486 | - // Hook the admin_init to the settings page. |
|
1487 | - Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
1488 | - $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
1489 | - |
|
1490 | - // Hook the admin_init to the analytics settings page. |
|
1491 | - Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
1492 | - $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
1493 | - |
|
1494 | - // Hook the init action to taxonomy services. |
|
1495 | - $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
1496 | - $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
1497 | - |
|
1498 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
1499 | - $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1500 | - |
|
1501 | - // Register custom allowed redirect hosts. |
|
1502 | - $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
1503 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1504 | - $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
1505 | - |
|
1506 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
1507 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
1508 | - $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
1509 | - $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
1510 | - |
|
1511 | - $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
1512 | - $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
1513 | - |
|
1514 | - // Entity listing customization (wp-admin/edit.php) |
|
1515 | - // Add custom columns. |
|
1516 | - $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
1517 | - // no explicit entity as it prevents handling of other post types. |
|
1518 | - $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1519 | - // Add 4W selection. |
|
1520 | - $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1521 | - $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1522 | - $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
1523 | - $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
1524 | - |
|
1525 | - /* |
|
1322 | + new Templates_Ajax_Endpoint(); |
|
1323 | + // Call this static method to register FAQ routes to rest api - disabled |
|
1324 | + // Faq_Rest_Controller::register_routes(); |
|
1325 | + |
|
1326 | + $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
1327 | + |
|
1328 | + /** WL Autocomplete. */ |
|
1329 | + $autocomplete_service = new All_Autocomplete_Service( |
|
1330 | + array( |
|
1331 | + new Local_Autocomplete_Service(), |
|
1332 | + new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
1333 | + ) |
|
1334 | + ); |
|
1335 | + $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
1336 | + |
|
1337 | + /** |
|
1338 | + * @since 3.27.2 |
|
1339 | + * Integrate the recipe maker jsonld & set recipe |
|
1340 | + * as default entity type to the wprm_recipe CPT. |
|
1341 | + */ |
|
1342 | + new Recipe_Maker_Post_Type_Hook(); |
|
1343 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
1344 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
1345 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
1346 | + new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
1347 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
1348 | + |
|
1349 | + new Duplicate_Markup_Remover(); |
|
1350 | + |
|
1351 | + /** |
|
1352 | + * @since 3.27.8 |
|
1353 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
1354 | + */ |
|
1355 | + new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
1356 | + /** |
|
1357 | + * @since 3.28.0 |
|
1358 | + * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
1359 | + */ |
|
1360 | + new Entity_No_Index_Flag(); |
|
1361 | + |
|
1362 | + /** |
|
1363 | + * @since 3.29.0 |
|
1364 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
1365 | + */ |
|
1366 | + new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
1367 | + |
|
1368 | + /** |
|
1369 | + * Expand author in to references. |
|
1370 | + * |
|
1371 | + * @since 3.30.0 |
|
1372 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
1373 | + */ |
|
1374 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1375 | + if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
1376 | + new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
1377 | + } |
|
1378 | + |
|
1379 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1380 | + if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
1381 | + $vocabulary_loader = new Vocabulary_Loader(); |
|
1382 | + $vocabulary_loader->init_vocabulary(); |
|
1383 | + } |
|
1384 | + |
|
1385 | + /** |
|
1386 | + * Added for feature request 1496 (Webhooks) |
|
1387 | + */ |
|
1388 | + if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
1389 | + $that->webhook_loader = new Webhooks_Loader(); |
|
1390 | + $that->webhook_loader->init(); |
|
1391 | + } |
|
1392 | + |
|
1393 | + /** |
|
1394 | + * @since 3.30.0 |
|
1395 | + * Add a checkbox to user option screen for wordlift admin. |
|
1396 | + */ |
|
1397 | + $wordlift_admin_checkbox = new Admin_User_Option(); |
|
1398 | + $wordlift_admin_checkbox->connect_hook(); |
|
1399 | + |
|
1400 | + /** |
|
1401 | + * @since 3.31.0 |
|
1402 | + * Init loader class for videoobject. |
|
1403 | + */ |
|
1404 | + $videoobject_loader = new Loader(); |
|
1405 | + $videoobject_loader->init_feature(); |
|
1406 | + |
|
1407 | + /** |
|
1408 | + * @since 3.35.0 |
|
1409 | + */ |
|
1410 | + $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
1411 | + $google_addon_integration_loader->init_feature(); |
|
1412 | + |
|
1413 | + /** |
|
1414 | + * @since 3.31.5 |
|
1415 | + * Create configuration endpoint for webapp to configure. |
|
1416 | + */ |
|
1417 | + new Config( $that->admin_setup, $that->key_validation_service ); |
|
1418 | + /** |
|
1419 | + * @since 3.31.7 |
|
1420 | + * Remove duplicate videoobject. |
|
1421 | + */ |
|
1422 | + new Videoobject_Duplicate_Remover(); |
|
1423 | + $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
1424 | + $synonym_loader->init_feature(); |
|
1425 | + /** |
|
1426 | + * @since 3.32.0 |
|
1427 | + * Create loader for vocabulary terms. |
|
1428 | + */ |
|
1429 | + $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
1430 | + $vocabulary_terms_loader->init_feature(); |
|
1431 | + |
|
1432 | + new Entity_Type_Change_Handler( |
|
1433 | + Wordlift_Entity_Service::get_instance(), |
|
1434 | + Wordlift_Entity_Type_Service::get_instance() |
|
1435 | + ); |
|
1436 | + |
|
1437 | + }, |
|
1438 | + 3 |
|
1439 | + ); |
|
1440 | + |
|
1441 | + new Entity_Type_Setter(); |
|
1442 | + $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
1443 | + $no_editor_analysis_loader->init_feature(); |
|
1444 | + } |
|
1445 | + |
|
1446 | + /** |
|
1447 | + * Define the locale for this plugin for internationalization. |
|
1448 | + * |
|
1449 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
1450 | + * with WordPress. |
|
1451 | + * |
|
1452 | + * @since 1.0.0 |
|
1453 | + * @access private |
|
1454 | + */ |
|
1455 | + private function set_locale() { |
|
1456 | + |
|
1457 | + $plugin_i18n = new Wordlift_I18n(); |
|
1458 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1459 | + |
|
1460 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1461 | + |
|
1462 | + } |
|
1463 | + |
|
1464 | + /** |
|
1465 | + * Register all of the hooks related to the admin area functionality |
|
1466 | + * of the plugin. |
|
1467 | + * |
|
1468 | + * @since 1.0.0 |
|
1469 | + * @access private |
|
1470 | + */ |
|
1471 | + private function define_admin_hooks( $that ) { |
|
1472 | + $plugin_admin = new Wordlift_Admin( |
|
1473 | + $that->get_plugin_name(), |
|
1474 | + $that->get_version(), |
|
1475 | + $that->notice_service, |
|
1476 | + $that->user_service |
|
1477 | + ); |
|
1478 | + |
|
1479 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1480 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1481 | + |
|
1482 | + // Hook the `admin_init` function to the Admin Setup. |
|
1483 | + Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
1484 | + $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
1485 | + |
|
1486 | + // Hook the admin_init to the settings page. |
|
1487 | + Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
1488 | + $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
1489 | + |
|
1490 | + // Hook the admin_init to the analytics settings page. |
|
1491 | + Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
1492 | + $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
1493 | + |
|
1494 | + // Hook the init action to taxonomy services. |
|
1495 | + $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
1496 | + $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
1497 | + |
|
1498 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
1499 | + $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1500 | + |
|
1501 | + // Register custom allowed redirect hosts. |
|
1502 | + $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
1503 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1504 | + $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
1505 | + |
|
1506 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
1507 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
1508 | + $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
1509 | + $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
1510 | + |
|
1511 | + $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
1512 | + $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
1513 | + |
|
1514 | + // Entity listing customization (wp-admin/edit.php) |
|
1515 | + // Add custom columns. |
|
1516 | + $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
1517 | + // no explicit entity as it prevents handling of other post types. |
|
1518 | + $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1519 | + // Add 4W selection. |
|
1520 | + $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1521 | + $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1522 | + $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
1523 | + $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
1524 | + |
|
1525 | + /* |
|
1526 | 1526 | * If `All Entity Types` is disable, use the radio button Walker. |
1527 | 1527 | * |
1528 | 1528 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1529 | 1529 | */ |
1530 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1531 | - if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1532 | - $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1533 | - } |
|
1534 | - |
|
1535 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
1536 | - // entities. |
|
1537 | - $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
1538 | - |
|
1539 | - /** |
|
1540 | - * Filter: wl_feature__enable__settings-download. |
|
1541 | - * |
|
1542 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
1543 | - * |
|
1544 | - * @return bool |
|
1545 | - * @since 3.27.6 |
|
1546 | - */ |
|
1547 | - $that->features_registry->register_feature_from_slug( |
|
1548 | - 'settings-download', |
|
1549 | - true, |
|
1550 | - array( |
|
1551 | - $that, |
|
1552 | - 'register_screens', |
|
1553 | - ) |
|
1554 | - ); |
|
1555 | - |
|
1556 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
1557 | - $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
1558 | - |
|
1559 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1560 | - $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1561 | - $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1562 | - $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1563 | - |
|
1564 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
1565 | - $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
1566 | - |
|
1567 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
1568 | - $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
1569 | - |
|
1570 | - $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
1571 | - |
|
1572 | - // Hook the menu creation on the general wordlift menu creation. |
|
1573 | - /** |
|
1574 | - * Filter: wl_feature__enable__screens. |
|
1575 | - * |
|
1576 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
1577 | - * |
|
1578 | - * @return bool |
|
1579 | - * @since 3.27.6 |
|
1580 | - * |
|
1581 | - * Since 3.30.0 this feature is registered using registry. |
|
1582 | - */ |
|
1583 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1584 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
1585 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
1586 | - } |
|
1587 | - |
|
1588 | - // Hook key update. |
|
1589 | - $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
1590 | - $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
1591 | - |
|
1592 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
1593 | - $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
1594 | - |
|
1595 | - /* |
|
1530 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1531 | + if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1532 | + $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1533 | + } |
|
1534 | + |
|
1535 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
1536 | + // entities. |
|
1537 | + $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
1538 | + |
|
1539 | + /** |
|
1540 | + * Filter: wl_feature__enable__settings-download. |
|
1541 | + * |
|
1542 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
1543 | + * |
|
1544 | + * @return bool |
|
1545 | + * @since 3.27.6 |
|
1546 | + */ |
|
1547 | + $that->features_registry->register_feature_from_slug( |
|
1548 | + 'settings-download', |
|
1549 | + true, |
|
1550 | + array( |
|
1551 | + $that, |
|
1552 | + 'register_screens', |
|
1553 | + ) |
|
1554 | + ); |
|
1555 | + |
|
1556 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
1557 | + $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
1558 | + |
|
1559 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1560 | + $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1561 | + $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1562 | + $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1563 | + |
|
1564 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
1565 | + $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
1566 | + |
|
1567 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
1568 | + $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
1569 | + |
|
1570 | + $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
1571 | + |
|
1572 | + // Hook the menu creation on the general wordlift menu creation. |
|
1573 | + /** |
|
1574 | + * Filter: wl_feature__enable__screens. |
|
1575 | + * |
|
1576 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
1577 | + * |
|
1578 | + * @return bool |
|
1579 | + * @since 3.27.6 |
|
1580 | + * |
|
1581 | + * Since 3.30.0 this feature is registered using registry. |
|
1582 | + */ |
|
1583 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1584 | + if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
1585 | + add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
1586 | + } |
|
1587 | + |
|
1588 | + // Hook key update. |
|
1589 | + $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
1590 | + $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
1591 | + |
|
1592 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
1593 | + $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
1594 | + |
|
1595 | + /* |
|
1596 | 1596 | * Remove the Analytics Settings link from the plugin page. |
1597 | 1597 | * |
1598 | 1598 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
1599 | 1599 | * @since 3.21.1 |
1600 | 1600 | */ |
1601 | - // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1602 | - |
|
1603 | - // Hook the AJAX `wl_publisher` action name. |
|
1604 | - $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
1605 | - |
|
1606 | - // Hook row actions for the entity type list admin. |
|
1607 | - $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1608 | - |
|
1609 | - /** Ajax actions. */ |
|
1610 | - $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
1611 | - |
|
1612 | - // Hook capabilities manipulation to allow access to entity type admin |
|
1613 | - // page on WordPress versions before 4.7. |
|
1614 | - global $wp_version; |
|
1615 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1616 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
1617 | - } |
|
1618 | - |
|
1619 | - /** Adapters. */ |
|
1620 | - $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1621 | - /** |
|
1622 | - * Disabling Faq temporarily. |
|
1623 | - * Load the tinymce editor button on the tool bar. |
|
1624 | - * |
|
1625 | - * @since 3.26.0 |
|
1626 | - */ |
|
1627 | - // $that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
1628 | - // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
1629 | - // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
1630 | - |
|
1631 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
1632 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
1633 | - |
|
1634 | - /** |
|
1635 | - * @since 3.26.0 |
|
1636 | - */ |
|
1637 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
1638 | - $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
1639 | - // Adding Rest route for the post excerpt |
|
1640 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
1641 | - |
|
1642 | - // Handle the autocomplete request. |
|
1643 | - add_action( |
|
1644 | - 'wp_ajax_wl_autocomplete', |
|
1645 | - array( |
|
1646 | - $that->autocomplete_adapter, |
|
1647 | - 'wl_autocomplete', |
|
1648 | - ) |
|
1649 | - ); |
|
1650 | - add_action( |
|
1651 | - 'wp_ajax_nopriv_wl_autocomplete', |
|
1652 | - array( |
|
1653 | - $that->autocomplete_adapter, |
|
1654 | - 'wl_autocomplete', |
|
1655 | - ) |
|
1656 | - ); |
|
1657 | - |
|
1658 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
1659 | - if ( is_multisite() ) { |
|
1660 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
1661 | - } |
|
1662 | - |
|
1663 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
1664 | - |
|
1665 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1666 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1667 | - add_action( |
|
1668 | - 'wp_ajax_wl_deactivation_feedback', |
|
1669 | - array( |
|
1670 | - $deactivator_feedback, |
|
1671 | - 'wl_deactivation_feedback', |
|
1672 | - ) |
|
1673 | - ); |
|
1674 | - |
|
1675 | - /** |
|
1676 | - * Always allow the `wordlift/classification` block. |
|
1677 | - * |
|
1678 | - * @since 3.23.0 |
|
1679 | - */ |
|
1680 | - add_filter( |
|
1681 | - 'allowed_block_types', |
|
1682 | - function ( $value ) { |
|
1683 | - |
|
1684 | - if ( true === $value ) { |
|
1685 | - return $value; |
|
1686 | - } |
|
1687 | - |
|
1688 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
1689 | - }, |
|
1690 | - PHP_INT_MAX |
|
1691 | - ); |
|
1692 | - |
|
1693 | - /** |
|
1694 | - * @since 3.27.7 |
|
1695 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
1696 | - */ |
|
1697 | - new Top_Entities(); |
|
1698 | - |
|
1699 | - } |
|
1700 | - |
|
1701 | - /** |
|
1702 | - * Register all of the hooks related to the public-facing functionality |
|
1703 | - * of the plugin. |
|
1704 | - * |
|
1705 | - * @since 1.0.0 |
|
1706 | - * @access private |
|
1707 | - */ |
|
1708 | - private function define_public_hooks( $that ) { |
|
1709 | - |
|
1710 | - $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
1711 | - |
|
1712 | - // Register the entity post type. |
|
1713 | - $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
1714 | - |
|
1715 | - // Bind the link generation and handling hooks to the entity link service. |
|
1716 | - $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
1717 | - $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1718 | - |
|
1719 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1720 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1721 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
1722 | - |
|
1723 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
1724 | - $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
1725 | - // Hook the content filter service to add entity links. |
|
1726 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1727 | - // We run before other filters. |
|
1728 | - $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
1729 | - } |
|
1730 | - |
|
1731 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
1732 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1733 | - |
|
1734 | - // Hook the ShareThis service. |
|
1735 | - $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
1736 | - $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
1737 | - |
|
1738 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1739 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1740 | - |
|
1741 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
1742 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
1743 | - // to categories. |
|
1744 | - $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1745 | - |
|
1746 | - /* |
|
1601 | + // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1602 | + |
|
1603 | + // Hook the AJAX `wl_publisher` action name. |
|
1604 | + $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
1605 | + |
|
1606 | + // Hook row actions for the entity type list admin. |
|
1607 | + $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1608 | + |
|
1609 | + /** Ajax actions. */ |
|
1610 | + $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
1611 | + |
|
1612 | + // Hook capabilities manipulation to allow access to entity type admin |
|
1613 | + // page on WordPress versions before 4.7. |
|
1614 | + global $wp_version; |
|
1615 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1616 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
1617 | + } |
|
1618 | + |
|
1619 | + /** Adapters. */ |
|
1620 | + $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1621 | + /** |
|
1622 | + * Disabling Faq temporarily. |
|
1623 | + * Load the tinymce editor button on the tool bar. |
|
1624 | + * |
|
1625 | + * @since 3.26.0 |
|
1626 | + */ |
|
1627 | + // $that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
1628 | + // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
1629 | + // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
1630 | + |
|
1631 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
1632 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
1633 | + |
|
1634 | + /** |
|
1635 | + * @since 3.26.0 |
|
1636 | + */ |
|
1637 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
1638 | + $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
1639 | + // Adding Rest route for the post excerpt |
|
1640 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
1641 | + |
|
1642 | + // Handle the autocomplete request. |
|
1643 | + add_action( |
|
1644 | + 'wp_ajax_wl_autocomplete', |
|
1645 | + array( |
|
1646 | + $that->autocomplete_adapter, |
|
1647 | + 'wl_autocomplete', |
|
1648 | + ) |
|
1649 | + ); |
|
1650 | + add_action( |
|
1651 | + 'wp_ajax_nopriv_wl_autocomplete', |
|
1652 | + array( |
|
1653 | + $that->autocomplete_adapter, |
|
1654 | + 'wl_autocomplete', |
|
1655 | + ) |
|
1656 | + ); |
|
1657 | + |
|
1658 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
1659 | + if ( is_multisite() ) { |
|
1660 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
1661 | + } |
|
1662 | + |
|
1663 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
1664 | + |
|
1665 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1666 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1667 | + add_action( |
|
1668 | + 'wp_ajax_wl_deactivation_feedback', |
|
1669 | + array( |
|
1670 | + $deactivator_feedback, |
|
1671 | + 'wl_deactivation_feedback', |
|
1672 | + ) |
|
1673 | + ); |
|
1674 | + |
|
1675 | + /** |
|
1676 | + * Always allow the `wordlift/classification` block. |
|
1677 | + * |
|
1678 | + * @since 3.23.0 |
|
1679 | + */ |
|
1680 | + add_filter( |
|
1681 | + 'allowed_block_types', |
|
1682 | + function ( $value ) { |
|
1683 | + |
|
1684 | + if ( true === $value ) { |
|
1685 | + return $value; |
|
1686 | + } |
|
1687 | + |
|
1688 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
1689 | + }, |
|
1690 | + PHP_INT_MAX |
|
1691 | + ); |
|
1692 | + |
|
1693 | + /** |
|
1694 | + * @since 3.27.7 |
|
1695 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
1696 | + */ |
|
1697 | + new Top_Entities(); |
|
1698 | + |
|
1699 | + } |
|
1700 | + |
|
1701 | + /** |
|
1702 | + * Register all of the hooks related to the public-facing functionality |
|
1703 | + * of the plugin. |
|
1704 | + * |
|
1705 | + * @since 1.0.0 |
|
1706 | + * @access private |
|
1707 | + */ |
|
1708 | + private function define_public_hooks( $that ) { |
|
1709 | + |
|
1710 | + $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
1711 | + |
|
1712 | + // Register the entity post type. |
|
1713 | + $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
1714 | + |
|
1715 | + // Bind the link generation and handling hooks to the entity link service. |
|
1716 | + $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
1717 | + $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1718 | + |
|
1719 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1720 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1721 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
1722 | + |
|
1723 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
1724 | + $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
1725 | + // Hook the content filter service to add entity links. |
|
1726 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1727 | + // We run before other filters. |
|
1728 | + $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
1729 | + } |
|
1730 | + |
|
1731 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
1732 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1733 | + |
|
1734 | + // Hook the ShareThis service. |
|
1735 | + $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
1736 | + $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
1737 | + |
|
1738 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1739 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1740 | + |
|
1741 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
1742 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
1743 | + // to categories. |
|
1744 | + $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1745 | + |
|
1746 | + /* |
|
1747 | 1747 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
1748 | 1748 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
1749 | 1749 | * order of start time. |
1750 | 1750 | */ |
1751 | - $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1752 | - |
|
1753 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
1754 | - $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
1755 | - |
|
1756 | - // Analytics Script Frontend. |
|
1757 | - if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
1758 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
1759 | - } |
|
1760 | - |
|
1761 | - } |
|
1762 | - |
|
1763 | - /** |
|
1764 | - * Run the loader to execute all of the hooks with WordPress. |
|
1765 | - * |
|
1766 | - * @since 1.0.0 |
|
1767 | - */ |
|
1768 | - public function run() { |
|
1769 | - $this->loader->run(); |
|
1770 | - } |
|
1771 | - |
|
1772 | - /** |
|
1773 | - * The name of the plugin used to uniquely identify it within the context of |
|
1774 | - * WordPress and to define internationalization functionality. |
|
1775 | - * |
|
1776 | - * @return string The name of the plugin. |
|
1777 | - * @since 1.0.0 |
|
1778 | - */ |
|
1779 | - public function get_plugin_name() { |
|
1780 | - return $this->plugin_name; |
|
1781 | - } |
|
1782 | - |
|
1783 | - /** |
|
1784 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
1785 | - * |
|
1786 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
1787 | - * @since 1.0.0 |
|
1788 | - */ |
|
1789 | - public function get_loader() { |
|
1790 | - return $this->loader; |
|
1791 | - } |
|
1792 | - |
|
1793 | - /** |
|
1794 | - * Retrieve the version number of the plugin. |
|
1795 | - * |
|
1796 | - * @return string The version number of the plugin. |
|
1797 | - * @since 1.0.0 |
|
1798 | - */ |
|
1799 | - public function get_version() { |
|
1800 | - return $this->version; |
|
1801 | - } |
|
1802 | - |
|
1803 | - /** |
|
1804 | - * Load dependencies for WP-CLI. |
|
1805 | - * |
|
1806 | - * @throws Exception when an error occurs. |
|
1807 | - * @since 3.18.0 |
|
1808 | - */ |
|
1809 | - private function load_cli_dependencies() { |
|
1810 | - |
|
1811 | - } |
|
1812 | - |
|
1813 | - public function add_wl_enabled_blocks() { |
|
1814 | - /** |
|
1815 | - * Filter: wl_feature__enable__blocks. |
|
1816 | - * |
|
1817 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
1818 | - * |
|
1819 | - * @return bool |
|
1820 | - * @since 3.27.6 |
|
1821 | - */ |
|
1822 | - // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
|
1823 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
1824 | - |
|
1825 | - $enabled_blocks = array(); |
|
1826 | - |
|
1827 | - /** |
|
1828 | - * Filter name: wl_feature__enable__product-navigator |
|
1829 | - * |
|
1830 | - * @since 3.32.3 |
|
1831 | - */ |
|
1832 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1833 | - if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
1834 | - $enabled_blocks[] = 'wordlift/products-navigator'; |
|
1835 | - } |
|
1836 | - |
|
1837 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1838 | - // To intimate JS |
|
1839 | - $enabled_blocks = array_merge( |
|
1840 | - $enabled_blocks, |
|
1841 | - array( |
|
1842 | - 'wordlift/navigator', |
|
1843 | - 'wordlift/chord', |
|
1844 | - 'wordlift/geomap', |
|
1845 | - 'wordlift/timeline', |
|
1846 | - 'wordlift/cloud', |
|
1847 | - 'wordlift/vocabulary', |
|
1848 | - 'wordlift/faceted-search', |
|
1849 | - ) |
|
1850 | - ); |
|
1851 | - } |
|
1852 | - |
|
1853 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
1854 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
1855 | - } |
|
1856 | - |
|
1857 | - /** |
|
1858 | - * Register screens based on the filter. |
|
1859 | - */ |
|
1860 | - public function register_screens() { |
|
1861 | - // Hook the menu to the Download Your Data page. |
|
1862 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1863 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
1864 | - Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
1865 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
1866 | - } |
|
1867 | - |
|
1868 | - Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
1869 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
1870 | - |
|
1871 | - } |
|
1751 | + $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1752 | + |
|
1753 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
1754 | + $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
1755 | + |
|
1756 | + // Analytics Script Frontend. |
|
1757 | + if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
1758 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
1759 | + } |
|
1760 | + |
|
1761 | + } |
|
1762 | + |
|
1763 | + /** |
|
1764 | + * Run the loader to execute all of the hooks with WordPress. |
|
1765 | + * |
|
1766 | + * @since 1.0.0 |
|
1767 | + */ |
|
1768 | + public function run() { |
|
1769 | + $this->loader->run(); |
|
1770 | + } |
|
1771 | + |
|
1772 | + /** |
|
1773 | + * The name of the plugin used to uniquely identify it within the context of |
|
1774 | + * WordPress and to define internationalization functionality. |
|
1775 | + * |
|
1776 | + * @return string The name of the plugin. |
|
1777 | + * @since 1.0.0 |
|
1778 | + */ |
|
1779 | + public function get_plugin_name() { |
|
1780 | + return $this->plugin_name; |
|
1781 | + } |
|
1782 | + |
|
1783 | + /** |
|
1784 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
1785 | + * |
|
1786 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
1787 | + * @since 1.0.0 |
|
1788 | + */ |
|
1789 | + public function get_loader() { |
|
1790 | + return $this->loader; |
|
1791 | + } |
|
1792 | + |
|
1793 | + /** |
|
1794 | + * Retrieve the version number of the plugin. |
|
1795 | + * |
|
1796 | + * @return string The version number of the plugin. |
|
1797 | + * @since 1.0.0 |
|
1798 | + */ |
|
1799 | + public function get_version() { |
|
1800 | + return $this->version; |
|
1801 | + } |
|
1802 | + |
|
1803 | + /** |
|
1804 | + * Load dependencies for WP-CLI. |
|
1805 | + * |
|
1806 | + * @throws Exception when an error occurs. |
|
1807 | + * @since 3.18.0 |
|
1808 | + */ |
|
1809 | + private function load_cli_dependencies() { |
|
1810 | + |
|
1811 | + } |
|
1812 | + |
|
1813 | + public function add_wl_enabled_blocks() { |
|
1814 | + /** |
|
1815 | + * Filter: wl_feature__enable__blocks. |
|
1816 | + * |
|
1817 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
1818 | + * |
|
1819 | + * @return bool |
|
1820 | + * @since 3.27.6 |
|
1821 | + */ |
|
1822 | + // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
|
1823 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
1824 | + |
|
1825 | + $enabled_blocks = array(); |
|
1826 | + |
|
1827 | + /** |
|
1828 | + * Filter name: wl_feature__enable__product-navigator |
|
1829 | + * |
|
1830 | + * @since 3.32.3 |
|
1831 | + */ |
|
1832 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1833 | + if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
1834 | + $enabled_blocks[] = 'wordlift/products-navigator'; |
|
1835 | + } |
|
1836 | + |
|
1837 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1838 | + // To intimate JS |
|
1839 | + $enabled_blocks = array_merge( |
|
1840 | + $enabled_blocks, |
|
1841 | + array( |
|
1842 | + 'wordlift/navigator', |
|
1843 | + 'wordlift/chord', |
|
1844 | + 'wordlift/geomap', |
|
1845 | + 'wordlift/timeline', |
|
1846 | + 'wordlift/cloud', |
|
1847 | + 'wordlift/vocabulary', |
|
1848 | + 'wordlift/faceted-search', |
|
1849 | + ) |
|
1850 | + ); |
|
1851 | + } |
|
1852 | + |
|
1853 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
1854 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
1855 | + } |
|
1856 | + |
|
1857 | + /** |
|
1858 | + * Register screens based on the filter. |
|
1859 | + */ |
|
1860 | + public function register_screens() { |
|
1861 | + // Hook the menu to the Download Your Data page. |
|
1862 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1863 | + if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
1864 | + Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
1865 | + add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
1866 | + } |
|
1867 | + |
|
1868 | + Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
1869 | + add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
1870 | + |
|
1871 | + } |
|
1872 | 1872 | |
1873 | 1873 | } |
@@ -637,15 +637,15 @@ discard block |
||
637 | 637 | $that = $this; |
638 | 638 | add_action( |
639 | 639 | 'plugins_loaded', |
640 | - function () use ( $that ) { |
|
641 | - $that->define_admin_hooks( $that ); |
|
642 | - $that->define_public_hooks( $that ); |
|
640 | + function() use ($that) { |
|
641 | + $that->define_admin_hooks($that); |
|
642 | + $that->define_public_hooks($that); |
|
643 | 643 | }, |
644 | 644 | 4 |
645 | 645 | ); |
646 | 646 | |
647 | 647 | // If we're in `WP_CLI` load the related files. |
648 | - if ( class_exists( 'WP_CLI' ) ) { |
|
648 | + if (class_exists('WP_CLI')) { |
|
649 | 649 | $this->load_cli_dependencies(); |
650 | 650 | } |
651 | 651 | |
@@ -685,328 +685,328 @@ discard block |
||
685 | 685 | * The class responsible for orchestrating the actions and filters of the |
686 | 686 | * core plugin. |
687 | 687 | */ |
688 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
688 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-loader.php'; |
|
689 | 689 | |
690 | 690 | // The class responsible for plugin uninstall. |
691 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
691 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-deactivator-feedback.php'; |
|
692 | 692 | |
693 | 693 | /** |
694 | 694 | * The class responsible for defining internationalization functionality |
695 | 695 | * of the plugin. |
696 | 696 | */ |
697 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
697 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-i18n.php'; |
|
698 | 698 | |
699 | 699 | /** |
700 | 700 | * WordLift's supported languages. |
701 | 701 | */ |
702 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
702 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-languages.php'; |
|
703 | 703 | |
704 | 704 | /** |
705 | 705 | * WordLift's supported countries. |
706 | 706 | */ |
707 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
707 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-countries.php'; |
|
708 | 708 | |
709 | 709 | /** |
710 | 710 | * Provide support functions to sanitize data. |
711 | 711 | */ |
712 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
712 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-sanitizer.php'; |
|
713 | 713 | |
714 | 714 | /** Services. */ |
715 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
716 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
717 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
718 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
719 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
720 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
721 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
722 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
723 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
715 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-log-service.php'; |
|
716 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-http-api.php'; |
|
717 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-redirect-service.php'; |
|
718 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-configuration-service.php'; |
|
719 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-post-type-service.php'; |
|
720 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-type-service.php'; |
|
721 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-link-service.php'; |
|
722 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-relation-service.php'; |
|
723 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-image-service.php'; |
|
724 | 724 | |
725 | 725 | /** |
726 | 726 | * The Schema service. |
727 | 727 | */ |
728 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
728 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-schema-service.php'; |
|
729 | 729 | |
730 | 730 | /** |
731 | 731 | * The schema:url property service. |
732 | 732 | */ |
733 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
734 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
733 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-property-service.php'; |
|
734 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-schema-url-property-service.php'; |
|
735 | 735 | |
736 | 736 | /** |
737 | 737 | * The UI service. |
738 | 738 | */ |
739 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
739 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-ui-service.php'; |
|
740 | 740 | |
741 | 741 | /** |
742 | 742 | * The Entity Types Taxonomy service. |
743 | 743 | */ |
744 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
744 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
745 | 745 | |
746 | 746 | /** |
747 | 747 | * The Entity service. |
748 | 748 | */ |
749 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
750 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
749 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-uri-service.php'; |
|
750 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-service.php'; |
|
751 | 751 | |
752 | 752 | // Add the entity rating service. |
753 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
753 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-rating-service.php'; |
|
754 | 754 | |
755 | 755 | /** |
756 | 756 | * The User service. |
757 | 757 | */ |
758 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
758 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-user-service.php'; |
|
759 | 759 | |
760 | 760 | /** |
761 | 761 | * The Timeline service. |
762 | 762 | */ |
763 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
763 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-timeline-service.php'; |
|
764 | 764 | |
765 | 765 | /** |
766 | 766 | * The Topic Taxonomy service. |
767 | 767 | */ |
768 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
768 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
769 | 769 | |
770 | 770 | /** |
771 | 771 | * The WordLift URI service. |
772 | 772 | */ |
773 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
774 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
775 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
773 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-uri-service.php'; |
|
774 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-property-factory.php'; |
|
775 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-sample-data-service.php'; |
|
776 | 776 | |
777 | - require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
778 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
777 | + require_once plugin_dir_path(__DIR__).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
778 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-attachment-service.php'; |
|
779 | 779 | |
780 | 780 | /** |
781 | 781 | * Load the converters. |
782 | 782 | */ |
783 | - require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
784 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
785 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
786 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
787 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
788 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
783 | + require_once plugin_dir_path(__DIR__).'includes/intf-wordlift-post-converter.php'; |
|
784 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
785 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
786 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
787 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
788 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-website-jsonld-converter.php'; |
|
789 | 789 | |
790 | 790 | /** |
791 | 791 | * Load cache-related files. |
792 | 792 | */ |
793 | - require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
793 | + require_once plugin_dir_path(__DIR__).'includes/cache/require.php'; |
|
794 | 794 | |
795 | 795 | /** |
796 | 796 | * Load the content filter. |
797 | 797 | */ |
798 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
798 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-content-filter-service.php'; |
|
799 | 799 | |
800 | 800 | /* |
801 | 801 | * Load the excerpt helper. |
802 | 802 | */ |
803 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
803 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-post-excerpt-helper.php'; |
|
804 | 804 | |
805 | 805 | /** |
806 | 806 | * Load the JSON-LD service to publish entities using JSON-LD.s |
807 | 807 | * |
808 | 808 | * @since 3.8.0 |
809 | 809 | */ |
810 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
810 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-jsonld-service.php'; |
|
811 | 811 | |
812 | 812 | // The Publisher Service and the AJAX adapter. |
813 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
814 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
813 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-publisher-service.php'; |
|
814 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
815 | 815 | |
816 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
816 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-post-adapter.php'; |
|
817 | 817 | |
818 | 818 | /** |
819 | 819 | * Load the WordLift key validation service. |
820 | 820 | */ |
821 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
821 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-key-validation-service.php'; |
|
822 | 822 | |
823 | 823 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
824 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
824 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-category-taxonomy-service.php'; |
|
825 | 825 | |
826 | 826 | // Load the `Wordlift_Entity_Page_Service` class definition. |
827 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
827 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-page-service.php'; |
|
828 | 828 | |
829 | 829 | /** Linked Data. */ |
830 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
831 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
832 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
833 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
834 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
835 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
836 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
837 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
838 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
839 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
840 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
830 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
831 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
832 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
833 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
834 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
835 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
836 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
837 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
838 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
839 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
840 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
841 | 841 | |
842 | 842 | /** Services. */ |
843 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
844 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
843 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-google-analytics-export-service.php'; |
|
844 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-api-service.php'; |
|
845 | 845 | |
846 | 846 | /** Adapters. */ |
847 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
848 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
849 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
850 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
851 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
847 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-tinymce-adapter.php'; |
|
848 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-newrelic-adapter.php'; |
|
849 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
850 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-type-adapter.php'; |
|
851 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-wprocket-adapter.php'; |
|
852 | 852 | |
853 | 853 | /** Autocomplete. */ |
854 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
854 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-autocomplete-adapter.php'; |
|
855 | 855 | |
856 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
856 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-remote-image-service.php'; |
|
857 | 857 | |
858 | 858 | /** Analytics */ |
859 | - require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
859 | + require_once plugin_dir_path(__DIR__).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
860 | 860 | |
861 | 861 | /** |
862 | 862 | * The class responsible for defining all actions that occur in the admin area. |
863 | 863 | */ |
864 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
864 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin.php'; |
|
865 | 865 | |
866 | 866 | /** |
867 | 867 | * The class to customize the entity list admin page. |
868 | 868 | */ |
869 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
869 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-entity-list-service.php'; |
|
870 | 870 | |
871 | 871 | /** |
872 | 872 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
873 | 873 | */ |
874 | 874 | global $wp_version; |
875 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
876 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
875 | + if (version_compare($wp_version, '5.3', '<')) { |
|
876 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
877 | 877 | } else { |
878 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
878 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | /** |
882 | 882 | * The Notice service. |
883 | 883 | */ |
884 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
884 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-notice-service.php'; |
|
885 | 885 | |
886 | 886 | /** |
887 | 887 | * The PrimaShop adapter. |
888 | 888 | */ |
889 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
889 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-primashop-adapter.php'; |
|
890 | 890 | |
891 | 891 | /** |
892 | 892 | * The WordLift Dashboard service. |
893 | 893 | */ |
894 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
894 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-dashboard-service.php'; |
|
895 | 895 | |
896 | 896 | /** |
897 | 897 | * The admin 'Install wizard' page. |
898 | 898 | */ |
899 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
899 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-setup.php'; |
|
900 | 900 | |
901 | 901 | /** |
902 | 902 | * The WordLift entity type list admin page controller. |
903 | 903 | */ |
904 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
904 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
905 | 905 | |
906 | 906 | /** |
907 | 907 | * The WordLift entity type settings admin page controller. |
908 | 908 | */ |
909 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
909 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-entity-type-settings.php'; |
|
910 | 910 | |
911 | 911 | /** |
912 | 912 | * The admin 'Download Your Data' page. |
913 | 913 | */ |
914 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
914 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-download-your-data-page.php'; |
|
915 | 915 | |
916 | 916 | /** |
917 | 917 | * The admin 'WordLift Settings' page. |
918 | 918 | */ |
919 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
920 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
921 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
922 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
923 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
924 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
925 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
926 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
927 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
928 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
929 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
930 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
931 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
932 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
933 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
919 | + require_once plugin_dir_path(__DIR__).'admin/elements/intf-wordlift-admin-element.php'; |
|
920 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-input-element.php'; |
|
921 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
922 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-select-element.php'; |
|
923 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
924 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
925 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
926 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
927 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-author-element.php'; |
|
928 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
929 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-page.php'; |
|
930 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-settings-page.php'; |
|
931 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
932 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
933 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
934 | 934 | |
935 | 935 | /** Admin Pages */ |
936 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
937 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
936 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-user-profile-page.php'; |
|
937 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-entity-type-admin-service.php'; |
|
938 | 938 | |
939 | 939 | /** |
940 | 940 | * The class responsible for defining all actions that occur in the public-facing |
941 | 941 | * side of the site. |
942 | 942 | */ |
943 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
943 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-public.php'; |
|
944 | 944 | |
945 | 945 | /** |
946 | 946 | * The shortcode abstract class. |
947 | 947 | */ |
948 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
948 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-shortcode.php'; |
|
949 | 949 | |
950 | 950 | /** |
951 | 951 | * The Timeline shortcode. |
952 | 952 | */ |
953 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
953 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-timeline-shortcode.php'; |
|
954 | 954 | |
955 | 955 | /** |
956 | 956 | * The Navigator shortcode. |
957 | 957 | */ |
958 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
958 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-navigator-shortcode.php'; |
|
959 | 959 | |
960 | 960 | /** |
961 | 961 | * The Products Navigator shortcode. |
962 | 962 | */ |
963 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
963 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-products-navigator-shortcode.php'; |
|
964 | 964 | |
965 | 965 | /** |
966 | 966 | * The chord shortcode. |
967 | 967 | */ |
968 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
968 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-chord-shortcode.php'; |
|
969 | 969 | |
970 | 970 | /** |
971 | 971 | * The geomap shortcode. |
972 | 972 | */ |
973 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
973 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-geomap-shortcode.php'; |
|
974 | 974 | |
975 | 975 | /** |
976 | 976 | * The entity cloud shortcode. |
977 | 977 | */ |
978 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
978 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
979 | 979 | |
980 | 980 | /** |
981 | 981 | * The entity glossary shortcode. |
982 | 982 | */ |
983 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
984 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
983 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-alphabet-service.php'; |
|
984 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-vocabulary-shortcode.php'; |
|
985 | 985 | |
986 | 986 | /** |
987 | 987 | * Faceted Search shortcode. |
988 | 988 | */ |
989 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
989 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-faceted-search-shortcode.php'; |
|
990 | 990 | |
991 | 991 | /** |
992 | 992 | * The ShareThis service. |
993 | 993 | */ |
994 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
994 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-sharethis-service.php'; |
|
995 | 995 | |
996 | 996 | /** |
997 | 997 | * The SEO service. |
998 | 998 | */ |
999 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
999 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-seo-service.php'; |
|
1000 | 1000 | |
1001 | 1001 | /** |
1002 | 1002 | * The AMP service. |
1003 | 1003 | */ |
1004 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
1004 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-amp-service.php'; |
|
1005 | 1005 | |
1006 | 1006 | /** Widgets */ |
1007 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
1008 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1009 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
1007 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-widget.php'; |
|
1008 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1009 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-context-cards-service.php'; |
|
1010 | 1010 | |
1011 | 1011 | /* |
1012 | 1012 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1015,8 +1015,8 @@ discard block |
||
1015 | 1015 | * |
1016 | 1016 | * @since 3.20.0 |
1017 | 1017 | */ |
1018 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1019 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1018 | + require_once plugin_dir_path(__DIR__).'includes/batch/intf-wordlift-batch-operation.php'; |
|
1019 | + require_once plugin_dir_path(__DIR__).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1020 | 1020 | |
1021 | 1021 | /* |
1022 | 1022 | * Schema.org Services. |
@@ -1024,10 +1024,10 @@ discard block |
||
1024 | 1024 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1025 | 1025 | */ |
1026 | 1026 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
1027 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1028 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1029 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1030 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1027 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
1028 | + require_once plugin_dir_path(__DIR__).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1029 | + require_once plugin_dir_path(__DIR__).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1030 | + require_once plugin_dir_path(__DIR__).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1031 | 1031 | new Wordlift_Schemaorg_Sync_Service(); |
1032 | 1032 | $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
1033 | 1033 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1043,13 +1043,13 @@ discard block |
||
1043 | 1043 | |
1044 | 1044 | // Instantiate a global logger. |
1045 | 1045 | global $wl_logger; |
1046 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1046 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
1047 | 1047 | |
1048 | 1048 | // Load the `wl-api` end-point. |
1049 | 1049 | new Wordlift_Http_Api(); |
1050 | 1050 | |
1051 | 1051 | // Load the Install Service. |
1052 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
1052 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-service.php'; |
|
1053 | 1053 | $this->install_service = new Wordlift_Install_Service(); |
1054 | 1054 | $this->notice_service = new Wordlift_Notice_Service(); |
1055 | 1055 | $this->user_service = Wordlift_User_Service::get_instance(); |
@@ -1071,21 +1071,21 @@ discard block |
||
1071 | 1071 | add_action( |
1072 | 1072 | 'plugins_loaded', |
1073 | 1073 | // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
1074 | - function () use ( &$that, $schemaorg_property_service ) { |
|
1074 | + function() use (&$that, $schemaorg_property_service) { |
|
1075 | 1075 | |
1076 | 1076 | /** Services. */ |
1077 | 1077 | // Create the configuration service. |
1078 | 1078 | $api_service = new Wordlift_Api_Service(); |
1079 | 1079 | |
1080 | 1080 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
1081 | - $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
1081 | + $that->entity_link_service = new Wordlift_Entity_Link_Service($that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path()); |
|
1082 | 1082 | |
1083 | 1083 | $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
1084 | 1084 | |
1085 | 1085 | $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
1086 | 1086 | |
1087 | 1087 | // Create a new instance of the Redirect service. |
1088 | - $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
1088 | + $that->redirect_service = new Wordlift_Redirect_Service($that->entity_uri_service); |
|
1089 | 1089 | |
1090 | 1090 | // Create a new instance of the Timeline service and Timeline shortcode. |
1091 | 1091 | $that->timeline_service = new Wordlift_Timeline_Service(); |
@@ -1098,30 +1098,30 @@ discard block |
||
1098 | 1098 | // Create an instance of the PrimaShop adapter. |
1099 | 1099 | $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
1100 | 1100 | |
1101 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1101 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
1102 | 1102 | |
1103 | 1103 | // Create the entity rating service. |
1104 | 1104 | $that->rating_service = Wordlift_Rating_Service::get_instance(); |
1105 | 1105 | |
1106 | 1106 | // Create entity list customization (wp-admin/edit.php). |
1107 | - $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
1107 | + $that->entity_list_service = new Wordlift_Entity_List_Service($that->rating_service); |
|
1108 | 1108 | |
1109 | 1109 | // Create an instance of the Publisher Service and the AJAX Adapter. |
1110 | 1110 | $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
1111 | - $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1112 | - $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1111 | + $that->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
1112 | + $that->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
1113 | 1113 | |
1114 | 1114 | $attachment_service = Wordlift_Attachment_Service::get_instance(); |
1115 | 1115 | |
1116 | 1116 | // Instantiate the JSON-LD service. |
1117 | 1117 | $property_getter = Wordlift_Property_Getter_Factory::create(); |
1118 | - $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1119 | - $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
1120 | - $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
1121 | - $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1118 | + $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service); |
|
1119 | + $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter); |
|
1120 | + $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter($that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter); |
|
1121 | + $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service); |
|
1122 | 1122 | |
1123 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
1124 | - $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
1123 | + $jsonld_cache = new Ttl_Cache('jsonld', 86400); |
|
1124 | + $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($that->postid_to_jsonld_converter, $jsonld_cache); |
|
1125 | 1125 | /* |
1126 | 1126 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
1127 | 1127 | * |
@@ -1129,22 +1129,22 @@ discard block |
||
1129 | 1129 | * |
1130 | 1130 | * @since 3.20.0 |
1131 | 1131 | */ |
1132 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1132 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-term-jsonld-adapter.php'; |
|
1133 | 1133 | |
1134 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
1135 | - $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
1134 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter($that->entity_uri_service, $that->cached_postid_to_jsonld_converter); |
|
1135 | + $that->jsonld_service = new Wordlift_Jsonld_Service(Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter); |
|
1136 | 1136 | |
1137 | 1137 | $jsonld_service = new Jsonld_Service( |
1138 | 1138 | $that->jsonld_service, |
1139 | 1139 | $term_jsonld_adapter, |
1140 | - new Jsonld_User_Service( $that->user_service ) |
|
1140 | + new Jsonld_User_Service($that->user_service) |
|
1141 | 1141 | ); |
1142 | - new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
1142 | + new Jsonld_Endpoint($jsonld_service, $that->entity_uri_service); |
|
1143 | 1143 | |
1144 | 1144 | // Prints the JSON-LD in the head. |
1145 | - new Jsonld_Adapter( $that->jsonld_service ); |
|
1145 | + new Jsonld_Adapter($that->jsonld_service); |
|
1146 | 1146 | |
1147 | - new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
1147 | + new Jsonld_By_Id_Endpoint($that->jsonld_service, $that->entity_uri_service); |
|
1148 | 1148 | |
1149 | 1149 | /** |
1150 | 1150 | * @since 3.37.1 |
@@ -1157,10 +1157,10 @@ discard block |
||
1157 | 1157 | // Creating Faq Content filter service. |
1158 | 1158 | $that->faq_content_filter_service = new Faq_Content_Filter(); |
1159 | 1159 | $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
1160 | - $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
1160 | + $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($that->sample_data_service); |
|
1161 | 1161 | |
1162 | - $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
1163 | - $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
1162 | + $that->loader->add_action('enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks'); |
|
1163 | + $that->loader->add_action('admin_enqueue_scripts', $that, 'add_wl_enabled_blocks'); |
|
1164 | 1164 | |
1165 | 1165 | /** |
1166 | 1166 | * Filter: wl_feature__enable__blocks. |
@@ -1170,15 +1170,15 @@ discard block |
||
1170 | 1170 | * @return bool |
1171 | 1171 | * @since 3.27.6 |
1172 | 1172 | */ |
1173 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1173 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
1174 | 1174 | // Initialize the short-codes. |
1175 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
1175 | + new Async_Template_Decorator(new Wordlift_Navigator_Shortcode()); |
|
1176 | 1176 | new Wordlift_Chord_Shortcode(); |
1177 | 1177 | new Wordlift_Geomap_Shortcode(); |
1178 | 1178 | new Wordlift_Timeline_Shortcode(); |
1179 | - new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
1179 | + new Wordlift_Related_Entities_Cloud_Shortcode(Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance()); |
|
1180 | 1180 | new Wordlift_Vocabulary_Shortcode(); |
1181 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
1181 | + new Async_Template_Decorator(new Wordlift_Faceted_Search_Shortcode()); |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | new Wordlift_Products_Navigator_Shortcode(); |
@@ -1190,16 +1190,16 @@ discard block |
||
1190 | 1190 | new Wordlift_Seo_Service(); |
1191 | 1191 | |
1192 | 1192 | // Initialize the AMP service. |
1193 | - new Wordlift_AMP_Service( $that->jsonld_service ); |
|
1193 | + new Wordlift_AMP_Service($that->jsonld_service); |
|
1194 | 1194 | |
1195 | 1195 | /** Services. */ |
1196 | 1196 | $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
1197 | 1197 | new Wordlift_Image_Service(); |
1198 | 1198 | |
1199 | 1199 | /** Adapters. */ |
1200 | - $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
1201 | - $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
1202 | - $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
1200 | + $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter(Wordlift_Entity_Type_Service::get_instance()); |
|
1201 | + $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($that->publisher_service); |
|
1202 | + $that->tinymce_adapter = new Wordlift_Tinymce_Adapter($that); |
|
1203 | 1203 | |
1204 | 1204 | /* |
1205 | 1205 | * Exclude our public js from WP-Rocket. |
@@ -1219,14 +1219,14 @@ discard block |
||
1219 | 1219 | $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
1220 | 1220 | $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
1221 | 1221 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
1222 | - $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
1223 | - $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
1222 | + $that->publisher_element = new Wordlift_Admin_Publisher_Element($that->publisher_service, $tabs_element, $that->select2_element); |
|
1223 | + $that->author_element = new Wordlift_Admin_Author_Element($that->publisher_service, $that->select2_element); |
|
1224 | 1224 | |
1225 | 1225 | $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
1226 | - $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
1226 | + $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($that->settings_page); |
|
1227 | 1227 | |
1228 | - $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
1229 | - $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
1228 | + $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($that->input_element, $that->radio_input_element); |
|
1229 | + $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($that->analytics_settings_page); |
|
1230 | 1230 | $that->analytics_connect = new Wordlift_Analytics_Connect(); |
1231 | 1231 | |
1232 | 1232 | // Pages. |
@@ -1237,9 +1237,9 @@ discard block |
||
1237 | 1237 | * |
1238 | 1238 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
1239 | 1239 | */ |
1240 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
1241 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1242 | - new Wordlift_Admin_Post_Edit_Page( $that ); |
|
1240 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
1241 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-post-edit-page.php'; |
|
1242 | + new Wordlift_Admin_Post_Edit_Page($that); |
|
1243 | 1243 | } |
1244 | 1244 | new Wordlift_Entity_Type_Admin_Service(); |
1245 | 1245 | |
@@ -1247,19 +1247,19 @@ discard block |
||
1247 | 1247 | $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
1248 | 1248 | |
1249 | 1249 | // Create an instance of the install wizard. |
1250 | - $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
1250 | + $that->admin_setup = new Wordlift_Admin_Setup($that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element); |
|
1251 | 1251 | |
1252 | - $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
1252 | + $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($that->entity_post_type_service); |
|
1253 | 1253 | |
1254 | 1254 | // User Profile. |
1255 | - new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
1255 | + new Wordlift_Admin_User_Profile_Page($that->author_element, $that->user_service); |
|
1256 | 1256 | |
1257 | 1257 | $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
1258 | 1258 | |
1259 | 1259 | // Load the debug service if WP is in debug mode. |
1260 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1261 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
1262 | - new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
1260 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1261 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-debug-service.php'; |
|
1262 | + new Wordlift_Debug_Service(Wordlift_Entity_Service::get_instance(), $uri_service); |
|
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | // Remote Image Service. |
@@ -1272,12 +1272,12 @@ discard block |
||
1272 | 1272 | * |
1273 | 1273 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
1274 | 1274 | */ |
1275 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
1276 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1277 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1275 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-batch-action.php'; |
|
1276 | + require_once plugin_dir_path(__DIR__).'includes/mapping/class-wordlift-mapping-service.php'; |
|
1277 | + require_once plugin_dir_path(__DIR__).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1278 | 1278 | |
1279 | 1279 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
1280 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1280 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
1281 | 1281 | |
1282 | 1282 | /* |
1283 | 1283 | * Load the Mappings JSON-LD post processing. |
@@ -1291,11 +1291,11 @@ discard block |
||
1291 | 1291 | // Taxonomy term rule validator for validating rules for term pages. |
1292 | 1292 | new Taxonomy_Term_Rule_Validator(); |
1293 | 1293 | new Post_Taxonomy_Term_Rule_Validator(); |
1294 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
1295 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
1296 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
1294 | + $rule_validators_registry = new Rule_Validators_Registry($default_rule_validator); |
|
1295 | + $rule_groups_validator = new Rule_Groups_Validator($rule_validators_registry); |
|
1296 | + $mappings_validator = new Mappings_Validator($mappings_dbo, $rule_groups_validator); |
|
1297 | 1297 | |
1298 | - new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
1298 | + new Url_To_Entity_Transform_Function($that->entity_uri_service); |
|
1299 | 1299 | new Taxonomy_To_Terms_Transform_Function(); |
1300 | 1300 | new Post_Id_To_Entity_Transform_Function(); |
1301 | 1301 | $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | * Intiailize the acf group data formatter. |
1306 | 1306 | */ |
1307 | 1307 | new Acf_Group_Formatter(); |
1308 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
1308 | + new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry); |
|
1309 | 1309 | |
1310 | 1310 | /** |
1311 | 1311 | * @since 3.26.0 |
@@ -1323,16 +1323,16 @@ discard block |
||
1323 | 1323 | // Call this static method to register FAQ routes to rest api - disabled |
1324 | 1324 | // Faq_Rest_Controller::register_routes(); |
1325 | 1325 | |
1326 | - $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
1326 | + $that->storage_factory = new Wordlift_Storage_Factory(Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter); |
|
1327 | 1327 | |
1328 | 1328 | /** WL Autocomplete. */ |
1329 | - $autocomplete_service = new All_Autocomplete_Service( |
|
1329 | + $autocomplete_service = new All_Autocomplete_Service( |
|
1330 | 1330 | array( |
1331 | 1331 | new Local_Autocomplete_Service(), |
1332 | - new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
1332 | + new Linked_Data_Autocomplete_Service(Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance()), |
|
1333 | 1333 | ) |
1334 | 1334 | ); |
1335 | - $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
1335 | + $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service); |
|
1336 | 1336 | |
1337 | 1337 | /** |
1338 | 1338 | * @since 3.27.2 |
@@ -1341,10 +1341,10 @@ discard block |
||
1341 | 1341 | */ |
1342 | 1342 | new Recipe_Maker_Post_Type_Hook(); |
1343 | 1343 | $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
1344 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
1345 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
1346 | - new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
1347 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
1344 | + new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service); |
|
1345 | + new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service); |
|
1346 | + new Recipe_Maker_Jsonld_Swap($recipe_maker_validation_service, $that->jsonld_service); |
|
1347 | + new Recipe_Maker_Warning($recipe_maker_validation_service); |
|
1348 | 1348 | |
1349 | 1349 | new Duplicate_Markup_Remover(); |
1350 | 1350 | |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | * @since 3.27.8 |
1353 | 1353 | * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
1354 | 1354 | */ |
1355 | - new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
1355 | + new Key_Validation_Notice($that->key_validation_service, Wordlift_Configuration_Service::get_instance()); |
|
1356 | 1356 | /** |
1357 | 1357 | * @since 3.28.0 |
1358 | 1358 | * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | * @since 3.29.0 |
1364 | 1364 | * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
1365 | 1365 | */ |
1366 | - new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
1366 | + new Entity_Rest_Service(Wordlift_Entity_Type_Service::get_instance()); |
|
1367 | 1367 | |
1368 | 1368 | /** |
1369 | 1369 | * Expand author in to references. |
@@ -1372,12 +1372,12 @@ discard block |
||
1372 | 1372 | * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
1373 | 1373 | */ |
1374 | 1374 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
1375 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
1376 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
1375 | + if (apply_filters('wl_feature__enable__article-wrapper', false)) { |
|
1376 | + new Jsonld_Article_Wrapper(Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
1380 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
1380 | + if (apply_filters('wl_feature__enable__match-terms', false)) { |
|
1381 | 1381 | $vocabulary_loader = new Vocabulary_Loader(); |
1382 | 1382 | $vocabulary_loader->init_vocabulary(); |
1383 | 1383 | } |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | /** |
1386 | 1386 | * Added for feature request 1496 (Webhooks) |
1387 | 1387 | */ |
1388 | - if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
1388 | + if (apply_filters('wl_feature__enable__webhooks', false)) { |
|
1389 | 1389 | $that->webhook_loader = new Webhooks_Loader(); |
1390 | 1390 | $that->webhook_loader->init(); |
1391 | 1391 | } |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | * @since 3.31.5 |
1415 | 1415 | * Create configuration endpoint for webapp to configure. |
1416 | 1416 | */ |
1417 | - new Config( $that->admin_setup, $that->key_validation_service ); |
|
1417 | + new Config($that->admin_setup, $that->key_validation_service); |
|
1418 | 1418 | /** |
1419 | 1419 | * @since 3.31.7 |
1420 | 1420 | * Remove duplicate videoobject. |
@@ -1426,7 +1426,7 @@ discard block |
||
1426 | 1426 | * @since 3.32.0 |
1427 | 1427 | * Create loader for vocabulary terms. |
1428 | 1428 | */ |
1429 | - $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
1429 | + $vocabulary_terms_loader = new Vocabulary_Terms_Loader(Wordlift_Entity_Type_Service::get_instance(), $property_getter); |
|
1430 | 1430 | $vocabulary_terms_loader->init_feature(); |
1431 | 1431 | |
1432 | 1432 | new Entity_Type_Change_Handler( |
@@ -1455,9 +1455,9 @@ discard block |
||
1455 | 1455 | private function set_locale() { |
1456 | 1456 | |
1457 | 1457 | $plugin_i18n = new Wordlift_I18n(); |
1458 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1458 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
1459 | 1459 | |
1460 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1460 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
1461 | 1461 | |
1462 | 1462 | } |
1463 | 1463 | |
@@ -1468,7 +1468,7 @@ discard block |
||
1468 | 1468 | * @since 1.0.0 |
1469 | 1469 | * @access private |
1470 | 1470 | */ |
1471 | - private function define_admin_hooks( $that ) { |
|
1471 | + private function define_admin_hooks($that) { |
|
1472 | 1472 | $plugin_admin = new Wordlift_Admin( |
1473 | 1473 | $that->get_plugin_name(), |
1474 | 1474 | $that->get_version(), |
@@ -1476,51 +1476,51 @@ discard block |
||
1476 | 1476 | $that->user_service |
1477 | 1477 | ); |
1478 | 1478 | |
1479 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1480 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1479 | + $that->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
1480 | + $that->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
1481 | 1481 | |
1482 | 1482 | // Hook the `admin_init` function to the Admin Setup. |
1483 | - Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
1484 | - $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
1483 | + Assertions::is_set($that->admin_setup, '`admin_setup` must be set'); |
|
1484 | + $that->loader->add_action('admin_init', $that->admin_setup, 'admin_init'); |
|
1485 | 1485 | |
1486 | 1486 | // Hook the admin_init to the settings page. |
1487 | - Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
1488 | - $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
1487 | + Assertions::is_set($that->settings_page, '`setting_page` must be set'); |
|
1488 | + $that->loader->add_action('admin_init', $that->settings_page, 'admin_init'); |
|
1489 | 1489 | |
1490 | 1490 | // Hook the admin_init to the analytics settings page. |
1491 | - Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
1492 | - $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
1491 | + Assertions::is_set($that->analytics_settings_page, '`analytics_setting_page` must be set'); |
|
1492 | + $that->loader->add_action('admin_init', $that->analytics_settings_page, 'admin_init'); |
|
1493 | 1493 | |
1494 | 1494 | // Hook the init action to taxonomy services. |
1495 | - $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
1496 | - $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
1495 | + $that->loader->add_action('init', $that->topic_taxonomy_service, 'init', 0); |
|
1496 | + $that->loader->add_action('init', $that->entity_types_taxonomy_service, 'init', 0); |
|
1497 | 1497 | |
1498 | 1498 | // Hook the AJAX wl_timeline action to the Timeline service. |
1499 | - $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1499 | + $that->loader->add_action('wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline'); |
|
1500 | 1500 | |
1501 | 1501 | // Register custom allowed redirect hosts. |
1502 | - $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
1502 | + $that->loader->add_filter('allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts'); |
|
1503 | 1503 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
1504 | - $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
1504 | + $that->loader->add_action('wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect'); |
|
1505 | 1505 | |
1506 | 1506 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
1507 | 1507 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
1508 | - $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
1509 | - $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
1508 | + $that->loader->add_action('save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2); |
|
1509 | + $that->loader->add_action('save_post', $that->rating_service, 'set_rating_for', 20, 1); |
|
1510 | 1510 | |
1511 | - $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
1512 | - $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
1511 | + $that->loader->add_action('edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1); |
|
1512 | + $that->loader->add_action('in_admin_header', $that->rating_service, 'in_admin_header'); |
|
1513 | 1513 | |
1514 | 1514 | // Entity listing customization (wp-admin/edit.php) |
1515 | 1515 | // Add custom columns. |
1516 | - $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
1516 | + $that->loader->add_filter('manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns'); |
|
1517 | 1517 | // no explicit entity as it prevents handling of other post types. |
1518 | - $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1518 | + $that->loader->add_filter('manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2); |
|
1519 | 1519 | // Add 4W selection. |
1520 | - $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1521 | - $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1522 | - $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
1523 | - $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
1520 | + $that->loader->add_action('restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
1521 | + $that->loader->add_filter('posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope'); |
|
1522 | + $that->loader->add_action('pre_get_posts', $that->entity_list_service, 'pre_get_posts'); |
|
1523 | + $that->loader->add_action('load-edit.php', $that->entity_list_service, 'load_edit'); |
|
1524 | 1524 | |
1525 | 1525 | /* |
1526 | 1526 | * If `All Entity Types` is disable, use the radio button Walker. |
@@ -1528,13 +1528,13 @@ discard block |
||
1528 | 1528 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1529 | 1529 | */ |
1530 | 1530 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
1531 | - if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1532 | - $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1531 | + if ( ! apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
1532 | + $that->loader->add_filter('wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
1536 | 1536 | // entities. |
1537 | - $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
1537 | + $that->loader->add_filter('prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10); |
|
1538 | 1538 | |
1539 | 1539 | /** |
1540 | 1540 | * Filter: wl_feature__enable__settings-download. |
@@ -1554,20 +1554,20 @@ discard block |
||
1554 | 1554 | ); |
1555 | 1555 | |
1556 | 1556 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
1557 | - $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
1557 | + $that->loader->add_action('wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10); |
|
1558 | 1558 | |
1559 | 1559 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
1560 | - $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1561 | - $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1562 | - $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1560 | + $that->loader->add_action('wp_ajax_wl_jsonld', $that->jsonld_service, 'get'); |
|
1561 | + $that->loader->add_action('admin_post_wl_jsonld', $that->jsonld_service, 'get'); |
|
1562 | + $that->loader->add_action('admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get'); |
|
1563 | 1563 | |
1564 | 1564 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
1565 | - $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
1565 | + $that->loader->add_action('wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key'); |
|
1566 | 1566 | |
1567 | 1567 | // Hook the AJAX wl_update_country_options action to the countries. |
1568 | - $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
1568 | + $that->loader->add_action('wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html'); |
|
1569 | 1569 | |
1570 | - $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
1570 | + $that->loader->add_filter('admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction'); |
|
1571 | 1571 | |
1572 | 1572 | // Hook the menu creation on the general wordlift menu creation. |
1573 | 1573 | /** |
@@ -1581,16 +1581,16 @@ discard block |
||
1581 | 1581 | * Since 3.30.0 this feature is registered using registry. |
1582 | 1582 | */ |
1583 | 1583 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
1584 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
1585 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
1584 | + if (apply_filters('wl_feature__enable__settings-screen', true) || Admin_User_Option::is_wordlift_admin()) { |
|
1585 | + add_action('wl_admin_menu', array($that->settings_page, 'admin_menu'), 10, 2); |
|
1586 | 1586 | } |
1587 | 1587 | |
1588 | 1588 | // Hook key update. |
1589 | - $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
1590 | - $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
1589 | + $that->loader->add_action('pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2); |
|
1590 | + $that->loader->add_action('update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2); |
|
1591 | 1591 | |
1592 | 1592 | // Add additional action links to the WordLift plugin in the plugins page. |
1593 | - $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
1593 | + $that->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1); |
|
1594 | 1594 | |
1595 | 1595 | /* |
1596 | 1596 | * Remove the Analytics Settings link from the plugin page. |
@@ -1601,23 +1601,23 @@ discard block |
||
1601 | 1601 | // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
1602 | 1602 | |
1603 | 1603 | // Hook the AJAX `wl_publisher` action name. |
1604 | - $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
1604 | + $that->loader->add_action('wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher'); |
|
1605 | 1605 | |
1606 | 1606 | // Hook row actions for the entity type list admin. |
1607 | - $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1607 | + $that->loader->add_filter('wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
1608 | 1608 | |
1609 | 1609 | /** Ajax actions. */ |
1610 | - $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
1610 | + $that->loader->add_action('wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export'); |
|
1611 | 1611 | |
1612 | 1612 | // Hook capabilities manipulation to allow access to entity type admin |
1613 | 1613 | // page on WordPress versions before 4.7. |
1614 | 1614 | global $wp_version; |
1615 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1616 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
1615 | + if (version_compare($wp_version, '4.7', '<')) { |
|
1616 | + $that->loader->add_filter('map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2); |
|
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | /** Adapters. */ |
1620 | - $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1620 | + $that->loader->add_filter('mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
1621 | 1621 | /** |
1622 | 1622 | * Disabling Faq temporarily. |
1623 | 1623 | * Load the tinymce editor button on the tool bar. |
@@ -1628,14 +1628,14 @@ discard block |
||
1628 | 1628 | // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
1629 | 1629 | // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
1630 | 1630 | |
1631 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
1632 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
1631 | + $that->loader->add_action('wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create'); |
|
1632 | + $that->loader->add_action('wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete'); |
|
1633 | 1633 | |
1634 | 1634 | /** |
1635 | 1635 | * @since 3.26.0 |
1636 | 1636 | */ |
1637 | 1637 | $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
1638 | - $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
1638 | + $that->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box'); |
|
1639 | 1639 | // Adding Rest route for the post excerpt |
1640 | 1640 | Post_Excerpt_Rest_Controller::register_routes(); |
1641 | 1641 | |
@@ -1656,14 +1656,14 @@ discard block |
||
1656 | 1656 | ); |
1657 | 1657 | |
1658 | 1658 | // Hooks to restrict multisite super admin from manipulating entity types. |
1659 | - if ( is_multisite() ) { |
|
1660 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
1659 | + if (is_multisite()) { |
|
1660 | + $that->loader->add_filter('map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2); |
|
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
1664 | 1664 | |
1665 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1666 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1665 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
1666 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
1667 | 1667 | add_action( |
1668 | 1668 | 'wp_ajax_wl_deactivation_feedback', |
1669 | 1669 | array( |
@@ -1679,13 +1679,13 @@ discard block |
||
1679 | 1679 | */ |
1680 | 1680 | add_filter( |
1681 | 1681 | 'allowed_block_types', |
1682 | - function ( $value ) { |
|
1682 | + function($value) { |
|
1683 | 1683 | |
1684 | - if ( true === $value ) { |
|
1684 | + if (true === $value) { |
|
1685 | 1685 | return $value; |
1686 | 1686 | } |
1687 | 1687 | |
1688 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
1688 | + return array_merge((array) $value, array('wordlift/classification')); |
|
1689 | 1689 | }, |
1690 | 1690 | PHP_INT_MAX |
1691 | 1691 | ); |
@@ -1705,57 +1705,57 @@ discard block |
||
1705 | 1705 | * @since 1.0.0 |
1706 | 1706 | * @access private |
1707 | 1707 | */ |
1708 | - private function define_public_hooks( $that ) { |
|
1708 | + private function define_public_hooks($that) { |
|
1709 | 1709 | |
1710 | - $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
1710 | + $plugin_public = new Wordlift_Public($that->get_plugin_name(), $that->get_version()); |
|
1711 | 1711 | |
1712 | 1712 | // Register the entity post type. |
1713 | - $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
1713 | + $that->loader->add_action('init', $that->entity_post_type_service, 'register'); |
|
1714 | 1714 | |
1715 | 1715 | // Bind the link generation and handling hooks to the entity link service. |
1716 | - $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
1717 | - $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1716 | + $that->loader->add_filter('post_type_link', $that->entity_link_service, 'post_type_link', 10, 2); |
|
1717 | + $that->loader->add_action('pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
1718 | 1718 | |
1719 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1720 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1721 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
1719 | + $that->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
1720 | + $that->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
1721 | + $that->loader->add_action('wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts'); |
|
1722 | 1722 | |
1723 | 1723 | // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
1724 | - $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
1724 | + $that->loader->add_filter('the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags'); |
|
1725 | 1725 | // Hook the content filter service to add entity links. |
1726 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1726 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
1727 | 1727 | // We run before other filters. |
1728 | - $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
1728 | + $that->loader->add_filter('the_content', $that->content_filter_service, 'the_content', 9); |
|
1729 | 1729 | } |
1730 | 1730 | |
1731 | 1731 | // Hook the AJAX wl_timeline action to the Timeline service. |
1732 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1732 | + $that->loader->add_action('wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline'); |
|
1733 | 1733 | |
1734 | 1734 | // Hook the ShareThis service. |
1735 | - $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
1736 | - $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
1735 | + $that->loader->add_filter('the_content', $that->sharethis_service, 'the_content', 99); |
|
1736 | + $that->loader->add_filter('the_excerpt', $that->sharethis_service, 'the_excerpt', 99); |
|
1737 | 1737 | |
1738 | 1738 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
1739 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1739 | + $that->loader->add_action('wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get'); |
|
1740 | 1740 | |
1741 | 1741 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
1742 | 1742 | // in order to tweak WP's `WP_Query` to include entities in queries related |
1743 | 1743 | // to categories. |
1744 | - $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1744 | + $that->loader->add_action('pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
1745 | 1745 | |
1746 | 1746 | /* |
1747 | 1747 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
1748 | 1748 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
1749 | 1749 | * order of start time. |
1750 | 1750 | */ |
1751 | - $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1751 | + $that->loader->add_action('pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1); |
|
1752 | 1752 | |
1753 | 1753 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
1754 | - $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
1754 | + $that->loader->add_action('save_post', $that->entity_type_adapter, 'save_post', 9, 2); |
|
1755 | 1755 | |
1756 | 1756 | // Analytics Script Frontend. |
1757 | - if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
1758 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
1757 | + if (apply_filters('wl_feature__enable__analytics', true) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable()) { |
|
1758 | + $that->loader->add_action('wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10); |
|
1759 | 1759 | } |
1760 | 1760 | |
1761 | 1761 | } |
@@ -1820,7 +1820,7 @@ discard block |
||
1820 | 1820 | * @since 3.27.6 |
1821 | 1821 | */ |
1822 | 1822 | // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
1823 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
1823 | + wp_register_script('wl_enabled_blocks', false); |
|
1824 | 1824 | |
1825 | 1825 | $enabled_blocks = array(); |
1826 | 1826 | |
@@ -1830,11 +1830,11 @@ discard block |
||
1830 | 1830 | * @since 3.32.3 |
1831 | 1831 | */ |
1832 | 1832 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
1833 | - if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
1833 | + if (apply_filters('wl_feature__enable__product-navigator', true)) { |
|
1834 | 1834 | $enabled_blocks[] = 'wordlift/products-navigator'; |
1835 | 1835 | } |
1836 | 1836 | |
1837 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1837 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
1838 | 1838 | // To intimate JS |
1839 | 1839 | $enabled_blocks = array_merge( |
1840 | 1840 | $enabled_blocks, |
@@ -1850,8 +1850,8 @@ discard block |
||
1850 | 1850 | ); |
1851 | 1851 | } |
1852 | 1852 | |
1853 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
1854 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
1853 | + wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks); |
|
1854 | + wp_enqueue_script('wl_enabled_blocks'); |
|
1855 | 1855 | } |
1856 | 1856 | |
1857 | 1857 | /** |
@@ -1860,13 +1860,13 @@ discard block |
||
1860 | 1860 | public function register_screens() { |
1861 | 1861 | // Hook the menu to the Download Your Data page. |
1862 | 1862 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
1863 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
1864 | - Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
1865 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
1863 | + if (apply_filters('wl_feature__enable__settings-download', true)) { |
|
1864 | + Assertions::is_set($this->download_your_data_page, "`download_your_data_page` can't be null"); |
|
1865 | + add_action('admin_menu', array($this->download_your_data_page, 'admin_menu'), 100, 0); |
|
1866 | 1866 | } |
1867 | 1867 | |
1868 | - Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
1869 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
1868 | + Assertions::is_set($this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null"); |
|
1869 | + add_action('admin_menu', array($this->entity_type_settings_admin_page, 'admin_menu'), 100, 0); |
|
1870 | 1870 | |
1871 | 1871 | } |
1872 | 1872 |
@@ -14,77 +14,77 @@ |
||
14 | 14 | */ |
15 | 15 | class Wordlift_Tinymce_Adapter { |
16 | 16 | |
17 | - /** |
|
18 | - * The {@link Wordlift} plugin instance. |
|
19 | - * |
|
20 | - * @since 3.12.0 |
|
21 | - * @access private |
|
22 | - * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
23 | - */ |
|
24 | - private $plugin; |
|
17 | + /** |
|
18 | + * The {@link Wordlift} plugin instance. |
|
19 | + * |
|
20 | + * @since 3.12.0 |
|
21 | + * @access private |
|
22 | + * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
23 | + */ |
|
24 | + private $plugin; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Wordlift_Tinymce_Adapter constructor. |
|
28 | - * |
|
29 | - * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
30 | - */ |
|
31 | - public function __construct( $plugin ) { |
|
26 | + /** |
|
27 | + * Wordlift_Tinymce_Adapter constructor. |
|
28 | + * |
|
29 | + * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
30 | + */ |
|
31 | + public function __construct( $plugin ) { |
|
32 | 32 | |
33 | - $this->plugin = $plugin; |
|
33 | + $this->plugin = $plugin; |
|
34 | 34 | |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Load the TinyMCE plugin. This method is called by the WP mce_external_plugins hook. |
|
39 | - * |
|
40 | - * @param array $plugins The existing plugins array. |
|
41 | - * |
|
42 | - * @return array The modified plugins array. |
|
43 | - * @since 3.12.0 |
|
44 | - */ |
|
45 | - public function mce_external_plugins( $plugins ) { |
|
37 | + /** |
|
38 | + * Load the TinyMCE plugin. This method is called by the WP mce_external_plugins hook. |
|
39 | + * |
|
40 | + * @param array $plugins The existing plugins array. |
|
41 | + * |
|
42 | + * @return array The modified plugins array. |
|
43 | + * @since 3.12.0 |
|
44 | + */ |
|
45 | + public function mce_external_plugins( $plugins ) { |
|
46 | 46 | |
47 | - /** |
|
48 | - * Bail out if you are on Media Library |
|
49 | - * |
|
50 | - * @since 3.27.1 |
|
51 | - * |
|
52 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1122 |
|
53 | - */ |
|
54 | - if ( isset( get_current_screen()->base ) && get_current_screen()->base === 'upload' ) { |
|
55 | - return $plugins; |
|
56 | - } |
|
47 | + /** |
|
48 | + * Bail out if you are on Media Library |
|
49 | + * |
|
50 | + * @since 3.27.1 |
|
51 | + * |
|
52 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1122 |
|
53 | + */ |
|
54 | + if ( isset( get_current_screen()->base ) && get_current_screen()->base === 'upload' ) { |
|
55 | + return $plugins; |
|
56 | + } |
|
57 | 57 | |
58 | - /* |
|
58 | + /* |
|
59 | 59 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
60 | 60 | * |
61 | 61 | * @since 3.20.3 |
62 | 62 | * |
63 | 63 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
64 | 64 | */ |
65 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
66 | - return $plugins; |
|
67 | - } |
|
65 | + if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
66 | + return $plugins; |
|
67 | + } |
|
68 | 68 | |
69 | - // Get WordLift's version as a cache killer. |
|
70 | - $version = $this->plugin->get_version(); |
|
69 | + // Get WordLift's version as a cache killer. |
|
70 | + $version = $this->plugin->get_version(); |
|
71 | 71 | |
72 | - // User can edit? |
|
73 | - $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
72 | + // User can edit? |
|
73 | + $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
74 | 74 | |
75 | - // If user can't edit or rich editing isn't enabled, bail out. |
|
76 | - if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
77 | - return $plugins; |
|
78 | - } |
|
75 | + // If user can't edit or rich editing isn't enabled, bail out. |
|
76 | + if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
77 | + return $plugins; |
|
78 | + } |
|
79 | 79 | |
80 | - // Add our own JavaScript file to TinyMCE's extensions. |
|
81 | - // DO NOT use the minified version, it'll yield errors with AngularJS. |
|
82 | - $plugins['wordlift'] = plugin_dir_url( __DIR__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
83 | - $plugins['wl_shortcodes'] = plugin_dir_url( __DIR__ ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
84 | - $plugins['wl_tinymce'] = plugin_dir_url( __DIR__ ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
85 | - $plugins['wl_tinymce_2'] = plugin_dir_url( __DIR__ ) . 'js/dist/tiny-mce.js?ver=' . $version; |
|
80 | + // Add our own JavaScript file to TinyMCE's extensions. |
|
81 | + // DO NOT use the minified version, it'll yield errors with AngularJS. |
|
82 | + $plugins['wordlift'] = plugin_dir_url( __DIR__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
83 | + $plugins['wl_shortcodes'] = plugin_dir_url( __DIR__ ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
84 | + $plugins['wl_tinymce'] = plugin_dir_url( __DIR__ ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
85 | + $plugins['wl_tinymce_2'] = plugin_dir_url( __DIR__ ) . 'js/dist/tiny-mce.js?ver=' . $version; |
|
86 | 86 | |
87 | - return $plugins; |
|
88 | - } |
|
87 | + return $plugins; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
30 | 30 | */ |
31 | - public function __construct( $plugin ) { |
|
31 | + public function __construct($plugin) { |
|
32 | 32 | |
33 | 33 | $this->plugin = $plugin; |
34 | 34 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return array The modified plugins array. |
43 | 43 | * @since 3.12.0 |
44 | 44 | */ |
45 | - public function mce_external_plugins( $plugins ) { |
|
45 | + public function mce_external_plugins($plugins) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Bail out if you are on Media Library |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @see https://github.com/insideout10/wordlift-plugin/issues/1122 |
53 | 53 | */ |
54 | - if ( isset( get_current_screen()->base ) && get_current_screen()->base === 'upload' ) { |
|
54 | + if (isset(get_current_screen()->base) && get_current_screen()->base === 'upload') { |
|
55 | 55 | return $plugins; |
56 | 56 | } |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
64 | 64 | */ |
65 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
65 | + if ( ! apply_filters('wl_can_see_classification_box', true)) { |
|
66 | 66 | return $plugins; |
67 | 67 | } |
68 | 68 | |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | $version = $this->plugin->get_version(); |
71 | 71 | |
72 | 72 | // User can edit? |
73 | - $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
73 | + $can_edit = current_user_can('edit_posts') || current_user_can('edit_pages'); |
|
74 | 74 | |
75 | 75 | // If user can't edit or rich editing isn't enabled, bail out. |
76 | - if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
76 | + if ( ! $can_edit || ! get_user_option('rich_editing')) { |
|
77 | 77 | return $plugins; |
78 | 78 | } |
79 | 79 | |
80 | 80 | // Add our own JavaScript file to TinyMCE's extensions. |
81 | 81 | // DO NOT use the minified version, it'll yield errors with AngularJS. |
82 | - $plugins['wordlift'] = plugin_dir_url( __DIR__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
83 | - $plugins['wl_shortcodes'] = plugin_dir_url( __DIR__ ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
84 | - $plugins['wl_tinymce'] = plugin_dir_url( __DIR__ ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
85 | - $plugins['wl_tinymce_2'] = plugin_dir_url( __DIR__ ) . 'js/dist/tiny-mce.js?ver=' . $version; |
|
82 | + $plugins['wordlift'] = plugin_dir_url(__DIR__).'js/wordlift-reloaded.js?ver='.$version; |
|
83 | + $plugins['wl_shortcodes'] = plugin_dir_url(__DIR__).'admin/js/wordlift_shortcode_tinymce_plugin.js?ver='.$version; |
|
84 | + $plugins['wl_tinymce'] = plugin_dir_url(__DIR__).'admin/js/1/tinymce.js?ver='.$version; |
|
85 | + $plugins['wl_tinymce_2'] = plugin_dir_url(__DIR__).'js/dist/tiny-mce.js?ver='.$version; |
|
86 | 86 | |
87 | 87 | return $plugins; |
88 | 88 | } |
@@ -14,118 +14,118 @@ |
||
14 | 14 | */ |
15 | 15 | abstract class Wordlift_Property_Service { |
16 | 16 | |
17 | - protected static $instance; |
|
18 | - |
|
19 | - public function __construct() { |
|
20 | - |
|
21 | - static::$instance = $this; |
|
22 | - } |
|
23 | - |
|
24 | - /** |
|
25 | - * Get the field singleton. |
|
26 | - * |
|
27 | - * @since 3.6.0 |
|
28 | - * @return \Wordlift_Schema_Url_Property_Service The singleton instance. |
|
29 | - */ |
|
30 | - public static function get_instance() { |
|
31 | - |
|
32 | - return static::$instance; |
|
33 | - } |
|
34 | - |
|
35 | - /** |
|
36 | - * Get the value for the specified post/entity. |
|
37 | - * |
|
38 | - * @since 3.6.0 |
|
39 | - * |
|
40 | - * @param int $post_id The post id. |
|
41 | - * |
|
42 | - * @return mixed |
|
43 | - */ |
|
44 | - abstract public function get( $post_id ); |
|
45 | - |
|
46 | - /** |
|
47 | - * Sanitize the provided value. |
|
48 | - * |
|
49 | - * @since 3.6.0 |
|
50 | - * |
|
51 | - * @param mixed $value The value to sanitize. |
|
52 | - * |
|
53 | - * @return mixed|NULL The sanitized value or NULL avoid saving this value (see {@link Wl_Metabox_Field}). |
|
54 | - */ |
|
55 | - abstract public function sanitize( $value ); |
|
56 | - |
|
57 | - /** |
|
58 | - * The RDF predicate for the property. |
|
59 | - * |
|
60 | - * @since 3.6.0 |
|
61 | - * @return string The RDF predicate. |
|
62 | - */ |
|
63 | - abstract public function get_rdf_predicate(); |
|
64 | - |
|
65 | - /** |
|
66 | - * The RDF data type. |
|
67 | - * |
|
68 | - * @since 3.6.0 |
|
69 | - * @return string The RDF data type. |
|
70 | - */ |
|
71 | - abstract public function get_rdf_data_type(); |
|
72 | - |
|
73 | - /** |
|
74 | - * The internal data type. |
|
75 | - * |
|
76 | - * @since 3.6.0 |
|
77 | - * @return string The internal data type. |
|
78 | - */ |
|
79 | - abstract public function get_data_type(); |
|
80 | - |
|
81 | - /** |
|
82 | - * The cardinality. |
|
83 | - * |
|
84 | - * @since 3.6.0 |
|
85 | - * @return mixed The cardinality. |
|
86 | - */ |
|
87 | - abstract public function get_cardinality(); |
|
88 | - |
|
89 | - /** |
|
90 | - * The metabox field class name. |
|
91 | - * |
|
92 | - * @since 3.6.0 |
|
93 | - * @return string The metabox field class name. |
|
94 | - */ |
|
95 | - abstract public function get_metabox_class(); |
|
96 | - |
|
97 | - /** |
|
98 | - * The untranslated metabox field label. |
|
99 | - * |
|
100 | - * @since 3.6.0 |
|
101 | - * @return string The untranslated metabox field label. |
|
102 | - */ |
|
103 | - abstract public function get_metabox_label(); |
|
104 | - |
|
105 | - /** |
|
106 | - * The definition of the property returned as a compatible array. |
|
107 | - * |
|
108 | - * @deprecated |
|
109 | - * |
|
110 | - * @since 3.6.0 |
|
111 | - * @return array An array of property definitions. |
|
112 | - */ |
|
113 | - public function get_compat_definition() { |
|
114 | - |
|
115 | - return array( |
|
116 | - 'type' => $this->get_data_type(), |
|
117 | - 'predicate' => $this->get_rdf_predicate(), |
|
118 | - 'export_type' => $this->get_rdf_data_type(), |
|
119 | - 'constraints' => array( |
|
120 | - 'cardinality' => $this->get_cardinality(), |
|
121 | - ), |
|
122 | - // Use the standard metabox for these URI (the URI metabox creates local entities). |
|
123 | - 'metabox' => array( |
|
124 | - 'class' => $this->get_metabox_class(), |
|
125 | - 'label' => $this->get_metabox_label(), |
|
126 | - ), |
|
127 | - 'sanitize' => array( $this, 'sanitize' ), |
|
128 | - ); |
|
129 | - } |
|
17 | + protected static $instance; |
|
18 | + |
|
19 | + public function __construct() { |
|
20 | + |
|
21 | + static::$instance = $this; |
|
22 | + } |
|
23 | + |
|
24 | + /** |
|
25 | + * Get the field singleton. |
|
26 | + * |
|
27 | + * @since 3.6.0 |
|
28 | + * @return \Wordlift_Schema_Url_Property_Service The singleton instance. |
|
29 | + */ |
|
30 | + public static function get_instance() { |
|
31 | + |
|
32 | + return static::$instance; |
|
33 | + } |
|
34 | + |
|
35 | + /** |
|
36 | + * Get the value for the specified post/entity. |
|
37 | + * |
|
38 | + * @since 3.6.0 |
|
39 | + * |
|
40 | + * @param int $post_id The post id. |
|
41 | + * |
|
42 | + * @return mixed |
|
43 | + */ |
|
44 | + abstract public function get( $post_id ); |
|
45 | + |
|
46 | + /** |
|
47 | + * Sanitize the provided value. |
|
48 | + * |
|
49 | + * @since 3.6.0 |
|
50 | + * |
|
51 | + * @param mixed $value The value to sanitize. |
|
52 | + * |
|
53 | + * @return mixed|NULL The sanitized value or NULL avoid saving this value (see {@link Wl_Metabox_Field}). |
|
54 | + */ |
|
55 | + abstract public function sanitize( $value ); |
|
56 | + |
|
57 | + /** |
|
58 | + * The RDF predicate for the property. |
|
59 | + * |
|
60 | + * @since 3.6.0 |
|
61 | + * @return string The RDF predicate. |
|
62 | + */ |
|
63 | + abstract public function get_rdf_predicate(); |
|
64 | + |
|
65 | + /** |
|
66 | + * The RDF data type. |
|
67 | + * |
|
68 | + * @since 3.6.0 |
|
69 | + * @return string The RDF data type. |
|
70 | + */ |
|
71 | + abstract public function get_rdf_data_type(); |
|
72 | + |
|
73 | + /** |
|
74 | + * The internal data type. |
|
75 | + * |
|
76 | + * @since 3.6.0 |
|
77 | + * @return string The internal data type. |
|
78 | + */ |
|
79 | + abstract public function get_data_type(); |
|
80 | + |
|
81 | + /** |
|
82 | + * The cardinality. |
|
83 | + * |
|
84 | + * @since 3.6.0 |
|
85 | + * @return mixed The cardinality. |
|
86 | + */ |
|
87 | + abstract public function get_cardinality(); |
|
88 | + |
|
89 | + /** |
|
90 | + * The metabox field class name. |
|
91 | + * |
|
92 | + * @since 3.6.0 |
|
93 | + * @return string The metabox field class name. |
|
94 | + */ |
|
95 | + abstract public function get_metabox_class(); |
|
96 | + |
|
97 | + /** |
|
98 | + * The untranslated metabox field label. |
|
99 | + * |
|
100 | + * @since 3.6.0 |
|
101 | + * @return string The untranslated metabox field label. |
|
102 | + */ |
|
103 | + abstract public function get_metabox_label(); |
|
104 | + |
|
105 | + /** |
|
106 | + * The definition of the property returned as a compatible array. |
|
107 | + * |
|
108 | + * @deprecated |
|
109 | + * |
|
110 | + * @since 3.6.0 |
|
111 | + * @return array An array of property definitions. |
|
112 | + */ |
|
113 | + public function get_compat_definition() { |
|
114 | + |
|
115 | + return array( |
|
116 | + 'type' => $this->get_data_type(), |
|
117 | + 'predicate' => $this->get_rdf_predicate(), |
|
118 | + 'export_type' => $this->get_rdf_data_type(), |
|
119 | + 'constraints' => array( |
|
120 | + 'cardinality' => $this->get_cardinality(), |
|
121 | + ), |
|
122 | + // Use the standard metabox for these URI (the URI metabox creates local entities). |
|
123 | + 'metabox' => array( |
|
124 | + 'class' => $this->get_metabox_class(), |
|
125 | + 'label' => $this->get_metabox_label(), |
|
126 | + ), |
|
127 | + 'sanitize' => array( $this, 'sanitize' ), |
|
128 | + ); |
|
129 | + } |
|
130 | 130 | |
131 | 131 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return mixed |
43 | 43 | */ |
44 | - abstract public function get( $post_id ); |
|
44 | + abstract public function get($post_id); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Sanitize the provided value. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return mixed|NULL The sanitized value or NULL avoid saving this value (see {@link Wl_Metabox_Field}). |
54 | 54 | */ |
55 | - abstract public function sanitize( $value ); |
|
55 | + abstract public function sanitize($value); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * The RDF predicate for the property. |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'class' => $this->get_metabox_class(), |
125 | 125 | 'label' => $this->get_metabox_label(), |
126 | 126 | ), |
127 | - 'sanitize' => array( $this, 'sanitize' ), |
|
127 | + 'sanitize' => array($this, 'sanitize'), |
|
128 | 128 | ); |
129 | 129 | } |
130 | 130 |
@@ -19,336 +19,336 @@ |
||
19 | 19 | */ |
20 | 20 | class Wordlift_User_Service { |
21 | 21 | |
22 | - /** |
|
23 | - * The meta key where the user's URI is stored. |
|
24 | - * |
|
25 | - * @since 3.1.7 |
|
26 | - */ |
|
27 | - const URI_META_KEY = '_wl_uri'; |
|
28 | - |
|
29 | - /** |
|
30 | - * The user meta key where the deny entity edit flag is stored. |
|
31 | - * |
|
32 | - * @since 3.14.0 |
|
33 | - */ |
|
34 | - const DENY_ENTITY_CREATE_META_KEY = '_wl_deny_entity_create'; |
|
35 | - |
|
36 | - /** |
|
37 | - * The meta key holding the entity id representing a {@link WP_User}. |
|
38 | - * |
|
39 | - * @since 3.14.0 |
|
40 | - */ |
|
41 | - const ENTITY_META_KEY = '_wl_entity'; |
|
42 | - |
|
43 | - /** |
|
44 | - * The Log service. |
|
45 | - * |
|
46 | - * @since 3.1.7 |
|
47 | - * @access private |
|
48 | - * @var \Wordlift_Log_Service $log_service The Log service. |
|
49 | - */ |
|
50 | - private $log_service; |
|
51 | - |
|
52 | - /** |
|
53 | - * Create an instance of the User service. |
|
54 | - * |
|
55 | - * @since 3.1.7 |
|
56 | - */ |
|
57 | - protected function __construct() { |
|
58 | - |
|
59 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' ); |
|
60 | - |
|
61 | - add_filter( 'user_has_cap', array( $this, 'has_cap' ), 10, 3 ); |
|
62 | - |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * The singleton instance of the User service. |
|
67 | - * |
|
68 | - * @since 3.1.7 |
|
69 | - * @access private |
|
70 | - * @var \Wordlift_User_Service $user_service The singleton instance of the User service. |
|
71 | - */ |
|
72 | - private static $instance = null; |
|
73 | - |
|
74 | - /** |
|
75 | - * Get the singleton instance of the User service. |
|
76 | - * |
|
77 | - * @return \Wordlift_User_Service The singleton instance of the User service. |
|
78 | - * @since 3.1.7 |
|
79 | - */ |
|
80 | - public static function get_instance() { |
|
81 | - |
|
82 | - if ( ! isset( self::$instance ) ) { |
|
83 | - self::$instance = new self(); |
|
84 | - } |
|
85 | - |
|
86 | - return self::$instance; |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * Get the URI for a user. |
|
91 | - * |
|
92 | - * @param int $user_id The user id |
|
93 | - * |
|
94 | - * @return false|string The user's URI or false in case of failure. |
|
95 | - * @since 3.1.7 |
|
96 | - */ |
|
97 | - public function get_uri( $user_id ) { |
|
98 | - |
|
99 | - // Try to get the URI stored in the user's meta and return it if available. |
|
100 | - $dataset_uri = wl_configuration_get_redlink_dataset_uri(); |
|
101 | - $user_uri = $this->_get_uri( $user_id ); |
|
102 | - if ( ! empty( $dataset_uri ) && ! empty( $user_uri ) && 0 === strpos( $user_uri, $dataset_uri ) ) { |
|
103 | - return $user_uri; |
|
104 | - } |
|
105 | - |
|
106 | - // Try to build an URI, return false in case of failure. |
|
107 | - $user_uri = $this->_build_uri( $user_id ); |
|
108 | - if ( false === $user_uri ) { |
|
109 | - return false; |
|
110 | - } |
|
111 | - |
|
112 | - // Store the URI for future requests (we need a "permanent" URI). |
|
113 | - $this->_set_uri( $user_id, $user_uri ); |
|
114 | - |
|
115 | - return $user_uri; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Set the `id` of the entity representing a {@link WP_User}. |
|
120 | - * |
|
121 | - * If the `id` is set to 0 (or less) then the meta is deleted. |
|
122 | - * |
|
123 | - * @param int $user_id The {@link WP_User}. |
|
124 | - * @param int $value The entity {@link WP_Post} `id`. |
|
125 | - * |
|
126 | - * @return bool|int Meta ID if the key didn't exist, true on successful update, false on failure. |
|
127 | - * @since 3.14.0 |
|
128 | - */ |
|
129 | - public function set_entity( $user_id, $value ) { |
|
130 | - |
|
131 | - return 0 < $value |
|
132 | - ? update_user_meta( $user_id, self::ENTITY_META_KEY, $value ) |
|
133 | - : delete_user_meta( $user_id, self::ENTITY_META_KEY ); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Get the {@link WP_Post} `id` of the entity representing a {@link WP_User}. |
|
138 | - * |
|
139 | - * @param int $user_id The {@link WP_User}'s `id`. |
|
140 | - * |
|
141 | - * @return string|false The entity {@link WP_Post} `id` or an empty string if not set or false if the object id is invalid |
|
142 | - * @since 3.14.0 |
|
143 | - */ |
|
144 | - public function get_entity( $user_id ) { |
|
145 | - |
|
146 | - return get_user_meta( $user_id, self::ENTITY_META_KEY, true ); |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * Get the user's URI stored in the user's meta. |
|
151 | - * |
|
152 | - * @param int $user_id The user id. |
|
153 | - * |
|
154 | - * @return false|string The user's URI or false if not found. |
|
155 | - * @since 3.1.7 |
|
156 | - */ |
|
157 | - // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
158 | - private function _get_uri( $user_id ) { |
|
159 | - |
|
160 | - $user_uri = get_user_meta( $user_id, self::URI_META_KEY, true ); |
|
161 | - |
|
162 | - if ( empty( $user_uri ) ) { |
|
163 | - return false; |
|
164 | - } |
|
165 | - |
|
166 | - return $user_uri; |
|
167 | - } |
|
168 | - |
|
169 | - /** |
|
170 | - * Build an URI for a user. |
|
171 | - * |
|
172 | - * @param int $user_id The user's id. |
|
173 | - * |
|
174 | - * @return false|string The user's URI or false in case of failure. |
|
175 | - * @since 3.1.7 |
|
176 | - */ |
|
177 | - // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
178 | - private function _build_uri( $user_id ) { |
|
179 | - |
|
180 | - // Get the user, return false in case of failure. |
|
181 | - $user = get_userdata( $user_id ); |
|
182 | - if ( false === $user ) { |
|
183 | - return false; |
|
184 | - }; |
|
185 | - |
|
186 | - // If the nicename is not set, return a failure. |
|
187 | - if ( empty( $user->user_nicename ) ) { |
|
188 | - return false; |
|
189 | - } |
|
190 | - |
|
191 | - /** |
|
192 | - * @since 3.27.7 changed `user` to `author` to avoid potential clashes with CPTs ( `author` is reserved |
|
193 | - * https://developer.wordpress.org/reference/functions/register_post_type/#reserved-post-types ) |
|
194 | - */ |
|
195 | - return untrailingslashit( wl_configuration_get_redlink_dataset_uri() ) . "/author/$user->user_nicename"; |
|
196 | - } |
|
197 | - |
|
198 | - /** |
|
199 | - * Store the URI in user's meta. |
|
200 | - * |
|
201 | - * @param int $user_id The user's id. |
|
202 | - * @param string $user_uri The user's uri. |
|
203 | - * |
|
204 | - * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
|
205 | - * @since 3.1.7 |
|
206 | - */ |
|
207 | - // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
208 | - private function _set_uri( $user_id, $user_uri ) { |
|
209 | - |
|
210 | - return update_user_meta( $user_id, self::URI_META_KEY, $user_uri ); |
|
211 | - } |
|
212 | - |
|
213 | - /** |
|
214 | - * Mark an editor user as denied from editing entities. |
|
215 | - * Does nothing if the user is not an editor |
|
216 | - * |
|
217 | - * @param integer $user_id The ID of the user |
|
218 | - * |
|
219 | - * @since 3.14.0 |
|
220 | - */ |
|
221 | - public function deny_editor_entity_create( $user_id ) { |
|
222 | - |
|
223 | - // Bail out if the user is not an editor. |
|
224 | - if ( ! $this->is_editor( $user_id ) ) { |
|
225 | - return; |
|
226 | - } |
|
227 | - |
|
228 | - // The user explicitly do not have the capability. |
|
229 | - update_user_option( $user_id, self::DENY_ENTITY_CREATE_META_KEY, 'yes' ); |
|
230 | - |
|
231 | - } |
|
232 | - |
|
233 | - /** |
|
234 | - * Remove the "deny entity editing" mark from an editor user. |
|
235 | - * Does nothing if the user is not an editor |
|
236 | - * |
|
237 | - * @param integer $user_id The ID of the user |
|
238 | - * |
|
239 | - * @since 3.14.0 |
|
240 | - */ |
|
241 | - public function allow_editor_entity_create( $user_id ) { |
|
242 | - |
|
243 | - // Bail out if the user is not an editor. |
|
244 | - if ( ! $this->is_editor( $user_id ) ) { |
|
245 | - return; |
|
246 | - } |
|
247 | - |
|
248 | - // The user explicitly do not have the capability. |
|
249 | - delete_user_option( $user_id, self::DENY_ENTITY_CREATE_META_KEY ); |
|
250 | - |
|
251 | - } |
|
252 | - |
|
253 | - /** |
|
254 | - * Get whether the 'deny editor entity editing' flag is set. |
|
255 | - * |
|
256 | - * @param int $user_id The {@link WP_User} `id`. |
|
257 | - * |
|
258 | - * @return int bool True if editing is denied otherwise false. |
|
259 | - * @since 3.14.0 |
|
260 | - */ |
|
261 | - public function is_deny_editor_entity_create( $user_id ) { |
|
262 | - |
|
263 | - return 'yes' === get_user_option( self::DENY_ENTITY_CREATE_META_KEY, $user_id ); |
|
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * Check whether the {@link WP_User} with the specified `id` is an editor, |
|
268 | - * i.e. has the `editor` role. |
|
269 | - * |
|
270 | - * @param int $user_id The {@link WP_User} `id`. |
|
271 | - * |
|
272 | - * @return bool True if the {@link WP_User} is an editor otherwise false. |
|
273 | - * @since 3.14.0 |
|
274 | - */ |
|
275 | - public function is_editor( $user_id ) { |
|
276 | - |
|
277 | - // Get the user. |
|
278 | - $user = get_user_by( 'id', $user_id ); |
|
279 | - |
|
280 | - // Return true, if the user is found and has the `editor` role. |
|
281 | - return is_a( $user, 'WP_User' ) && in_array( 'editor', (array) $user->roles, true ); |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * Check if an editor can create entities. |
|
286 | - * |
|
287 | - * @param int $user_id The user id of the user being checked. |
|
288 | - * |
|
289 | - * @return bool false if it is an editor that is denied from edit entities, true otherwise. |
|
290 | - * @since 3.14.0 |
|
291 | - */ |
|
292 | - public function editor_can_create_entities( $user_id ) { |
|
293 | - |
|
294 | - // Return true if not an editor. |
|
295 | - if ( ! $this->is_editor( $user_id ) ) { |
|
296 | - return true; |
|
297 | - } |
|
298 | - |
|
299 | - // Check if the user explicitly denied. |
|
300 | - return ! $this->is_deny_editor_entity_create( $user_id ); |
|
301 | - } |
|
302 | - |
|
303 | - /** |
|
304 | - * Filter capabilities of user. |
|
305 | - * |
|
306 | - * Deny the capability of managing and editing entities for some users. |
|
307 | - * |
|
308 | - * @param array $allcaps All the capabilities of the user |
|
309 | - * @param array $cap [0] Required capability |
|
310 | - * @param array $args [0] Requested capability |
|
311 | - * [1] User ID |
|
312 | - * [2] Associated object ID |
|
313 | - * |
|
314 | - * @return array The capabilities array. |
|
315 | - * @since 3.14.0 |
|
316 | - */ |
|
317 | - public function has_cap( $allcaps, $cap, $args ) { |
|
318 | - /* |
|
22 | + /** |
|
23 | + * The meta key where the user's URI is stored. |
|
24 | + * |
|
25 | + * @since 3.1.7 |
|
26 | + */ |
|
27 | + const URI_META_KEY = '_wl_uri'; |
|
28 | + |
|
29 | + /** |
|
30 | + * The user meta key where the deny entity edit flag is stored. |
|
31 | + * |
|
32 | + * @since 3.14.0 |
|
33 | + */ |
|
34 | + const DENY_ENTITY_CREATE_META_KEY = '_wl_deny_entity_create'; |
|
35 | + |
|
36 | + /** |
|
37 | + * The meta key holding the entity id representing a {@link WP_User}. |
|
38 | + * |
|
39 | + * @since 3.14.0 |
|
40 | + */ |
|
41 | + const ENTITY_META_KEY = '_wl_entity'; |
|
42 | + |
|
43 | + /** |
|
44 | + * The Log service. |
|
45 | + * |
|
46 | + * @since 3.1.7 |
|
47 | + * @access private |
|
48 | + * @var \Wordlift_Log_Service $log_service The Log service. |
|
49 | + */ |
|
50 | + private $log_service; |
|
51 | + |
|
52 | + /** |
|
53 | + * Create an instance of the User service. |
|
54 | + * |
|
55 | + * @since 3.1.7 |
|
56 | + */ |
|
57 | + protected function __construct() { |
|
58 | + |
|
59 | + $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' ); |
|
60 | + |
|
61 | + add_filter( 'user_has_cap', array( $this, 'has_cap' ), 10, 3 ); |
|
62 | + |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * The singleton instance of the User service. |
|
67 | + * |
|
68 | + * @since 3.1.7 |
|
69 | + * @access private |
|
70 | + * @var \Wordlift_User_Service $user_service The singleton instance of the User service. |
|
71 | + */ |
|
72 | + private static $instance = null; |
|
73 | + |
|
74 | + /** |
|
75 | + * Get the singleton instance of the User service. |
|
76 | + * |
|
77 | + * @return \Wordlift_User_Service The singleton instance of the User service. |
|
78 | + * @since 3.1.7 |
|
79 | + */ |
|
80 | + public static function get_instance() { |
|
81 | + |
|
82 | + if ( ! isset( self::$instance ) ) { |
|
83 | + self::$instance = new self(); |
|
84 | + } |
|
85 | + |
|
86 | + return self::$instance; |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * Get the URI for a user. |
|
91 | + * |
|
92 | + * @param int $user_id The user id |
|
93 | + * |
|
94 | + * @return false|string The user's URI or false in case of failure. |
|
95 | + * @since 3.1.7 |
|
96 | + */ |
|
97 | + public function get_uri( $user_id ) { |
|
98 | + |
|
99 | + // Try to get the URI stored in the user's meta and return it if available. |
|
100 | + $dataset_uri = wl_configuration_get_redlink_dataset_uri(); |
|
101 | + $user_uri = $this->_get_uri( $user_id ); |
|
102 | + if ( ! empty( $dataset_uri ) && ! empty( $user_uri ) && 0 === strpos( $user_uri, $dataset_uri ) ) { |
|
103 | + return $user_uri; |
|
104 | + } |
|
105 | + |
|
106 | + // Try to build an URI, return false in case of failure. |
|
107 | + $user_uri = $this->_build_uri( $user_id ); |
|
108 | + if ( false === $user_uri ) { |
|
109 | + return false; |
|
110 | + } |
|
111 | + |
|
112 | + // Store the URI for future requests (we need a "permanent" URI). |
|
113 | + $this->_set_uri( $user_id, $user_uri ); |
|
114 | + |
|
115 | + return $user_uri; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Set the `id` of the entity representing a {@link WP_User}. |
|
120 | + * |
|
121 | + * If the `id` is set to 0 (or less) then the meta is deleted. |
|
122 | + * |
|
123 | + * @param int $user_id The {@link WP_User}. |
|
124 | + * @param int $value The entity {@link WP_Post} `id`. |
|
125 | + * |
|
126 | + * @return bool|int Meta ID if the key didn't exist, true on successful update, false on failure. |
|
127 | + * @since 3.14.0 |
|
128 | + */ |
|
129 | + public function set_entity( $user_id, $value ) { |
|
130 | + |
|
131 | + return 0 < $value |
|
132 | + ? update_user_meta( $user_id, self::ENTITY_META_KEY, $value ) |
|
133 | + : delete_user_meta( $user_id, self::ENTITY_META_KEY ); |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * Get the {@link WP_Post} `id` of the entity representing a {@link WP_User}. |
|
138 | + * |
|
139 | + * @param int $user_id The {@link WP_User}'s `id`. |
|
140 | + * |
|
141 | + * @return string|false The entity {@link WP_Post} `id` or an empty string if not set or false if the object id is invalid |
|
142 | + * @since 3.14.0 |
|
143 | + */ |
|
144 | + public function get_entity( $user_id ) { |
|
145 | + |
|
146 | + return get_user_meta( $user_id, self::ENTITY_META_KEY, true ); |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * Get the user's URI stored in the user's meta. |
|
151 | + * |
|
152 | + * @param int $user_id The user id. |
|
153 | + * |
|
154 | + * @return false|string The user's URI or false if not found. |
|
155 | + * @since 3.1.7 |
|
156 | + */ |
|
157 | + // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
158 | + private function _get_uri( $user_id ) { |
|
159 | + |
|
160 | + $user_uri = get_user_meta( $user_id, self::URI_META_KEY, true ); |
|
161 | + |
|
162 | + if ( empty( $user_uri ) ) { |
|
163 | + return false; |
|
164 | + } |
|
165 | + |
|
166 | + return $user_uri; |
|
167 | + } |
|
168 | + |
|
169 | + /** |
|
170 | + * Build an URI for a user. |
|
171 | + * |
|
172 | + * @param int $user_id The user's id. |
|
173 | + * |
|
174 | + * @return false|string The user's URI or false in case of failure. |
|
175 | + * @since 3.1.7 |
|
176 | + */ |
|
177 | + // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
178 | + private function _build_uri( $user_id ) { |
|
179 | + |
|
180 | + // Get the user, return false in case of failure. |
|
181 | + $user = get_userdata( $user_id ); |
|
182 | + if ( false === $user ) { |
|
183 | + return false; |
|
184 | + }; |
|
185 | + |
|
186 | + // If the nicename is not set, return a failure. |
|
187 | + if ( empty( $user->user_nicename ) ) { |
|
188 | + return false; |
|
189 | + } |
|
190 | + |
|
191 | + /** |
|
192 | + * @since 3.27.7 changed `user` to `author` to avoid potential clashes with CPTs ( `author` is reserved |
|
193 | + * https://developer.wordpress.org/reference/functions/register_post_type/#reserved-post-types ) |
|
194 | + */ |
|
195 | + return untrailingslashit( wl_configuration_get_redlink_dataset_uri() ) . "/author/$user->user_nicename"; |
|
196 | + } |
|
197 | + |
|
198 | + /** |
|
199 | + * Store the URI in user's meta. |
|
200 | + * |
|
201 | + * @param int $user_id The user's id. |
|
202 | + * @param string $user_uri The user's uri. |
|
203 | + * |
|
204 | + * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
|
205 | + * @since 3.1.7 |
|
206 | + */ |
|
207 | + // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
208 | + private function _set_uri( $user_id, $user_uri ) { |
|
209 | + |
|
210 | + return update_user_meta( $user_id, self::URI_META_KEY, $user_uri ); |
|
211 | + } |
|
212 | + |
|
213 | + /** |
|
214 | + * Mark an editor user as denied from editing entities. |
|
215 | + * Does nothing if the user is not an editor |
|
216 | + * |
|
217 | + * @param integer $user_id The ID of the user |
|
218 | + * |
|
219 | + * @since 3.14.0 |
|
220 | + */ |
|
221 | + public function deny_editor_entity_create( $user_id ) { |
|
222 | + |
|
223 | + // Bail out if the user is not an editor. |
|
224 | + if ( ! $this->is_editor( $user_id ) ) { |
|
225 | + return; |
|
226 | + } |
|
227 | + |
|
228 | + // The user explicitly do not have the capability. |
|
229 | + update_user_option( $user_id, self::DENY_ENTITY_CREATE_META_KEY, 'yes' ); |
|
230 | + |
|
231 | + } |
|
232 | + |
|
233 | + /** |
|
234 | + * Remove the "deny entity editing" mark from an editor user. |
|
235 | + * Does nothing if the user is not an editor |
|
236 | + * |
|
237 | + * @param integer $user_id The ID of the user |
|
238 | + * |
|
239 | + * @since 3.14.0 |
|
240 | + */ |
|
241 | + public function allow_editor_entity_create( $user_id ) { |
|
242 | + |
|
243 | + // Bail out if the user is not an editor. |
|
244 | + if ( ! $this->is_editor( $user_id ) ) { |
|
245 | + return; |
|
246 | + } |
|
247 | + |
|
248 | + // The user explicitly do not have the capability. |
|
249 | + delete_user_option( $user_id, self::DENY_ENTITY_CREATE_META_KEY ); |
|
250 | + |
|
251 | + } |
|
252 | + |
|
253 | + /** |
|
254 | + * Get whether the 'deny editor entity editing' flag is set. |
|
255 | + * |
|
256 | + * @param int $user_id The {@link WP_User} `id`. |
|
257 | + * |
|
258 | + * @return int bool True if editing is denied otherwise false. |
|
259 | + * @since 3.14.0 |
|
260 | + */ |
|
261 | + public function is_deny_editor_entity_create( $user_id ) { |
|
262 | + |
|
263 | + return 'yes' === get_user_option( self::DENY_ENTITY_CREATE_META_KEY, $user_id ); |
|
264 | + } |
|
265 | + |
|
266 | + /** |
|
267 | + * Check whether the {@link WP_User} with the specified `id` is an editor, |
|
268 | + * i.e. has the `editor` role. |
|
269 | + * |
|
270 | + * @param int $user_id The {@link WP_User} `id`. |
|
271 | + * |
|
272 | + * @return bool True if the {@link WP_User} is an editor otherwise false. |
|
273 | + * @since 3.14.0 |
|
274 | + */ |
|
275 | + public function is_editor( $user_id ) { |
|
276 | + |
|
277 | + // Get the user. |
|
278 | + $user = get_user_by( 'id', $user_id ); |
|
279 | + |
|
280 | + // Return true, if the user is found and has the `editor` role. |
|
281 | + return is_a( $user, 'WP_User' ) && in_array( 'editor', (array) $user->roles, true ); |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * Check if an editor can create entities. |
|
286 | + * |
|
287 | + * @param int $user_id The user id of the user being checked. |
|
288 | + * |
|
289 | + * @return bool false if it is an editor that is denied from edit entities, true otherwise. |
|
290 | + * @since 3.14.0 |
|
291 | + */ |
|
292 | + public function editor_can_create_entities( $user_id ) { |
|
293 | + |
|
294 | + // Return true if not an editor. |
|
295 | + if ( ! $this->is_editor( $user_id ) ) { |
|
296 | + return true; |
|
297 | + } |
|
298 | + |
|
299 | + // Check if the user explicitly denied. |
|
300 | + return ! $this->is_deny_editor_entity_create( $user_id ); |
|
301 | + } |
|
302 | + |
|
303 | + /** |
|
304 | + * Filter capabilities of user. |
|
305 | + * |
|
306 | + * Deny the capability of managing and editing entities for some users. |
|
307 | + * |
|
308 | + * @param array $allcaps All the capabilities of the user |
|
309 | + * @param array $cap [0] Required capability |
|
310 | + * @param array $args [0] Requested capability |
|
311 | + * [1] User ID |
|
312 | + * [2] Associated object ID |
|
313 | + * |
|
314 | + * @return array The capabilities array. |
|
315 | + * @since 3.14.0 |
|
316 | + */ |
|
317 | + public function has_cap( $allcaps, $cap, $args ) { |
|
318 | + /* |
|
319 | 319 | * For entity management/editing related capabilities |
320 | 320 | * check that an editor was not explicitly denied (in user profile) |
321 | 321 | * the capability. |
322 | 322 | */ |
323 | 323 | |
324 | - /* |
|
324 | + /* |
|
325 | 325 | * Need protection against the case of edit_user and likes which do not |
326 | 326 | * require a capability, just request one. |
327 | 327 | */ |
328 | - if ( empty( $cap ) || ! isset( $cap[0] ) ) { |
|
329 | - return $allcaps; |
|
330 | - } |
|
331 | - |
|
332 | - if ( |
|
333 | - ( 'edit_wordlift_entity' === $cap[0] ) || |
|
334 | - ( 'edit_wordlift_entities' === $cap[0] ) || |
|
335 | - ( 'edit_others_wordlift_entities' === $cap[0] ) || |
|
336 | - ( 'publish_wordlift_entities' === $cap[0] ) || |
|
337 | - ( 'read_private_wordlift_entities' === $cap[0] ) || |
|
338 | - ( 'delete_wordlift_entity' === $cap[0] ) || |
|
339 | - ( 'delete_wordlift_entities' === $cap[0] ) || |
|
340 | - ( 'delete_others_wordlift_entities' === $cap[0] ) || |
|
341 | - ( 'delete_published_wordlift_entities' === $cap[0] ) || |
|
342 | - ( 'delete_private_wordlift_entities' === $cap[0] ) |
|
343 | - ) { |
|
344 | - $user_id = $args[1]; |
|
345 | - |
|
346 | - if ( ! $this->editor_can_create_entities( $user_id ) ) { |
|
347 | - $allcaps[ $cap[0] ] = false; |
|
348 | - } |
|
349 | - } |
|
350 | - |
|
351 | - return $allcaps; |
|
352 | - } |
|
328 | + if ( empty( $cap ) || ! isset( $cap[0] ) ) { |
|
329 | + return $allcaps; |
|
330 | + } |
|
331 | + |
|
332 | + if ( |
|
333 | + ( 'edit_wordlift_entity' === $cap[0] ) || |
|
334 | + ( 'edit_wordlift_entities' === $cap[0] ) || |
|
335 | + ( 'edit_others_wordlift_entities' === $cap[0] ) || |
|
336 | + ( 'publish_wordlift_entities' === $cap[0] ) || |
|
337 | + ( 'read_private_wordlift_entities' === $cap[0] ) || |
|
338 | + ( 'delete_wordlift_entity' === $cap[0] ) || |
|
339 | + ( 'delete_wordlift_entities' === $cap[0] ) || |
|
340 | + ( 'delete_others_wordlift_entities' === $cap[0] ) || |
|
341 | + ( 'delete_published_wordlift_entities' === $cap[0] ) || |
|
342 | + ( 'delete_private_wordlift_entities' === $cap[0] ) |
|
343 | + ) { |
|
344 | + $user_id = $args[1]; |
|
345 | + |
|
346 | + if ( ! $this->editor_can_create_entities( $user_id ) ) { |
|
347 | + $allcaps[ $cap[0] ] = false; |
|
348 | + } |
|
349 | + } |
|
350 | + |
|
351 | + return $allcaps; |
|
352 | + } |
|
353 | 353 | |
354 | 354 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | */ |
57 | 57 | protected function __construct() { |
58 | 58 | |
59 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' ); |
|
59 | + $this->log_service = Wordlift_Log_Service::get_logger('Wordlift_User_Service'); |
|
60 | 60 | |
61 | - add_filter( 'user_has_cap', array( $this, 'has_cap' ), 10, 3 ); |
|
61 | + add_filter('user_has_cap', array($this, 'has_cap'), 10, 3); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public static function get_instance() { |
81 | 81 | |
82 | - if ( ! isset( self::$instance ) ) { |
|
82 | + if ( ! isset(self::$instance)) { |
|
83 | 83 | self::$instance = new self(); |
84 | 84 | } |
85 | 85 | |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | * @return false|string The user's URI or false in case of failure. |
95 | 95 | * @since 3.1.7 |
96 | 96 | */ |
97 | - public function get_uri( $user_id ) { |
|
97 | + public function get_uri($user_id) { |
|
98 | 98 | |
99 | 99 | // Try to get the URI stored in the user's meta and return it if available. |
100 | 100 | $dataset_uri = wl_configuration_get_redlink_dataset_uri(); |
101 | - $user_uri = $this->_get_uri( $user_id ); |
|
102 | - if ( ! empty( $dataset_uri ) && ! empty( $user_uri ) && 0 === strpos( $user_uri, $dataset_uri ) ) { |
|
101 | + $user_uri = $this->_get_uri($user_id); |
|
102 | + if ( ! empty($dataset_uri) && ! empty($user_uri) && 0 === strpos($user_uri, $dataset_uri)) { |
|
103 | 103 | return $user_uri; |
104 | 104 | } |
105 | 105 | |
106 | 106 | // Try to build an URI, return false in case of failure. |
107 | - $user_uri = $this->_build_uri( $user_id ); |
|
108 | - if ( false === $user_uri ) { |
|
107 | + $user_uri = $this->_build_uri($user_id); |
|
108 | + if (false === $user_uri) { |
|
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | |
112 | 112 | // Store the URI for future requests (we need a "permanent" URI). |
113 | - $this->_set_uri( $user_id, $user_uri ); |
|
113 | + $this->_set_uri($user_id, $user_uri); |
|
114 | 114 | |
115 | 115 | return $user_uri; |
116 | 116 | } |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | * @return bool|int Meta ID if the key didn't exist, true on successful update, false on failure. |
127 | 127 | * @since 3.14.0 |
128 | 128 | */ |
129 | - public function set_entity( $user_id, $value ) { |
|
129 | + public function set_entity($user_id, $value) { |
|
130 | 130 | |
131 | 131 | return 0 < $value |
132 | - ? update_user_meta( $user_id, self::ENTITY_META_KEY, $value ) |
|
133 | - : delete_user_meta( $user_id, self::ENTITY_META_KEY ); |
|
132 | + ? update_user_meta($user_id, self::ENTITY_META_KEY, $value) |
|
133 | + : delete_user_meta($user_id, self::ENTITY_META_KEY); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | * @return string|false The entity {@link WP_Post} `id` or an empty string if not set or false if the object id is invalid |
142 | 142 | * @since 3.14.0 |
143 | 143 | */ |
144 | - public function get_entity( $user_id ) { |
|
144 | + public function get_entity($user_id) { |
|
145 | 145 | |
146 | - return get_user_meta( $user_id, self::ENTITY_META_KEY, true ); |
|
146 | + return get_user_meta($user_id, self::ENTITY_META_KEY, true); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | * @since 3.1.7 |
156 | 156 | */ |
157 | 157 | // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
158 | - private function _get_uri( $user_id ) { |
|
158 | + private function _get_uri($user_id) { |
|
159 | 159 | |
160 | - $user_uri = get_user_meta( $user_id, self::URI_META_KEY, true ); |
|
160 | + $user_uri = get_user_meta($user_id, self::URI_META_KEY, true); |
|
161 | 161 | |
162 | - if ( empty( $user_uri ) ) { |
|
162 | + if (empty($user_uri)) { |
|
163 | 163 | return false; |
164 | 164 | } |
165 | 165 | |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | * @since 3.1.7 |
176 | 176 | */ |
177 | 177 | // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
178 | - private function _build_uri( $user_id ) { |
|
178 | + private function _build_uri($user_id) { |
|
179 | 179 | |
180 | 180 | // Get the user, return false in case of failure. |
181 | - $user = get_userdata( $user_id ); |
|
182 | - if ( false === $user ) { |
|
181 | + $user = get_userdata($user_id); |
|
182 | + if (false === $user) { |
|
183 | 183 | return false; |
184 | 184 | }; |
185 | 185 | |
186 | 186 | // If the nicename is not set, return a failure. |
187 | - if ( empty( $user->user_nicename ) ) { |
|
187 | + if (empty($user->user_nicename)) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @since 3.27.7 changed `user` to `author` to avoid potential clashes with CPTs ( `author` is reserved |
193 | 193 | * https://developer.wordpress.org/reference/functions/register_post_type/#reserved-post-types ) |
194 | 194 | */ |
195 | - return untrailingslashit( wl_configuration_get_redlink_dataset_uri() ) . "/author/$user->user_nicename"; |
|
195 | + return untrailingslashit(wl_configuration_get_redlink_dataset_uri())."/author/$user->user_nicename"; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | * @since 3.1.7 |
206 | 206 | */ |
207 | 207 | // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
208 | - private function _set_uri( $user_id, $user_uri ) { |
|
208 | + private function _set_uri($user_id, $user_uri) { |
|
209 | 209 | |
210 | - return update_user_meta( $user_id, self::URI_META_KEY, $user_uri ); |
|
210 | + return update_user_meta($user_id, self::URI_META_KEY, $user_uri); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -218,15 +218,15 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @since 3.14.0 |
220 | 220 | */ |
221 | - public function deny_editor_entity_create( $user_id ) { |
|
221 | + public function deny_editor_entity_create($user_id) { |
|
222 | 222 | |
223 | 223 | // Bail out if the user is not an editor. |
224 | - if ( ! $this->is_editor( $user_id ) ) { |
|
224 | + if ( ! $this->is_editor($user_id)) { |
|
225 | 225 | return; |
226 | 226 | } |
227 | 227 | |
228 | 228 | // The user explicitly do not have the capability. |
229 | - update_user_option( $user_id, self::DENY_ENTITY_CREATE_META_KEY, 'yes' ); |
|
229 | + update_user_option($user_id, self::DENY_ENTITY_CREATE_META_KEY, 'yes'); |
|
230 | 230 | |
231 | 231 | } |
232 | 232 | |
@@ -238,15 +238,15 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @since 3.14.0 |
240 | 240 | */ |
241 | - public function allow_editor_entity_create( $user_id ) { |
|
241 | + public function allow_editor_entity_create($user_id) { |
|
242 | 242 | |
243 | 243 | // Bail out if the user is not an editor. |
244 | - if ( ! $this->is_editor( $user_id ) ) { |
|
244 | + if ( ! $this->is_editor($user_id)) { |
|
245 | 245 | return; |
246 | 246 | } |
247 | 247 | |
248 | 248 | // The user explicitly do not have the capability. |
249 | - delete_user_option( $user_id, self::DENY_ENTITY_CREATE_META_KEY ); |
|
249 | + delete_user_option($user_id, self::DENY_ENTITY_CREATE_META_KEY); |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | * @return int bool True if editing is denied otherwise false. |
259 | 259 | * @since 3.14.0 |
260 | 260 | */ |
261 | - public function is_deny_editor_entity_create( $user_id ) { |
|
261 | + public function is_deny_editor_entity_create($user_id) { |
|
262 | 262 | |
263 | - return 'yes' === get_user_option( self::DENY_ENTITY_CREATE_META_KEY, $user_id ); |
|
263 | + return 'yes' === get_user_option(self::DENY_ENTITY_CREATE_META_KEY, $user_id); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -272,13 +272,13 @@ discard block |
||
272 | 272 | * @return bool True if the {@link WP_User} is an editor otherwise false. |
273 | 273 | * @since 3.14.0 |
274 | 274 | */ |
275 | - public function is_editor( $user_id ) { |
|
275 | + public function is_editor($user_id) { |
|
276 | 276 | |
277 | 277 | // Get the user. |
278 | - $user = get_user_by( 'id', $user_id ); |
|
278 | + $user = get_user_by('id', $user_id); |
|
279 | 279 | |
280 | 280 | // Return true, if the user is found and has the `editor` role. |
281 | - return is_a( $user, 'WP_User' ) && in_array( 'editor', (array) $user->roles, true ); |
|
281 | + return is_a($user, 'WP_User') && in_array('editor', (array) $user->roles, true); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -289,15 +289,15 @@ discard block |
||
289 | 289 | * @return bool false if it is an editor that is denied from edit entities, true otherwise. |
290 | 290 | * @since 3.14.0 |
291 | 291 | */ |
292 | - public function editor_can_create_entities( $user_id ) { |
|
292 | + public function editor_can_create_entities($user_id) { |
|
293 | 293 | |
294 | 294 | // Return true if not an editor. |
295 | - if ( ! $this->is_editor( $user_id ) ) { |
|
295 | + if ( ! $this->is_editor($user_id)) { |
|
296 | 296 | return true; |
297 | 297 | } |
298 | 298 | |
299 | 299 | // Check if the user explicitly denied. |
300 | - return ! $this->is_deny_editor_entity_create( $user_id ); |
|
300 | + return ! $this->is_deny_editor_entity_create($user_id); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @return array The capabilities array. |
315 | 315 | * @since 3.14.0 |
316 | 316 | */ |
317 | - public function has_cap( $allcaps, $cap, $args ) { |
|
317 | + public function has_cap($allcaps, $cap, $args) { |
|
318 | 318 | /* |
319 | 319 | * For entity management/editing related capabilities |
320 | 320 | * check that an editor was not explicitly denied (in user profile) |
@@ -325,26 +325,26 @@ discard block |
||
325 | 325 | * Need protection against the case of edit_user and likes which do not |
326 | 326 | * require a capability, just request one. |
327 | 327 | */ |
328 | - if ( empty( $cap ) || ! isset( $cap[0] ) ) { |
|
328 | + if (empty($cap) || ! isset($cap[0])) { |
|
329 | 329 | return $allcaps; |
330 | 330 | } |
331 | 331 | |
332 | 332 | if ( |
333 | - ( 'edit_wordlift_entity' === $cap[0] ) || |
|
334 | - ( 'edit_wordlift_entities' === $cap[0] ) || |
|
335 | - ( 'edit_others_wordlift_entities' === $cap[0] ) || |
|
336 | - ( 'publish_wordlift_entities' === $cap[0] ) || |
|
337 | - ( 'read_private_wordlift_entities' === $cap[0] ) || |
|
338 | - ( 'delete_wordlift_entity' === $cap[0] ) || |
|
339 | - ( 'delete_wordlift_entities' === $cap[0] ) || |
|
340 | - ( 'delete_others_wordlift_entities' === $cap[0] ) || |
|
341 | - ( 'delete_published_wordlift_entities' === $cap[0] ) || |
|
342 | - ( 'delete_private_wordlift_entities' === $cap[0] ) |
|
333 | + ('edit_wordlift_entity' === $cap[0]) || |
|
334 | + ('edit_wordlift_entities' === $cap[0]) || |
|
335 | + ('edit_others_wordlift_entities' === $cap[0]) || |
|
336 | + ('publish_wordlift_entities' === $cap[0]) || |
|
337 | + ('read_private_wordlift_entities' === $cap[0]) || |
|
338 | + ('delete_wordlift_entity' === $cap[0]) || |
|
339 | + ('delete_wordlift_entities' === $cap[0]) || |
|
340 | + ('delete_others_wordlift_entities' === $cap[0]) || |
|
341 | + ('delete_published_wordlift_entities' === $cap[0]) || |
|
342 | + ('delete_private_wordlift_entities' === $cap[0]) |
|
343 | 343 | ) { |
344 | 344 | $user_id = $args[1]; |
345 | 345 | |
346 | - if ( ! $this->editor_can_create_entities( $user_id ) ) { |
|
347 | - $allcaps[ $cap[0] ] = false; |
|
346 | + if ( ! $this->editor_can_create_entities($user_id)) { |
|
347 | + $allcaps[$cap[0]] = false; |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 |
@@ -17,59 +17,59 @@ |
||
17 | 17 | */ |
18 | 18 | class Wordlift_Sample_Data_Ajax_Adapter { |
19 | 19 | |
20 | - /** |
|
21 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
22 | - * |
|
23 | - * @since 3.12.0 |
|
24 | - * @access private |
|
25 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
26 | - */ |
|
27 | - private $sample_data_service; |
|
20 | + /** |
|
21 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
22 | + * |
|
23 | + * @since 3.12.0 |
|
24 | + * @access private |
|
25 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
26 | + */ |
|
27 | + private $sample_data_service; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Create a {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
31 | - * |
|
32 | - * @since 3.12.0 |
|
33 | - * |
|
34 | - * @param \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
35 | - */ |
|
36 | - public function __construct( $sample_data_service ) { |
|
29 | + /** |
|
30 | + * Create a {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
31 | + * |
|
32 | + * @since 3.12.0 |
|
33 | + * |
|
34 | + * @param \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
35 | + */ |
|
36 | + public function __construct( $sample_data_service ) { |
|
37 | 37 | |
38 | - $this->sample_data_service = $sample_data_service; |
|
38 | + $this->sample_data_service = $sample_data_service; |
|
39 | 39 | |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Handle the `wl_sample_data_create` ajax action. |
|
44 | - * |
|
45 | - * @since 3.12.0 |
|
46 | - */ |
|
47 | - public function create() { |
|
42 | + /** |
|
43 | + * Handle the `wl_sample_data_create` ajax action. |
|
44 | + * |
|
45 | + * @since 3.12.0 |
|
46 | + */ |
|
47 | + public function create() { |
|
48 | 48 | |
49 | - // Clean any potential garbage before us. |
|
50 | - ob_clean(); |
|
49 | + // Clean any potential garbage before us. |
|
50 | + ob_clean(); |
|
51 | 51 | |
52 | - // Create the sample data. |
|
53 | - $this->sample_data_service->create(); |
|
52 | + // Create the sample data. |
|
53 | + $this->sample_data_service->create(); |
|
54 | 54 | |
55 | - // Send success. |
|
56 | - wp_send_json_success(); |
|
55 | + // Send success. |
|
56 | + wp_send_json_success(); |
|
57 | 57 | |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | - public function delete() { |
|
60 | + public function delete() { |
|
61 | 61 | |
62 | - // Clean any potential garbage before us. |
|
63 | - ob_clean(); |
|
62 | + // Clean any potential garbage before us. |
|
63 | + ob_clean(); |
|
64 | 64 | |
65 | - // Create the sample data. |
|
66 | - $this->sample_data_service->delete(); |
|
65 | + // Create the sample data. |
|
66 | + $this->sample_data_service->delete(); |
|
67 | 67 | |
68 | - // Send success. |
|
69 | - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
70 | - @header( 'Content-Disposition: inline' ); |
|
71 | - wp_send_json_success(); |
|
68 | + // Send success. |
|
69 | + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
70 | + @header( 'Content-Disposition: inline' ); |
|
71 | + wp_send_json_success(); |
|
72 | 72 | |
73 | - } |
|
73 | + } |
|
74 | 74 | |
75 | 75 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
35 | 35 | */ |
36 | - public function __construct( $sample_data_service ) { |
|
36 | + public function __construct($sample_data_service) { |
|
37 | 37 | |
38 | 38 | $this->sample_data_service = $sample_data_service; |
39 | 39 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | // Send success. |
69 | 69 | // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
70 | - @header( 'Content-Disposition: inline' ); |
|
70 | + @header('Content-Disposition: inline'); |
|
71 | 71 | wp_send_json_success(); |
72 | 72 | |
73 | 73 | } |
@@ -26,38 +26,38 @@ |
||
26 | 26 | */ |
27 | 27 | class Wordlift_I18n { |
28 | 28 | |
29 | - /** |
|
30 | - * The domain specified for this plugin. |
|
31 | - * |
|
32 | - * @since 1.0.0 |
|
33 | - * @access private |
|
34 | - * @var string $domain The domain identifier for this plugin. |
|
35 | - */ |
|
36 | - private $domain; |
|
37 | - |
|
38 | - /** |
|
39 | - * Load the plugin text domain for translation. |
|
40 | - * |
|
41 | - * @since 1.0.0 |
|
42 | - */ |
|
43 | - public function load_plugin_textdomain() { |
|
44 | - |
|
45 | - load_plugin_textdomain( |
|
46 | - $this->domain, |
|
47 | - false, |
|
48 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
49 | - ); |
|
50 | - |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Set the domain equal to that of the specified domain. |
|
55 | - * |
|
56 | - * @since 1.0.0 |
|
57 | - * @param string $domain The domain that represents the locale of this plugin. |
|
58 | - */ |
|
59 | - public function set_domain( $domain ) { |
|
60 | - $this->domain = $domain; |
|
61 | - } |
|
29 | + /** |
|
30 | + * The domain specified for this plugin. |
|
31 | + * |
|
32 | + * @since 1.0.0 |
|
33 | + * @access private |
|
34 | + * @var string $domain The domain identifier for this plugin. |
|
35 | + */ |
|
36 | + private $domain; |
|
37 | + |
|
38 | + /** |
|
39 | + * Load the plugin text domain for translation. |
|
40 | + * |
|
41 | + * @since 1.0.0 |
|
42 | + */ |
|
43 | + public function load_plugin_textdomain() { |
|
44 | + |
|
45 | + load_plugin_textdomain( |
|
46 | + $this->domain, |
|
47 | + false, |
|
48 | + dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
49 | + ); |
|
50 | + |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Set the domain equal to that of the specified domain. |
|
55 | + * |
|
56 | + * @since 1.0.0 |
|
57 | + * @param string $domain The domain that represents the locale of this plugin. |
|
58 | + */ |
|
59 | + public function set_domain( $domain ) { |
|
60 | + $this->domain = $domain; |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | load_plugin_textdomain( |
46 | 46 | $this->domain, |
47 | 47 | false, |
48 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
48 | + dirname(dirname(plugin_basename(__FILE__))).'/languages/' |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @since 1.0.0 |
57 | 57 | * @param string $domain The domain that represents the locale of this plugin. |
58 | 58 | */ |
59 | - public function set_domain( $domain ) { |
|
59 | + public function set_domain($domain) { |
|
60 | 60 | $this->domain = $domain; |
61 | 61 | } |
62 | 62 |
@@ -13,214 +13,214 @@ |
||
13 | 13 | */ |
14 | 14 | class Wordlift_Entity_Post_To_Jsonld_Converter extends Wordlift_Abstract_Post_To_Jsonld_Converter { |
15 | 15 | |
16 | - /** |
|
17 | - * The {@link Wordlift_Schemaorg_Property_Service} or null if not provided. |
|
18 | - * |
|
19 | - * @since 3.20.0 |
|
20 | - * @access private |
|
21 | - * @var null|Wordlift_Schemaorg_Property_Service The {@link Wordlift_Schemaorg_Property_Service} or null if not provided. |
|
22 | - */ |
|
23 | - private $schemaorg_property_service; |
|
24 | - |
|
25 | - /** |
|
26 | - * The {@link Wordlift_Post_To_Jsonld_Converter} is used to convert entities that also have the `article` term. |
|
27 | - * |
|
28 | - * @since 3.25.2 |
|
29 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter The {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
30 | - */ |
|
31 | - private $post_to_jsonld_converter; |
|
32 | - |
|
33 | - /** |
|
34 | - * Wordlift_Entity_To_Jsonld_Converter constructor. |
|
35 | - * |
|
36 | - * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
37 | - * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
38 | - * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
39 | - * @param \Wordlift_Property_Getter $property_getter A {@link Wordlift_Property_Getter} instance. |
|
40 | - * @param \Wordlift_Schemaorg_Property_Service $schemaorg_property_service A {@link Wordlift_Schemaorg_Property_Service} instance. |
|
41 | - * @param \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter The {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
42 | - * |
|
43 | - * @since 3.8.0 |
|
44 | - */ |
|
45 | - public function __construct( $entity_type_service, $user_service, $attachment_service, $property_getter, $schemaorg_property_service, $post_to_jsonld_converter ) { |
|
46 | - parent::__construct( $entity_type_service, $user_service, $attachment_service, $property_getter ); |
|
47 | - $this->schemaorg_property_service = $schemaorg_property_service; |
|
48 | - $this->post_to_jsonld_converter = $post_to_jsonld_converter; |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
53 | - * found while processing the post is set in the $references array. |
|
54 | - * |
|
55 | - * @param int $post_id The {@link WP_Post} id. |
|
56 | - * @param array $references An array of entity references. |
|
57 | - * @param array $references_infos |
|
58 | - * |
|
59 | - * @return array A JSON-LD array. |
|
60 | - * @since 3.8.0 |
|
61 | - */ |
|
62 | - public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
63 | - |
|
64 | - // Get the post instance. |
|
65 | - $post = get_post( $post_id ); |
|
66 | - if ( null === $post ) { |
|
67 | - // Post not found. |
|
68 | - return null; |
|
69 | - } |
|
70 | - |
|
71 | - // Get the base JSON-LD and the list of entities referenced by this entity. |
|
72 | - if ( has_term( 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $post_id ) ) { |
|
73 | - $jsonld = $this->post_to_jsonld_converter->convert( $post_id, $references, $references_infos ); |
|
74 | - } else { |
|
75 | - $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
76 | - } |
|
77 | - |
|
78 | - // Get the entity name. |
|
79 | - $jsonld['name'] = html_entity_decode( $post->post_title ); |
|
80 | - |
|
81 | - // 3.13.0, add alternate names. |
|
82 | - $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id ); |
|
83 | - if ( 0 < count( $alternative_labels ) ) { |
|
84 | - $jsonld['alternateName'] = $alternative_labels; |
|
85 | - } |
|
86 | - |
|
87 | - // Get the entity `@type` with custom fields set by the Wordlift_Schema_Service. |
|
88 | - // |
|
89 | - // This allows us to gather the basic properties as defined by the `Thing` entity type. |
|
90 | - // Get the configured type custom fields. |
|
91 | - $custom_fields = $this->entity_type_service->get_custom_fields_for_post( $post_id ); |
|
92 | - |
|
93 | - if ( isset( $custom_fields ) ) { |
|
94 | - $this->process_type_custom_fields( $jsonld, $custom_fields, $post, $references, $references_infos ); |
|
95 | - } |
|
96 | - |
|
97 | - /* |
|
16 | + /** |
|
17 | + * The {@link Wordlift_Schemaorg_Property_Service} or null if not provided. |
|
18 | + * |
|
19 | + * @since 3.20.0 |
|
20 | + * @access private |
|
21 | + * @var null|Wordlift_Schemaorg_Property_Service The {@link Wordlift_Schemaorg_Property_Service} or null if not provided. |
|
22 | + */ |
|
23 | + private $schemaorg_property_service; |
|
24 | + |
|
25 | + /** |
|
26 | + * The {@link Wordlift_Post_To_Jsonld_Converter} is used to convert entities that also have the `article` term. |
|
27 | + * |
|
28 | + * @since 3.25.2 |
|
29 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter The {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
30 | + */ |
|
31 | + private $post_to_jsonld_converter; |
|
32 | + |
|
33 | + /** |
|
34 | + * Wordlift_Entity_To_Jsonld_Converter constructor. |
|
35 | + * |
|
36 | + * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
37 | + * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
38 | + * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
39 | + * @param \Wordlift_Property_Getter $property_getter A {@link Wordlift_Property_Getter} instance. |
|
40 | + * @param \Wordlift_Schemaorg_Property_Service $schemaorg_property_service A {@link Wordlift_Schemaorg_Property_Service} instance. |
|
41 | + * @param \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter The {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
42 | + * |
|
43 | + * @since 3.8.0 |
|
44 | + */ |
|
45 | + public function __construct( $entity_type_service, $user_service, $attachment_service, $property_getter, $schemaorg_property_service, $post_to_jsonld_converter ) { |
|
46 | + parent::__construct( $entity_type_service, $user_service, $attachment_service, $property_getter ); |
|
47 | + $this->schemaorg_property_service = $schemaorg_property_service; |
|
48 | + $this->post_to_jsonld_converter = $post_to_jsonld_converter; |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
53 | + * found while processing the post is set in the $references array. |
|
54 | + * |
|
55 | + * @param int $post_id The {@link WP_Post} id. |
|
56 | + * @param array $references An array of entity references. |
|
57 | + * @param array $references_infos |
|
58 | + * |
|
59 | + * @return array A JSON-LD array. |
|
60 | + * @since 3.8.0 |
|
61 | + */ |
|
62 | + public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
63 | + |
|
64 | + // Get the post instance. |
|
65 | + $post = get_post( $post_id ); |
|
66 | + if ( null === $post ) { |
|
67 | + // Post not found. |
|
68 | + return null; |
|
69 | + } |
|
70 | + |
|
71 | + // Get the base JSON-LD and the list of entities referenced by this entity. |
|
72 | + if ( has_term( 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $post_id ) ) { |
|
73 | + $jsonld = $this->post_to_jsonld_converter->convert( $post_id, $references, $references_infos ); |
|
74 | + } else { |
|
75 | + $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
76 | + } |
|
77 | + |
|
78 | + // Get the entity name. |
|
79 | + $jsonld['name'] = html_entity_decode( $post->post_title ); |
|
80 | + |
|
81 | + // 3.13.0, add alternate names. |
|
82 | + $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id ); |
|
83 | + if ( 0 < count( $alternative_labels ) ) { |
|
84 | + $jsonld['alternateName'] = $alternative_labels; |
|
85 | + } |
|
86 | + |
|
87 | + // Get the entity `@type` with custom fields set by the Wordlift_Schema_Service. |
|
88 | + // |
|
89 | + // This allows us to gather the basic properties as defined by the `Thing` entity type. |
|
90 | + // Get the configured type custom fields. |
|
91 | + $custom_fields = $this->entity_type_service->get_custom_fields_for_post( $post_id ); |
|
92 | + |
|
93 | + if ( isset( $custom_fields ) ) { |
|
94 | + $this->process_type_custom_fields( $jsonld, $custom_fields, $post, $references, $references_infos ); |
|
95 | + } |
|
96 | + |
|
97 | + /* |
|
98 | 98 | * Get the properties attached to the post. |
99 | 99 | * |
100 | 100 | * @since 3.20.0 We attach properties directly to the posts. |
101 | 101 | * |
102 | 102 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
103 | 103 | */ |
104 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
105 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
106 | - $this->process_post_properties( $jsonld, $post_id ); |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references. |
|
111 | - * |
|
112 | - * @param array $value { |
|
113 | - * |
|
114 | - * @type array $jsonld The JSON-LD structure. |
|
115 | - * @type int[] $references An array of post IDs. |
|
116 | - * } |
|
117 | - * @since 3.25.0 |
|
118 | - * |
|
119 | - * @see https://www.geeklab.info/2010/04/wordpress-pass-variables-by-reference-with-apply_filter/ |
|
120 | - * |
|
121 | - * @api |
|
122 | - */ |
|
123 | - $ret_val = apply_filters( |
|
124 | - 'wl_entity_jsonld_array', |
|
125 | - array( |
|
126 | - 'jsonld' => $jsonld, |
|
127 | - 'references' => $references, |
|
128 | - ), |
|
129 | - $post_id |
|
130 | - ); |
|
131 | - $jsonld = $ret_val['jsonld']; |
|
132 | - $references = $ret_val['references']; |
|
133 | - |
|
134 | - /** |
|
135 | - * Call the `wl_entity_jsonld` filter. |
|
136 | - * |
|
137 | - * @param array $jsonld The JSON-LD structure. |
|
138 | - * @param int $post_id The {@link WP_Post} `id`. |
|
139 | - * @param array $references The array of referenced entities. |
|
140 | - * |
|
141 | - * @since 3.20.0 |
|
142 | - * |
|
143 | - * @api |
|
144 | - */ |
|
145 | - return apply_filters( 'wl_entity_jsonld', $this->post_process( $jsonld ), $post_id, $references ); |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Process the properties attached to the {@link WP_Post}. |
|
150 | - * |
|
151 | - * @param array $jsonld The JSON-LD array. |
|
152 | - * @param int $post_id The target {@link WP_Post} id. |
|
153 | - * |
|
154 | - * @since 3.20.0 |
|
155 | - */ |
|
156 | - private function process_post_properties( &$jsonld, $post_id ) { |
|
157 | - |
|
158 | - // Get all the props. |
|
159 | - $props = $this->schemaorg_property_service->get_all( $post_id ); |
|
160 | - |
|
161 | - // Process all the props. |
|
162 | - foreach ( $props as $name => $instances ) { |
|
163 | - |
|
164 | - // Get the values. |
|
165 | - $values = array_map( |
|
166 | - function ( $instance ) { |
|
167 | - return $instance['value']; |
|
168 | - }, |
|
169 | - $instances |
|
170 | - ); |
|
171 | - |
|
172 | - // We might receive empty values, remove them. |
|
173 | - $non_empty_values = array_filter( |
|
174 | - $values, |
|
175 | - function ( $value ) { |
|
176 | - return ! empty( $value ); |
|
177 | - } |
|
178 | - ); |
|
179 | - |
|
180 | - // Skip empty properties. |
|
181 | - if ( empty( $non_empty_values ) ) { |
|
182 | - continue; |
|
183 | - } |
|
184 | - |
|
185 | - // @@todo: need to handle maybe Numbers and URLs differently. |
|
186 | - // Make an array a single value when possible. |
|
187 | - $jsonld[ $name ] = self::make_one( $non_empty_values ); |
|
188 | - } |
|
189 | - |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * Post process the generated JSON to reorganize values which are stored as 1st |
|
194 | - * level in WP but are really 2nd level. |
|
195 | - * |
|
196 | - * @param array $jsonld An array of JSON-LD properties and values. |
|
197 | - * |
|
198 | - * @return array The array remapped. |
|
199 | - * @since 3.8.0 |
|
200 | - */ |
|
201 | - private function post_process( $jsonld ) { |
|
202 | - |
|
203 | - foreach ( $jsonld as $key => $value ) { |
|
204 | - if ( 'streetAddress' === $key || 'postalCode' === $key || 'addressLocality' === $key || 'addressRegion' === $key || 'addressCountry' === $key || 'postOfficeBoxNumber' === $key ) { |
|
205 | - $jsonld['address']['@type'] = 'PostalAddress'; |
|
206 | - $jsonld['address'][ $key ] = $value; |
|
207 | - unset( $jsonld[ $key ] ); |
|
208 | - } |
|
209 | - |
|
210 | - if ( 'latitude' === $key || 'longitude' === $key ) { |
|
211 | - $jsonld['geo']['@type'] = 'GeoCoordinates'; |
|
212 | - $jsonld['geo'][ $key ] = $value; |
|
213 | - unset( $jsonld[ $key ] ); |
|
214 | - } |
|
215 | - |
|
216 | - if ( 'calories' === $key ) { |
|
217 | - $jsonld['nutrition']['@type'] = 'NutritionInformation'; |
|
218 | - $jsonld['nutrition'][ $key ] = $value; |
|
219 | - unset( $jsonld[ $key ] ); |
|
220 | - } |
|
221 | - } |
|
222 | - |
|
223 | - return $jsonld; |
|
224 | - } |
|
104 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
105 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
106 | + $this->process_post_properties( $jsonld, $post_id ); |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references. |
|
111 | + * |
|
112 | + * @param array $value { |
|
113 | + * |
|
114 | + * @type array $jsonld The JSON-LD structure. |
|
115 | + * @type int[] $references An array of post IDs. |
|
116 | + * } |
|
117 | + * @since 3.25.0 |
|
118 | + * |
|
119 | + * @see https://www.geeklab.info/2010/04/wordpress-pass-variables-by-reference-with-apply_filter/ |
|
120 | + * |
|
121 | + * @api |
|
122 | + */ |
|
123 | + $ret_val = apply_filters( |
|
124 | + 'wl_entity_jsonld_array', |
|
125 | + array( |
|
126 | + 'jsonld' => $jsonld, |
|
127 | + 'references' => $references, |
|
128 | + ), |
|
129 | + $post_id |
|
130 | + ); |
|
131 | + $jsonld = $ret_val['jsonld']; |
|
132 | + $references = $ret_val['references']; |
|
133 | + |
|
134 | + /** |
|
135 | + * Call the `wl_entity_jsonld` filter. |
|
136 | + * |
|
137 | + * @param array $jsonld The JSON-LD structure. |
|
138 | + * @param int $post_id The {@link WP_Post} `id`. |
|
139 | + * @param array $references The array of referenced entities. |
|
140 | + * |
|
141 | + * @since 3.20.0 |
|
142 | + * |
|
143 | + * @api |
|
144 | + */ |
|
145 | + return apply_filters( 'wl_entity_jsonld', $this->post_process( $jsonld ), $post_id, $references ); |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * Process the properties attached to the {@link WP_Post}. |
|
150 | + * |
|
151 | + * @param array $jsonld The JSON-LD array. |
|
152 | + * @param int $post_id The target {@link WP_Post} id. |
|
153 | + * |
|
154 | + * @since 3.20.0 |
|
155 | + */ |
|
156 | + private function process_post_properties( &$jsonld, $post_id ) { |
|
157 | + |
|
158 | + // Get all the props. |
|
159 | + $props = $this->schemaorg_property_service->get_all( $post_id ); |
|
160 | + |
|
161 | + // Process all the props. |
|
162 | + foreach ( $props as $name => $instances ) { |
|
163 | + |
|
164 | + // Get the values. |
|
165 | + $values = array_map( |
|
166 | + function ( $instance ) { |
|
167 | + return $instance['value']; |
|
168 | + }, |
|
169 | + $instances |
|
170 | + ); |
|
171 | + |
|
172 | + // We might receive empty values, remove them. |
|
173 | + $non_empty_values = array_filter( |
|
174 | + $values, |
|
175 | + function ( $value ) { |
|
176 | + return ! empty( $value ); |
|
177 | + } |
|
178 | + ); |
|
179 | + |
|
180 | + // Skip empty properties. |
|
181 | + if ( empty( $non_empty_values ) ) { |
|
182 | + continue; |
|
183 | + } |
|
184 | + |
|
185 | + // @@todo: need to handle maybe Numbers and URLs differently. |
|
186 | + // Make an array a single value when possible. |
|
187 | + $jsonld[ $name ] = self::make_one( $non_empty_values ); |
|
188 | + } |
|
189 | + |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * Post process the generated JSON to reorganize values which are stored as 1st |
|
194 | + * level in WP but are really 2nd level. |
|
195 | + * |
|
196 | + * @param array $jsonld An array of JSON-LD properties and values. |
|
197 | + * |
|
198 | + * @return array The array remapped. |
|
199 | + * @since 3.8.0 |
|
200 | + */ |
|
201 | + private function post_process( $jsonld ) { |
|
202 | + |
|
203 | + foreach ( $jsonld as $key => $value ) { |
|
204 | + if ( 'streetAddress' === $key || 'postalCode' === $key || 'addressLocality' === $key || 'addressRegion' === $key || 'addressCountry' === $key || 'postOfficeBoxNumber' === $key ) { |
|
205 | + $jsonld['address']['@type'] = 'PostalAddress'; |
|
206 | + $jsonld['address'][ $key ] = $value; |
|
207 | + unset( $jsonld[ $key ] ); |
|
208 | + } |
|
209 | + |
|
210 | + if ( 'latitude' === $key || 'longitude' === $key ) { |
|
211 | + $jsonld['geo']['@type'] = 'GeoCoordinates'; |
|
212 | + $jsonld['geo'][ $key ] = $value; |
|
213 | + unset( $jsonld[ $key ] ); |
|
214 | + } |
|
215 | + |
|
216 | + if ( 'calories' === $key ) { |
|
217 | + $jsonld['nutrition']['@type'] = 'NutritionInformation'; |
|
218 | + $jsonld['nutrition'][ $key ] = $value; |
|
219 | + unset( $jsonld[ $key ] ); |
|
220 | + } |
|
221 | + } |
|
222 | + |
|
223 | + return $jsonld; |
|
224 | + } |
|
225 | 225 | |
226 | 226 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @since 3.8.0 |
44 | 44 | */ |
45 | - public function __construct( $entity_type_service, $user_service, $attachment_service, $property_getter, $schemaorg_property_service, $post_to_jsonld_converter ) { |
|
46 | - parent::__construct( $entity_type_service, $user_service, $attachment_service, $property_getter ); |
|
45 | + public function __construct($entity_type_service, $user_service, $attachment_service, $property_getter, $schemaorg_property_service, $post_to_jsonld_converter) { |
|
46 | + parent::__construct($entity_type_service, $user_service, $attachment_service, $property_getter); |
|
47 | 47 | $this->schemaorg_property_service = $schemaorg_property_service; |
48 | 48 | $this->post_to_jsonld_converter = $post_to_jsonld_converter; |
49 | 49 | } |
@@ -59,28 +59,28 @@ discard block |
||
59 | 59 | * @return array A JSON-LD array. |
60 | 60 | * @since 3.8.0 |
61 | 61 | */ |
62 | - public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
62 | + public function convert($post_id, &$references = array(), &$references_infos = array()) { |
|
63 | 63 | |
64 | 64 | // Get the post instance. |
65 | - $post = get_post( $post_id ); |
|
66 | - if ( null === $post ) { |
|
65 | + $post = get_post($post_id); |
|
66 | + if (null === $post) { |
|
67 | 67 | // Post not found. |
68 | 68 | return null; |
69 | 69 | } |
70 | 70 | |
71 | 71 | // Get the base JSON-LD and the list of entities referenced by this entity. |
72 | - if ( has_term( 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $post_id ) ) { |
|
73 | - $jsonld = $this->post_to_jsonld_converter->convert( $post_id, $references, $references_infos ); |
|
72 | + if (has_term('article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $post_id)) { |
|
73 | + $jsonld = $this->post_to_jsonld_converter->convert($post_id, $references, $references_infos); |
|
74 | 74 | } else { |
75 | - $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
75 | + $jsonld = parent::convert($post_id, $references, $references_infos); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // Get the entity name. |
79 | - $jsonld['name'] = html_entity_decode( $post->post_title ); |
|
79 | + $jsonld['name'] = html_entity_decode($post->post_title); |
|
80 | 80 | |
81 | 81 | // 3.13.0, add alternate names. |
82 | - $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id ); |
|
83 | - if ( 0 < count( $alternative_labels ) ) { |
|
82 | + $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels($post_id); |
|
83 | + if (0 < count($alternative_labels)) { |
|
84 | 84 | $jsonld['alternateName'] = $alternative_labels; |
85 | 85 | } |
86 | 86 | |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | // |
89 | 89 | // This allows us to gather the basic properties as defined by the `Thing` entity type. |
90 | 90 | // Get the configured type custom fields. |
91 | - $custom_fields = $this->entity_type_service->get_custom_fields_for_post( $post_id ); |
|
91 | + $custom_fields = $this->entity_type_service->get_custom_fields_for_post($post_id); |
|
92 | 92 | |
93 | - if ( isset( $custom_fields ) ) { |
|
94 | - $this->process_type_custom_fields( $jsonld, $custom_fields, $post, $references, $references_infos ); |
|
93 | + if (isset($custom_fields)) { |
|
94 | + $this->process_type_custom_fields($jsonld, $custom_fields, $post, $references, $references_infos); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /* |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
103 | 103 | */ |
104 | 104 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
105 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
106 | - $this->process_post_properties( $jsonld, $post_id ); |
|
105 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
106 | + $this->process_post_properties($jsonld, $post_id); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @api |
122 | 122 | */ |
123 | - $ret_val = apply_filters( |
|
123 | + $ret_val = apply_filters( |
|
124 | 124 | 'wl_entity_jsonld_array', |
125 | 125 | array( |
126 | 126 | 'jsonld' => $jsonld, |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @api |
144 | 144 | */ |
145 | - return apply_filters( 'wl_entity_jsonld', $this->post_process( $jsonld ), $post_id, $references ); |
|
145 | + return apply_filters('wl_entity_jsonld', $this->post_process($jsonld), $post_id, $references); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @since 3.20.0 |
155 | 155 | */ |
156 | - private function process_post_properties( &$jsonld, $post_id ) { |
|
156 | + private function process_post_properties(&$jsonld, $post_id) { |
|
157 | 157 | |
158 | 158 | // Get all the props. |
159 | - $props = $this->schemaorg_property_service->get_all( $post_id ); |
|
159 | + $props = $this->schemaorg_property_service->get_all($post_id); |
|
160 | 160 | |
161 | 161 | // Process all the props. |
162 | - foreach ( $props as $name => $instances ) { |
|
162 | + foreach ($props as $name => $instances) { |
|
163 | 163 | |
164 | 164 | // Get the values. |
165 | 165 | $values = array_map( |
166 | - function ( $instance ) { |
|
166 | + function($instance) { |
|
167 | 167 | return $instance['value']; |
168 | 168 | }, |
169 | 169 | $instances |
@@ -172,19 +172,19 @@ discard block |
||
172 | 172 | // We might receive empty values, remove them. |
173 | 173 | $non_empty_values = array_filter( |
174 | 174 | $values, |
175 | - function ( $value ) { |
|
176 | - return ! empty( $value ); |
|
175 | + function($value) { |
|
176 | + return ! empty($value); |
|
177 | 177 | } |
178 | 178 | ); |
179 | 179 | |
180 | 180 | // Skip empty properties. |
181 | - if ( empty( $non_empty_values ) ) { |
|
181 | + if (empty($non_empty_values)) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | |
185 | 185 | // @@todo: need to handle maybe Numbers and URLs differently. |
186 | 186 | // Make an array a single value when possible. |
187 | - $jsonld[ $name ] = self::make_one( $non_empty_values ); |
|
187 | + $jsonld[$name] = self::make_one($non_empty_values); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | } |
@@ -198,25 +198,25 @@ discard block |
||
198 | 198 | * @return array The array remapped. |
199 | 199 | * @since 3.8.0 |
200 | 200 | */ |
201 | - private function post_process( $jsonld ) { |
|
201 | + private function post_process($jsonld) { |
|
202 | 202 | |
203 | - foreach ( $jsonld as $key => $value ) { |
|
204 | - if ( 'streetAddress' === $key || 'postalCode' === $key || 'addressLocality' === $key || 'addressRegion' === $key || 'addressCountry' === $key || 'postOfficeBoxNumber' === $key ) { |
|
203 | + foreach ($jsonld as $key => $value) { |
|
204 | + if ('streetAddress' === $key || 'postalCode' === $key || 'addressLocality' === $key || 'addressRegion' === $key || 'addressCountry' === $key || 'postOfficeBoxNumber' === $key) { |
|
205 | 205 | $jsonld['address']['@type'] = 'PostalAddress'; |
206 | - $jsonld['address'][ $key ] = $value; |
|
207 | - unset( $jsonld[ $key ] ); |
|
206 | + $jsonld['address'][$key] = $value; |
|
207 | + unset($jsonld[$key]); |
|
208 | 208 | } |
209 | 209 | |
210 | - if ( 'latitude' === $key || 'longitude' === $key ) { |
|
210 | + if ('latitude' === $key || 'longitude' === $key) { |
|
211 | 211 | $jsonld['geo']['@type'] = 'GeoCoordinates'; |
212 | - $jsonld['geo'][ $key ] = $value; |
|
213 | - unset( $jsonld[ $key ] ); |
|
212 | + $jsonld['geo'][$key] = $value; |
|
213 | + unset($jsonld[$key]); |
|
214 | 214 | } |
215 | 215 | |
216 | - if ( 'calories' === $key ) { |
|
216 | + if ('calories' === $key) { |
|
217 | 217 | $jsonld['nutrition']['@type'] = 'NutritionInformation'; |
218 | - $jsonld['nutrition'][ $key ] = $value; |
|
219 | - unset( $jsonld[ $key ] ); |
|
218 | + $jsonld['nutrition'][$key] = $value; |
|
219 | + unset($jsonld[$key]); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 |
@@ -13,178 +13,178 @@ |
||
13 | 13 | */ |
14 | 14 | class Wordlift_Schema_Url_Property_Service extends Wordlift_Property_Service { |
15 | 15 | |
16 | - /** |
|
17 | - * The meta key used to store data for this property. We don't use wl_url to |
|
18 | - * avoid potential confusion about other URLs. |
|
19 | - * |
|
20 | - * @since 3.6.0 |
|
21 | - */ |
|
22 | - const META_KEY = 'wl_schema_url'; |
|
23 | - |
|
24 | - /** |
|
25 | - * {@inheritdoc} |
|
26 | - */ |
|
27 | - public function get_rdf_predicate() { |
|
28 | - |
|
29 | - return 'http://schema.org/url'; |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * {@inheritdoc} |
|
34 | - */ |
|
35 | - public function get_rdf_data_type() { |
|
36 | - |
|
37 | - return 'xsd:anyURI'; |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - public function get_data_type() { |
|
44 | - |
|
45 | - return Wordlift_Schema_Service::DATA_TYPE_URI; |
|
46 | - } |
|
47 | - |
|
48 | - /** |
|
49 | - * {@inheritdoc} |
|
50 | - */ |
|
51 | - public function get_cardinality() { |
|
52 | - |
|
53 | - return INF; |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * {@inheritdoc} |
|
58 | - */ |
|
59 | - public function get_metabox_class() { |
|
60 | - |
|
61 | - return 'Wl_Metabox_Field'; |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * {@inheritdoc} |
|
66 | - */ |
|
67 | - public function get_metabox_label() { |
|
68 | - |
|
69 | - return __( 'Web Site(s)', 'wordlift' ); |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * Create a Wordlift_Schema_Url_Property_Service instance. |
|
74 | - * |
|
75 | - * @since 3.6.0 |
|
76 | - */ |
|
77 | - public function __construct() { |
|
78 | - parent::__construct(); |
|
79 | - |
|
80 | - // Finally listen for metadata requests for this field. |
|
81 | - $this->add_filter_get_post_metadata(); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * Get the schema:url value for the specified post/entity. |
|
86 | - * |
|
87 | - * @param int $post_id The post id. |
|
88 | - * |
|
89 | - * @return array|NULL The schema:url value or NULL if not set. |
|
90 | - * @since 3.6.0 |
|
91 | - */ |
|
92 | - public function get( $post_id ) { |
|
93 | - |
|
94 | - // Get the schema:url values set in WP. |
|
95 | - $values = get_post_meta( $post_id, self::META_KEY, false ); |
|
96 | - |
|
97 | - // If the property has never been set, we set its default value the first |
|
98 | - // time to <permalink>. |
|
99 | - if ( empty( $values ) ) { |
|
100 | - return array( '<permalink>' ); |
|
101 | - } |
|
102 | - |
|
103 | - // If there's only one value and that value is empty, we return NULL, i.e. |
|
104 | - // variable not set. |
|
105 | - if ( 1 === count( $values ) && empty( $values[0] ) ) { |
|
106 | - return null; |
|
107 | - } |
|
108 | - |
|
109 | - // Finally return whatever values the editor set. |
|
110 | - return $values; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * {@inheritdoc} |
|
115 | - */ |
|
116 | - public function sanitize( $value ) { |
|
117 | - |
|
118 | - // TODO: check that it's an URL or that is <permalink> |
|
119 | - |
|
120 | - return $value; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * Get direct calls to read this meta and alter the response according to our |
|
125 | - * own strategy, i.e. if a value has never been set for this meta, then return |
|
126 | - * <permalink>. |
|
127 | - * |
|
128 | - * @param mixed $value The original value. |
|
129 | - * @param int $object_id The post id. |
|
130 | - * @param string $meta_key The meta key. We expect wl_schema_url or we return straight the value. |
|
131 | - * @param bool $single Whether to return a single value. |
|
132 | - * |
|
133 | - * @return array|mixed|NULL|string |
|
134 | - * @since 3.6.0 |
|
135 | - */ |
|
136 | - public function get_post_metadata( $value, $object_id, $meta_key, $single ) { |
|
137 | - |
|
138 | - // It's not us, return the value. |
|
139 | - if ( self::META_KEY !== $meta_key ) { |
|
140 | - return $value; |
|
141 | - } |
|
142 | - |
|
143 | - $this->remove_filter_get_post_metadata(); |
|
144 | - |
|
145 | - $new_value = $this->get( $object_id ); |
|
146 | - |
|
147 | - $this->add_filter_get_post_metadata(); |
|
148 | - |
|
149 | - // If we must return a single value, but we don't have a value, then return an empty string. |
|
150 | - if ( $single && ( $new_value === null || empty( $new_value ) ) ) { |
|
151 | - return ''; |
|
152 | - } |
|
153 | - |
|
154 | - // If we have a value and we need to return it as single, return the first value. |
|
155 | - if ( $single ) { |
|
156 | - return $new_value[0]; |
|
157 | - } |
|
158 | - |
|
159 | - // Otherwise return the array. |
|
160 | - return $new_value; |
|
161 | - } |
|
162 | - |
|
163 | - private function add_filter_get_post_metadata() { |
|
164 | - |
|
165 | - add_filter( |
|
166 | - 'get_post_metadata', |
|
167 | - array( |
|
168 | - $this, |
|
169 | - 'get_post_metadata', |
|
170 | - ), |
|
171 | - 10, |
|
172 | - 4 |
|
173 | - ); |
|
174 | - |
|
175 | - } |
|
176 | - |
|
177 | - private function remove_filter_get_post_metadata() { |
|
178 | - |
|
179 | - remove_filter( |
|
180 | - 'get_post_metadata', |
|
181 | - array( |
|
182 | - $this, |
|
183 | - 'get_post_metadata', |
|
184 | - ), |
|
185 | - 10 |
|
186 | - ); |
|
187 | - |
|
188 | - } |
|
16 | + /** |
|
17 | + * The meta key used to store data for this property. We don't use wl_url to |
|
18 | + * avoid potential confusion about other URLs. |
|
19 | + * |
|
20 | + * @since 3.6.0 |
|
21 | + */ |
|
22 | + const META_KEY = 'wl_schema_url'; |
|
23 | + |
|
24 | + /** |
|
25 | + * {@inheritdoc} |
|
26 | + */ |
|
27 | + public function get_rdf_predicate() { |
|
28 | + |
|
29 | + return 'http://schema.org/url'; |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * {@inheritdoc} |
|
34 | + */ |
|
35 | + public function get_rdf_data_type() { |
|
36 | + |
|
37 | + return 'xsd:anyURI'; |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + public function get_data_type() { |
|
44 | + |
|
45 | + return Wordlift_Schema_Service::DATA_TYPE_URI; |
|
46 | + } |
|
47 | + |
|
48 | + /** |
|
49 | + * {@inheritdoc} |
|
50 | + */ |
|
51 | + public function get_cardinality() { |
|
52 | + |
|
53 | + return INF; |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * {@inheritdoc} |
|
58 | + */ |
|
59 | + public function get_metabox_class() { |
|
60 | + |
|
61 | + return 'Wl_Metabox_Field'; |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * {@inheritdoc} |
|
66 | + */ |
|
67 | + public function get_metabox_label() { |
|
68 | + |
|
69 | + return __( 'Web Site(s)', 'wordlift' ); |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * Create a Wordlift_Schema_Url_Property_Service instance. |
|
74 | + * |
|
75 | + * @since 3.6.0 |
|
76 | + */ |
|
77 | + public function __construct() { |
|
78 | + parent::__construct(); |
|
79 | + |
|
80 | + // Finally listen for metadata requests for this field. |
|
81 | + $this->add_filter_get_post_metadata(); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * Get the schema:url value for the specified post/entity. |
|
86 | + * |
|
87 | + * @param int $post_id The post id. |
|
88 | + * |
|
89 | + * @return array|NULL The schema:url value or NULL if not set. |
|
90 | + * @since 3.6.0 |
|
91 | + */ |
|
92 | + public function get( $post_id ) { |
|
93 | + |
|
94 | + // Get the schema:url values set in WP. |
|
95 | + $values = get_post_meta( $post_id, self::META_KEY, false ); |
|
96 | + |
|
97 | + // If the property has never been set, we set its default value the first |
|
98 | + // time to <permalink>. |
|
99 | + if ( empty( $values ) ) { |
|
100 | + return array( '<permalink>' ); |
|
101 | + } |
|
102 | + |
|
103 | + // If there's only one value and that value is empty, we return NULL, i.e. |
|
104 | + // variable not set. |
|
105 | + if ( 1 === count( $values ) && empty( $values[0] ) ) { |
|
106 | + return null; |
|
107 | + } |
|
108 | + |
|
109 | + // Finally return whatever values the editor set. |
|
110 | + return $values; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * {@inheritdoc} |
|
115 | + */ |
|
116 | + public function sanitize( $value ) { |
|
117 | + |
|
118 | + // TODO: check that it's an URL or that is <permalink> |
|
119 | + |
|
120 | + return $value; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * Get direct calls to read this meta and alter the response according to our |
|
125 | + * own strategy, i.e. if a value has never been set for this meta, then return |
|
126 | + * <permalink>. |
|
127 | + * |
|
128 | + * @param mixed $value The original value. |
|
129 | + * @param int $object_id The post id. |
|
130 | + * @param string $meta_key The meta key. We expect wl_schema_url or we return straight the value. |
|
131 | + * @param bool $single Whether to return a single value. |
|
132 | + * |
|
133 | + * @return array|mixed|NULL|string |
|
134 | + * @since 3.6.0 |
|
135 | + */ |
|
136 | + public function get_post_metadata( $value, $object_id, $meta_key, $single ) { |
|
137 | + |
|
138 | + // It's not us, return the value. |
|
139 | + if ( self::META_KEY !== $meta_key ) { |
|
140 | + return $value; |
|
141 | + } |
|
142 | + |
|
143 | + $this->remove_filter_get_post_metadata(); |
|
144 | + |
|
145 | + $new_value = $this->get( $object_id ); |
|
146 | + |
|
147 | + $this->add_filter_get_post_metadata(); |
|
148 | + |
|
149 | + // If we must return a single value, but we don't have a value, then return an empty string. |
|
150 | + if ( $single && ( $new_value === null || empty( $new_value ) ) ) { |
|
151 | + return ''; |
|
152 | + } |
|
153 | + |
|
154 | + // If we have a value and we need to return it as single, return the first value. |
|
155 | + if ( $single ) { |
|
156 | + return $new_value[0]; |
|
157 | + } |
|
158 | + |
|
159 | + // Otherwise return the array. |
|
160 | + return $new_value; |
|
161 | + } |
|
162 | + |
|
163 | + private function add_filter_get_post_metadata() { |
|
164 | + |
|
165 | + add_filter( |
|
166 | + 'get_post_metadata', |
|
167 | + array( |
|
168 | + $this, |
|
169 | + 'get_post_metadata', |
|
170 | + ), |
|
171 | + 10, |
|
172 | + 4 |
|
173 | + ); |
|
174 | + |
|
175 | + } |
|
176 | + |
|
177 | + private function remove_filter_get_post_metadata() { |
|
178 | + |
|
179 | + remove_filter( |
|
180 | + 'get_post_metadata', |
|
181 | + array( |
|
182 | + $this, |
|
183 | + 'get_post_metadata', |
|
184 | + ), |
|
185 | + 10 |
|
186 | + ); |
|
187 | + |
|
188 | + } |
|
189 | 189 | |
190 | 190 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function get_metabox_label() { |
68 | 68 | |
69 | - return __( 'Web Site(s)', 'wordlift' ); |
|
69 | + return __('Web Site(s)', 'wordlift'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | * @return array|NULL The schema:url value or NULL if not set. |
90 | 90 | * @since 3.6.0 |
91 | 91 | */ |
92 | - public function get( $post_id ) { |
|
92 | + public function get($post_id) { |
|
93 | 93 | |
94 | 94 | // Get the schema:url values set in WP. |
95 | - $values = get_post_meta( $post_id, self::META_KEY, false ); |
|
95 | + $values = get_post_meta($post_id, self::META_KEY, false); |
|
96 | 96 | |
97 | 97 | // If the property has never been set, we set its default value the first |
98 | 98 | // time to <permalink>. |
99 | - if ( empty( $values ) ) { |
|
100 | - return array( '<permalink>' ); |
|
99 | + if (empty($values)) { |
|
100 | + return array('<permalink>'); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // If there's only one value and that value is empty, we return NULL, i.e. |
104 | 104 | // variable not set. |
105 | - if ( 1 === count( $values ) && empty( $values[0] ) ) { |
|
105 | + if (1 === count($values) && empty($values[0])) { |
|
106 | 106 | return null; |
107 | 107 | } |
108 | 108 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /** |
114 | 114 | * {@inheritdoc} |
115 | 115 | */ |
116 | - public function sanitize( $value ) { |
|
116 | + public function sanitize($value) { |
|
117 | 117 | |
118 | 118 | // TODO: check that it's an URL or that is <permalink> |
119 | 119 | |
@@ -133,26 +133,26 @@ discard block |
||
133 | 133 | * @return array|mixed|NULL|string |
134 | 134 | * @since 3.6.0 |
135 | 135 | */ |
136 | - public function get_post_metadata( $value, $object_id, $meta_key, $single ) { |
|
136 | + public function get_post_metadata($value, $object_id, $meta_key, $single) { |
|
137 | 137 | |
138 | 138 | // It's not us, return the value. |
139 | - if ( self::META_KEY !== $meta_key ) { |
|
139 | + if (self::META_KEY !== $meta_key) { |
|
140 | 140 | return $value; |
141 | 141 | } |
142 | 142 | |
143 | 143 | $this->remove_filter_get_post_metadata(); |
144 | 144 | |
145 | - $new_value = $this->get( $object_id ); |
|
145 | + $new_value = $this->get($object_id); |
|
146 | 146 | |
147 | 147 | $this->add_filter_get_post_metadata(); |
148 | 148 | |
149 | 149 | // If we must return a single value, but we don't have a value, then return an empty string. |
150 | - if ( $single && ( $new_value === null || empty( $new_value ) ) ) { |
|
150 | + if ($single && ($new_value === null || empty($new_value))) { |
|
151 | 151 | return ''; |
152 | 152 | } |
153 | 153 | |
154 | 154 | // If we have a value and we need to return it as single, return the first value. |
155 | - if ( $single ) { |
|
155 | + if ($single) { |
|
156 | 156 | return $new_value[0]; |
157 | 157 | } |
158 | 158 |